BokaMera.API.Host

<back to all web services

UnsubscribeEmailTopic

The following routes are available for this service:
POST/unsubscribeUnsubscribe an email from onboarding and similar campaign messages.No authentication required.
<?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 UnsubscribeEmailTopicResponse implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $Email='',
        /** @var string */
        public string $ConfigurationSet='',
        /** @var string */
        public string $Topic='',
        /** @var bool|null */
        public ?bool $Unsubscribed=null
    ) {
    }

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

class UnsubscribeEmailTopic implements JsonSerializable
{
    public function __construct(
        /** @description The email address to unsubscribe. */
        // @ApiMember(Description="The email address to unsubscribe.", IsRequired=true)
        /** @var string */
        public string $Email='',

        /** @description Configuration set identifier used when sending the email. */
        // @ApiMember(Description="Configuration set identifier used when sending the email.", IsRequired=true)
        /** @var string */
        public string $ConfigurationSet='',

        /** @description Topic identifier used when sending the email. */
        // @ApiMember(Description="Topic identifier used when sending the email.", IsRequired=true)
        /** @var string */
        public string $Topic='',

        /** @description Verification token from the unsubscribe link. */
        // @ApiMember(Description="Verification token from the unsubscribe link.", IsRequired=true)
        /** @var string */
        public string $Token=''
    ) {
    }

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

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

POST /unsubscribe HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"Email":"String","ConfigurationSet":"String","Topic":"String","Token":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Email":"String","ConfigurationSet":"String","Topic":"String","Unsubscribed":false}