Trendsic Platform Service

<back to all web services

MessagingTestRequest

Requires Authentication
The following routes are available for this service:
POST/v1/messaging/test
<?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 MessagingTestSend implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $StepId=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var string|null */
        public ?string $Output=null,
        /** @var string|null */
        public ?string $Body=null,
        /** @var int */
        public int $Segments=0,
        /** @var int */
        public int $SmsMessageId=0
    ) {
    }

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

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

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

class MessagingTestRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $RuleKey=null,
        /** @var string */
        public string $BranchId='',
        /** @var string|null */
        public ?string $LineId=null,
        /** @var array<string>|null */
        public ?array $StepIds=null,
        /** @var string|null */
        public ?string $ToPhone=null,
        /** @var bool|null */
        public ?bool $Remember=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['RuleKey'])) $this->RuleKey = $o['RuleKey'];
        if (isset($o['BranchId'])) $this->BranchId = $o['BranchId'];
        if (isset($o['LineId'])) $this->LineId = $o['LineId'];
        if (isset($o['StepIds'])) $this->StepIds = JsonConverters::fromArray('string', $o['StepIds']);
        if (isset($o['ToPhone'])) $this->ToPhone = $o['ToPhone'];
        if (isset($o['Remember'])) $this->Remember = $o['Remember'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->RuleKey)) $o['RuleKey'] = $this->RuleKey;
        if (isset($this->BranchId)) $o['BranchId'] = $this->BranchId;
        if (isset($this->LineId)) $o['LineId'] = $this->LineId;
        if (isset($this->StepIds)) $o['StepIds'] = JsonConverters::toArray('string', $this->StepIds);
        if (isset($this->ToPhone)) $o['ToPhone'] = $this->ToPhone;
        if (isset($this->Remember)) $o['Remember'] = $this->Remember;
        return empty($o) ? new class(){} : $o;
    }
}

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

POST /v1/messaging/test HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	RuleKey: String,
	BranchId: 00000000000000000000000000000000,
	LineId: 00000000000000000000000000000000,
	StepIds: 
	[
		String
	],
	ToPhone: String,
	Remember: False
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	},
	Sent: 
	[
		{
			StepId: String,
			Status: String,
			Output: String,
			Body: String,
			Segments: 0,
			SmsMessageId: 0
		}
	]
}