BokaMera.API.Host

<back to all web services

WebhookCreateAgreement

The following routes are available for this service:
POST/webhooks/termsWebhook from prismic
<?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 WebhookAgreements implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null,
        /** @var string|null */
        public ?string $label=null,
        /** @var array<string>|null */
        public ?array $documents=null
    ) {
    }

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

class Releases implements JsonSerializable
{
    public function __construct(
        /** @var array<WebhookAgreements>|null */
        public ?array $deletion=null
    ) {
    }

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

// @ApiResponse(Description="Returned if there is a validation error on the input parameters", StatusCode=400)
// @ApiResponse(Description="Returned if the current user is not allowed to perform the action", StatusCode=401)
class WebhookCreateAgreement implements JsonSerializable
{
    public function __construct(
        /** @var Releases|null */
        public ?Releases $releases=null,
        /** @var array<string>|null */
        public ?array $documents=null,
        /** @var string|null */
        public ?string $secret=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['releases'])) $this->releases = JsonConverters::from('Releases', $o['releases']);
        if (isset($o['documents'])) $this->documents = JsonConverters::fromArray('string', $o['documents']);
        if (isset($o['secret'])) $this->secret = $o['secret'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->releases)) $o['releases'] = JsonConverters::to('Releases', $this->releases);
        if (isset($this->documents)) $o['documents'] = JsonConverters::toArray('string', $this->documents);
        if (isset($this->secret)) $o['secret'] = $this->secret;
        return empty($o) ? new class(){} : $o;
    }
}

PHP WebhookCreateAgreement DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

POST /webhooks/terms HTTP/1.1 
Host: api.bokamera.se 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"releases":{"deletion":[{"id":"String","label":"String","documents":["String"]}]},"documents":["String"],"secret":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{}