BokaMera.API.Host

<back to all web services

ListWebhookEndpointAttempts

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
GET/webhook/endpoints/{EndpointId}/attemptsList webhook endpoint attempts
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class WebhookMessageAttempt implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $Id='',
        /** @var string */
        public string $MessageId='',
        /** @var string */
        public string $EndpointId='',
        /** @var string */
        public string $Url='',
        /** @var string */
        public string $Status='',
        /** @var int|null */
        public ?int $ResponseStatusCode=null,
        /** @var DateTime */
        public DateTime $Timestamp=new DateTime(),
        /** @var string */
        public string $TriggerType=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['MessageId'])) $this->MessageId = $o['MessageId'];
        if (isset($o['EndpointId'])) $this->EndpointId = $o['EndpointId'];
        if (isset($o['Url'])) $this->Url = $o['Url'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['ResponseStatusCode'])) $this->ResponseStatusCode = $o['ResponseStatusCode'];
        if (isset($o['Timestamp'])) $this->Timestamp = JsonConverters::from('DateTime', $o['Timestamp']);
        if (isset($o['TriggerType'])) $this->TriggerType = $o['TriggerType'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->MessageId)) $o['MessageId'] = $this->MessageId;
        if (isset($this->EndpointId)) $o['EndpointId'] = $this->EndpointId;
        if (isset($this->Url)) $o['Url'] = $this->Url;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->ResponseStatusCode)) $o['ResponseStatusCode'] = $this->ResponseStatusCode;
        if (isset($this->Timestamp)) $o['Timestamp'] = JsonConverters::to('DateTime', $this->Timestamp);
        if (isset($this->TriggerType)) $o['TriggerType'] = $this->TriggerType;
        return empty($o) ? new class(){} : $o;
    }
}

class ListMessageAttemptsResponse implements JsonSerializable
{
    public function __construct(
        /** @var array<WebhookMessageAttempt>|null */
        public ?array $Attempts=null,
        /** @var bool|null */
        public ?bool $Done=null,
        /** @var string|null */
        public ?string $Iterator=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Attempts'])) $this->Attempts = JsonConverters::fromArray('WebhookMessageAttempt', $o['Attempts']);
        if (isset($o['Done'])) $this->Done = $o['Done'];
        if (isset($o['Iterator'])) $this->Iterator = $o['Iterator'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Attempts)) $o['Attempts'] = JsonConverters::toArray('WebhookMessageAttempt', $this->Attempts);
        if (isset($this->Done)) $o['Done'] = $this->Done;
        if (isset($this->Iterator)) $o['Iterator'] = $this->Iterator;
        return empty($o) ? new class(){} : $o;
    }
}

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class ListWebhookEndpointAttempts implements ICompany, JsonSerializable
{
    public function __construct(
        /** @description The company id, if empty will use the company id for the user you are logged in with. */
        // @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.", IsRequired=true, ParameterType="query")
        /** @var string */
        public string $CompanyId='',

        /** @description The ID of the webhook endpoint. */
        // @ApiMember(Description="The ID of the webhook endpoint.", IsRequired=true, ParameterType="path")
        /** @var string */
        public string $EndpointId='',

        /** @description Pagination iterator. */
        // @ApiMember(Description="Pagination iterator.")
        /** @var string|null */
        public ?string $Iterator=null,

        /** @description Maximum number of attempts to return. */
        // @ApiMember(Description="Maximum number of attempts to return.")
        /** @var int|null */
        public ?int $Limit=null,

        /** @description Filter by message status. 0 = Success, 1 = Pending, 2 = Fail, 3 = Sending. */
        // @ApiMember(Description="Filter by message status. 0 = Success, 1 = Pending, 2 = Fail, 3 = Sending.")
        /** @var int|null */
        public ?int $Status=null,

        /** @description Filter by event types. */
        // @ApiMember(Description="Filter by event types.")
        /** @var array<string>|null */
        public ?array $EventTypes=null,

        /** @description Filter attempts before this date. */
        // @ApiMember(Description="Filter attempts before this date.")
        /** @var DateTime|null */
        public ?DateTime $Before=null,

        /** @description Filter attempts after this date. */
        // @ApiMember(Description="Filter attempts after this date.")
        /** @var DateTime|null */
        public ?DateTime $After=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['EndpointId'])) $this->EndpointId = $o['EndpointId'];
        if (isset($o['Iterator'])) $this->Iterator = $o['Iterator'];
        if (isset($o['Limit'])) $this->Limit = $o['Limit'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['EventTypes'])) $this->EventTypes = JsonConverters::fromArray('string', $o['EventTypes']);
        if (isset($o['Before'])) $this->Before = JsonConverters::from('DateTime', $o['Before']);
        if (isset($o['After'])) $this->After = JsonConverters::from('DateTime', $o['After']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->EndpointId)) $o['EndpointId'] = $this->EndpointId;
        if (isset($this->Iterator)) $o['Iterator'] = $this->Iterator;
        if (isset($this->Limit)) $o['Limit'] = $this->Limit;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->EventTypes)) $o['EventTypes'] = JsonConverters::toArray('string', $this->EventTypes);
        if (isset($this->Before)) $o['Before'] = JsonConverters::to('DateTime', $this->Before);
        if (isset($this->After)) $o['After'] = JsonConverters::to('DateTime', $this->After);
        return empty($o) ? new class(){} : $o;
    }
}

PHP ListWebhookEndpointAttempts DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /webhook/endpoints/{EndpointId}/attempts HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Attempts: 
	[
		{
			Id: String,
			MessageId: String,
			EndpointId: String,
			Url: String,
			Status: String,
			ResponseStatusCode: 0,
			TriggerType: String
		}
	],
	Done: False,
	Iterator: String
}