Trendsic Platform Service

<back to all web services

CustomerDeviceRegisterRequest

The following routes are available for this service:
POST/v1/c/device
<?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 CustomerDeviceResponse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var int */
        public int $Devices=0,
        /** @var int */
        public int $Sent=0,
        /** @var bool|null */
        public ?bool $PushConfigured=null,
        /** @var string|null */
        public ?string $Payload=null,
        /** @var string|null */
        public ?string $Message=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

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

class CustomerDeviceRegisterRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Platform=null,
        /** @var string|null */
        public ?string $FcmToken=null
    ) {
    }

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

PHP CustomerDeviceRegisterRequest 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/c/device HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Platform: String,
	FcmToken: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Id: 0,
	Devices: 0,
	Sent: 0,
	PushConfigured: False,
	Payload: String,
	Message: String,
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}