Trendsic Platform Service

<back to all web services

EmailQueueSearchRequest

Requires Authentication
Required role:AdministratorRequires any of the roles:Agent, Administrator
The following routes are available for this service:
GET,OPTIONS/v1/EmailQueueSearch/{SearchTerm}
GET,OPTIONS/v1/EmailQueueSearch
<?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 EmailQueue implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $EmailQueueId=0,
        /** @var string|null */
        public ?string $Recipient=null,
        /** @var string|null */
        public ?string $Sender=null,
        /** @var string|null */
        public ?string $Subject=null,
        /** @var string|null */
        public ?string $Body=null,
        /** @var bool|null */
        public ?bool $IsBodyHTML=null,
        /** @var bool|null */
        public ?bool $SendThroughAppEmail=null,
        /** @var string|null */
        public ?string $SenderUserId=null,
        /** @var string|null */
        public ?string $EmailFromName=null,
        /** @var DateTime */
        public DateTime $DateCompleted=new DateTime(),
        /** @var DateTime */
        public DateTime $DateToSend=new DateTime(),
        /** @var int */
        public int $FailCount=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['EmailQueueId'])) $this->EmailQueueId = $o['EmailQueueId'];
        if (isset($o['Recipient'])) $this->Recipient = $o['Recipient'];
        if (isset($o['Sender'])) $this->Sender = $o['Sender'];
        if (isset($o['Subject'])) $this->Subject = $o['Subject'];
        if (isset($o['Body'])) $this->Body = $o['Body'];
        if (isset($o['IsBodyHTML'])) $this->IsBodyHTML = $o['IsBodyHTML'];
        if (isset($o['SendThroughAppEmail'])) $this->SendThroughAppEmail = $o['SendThroughAppEmail'];
        if (isset($o['SenderUserId'])) $this->SenderUserId = $o['SenderUserId'];
        if (isset($o['EmailFromName'])) $this->EmailFromName = $o['EmailFromName'];
        if (isset($o['DateCompleted'])) $this->DateCompleted = JsonConverters::from('DateTime', $o['DateCompleted']);
        if (isset($o['DateToSend'])) $this->DateToSend = JsonConverters::from('DateTime', $o['DateToSend']);
        if (isset($o['FailCount'])) $this->FailCount = $o['FailCount'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->EmailQueueId)) $o['EmailQueueId'] = $this->EmailQueueId;
        if (isset($this->Recipient)) $o['Recipient'] = $this->Recipient;
        if (isset($this->Sender)) $o['Sender'] = $this->Sender;
        if (isset($this->Subject)) $o['Subject'] = $this->Subject;
        if (isset($this->Body)) $o['Body'] = $this->Body;
        if (isset($this->IsBodyHTML)) $o['IsBodyHTML'] = $this->IsBodyHTML;
        if (isset($this->SendThroughAppEmail)) $o['SendThroughAppEmail'] = $this->SendThroughAppEmail;
        if (isset($this->SenderUserId)) $o['SenderUserId'] = $this->SenderUserId;
        if (isset($this->EmailFromName)) $o['EmailFromName'] = $this->EmailFromName;
        if (isset($this->DateCompleted)) $o['DateCompleted'] = JsonConverters::to('DateTime', $this->DateCompleted);
        if (isset($this->DateToSend)) $o['DateToSend'] = JsonConverters::to('DateTime', $this->DateToSend);
        if (isset($this->FailCount)) $o['FailCount'] = $this->FailCount;
        return empty($o) ? new class(){} : $o;
    }
}

class EmailQueueSearchResponse implements JsonSerializable
{
    public function __construct(
        /** @var array<EmailQueue>|null */
        public ?array $QueueSearchResults=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

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

class EmailQueueSearchRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $SearchTerm=null
    ) {
    }

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

PHP EmailQueueSearchRequest DTOs

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

HTTP + CSV

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

GET /v1/EmailQueueSearch/{SearchTerm} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"QueueSearchResults":[{"EmailQueueId":0,"Recipient":"String","Sender":"String","Subject":"String","Body":"String","IsBodyHTML":false,"SendThroughAppEmail":false,"SenderUserId":"String","EmailFromName":"String","DateCompleted":"0001-01-01T00:00:00.0000000","DateToSend":"0001-01-01T00:00:00.0000000","FailCount":0}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}