BokaMera.API.Host

<back to all web services

ResendMessage

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
PUT/messages/log/{Id}/resendResend a message from the logResend a message from the log to the recepient.
<?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 MessageLogQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @description The message log id */
        // @ApiMember(Description="The message log id")
        /** @var int */
        public int $Id=0,

        /** @description The booking id for the message (if connected to a booking). */
        // @ApiMember(Description="The booking id for the message (if connected to a booking).")
        /** @var int|null */
        public ?int $BookingId=null,

        /** @description The message receiver. Either a email or a mobile phone number. */
        // @ApiMember(Description="The message receiver. Either a email or a mobile phone number.")
        /** @var string|null */
        public ?string $Receiver=null,

        /** @description Message Title. */
        // @ApiMember(Description="Message Title.")
        /** @var string|null */
        public ?string $MessageTitle=null,

        /** @description Message Storage Url. */
        // @ApiMember(Description="Message Storage Url.")
        /** @var string|null */
        public ?string $StorageUrl=null,

        /** @description Message Body. */
        // @ApiMember(Description="Message Body.")
        /** @var string|null */
        public ?string $MessageBody=null,

        /** @description When message was created. */
        // @ApiMember(Description="When message was created.")
        /** @var DateTime */
        public DateTime $Created=new DateTime(),

        /** @description When the message will be sent. */
        // @ApiMember(Description="When the message will be sent.")
        /** @var DateTime */
        public DateTime $ToSendDate=new DateTime(),

        /** @description When the message was sent. */
        // @ApiMember(Description="When the message was sent.")
        /** @var DateTime|null */
        public ?DateTime $SentDate=null,

        /** @description If Message is sent */
        // @ApiMember(Description="If Message is sent")
        /** @var bool|null */
        public ?bool $Sent=null,

        /** @description Number of retries to send the message */
        // @ApiMember(Description="Number of retries to send the message")
        /** @var int */
        public int $MessageRetries=0,

        /** @description Send Method. 1 = Email, 2 = SMS */
        // @ApiMember(Description="Send Method. 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['BookingId'])) $this->BookingId = $o['BookingId'];
        if (isset($o['Receiver'])) $this->Receiver = $o['Receiver'];
        if (isset($o['MessageTitle'])) $this->MessageTitle = $o['MessageTitle'];
        if (isset($o['StorageUrl'])) $this->StorageUrl = $o['StorageUrl'];
        if (isset($o['MessageBody'])) $this->MessageBody = $o['MessageBody'];
        if (isset($o['Created'])) $this->Created = JsonConverters::from('DateTime', $o['Created']);
        if (isset($o['ToSendDate'])) $this->ToSendDate = JsonConverters::from('DateTime', $o['ToSendDate']);
        if (isset($o['SentDate'])) $this->SentDate = JsonConverters::from('DateTime', $o['SentDate']);
        if (isset($o['Sent'])) $this->Sent = $o['Sent'];
        if (isset($o['MessageRetries'])) $this->MessageRetries = $o['MessageRetries'];
        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->BookingId)) $o['BookingId'] = $this->BookingId;
        if (isset($this->Receiver)) $o['Receiver'] = $this->Receiver;
        if (isset($this->MessageTitle)) $o['MessageTitle'] = $this->MessageTitle;
        if (isset($this->StorageUrl)) $o['StorageUrl'] = $this->StorageUrl;
        if (isset($this->MessageBody)) $o['MessageBody'] = $this->MessageBody;
        if (isset($this->Created)) $o['Created'] = JsonConverters::to('DateTime', $this->Created);
        if (isset($this->ToSendDate)) $o['ToSendDate'] = JsonConverters::to('DateTime', $this->ToSendDate);
        if (isset($this->SentDate)) $o['SentDate'] = JsonConverters::to('DateTime', $this->SentDate);
        if (isset($this->Sent)) $o['Sent'] = $this->Sent;
        if (isset($this->MessageRetries)) $o['MessageRetries'] = $this->MessageRetries;
        if (isset($this->SendMethodId)) $o['SendMethodId'] = $this->SendMethodId;
        return empty($o) ? new class(){} : $o;
    }
}

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

        /** @description Message Id */
        // @ApiMember(DataType="int", Description="Message Id", 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 ResendMessage DTOs

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

HTTP + OTHER

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

PUT /messages/log/{Id}/resend HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","Id":0}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Id":0,"BookingId":0,"Receiver":"String","MessageTitle":"String","StorageUrl":"String","MessageBody":"String","SentDate":"0001-01-01T00:00:00","Sent":false,"MessageRetries":0,"SendMethodId":0}