| Requires any of the roles: | Agent, Administrator |
| PUT,OPTIONS | /v1/project/job/{JobID}/schedule |
|---|
<?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 TimelineCrew implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ProjectJobCrewMemberID=0,
/** @var int */
public int $ContactID=0,
/** @var string|null */
public ?string $ContactName=null,
/** @var float|null */
public ?float $BudgetedHours=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ProjectJobCrewMemberID'])) $this->ProjectJobCrewMemberID = $o['ProjectJobCrewMemberID'];
if (isset($o['ContactID'])) $this->ContactID = $o['ContactID'];
if (isset($o['ContactName'])) $this->ContactName = $o['ContactName'];
if (isset($o['BudgetedHours'])) $this->BudgetedHours = $o['BudgetedHours'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ProjectJobCrewMemberID)) $o['ProjectJobCrewMemberID'] = $this->ProjectJobCrewMemberID;
if (isset($this->ContactID)) $o['ContactID'] = $this->ContactID;
if (isset($this->ContactName)) $o['ContactName'] = $this->ContactName;
if (isset($this->BudgetedHours)) $o['BudgetedHours'] = $this->BudgetedHours;
return empty($o) ? new class(){} : $o;
}
}
class TimelineEquipment implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ProjectJobEquipmentID=0,
/** @var int */
public int $EquipmentID=0,
/** @var string|null */
public ?string $EquipmentName=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ProjectJobEquipmentID'])) $this->ProjectJobEquipmentID = $o['ProjectJobEquipmentID'];
if (isset($o['EquipmentID'])) $this->EquipmentID = $o['EquipmentID'];
if (isset($o['EquipmentName'])) $this->EquipmentName = $o['EquipmentName'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ProjectJobEquipmentID)) $o['ProjectJobEquipmentID'] = $this->ProjectJobEquipmentID;
if (isset($this->EquipmentID)) $o['EquipmentID'] = $this->EquipmentID;
if (isset($this->EquipmentName)) $o['EquipmentName'] = $this->EquipmentName;
return empty($o) ? new class(){} : $o;
}
}
class TimelineJob implements JsonSerializable
{
public function __construct(
/** @var int */
public int $JobID=0,
/** @var string|null */
public ?string $JobName=null,
/** @var DateTime|null */
public ?DateTime $ExpectedStartDate=null,
/** @var DateTime|null */
public ?DateTime $ExpectedCompletionDate=null,
/** @var DateTime|null */
public ?DateTime $ActualStartDate=null,
/** @var DateTime|null */
public ?DateTime $ActualEndDate=null,
/** @var float */
public float $PercentComplete=0.0,
/** @var int|null */
public ?int $StatusID=null,
/** @var string|null */
public ?string $JobCategory=null,
/** @var bool|null */
public ?bool $IsAgreementVisit=null,
/** @var DateTime|null */
public ?DateTime $OccurrenceDate=null,
/** @var array<TimelineCrew>|null */
public ?array $Crew=null,
/** @var array<TimelineEquipment>|null */
public ?array $Equipment=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['JobID'])) $this->JobID = $o['JobID'];
if (isset($o['JobName'])) $this->JobName = $o['JobName'];
if (isset($o['ExpectedStartDate'])) $this->ExpectedStartDate = JsonConverters::from('DateTime', $o['ExpectedStartDate']);
if (isset($o['ExpectedCompletionDate'])) $this->ExpectedCompletionDate = JsonConverters::from('DateTime', $o['ExpectedCompletionDate']);
if (isset($o['ActualStartDate'])) $this->ActualStartDate = JsonConverters::from('DateTime', $o['ActualStartDate']);
if (isset($o['ActualEndDate'])) $this->ActualEndDate = JsonConverters::from('DateTime', $o['ActualEndDate']);
if (isset($o['PercentComplete'])) $this->PercentComplete = $o['PercentComplete'];
if (isset($o['StatusID'])) $this->StatusID = $o['StatusID'];
if (isset($o['JobCategory'])) $this->JobCategory = $o['JobCategory'];
if (isset($o['IsAgreementVisit'])) $this->IsAgreementVisit = $o['IsAgreementVisit'];
if (isset($o['OccurrenceDate'])) $this->OccurrenceDate = JsonConverters::from('DateTime', $o['OccurrenceDate']);
if (isset($o['Crew'])) $this->Crew = JsonConverters::fromArray('TimelineCrew', $o['Crew']);
if (isset($o['Equipment'])) $this->Equipment = JsonConverters::fromArray('TimelineEquipment', $o['Equipment']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->JobID)) $o['JobID'] = $this->JobID;
if (isset($this->JobName)) $o['JobName'] = $this->JobName;
if (isset($this->ExpectedStartDate)) $o['ExpectedStartDate'] = JsonConverters::to('DateTime', $this->ExpectedStartDate);
if (isset($this->ExpectedCompletionDate)) $o['ExpectedCompletionDate'] = JsonConverters::to('DateTime', $this->ExpectedCompletionDate);
if (isset($this->ActualStartDate)) $o['ActualStartDate'] = JsonConverters::to('DateTime', $this->ActualStartDate);
if (isset($this->ActualEndDate)) $o['ActualEndDate'] = JsonConverters::to('DateTime', $this->ActualEndDate);
if (isset($this->PercentComplete)) $o['PercentComplete'] = $this->PercentComplete;
if (isset($this->StatusID)) $o['StatusID'] = $this->StatusID;
if (isset($this->JobCategory)) $o['JobCategory'] = $this->JobCategory;
if (isset($this->IsAgreementVisit)) $o['IsAgreementVisit'] = $this->IsAgreementVisit;
if (isset($this->OccurrenceDate)) $o['OccurrenceDate'] = JsonConverters::to('DateTime', $this->OccurrenceDate);
if (isset($this->Crew)) $o['Crew'] = JsonConverters::toArray('TimelineCrew', $this->Crew);
if (isset($this->Equipment)) $o['Equipment'] = JsonConverters::toArray('TimelineEquipment', $this->Equipment);
return empty($o) ? new class(){} : $o;
}
}
class JobScheduleUpdateResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var TimelineJob|null */
public ?TimelineJob $Job=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['Job'])) $this->Job = JsonConverters::from('TimelineJob', $o['Job']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->Job)) $o['Job'] = JsonConverters::to('TimelineJob', $this->Job);
return empty($o) ? new class(){} : $o;
}
}
class JobScheduleUpdateRequest implements JsonSerializable
{
public function __construct(
/** @var int */
public int $JobID=0,
/** @var DateTime|null */
public ?DateTime $ExpectedStartDate=null,
/** @var DateTime|null */
public ?DateTime $ExpectedCompletionDate=null,
/** @var float|null */
public ?float $PercentComplete=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['JobID'])) $this->JobID = $o['JobID'];
if (isset($o['ExpectedStartDate'])) $this->ExpectedStartDate = JsonConverters::from('DateTime', $o['ExpectedStartDate']);
if (isset($o['ExpectedCompletionDate'])) $this->ExpectedCompletionDate = JsonConverters::from('DateTime', $o['ExpectedCompletionDate']);
if (isset($o['PercentComplete'])) $this->PercentComplete = $o['PercentComplete'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->JobID)) $o['JobID'] = $this->JobID;
if (isset($this->ExpectedStartDate)) $o['ExpectedStartDate'] = JsonConverters::to('DateTime', $this->ExpectedStartDate);
if (isset($this->ExpectedCompletionDate)) $o['ExpectedCompletionDate'] = JsonConverters::to('DateTime', $this->ExpectedCompletionDate);
if (isset($this->PercentComplete)) $o['PercentComplete'] = $this->PercentComplete;
return empty($o) ? new class(){} : $o;
}
}
PHP JobScheduleUpdateRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
PUT /v1/project/job/{JobID}/schedule HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<JobScheduleUpdateRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<ExpectedCompletionDate>0001-01-01T00:00:00</ExpectedCompletionDate>
<ExpectedStartDate>0001-01-01T00:00:00</ExpectedStartDate>
<JobID>0</JobID>
<PercentComplete>0</PercentComplete>
</JobScheduleUpdateRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<JobScheduleUpdateResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<Job>
<ActualEndDate>0001-01-01T00:00:00</ActualEndDate>
<ActualStartDate>0001-01-01T00:00:00</ActualStartDate>
<Crew>
<TimelineCrew>
<BudgetedHours>0</BudgetedHours>
<ContactID>0</ContactID>
<ContactName>String</ContactName>
<ProjectJobCrewMemberID>0</ProjectJobCrewMemberID>
</TimelineCrew>
</Crew>
<Equipment>
<TimelineEquipment>
<EquipmentID>0</EquipmentID>
<EquipmentName>String</EquipmentName>
<ProjectJobEquipmentID>0</ProjectJobEquipmentID>
</TimelineEquipment>
</Equipment>
<ExpectedCompletionDate>0001-01-01T00:00:00</ExpectedCompletionDate>
<ExpectedStartDate>0001-01-01T00:00:00</ExpectedStartDate>
<IsAgreementVisit>false</IsAgreementVisit>
<JobCategory>String</JobCategory>
<JobID>0</JobID>
<JobName>String</JobName>
<OccurrenceDate>0001-01-01T00:00:00</OccurrenceDate>
<PercentComplete>0</PercentComplete>
<StatusID>0</StatusID>
</Job>
<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>
</JobScheduleUpdateResponse>