Trendsic Platform Service

<back to all web services

CrewContactsRequest

Requires Authentication
The following routes are available for this service:
GET,OPTIONS/v1/CrewContacts/{CrewID}
<?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 CrewContact implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $CrewContactID=0,
        /** @var int */
        public int $CrewID=0,
        /** @var string|null */
        public ?string $CrewName=null,
        /** @var int */
        public int $ContactID=0,
        /** @var string|null */
        public ?string $ContactName=null,
        /** @var bool|null */
        public ?bool $Active=null,
        /** @var bool|null */
        public ?bool $Deleted=null,
        /** @var DateTime */
        public DateTime $DeletedDate=new DateTime(),
        /** @var DateTime */
        public DateTime $RecordCreatedDate=new DateTime(),
        /** @var string */
        public string $CreatedByUID='',
        /** @var string|null */
        public ?string $ContactImage=null,
        /** @var string|null */
        public ?string $FirstName=null,
        /** @var string|null */
        public ?string $LastName=null,
        /** @var string|null */
        public ?string $Initials=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CrewContactID'])) $this->CrewContactID = $o['CrewContactID'];
        if (isset($o['CrewID'])) $this->CrewID = $o['CrewID'];
        if (isset($o['CrewName'])) $this->CrewName = $o['CrewName'];
        if (isset($o['ContactID'])) $this->ContactID = $o['ContactID'];
        if (isset($o['ContactName'])) $this->ContactName = $o['ContactName'];
        if (isset($o['Active'])) $this->Active = $o['Active'];
        if (isset($o['Deleted'])) $this->Deleted = $o['Deleted'];
        if (isset($o['DeletedDate'])) $this->DeletedDate = JsonConverters::from('DateTime', $o['DeletedDate']);
        if (isset($o['RecordCreatedDate'])) $this->RecordCreatedDate = JsonConverters::from('DateTime', $o['RecordCreatedDate']);
        if (isset($o['CreatedByUID'])) $this->CreatedByUID = $o['CreatedByUID'];
        if (isset($o['ContactImage'])) $this->ContactImage = $o['ContactImage'];
        if (isset($o['FirstName'])) $this->FirstName = $o['FirstName'];
        if (isset($o['LastName'])) $this->LastName = $o['LastName'];
        if (isset($o['Initials'])) $this->Initials = $o['Initials'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CrewContactID)) $o['CrewContactID'] = $this->CrewContactID;
        if (isset($this->CrewID)) $o['CrewID'] = $this->CrewID;
        if (isset($this->CrewName)) $o['CrewName'] = $this->CrewName;
        if (isset($this->ContactID)) $o['ContactID'] = $this->ContactID;
        if (isset($this->ContactName)) $o['ContactName'] = $this->ContactName;
        if (isset($this->Active)) $o['Active'] = $this->Active;
        if (isset($this->Deleted)) $o['Deleted'] = $this->Deleted;
        if (isset($this->DeletedDate)) $o['DeletedDate'] = JsonConverters::to('DateTime', $this->DeletedDate);
        if (isset($this->RecordCreatedDate)) $o['RecordCreatedDate'] = JsonConverters::to('DateTime', $this->RecordCreatedDate);
        if (isset($this->CreatedByUID)) $o['CreatedByUID'] = $this->CreatedByUID;
        if (isset($this->ContactImage)) $o['ContactImage'] = $this->ContactImage;
        if (isset($this->FirstName)) $o['FirstName'] = $this->FirstName;
        if (isset($this->LastName)) $o['LastName'] = $this->LastName;
        if (isset($this->Initials)) $o['Initials'] = $this->Initials;
        return empty($o) ? new class(){} : $o;
    }
}

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

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

class CrewContactsRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $CrewID=0,
        /** @var array<CrewContact>|null */
        public ?array $CrewContact=null
    ) {
    }

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

PHP CrewContactsRequest DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

GET /v1/CrewContacts/{CrewID} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"CrewContact":[{"CrewContactID":0,"CrewID":0,"CrewName":"String","ContactID":0,"ContactName":"String","Active":false,"Deleted":false,"DeletedDate":"0001-01-01T00:00:00.0000000","RecordCreatedDate":"0001-01-01T00:00:00.0000000","CreatedByUID":"00000000000000000000000000000000","ContactImage":"String","FirstName":"String","LastName":"String","Initials":"String"}]}