Revision eca75f82
Von Jan Büren vor etwa 1 Jahr hinzugefügt
SL/KIX18Client.pm | ||
---|---|---|
return $params{article}{TicketID};
|
||
}
|
||
|
||
sub get_ticket {
|
||
my ($self) = shift;
|
||
die "Invalid connection state" unless $self->connector->can('GET');
|
||
|
||
validate(
|
||
@_, {
|
||
ticket_id => 1,
|
||
}
|
||
);
|
||
my %params = @_;
|
||
|
||
my $ret = _decode_and_status_code($self->connector->GET("tickets/$params{ticket_id}"));
|
||
|
||
return $ret;
|
||
}
|
||
|
||
sub create_ticket {
|
||
my ($self) = shift;
|
||
die "Invalid connection state" unless $self->connector->can('POST');
|
||
... | ... | |
Body => 1,
|
||
Channel => { type => SCALAR, default => 'note' },
|
||
Charset => { type => SCALAR, default => 'utf-8' },
|
||
MimeType => { type => SCALAR, default => 'text/plain', },
|
||
ContentType => { type => SCALAR, default => 'text/plain; charset=utf-8' },
|
||
MimeType => { type => SCALAR, default => 'text/html', },
|
||
ContentType => { type => SCALAR, default => 'text/html; charset=utf-8' },
|
||
|
||
TicketID => { callbacks => {
|
||
'is an integer' => sub {
|
||
... | ... | |
# therefore the defaults need to be defined again:
|
||
$params{Channel} //= 'note';
|
||
$params{Charset} //= 'utf-8';
|
||
$params{MimeType} //= 'text/plain';
|
||
$params{ContentType} //= 'text/plain; charset=utf-8';
|
||
$params{MimeType} //= 'text/html';
|
||
$params{ContentType} //= 'text/html; charset=utf-8';
|
||
|
||
my %a_params = ();
|
||
foreach (keys %params) {
|
||
... | ... | |
my ($ret) = @_;
|
||
|
||
die t8("Unsuccessful HTTP return code: #1 Details: #2", $ret->responseCode(), $ret->responseContent())
|
||
unless $ret->responseCode() == 201;
|
||
unless $ret->responseCode() == 201 || $ret->responseCode() == 200;
|
||
|
||
try {
|
||
return decode_json($ret->responseContent());
|
||
... | ... | |
|
||
=over 4
|
||
|
||
=item C<get_ticket $ticket_id>
|
||
|
||
Gets the specific ticket with $ticket_id and returns all standard ticket data
|
||
as a nested hash structure.
|
||
|
||
=item C<create_ticket $Title>
|
||
|
||
Creates a Ticket with the named param Title. Returns the ID of the created Ticket.
|
Auch abrufbar als: Unified diff
kix18: Neue Methode get_ticket