BokaMera.API.Host

<back to all web services

DeleteMessageTemplate

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
DELETE/messages/templates/{Id}Delete an existing company message templatesDelete an existing company message templates.
<?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 MessageTypeQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @description The message type id */
        // @ApiMember(Description="The message type id")
        /** @var int */
        public int $Id=0,

        /** @description The message type name. */
        // @ApiMember(Description="The message type name.")
        /** @var string|null */
        public ?string $Name=null,

        /** @description The message type description. */
        // @ApiMember(Description="The message type description.")
        /** @var string|null */
        public ?string $Description=null,

        /** @description The maximum number of charachters that can be entered into message body using this type. */
        // @ApiMember(Description="The maximum number of charachters that can be entered into message body using this type.")
        /** @var int */
        public int $MaxCharacters=0,

        /** @description The default text that is always included when sending messages of this type. */
        // @ApiMember(Description="The default text that is always included when sending messages of this type.")
        /** @var string|null */
        public ?string $DefaultText=null,

        /** @description The send method for this type. 1 = Email, 2 = SMS. */
        // @ApiMember(Description="The send method for this type. 1 = Email, 2 = SMS.")
        /** @var int */
        public int $SendMethodId=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['MaxCharacters'])) $this->MaxCharacters = $o['MaxCharacters'];
        if (isset($o['DefaultText'])) $this->DefaultText = $o['DefaultText'];
        if (isset($o['SendMethodId'])) $this->SendMethodId = $o['SendMethodId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->MaxCharacters)) $o['MaxCharacters'] = $this->MaxCharacters;
        if (isset($this->DefaultText)) $o['DefaultText'] = $this->DefaultText;
        if (isset($this->SendMethodId)) $o['SendMethodId'] = $this->SendMethodId;
        return empty($o) ? new class(){} : $o;
    }
}

class MessageServices implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @description Name of the service */
        // @ApiMember(Description="Name of the service")
        /** @var string|null */
        public ?string $Name=null,

        /** @description The image url of the service */
        // @ApiMember(Description="The image url of the service")
        /** @var string|null */
        public ?string $ImageUrl=null
    ) {
    }

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

class MessageTemplatesQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @description The message template id */
        // @ApiMember(Description="The message template id")
        /** @var int */
        public int $Id=0,

        /** @description The message template name. */
        // @ApiMember(Description="The message template name.")
        /** @var string|null */
        public ?string $Name=null,

        /** @description The message template title. */
        // @ApiMember(Description="The message template title.")
        /** @var string|null */
        public ?string $Title=null,

        /** @description The message template title. */
        // @ApiMember(Description="The message template title.")
        /** @var string|null */
        public ?string $Body=null,

        /** @description The message template sender (an email for message types with sendmethod 1, for SMS this cannot be set). */
        // @ApiMember(Description="The message template sender (an email for message types with sendmethod 1, for SMS this cannot be set).")
        /** @var string|null */
        public ?string $Sender=null,

        /** @description If the message template is the default message currently in use. */
        // @ApiMember(Description="If the message template is the default message currently in use.")
        /** @var bool|null */
        public ?bool $Default=null,

        /** @description If the message type information. */
        // @ApiMember(Description="If the message type information.")
        /** @var MessageTypeQueryResponse|null */
        public ?MessageTypeQueryResponse $MessageType=null,

        /** @description Template language. */
        // @ApiMember(Description="Template language.")
        /** @var string|null */
        public ?string $Language=null,

        /** @description The connected services which the template is valid for. If empty then it's valid for all services. */
        // @ApiMember(Description="The connected services which the template is valid for. If empty then it's valid for all services.")
        /** @var array<MessageServices>|null */
        public ?array $Services=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Title'])) $this->Title = $o['Title'];
        if (isset($o['Body'])) $this->Body = $o['Body'];
        if (isset($o['Sender'])) $this->Sender = $o['Sender'];
        if (isset($o['Default'])) $this->Default = $o['Default'];
        if (isset($o['MessageType'])) $this->MessageType = JsonConverters::from('MessageTypeQueryResponse', $o['MessageType']);
        if (isset($o['Language'])) $this->Language = $o['Language'];
        if (isset($o['Services'])) $this->Services = JsonConverters::fromArray('MessageServices', $o['Services']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Title)) $o['Title'] = $this->Title;
        if (isset($this->Body)) $o['Body'] = $this->Body;
        if (isset($this->Sender)) $o['Sender'] = $this->Sender;
        if (isset($this->Default)) $o['Default'] = $this->Default;
        if (isset($this->MessageType)) $o['MessageType'] = JsonConverters::to('MessageTypeQueryResponse', $this->MessageType);
        if (isset($this->Language)) $o['Language'] = $this->Language;
        if (isset($this->Services)) $o['Services'] = JsonConverters::toArray('MessageServices', $this->Services);
        return empty($o) ? new class(){} : $o;
    }
}

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class DeleteMessageTemplate 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.")
        /** @var string|null */
        public ?string $CompanyId=null,

        /** @description The message template id. */
        // @ApiMember(Description="The message template id.", IsRequired=true, ParameterType="path")
        /** @var int */
        public int $Id=0
    ) {
    }

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

PHP DeleteMessageTemplate 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.

DELETE /messages/templates/{Id} HTTP/1.1 
Host: testapi.bokamera.se 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Id":0,"Name":"String","Title":"String","Body":"String","Sender":"String","Default":false,"MessageType":{"Id":0,"Name":"String","Description":"String","MaxCharacters":0,"DefaultText":"String","SendMethodId":0},"Language":"String","Services":[{"Id":0,"Name":"String"}]}