BokaMera.API.Host

<back to all web services

UpdateNewsletterTemplate

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
PUT/newsletter/templates/{Id}Update a company newsletter template.Update a company newsletter template.
<?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 NewsletterSendMethodQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @description The send method id */
        // @ApiMember(Description="The send method id")
        /** @var int */
        public int $Id=0,

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

        /** @description The send method description. */
        // @ApiMember(Description="The send method description.")
        /** @var string|null */
        public ?string $Description=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['Description'])) $this->Description = $o['Description'];
    }
    
    /** @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;
        return empty($o) ? new class(){} : $o;
    }
}

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

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

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

        /** @description The email template html content. */
        // @ApiMember(Description="The email template html content.")
        /** @var string|null */
        public ?string $Body=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['Description'])) $this->Description = $o['Description'];
        if (isset($o['Body'])) $this->Body = $o['Body'];
    }
    
    /** @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->Body)) $o['Body'] = $this->Body;
        return empty($o) ? new class(){} : $o;
    }
}

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

        /** @description The newsletter template heading. */
        // @ApiMember(Description="The newsletter template heading.")
        /** @var string|null */
        public ?string $Heading=null,

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

        /** @description The email template the newsletter uses. */
        // @ApiMember(Description="The email template the newsletter uses.")
        /** @var int|null */
        public ?int $EmailTemplateId=null,

        /** @description Send Method. 1 = Email, 2 = SMS */
        // @ApiMember(Description="Send Method. 1 = Email, 2 = SMS")
        /** @var int */
        public int $SendMethodId=0,

        /** @description The newsletter template image url. */
        // @ApiMember(Description="The newsletter template image url.")
        /** @var string|null */
        public ?string $ImageUrl=null,

        /** @description The newsletter created date. */
        // @ApiMember(Description="The newsletter created date.")
        /** @var DateTime */
        public DateTime $Created=new DateTime(),

        /** @description Send method information. */
        // @ApiMember(Description="Send method information.")
        /** @var NewsletterSendMethodQueryResponse|null */
        public ?NewsletterSendMethodQueryResponse $SendMethodInformation=null,

        /** @description Email template information. */
        // @ApiMember(Description="Email template information.")
        /** @var NewsletterEmailTemplatesQueryResponse|null */
        public ?NewsletterEmailTemplatesQueryResponse $EmailTemplateInformation=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Heading'])) $this->Heading = $o['Heading'];
        if (isset($o['Body'])) $this->Body = $o['Body'];
        if (isset($o['EmailTemplateId'])) $this->EmailTemplateId = $o['EmailTemplateId'];
        if (isset($o['SendMethodId'])) $this->SendMethodId = $o['SendMethodId'];
        if (isset($o['ImageUrl'])) $this->ImageUrl = $o['ImageUrl'];
        if (isset($o['Created'])) $this->Created = JsonConverters::from('DateTime', $o['Created']);
        if (isset($o['SendMethodInformation'])) $this->SendMethodInformation = JsonConverters::from('NewsletterSendMethodQueryResponse', $o['SendMethodInformation']);
        if (isset($o['EmailTemplateInformation'])) $this->EmailTemplateInformation = JsonConverters::from('NewsletterEmailTemplatesQueryResponse', $o['EmailTemplateInformation']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Heading)) $o['Heading'] = $this->Heading;
        if (isset($this->Body)) $o['Body'] = $this->Body;
        if (isset($this->EmailTemplateId)) $o['EmailTemplateId'] = $this->EmailTemplateId;
        if (isset($this->SendMethodId)) $o['SendMethodId'] = $this->SendMethodId;
        if (isset($this->ImageUrl)) $o['ImageUrl'] = $this->ImageUrl;
        if (isset($this->Created)) $o['Created'] = JsonConverters::to('DateTime', $this->Created);
        if (isset($this->SendMethodInformation)) $o['SendMethodInformation'] = JsonConverters::to('NewsletterSendMethodQueryResponse', $this->SendMethodInformation);
        if (isset($this->EmailTemplateInformation)) $o['EmailTemplateInformation'] = JsonConverters::to('NewsletterEmailTemplatesQueryResponse', $this->EmailTemplateInformation);
        return empty($o) ? new class(){} : $o;
    }
}

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class UpdateNewsletterTemplate 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 newsletter template id. */
        // @ApiMember(Description="The newsletter template id.", IsRequired=true, ParameterType="path")
        /** @var int */
        public int $Id=0,

        /** @description The newsletter template heading. */
        // @ApiMember(Description="The newsletter template heading.")
        /** @var string|null */
        public ?string $Heading=null,

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

        /** @description The newsletter template image url. */
        // @ApiMember(Description="The newsletter template image url.")
        /** @var string|null */
        public ?string $ImageUrl=null,

        /** @description The newsletter template send method (1=email, 2=sms). */
        // @ApiMember(Description="The newsletter template send method (1=email, 2=sms).")
        /** @var int|null */
        public ?int $SendMethodId=null,

        /** @description The email template id. Get valid email templates from GET /newsletter/emailtemplates */
        // @ApiMember(Description="The email template id. Get valid email templates from GET /newsletter/emailtemplates")
        /** @var int|null */
        public ?int $EmailTemplateId=null
    ) {
    }

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

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

PUT /newsletter/templates/{Id} HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	CompanyId: 00000000-0000-0000-0000-000000000000,
	Id: 0,
	Heading: String,
	Body: String,
	ImageUrl: String,
	SendMethodId: 0,
	EmailTemplateId: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Id: 0,
	Heading: String,
	Body: String,
	EmailTemplateId: 0,
	SendMethodId: 0,
	ImageUrl: String,
	SendMethodInformation: 
	{
		Id: 0,
		Name: String,
		Description: String
	},
	EmailTemplateInformation: 
	{
		Id: 0,
		Name: String,
		Description: String,
		Body: String
	}
}