Trendsic Platform Service

<back to all web services

CrewAssignmentsExportCsvRequest

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/CrewAssignments/Export/CSV/{SelectedDate}
<?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 CrewAssignmentsExportCsvResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var string|null */
        public ?string $file=null
    ) {
    }

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

class CrewAssignmentCrewMember implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Status=null
    ) {
    }

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

class CrewAssignmentEquipment implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Status=null
    ) {
    }

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

class CrewAssignmentJob implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $JobName=null,
        /** @var array<CrewAssignmentCrewMember>|null */
        public ?array $CrewMembers=null,
        /** @var array<CrewAssignmentEquipment>|null */
        public ?array $Equipment=null
    ) {
    }

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

class CrewAssignmentProject implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $ProjectName=null,
        /** @var array<CrewAssignmentJob>|null */
        public ?array $Jobs=null
    ) {
    }

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

class CrewAssignmentsExportCsvRequest implements JsonSerializable
{
    public function __construct(
        /** @var DateTime */
        public DateTime $SelectedDate=new DateTime(),
        /** @var array<CrewAssignmentProject>|null */
        public ?array $projects=null
    ) {
    }

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

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

POST /v1/CrewAssignments/Export/CSV/{SelectedDate} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"SelectedDate":"0001-01-01T00:00:00.0000000","projects":[{"ProjectName":"String","Jobs":[{"JobName":"String","CrewMembers":[{"Name":"String","Status":"String"}],"Equipment":[{"Name":"String","Status":"String"}]}]}]}
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"}},"file":"String"}