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 .xml suffix or ?format=xml

HTTP + XML

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: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<EmailQueueSearchResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <QueueSearchResults>
    <EmailQueue>
      <Body>String</Body>
      <DateCompleted>0001-01-01T00:00:00</DateCompleted>
      <DateToSend>0001-01-01T00:00:00</DateToSend>
      <EmailFromName>String</EmailFromName>
      <EmailQueueId>0</EmailQueueId>
      <FailCount>0</FailCount>
      <IsBodyHTML>false</IsBodyHTML>
      <Recipient>String</Recipient>
      <SendThroughAppEmail>false</SendThroughAppEmail>
      <Sender>String</Sender>
      <SenderUserId>String</SenderUserId>
      <Subject>String</Subject>
    </EmailQueue>
  </QueueSearchResults>
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
</EmailQueueSearchResponse>