Trendsic Platform Service

<back to all web services

PunchCreateRequest

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/projects/{ProjectID}/punch
<?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 PunchItem implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $PunchItemID=0,
        /** @var string */
        public string $PunchItemUID='',
        /** @var int */
        public int $ProjectID=0,
        /** @var string|null */
        public ?string $PunchNo=null,
        /** @var string|null */
        public ?string $Title=null,
        /** @var string|null */
        public ?string $Description=null,
        /** @var string|null */
        public ?string $Area=null,
        /** @var string|null */
        public ?string $Trade=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var string|null */
        public ?string $Priority=null,
        /** @var string|null */
        public ?string $AssignedSub=null,
        /** @var string|null */
        public ?string $AssignedTo=null,
        /** @var int|null */
        public ?int $AssignedSubContactID=null,
        /** @var int */
        public int $PhotoCount=0,
        /** @var string|null */
        public ?string $OriginType=null,
        /** @var string|null */
        public ?string $OriginRef=null,
        /** @var DateTime|null */
        public ?DateTime $OpenedAt=null,
        /** @var DateTime|null */
        public ?DateTime $VerifiedAt=null,
        /** @var DateTime|null */
        public ?DateTime $ClosedAt=null,
        /** @var string|null */
        public ?string $CreatedBy=null,
        /** @var DateTime|null */
        public ?DateTime $CreatedAt=null,
        /** @var DateTime|null */
        public ?DateTime $UpdatedAt=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['PunchItemID'])) $this->PunchItemID = $o['PunchItemID'];
        if (isset($o['PunchItemUID'])) $this->PunchItemUID = $o['PunchItemUID'];
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['PunchNo'])) $this->PunchNo = $o['PunchNo'];
        if (isset($o['Title'])) $this->Title = $o['Title'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['Area'])) $this->Area = $o['Area'];
        if (isset($o['Trade'])) $this->Trade = $o['Trade'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['Priority'])) $this->Priority = $o['Priority'];
        if (isset($o['AssignedSub'])) $this->AssignedSub = $o['AssignedSub'];
        if (isset($o['AssignedTo'])) $this->AssignedTo = $o['AssignedTo'];
        if (isset($o['AssignedSubContactID'])) $this->AssignedSubContactID = $o['AssignedSubContactID'];
        if (isset($o['PhotoCount'])) $this->PhotoCount = $o['PhotoCount'];
        if (isset($o['OriginType'])) $this->OriginType = $o['OriginType'];
        if (isset($o['OriginRef'])) $this->OriginRef = $o['OriginRef'];
        if (isset($o['OpenedAt'])) $this->OpenedAt = JsonConverters::from('DateTime', $o['OpenedAt']);
        if (isset($o['VerifiedAt'])) $this->VerifiedAt = JsonConverters::from('DateTime', $o['VerifiedAt']);
        if (isset($o['ClosedAt'])) $this->ClosedAt = JsonConverters::from('DateTime', $o['ClosedAt']);
        if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
        if (isset($o['CreatedAt'])) $this->CreatedAt = JsonConverters::from('DateTime', $o['CreatedAt']);
        if (isset($o['UpdatedAt'])) $this->UpdatedAt = JsonConverters::from('DateTime', $o['UpdatedAt']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->PunchItemID)) $o['PunchItemID'] = $this->PunchItemID;
        if (isset($this->PunchItemUID)) $o['PunchItemUID'] = $this->PunchItemUID;
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->PunchNo)) $o['PunchNo'] = $this->PunchNo;
        if (isset($this->Title)) $o['Title'] = $this->Title;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->Area)) $o['Area'] = $this->Area;
        if (isset($this->Trade)) $o['Trade'] = $this->Trade;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->Priority)) $o['Priority'] = $this->Priority;
        if (isset($this->AssignedSub)) $o['AssignedSub'] = $this->AssignedSub;
        if (isset($this->AssignedTo)) $o['AssignedTo'] = $this->AssignedTo;
        if (isset($this->AssignedSubContactID)) $o['AssignedSubContactID'] = $this->AssignedSubContactID;
        if (isset($this->PhotoCount)) $o['PhotoCount'] = $this->PhotoCount;
        if (isset($this->OriginType)) $o['OriginType'] = $this->OriginType;
        if (isset($this->OriginRef)) $o['OriginRef'] = $this->OriginRef;
        if (isset($this->OpenedAt)) $o['OpenedAt'] = JsonConverters::to('DateTime', $this->OpenedAt);
        if (isset($this->VerifiedAt)) $o['VerifiedAt'] = JsonConverters::to('DateTime', $this->VerifiedAt);
        if (isset($this->ClosedAt)) $o['ClosedAt'] = JsonConverters::to('DateTime', $this->ClosedAt);
        if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
        if (isset($this->CreatedAt)) $o['CreatedAt'] = JsonConverters::to('DateTime', $this->CreatedAt);
        if (isset($this->UpdatedAt)) $o['UpdatedAt'] = JsonConverters::to('DateTime', $this->UpdatedAt);
        return empty($o) ? new class(){} : $o;
    }
}

class PunchSummary implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ProjectID=0,
        /** @var int */
        public int $TotalItems=0,
        /** @var int */
        public int $OpenCount=0,
        /** @var int */
        public int $VerifyCount=0,
        /** @var int */
        public int $ClosedCount=0,
        /** @var int */
        public int $RejectedCount=0,
        /** @var int */
        public int $PercentComplete=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['TotalItems'])) $this->TotalItems = $o['TotalItems'];
        if (isset($o['OpenCount'])) $this->OpenCount = $o['OpenCount'];
        if (isset($o['VerifyCount'])) $this->VerifyCount = $o['VerifyCount'];
        if (isset($o['ClosedCount'])) $this->ClosedCount = $o['ClosedCount'];
        if (isset($o['RejectedCount'])) $this->RejectedCount = $o['RejectedCount'];
        if (isset($o['PercentComplete'])) $this->PercentComplete = $o['PercentComplete'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->TotalItems)) $o['TotalItems'] = $this->TotalItems;
        if (isset($this->OpenCount)) $o['OpenCount'] = $this->OpenCount;
        if (isset($this->VerifyCount)) $o['VerifyCount'] = $this->VerifyCount;
        if (isset($this->ClosedCount)) $o['ClosedCount'] = $this->ClosedCount;
        if (isset($this->RejectedCount)) $o['RejectedCount'] = $this->RejectedCount;
        if (isset($this->PercentComplete)) $o['PercentComplete'] = $this->PercentComplete;
        return empty($o) ? new class(){} : $o;
    }
}

class PunchItemResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var PunchItem|null */
        public ?PunchItem $Item=null,
        /** @var PunchSummary|null */
        public ?PunchSummary $Summary=null
    ) {
    }

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

class PunchCreateRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ProjectID=0,
        /** @var string|null */
        public ?string $PunchNo=null,
        /** @var string|null */
        public ?string $Title=null,
        /** @var string|null */
        public ?string $Description=null,
        /** @var string|null */
        public ?string $Area=null,
        /** @var string|null */
        public ?string $Trade=null,
        /** @var string|null */
        public ?string $Priority=null,
        /** @var string|null */
        public ?string $AssignedSub=null,
        /** @var string|null */
        public ?string $AssignedTo=null,
        /** @var int|null */
        public ?int $AssignedSubContactID=null,
        /** @var string|null */
        public ?string $OriginType=null,
        /** @var string|null */
        public ?string $OriginRef=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['PunchNo'])) $this->PunchNo = $o['PunchNo'];
        if (isset($o['Title'])) $this->Title = $o['Title'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['Area'])) $this->Area = $o['Area'];
        if (isset($o['Trade'])) $this->Trade = $o['Trade'];
        if (isset($o['Priority'])) $this->Priority = $o['Priority'];
        if (isset($o['AssignedSub'])) $this->AssignedSub = $o['AssignedSub'];
        if (isset($o['AssignedTo'])) $this->AssignedTo = $o['AssignedTo'];
        if (isset($o['AssignedSubContactID'])) $this->AssignedSubContactID = $o['AssignedSubContactID'];
        if (isset($o['OriginType'])) $this->OriginType = $o['OriginType'];
        if (isset($o['OriginRef'])) $this->OriginRef = $o['OriginRef'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->PunchNo)) $o['PunchNo'] = $this->PunchNo;
        if (isset($this->Title)) $o['Title'] = $this->Title;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->Area)) $o['Area'] = $this->Area;
        if (isset($this->Trade)) $o['Trade'] = $this->Trade;
        if (isset($this->Priority)) $o['Priority'] = $this->Priority;
        if (isset($this->AssignedSub)) $o['AssignedSub'] = $this->AssignedSub;
        if (isset($this->AssignedTo)) $o['AssignedTo'] = $this->AssignedTo;
        if (isset($this->AssignedSubContactID)) $o['AssignedSubContactID'] = $this->AssignedSubContactID;
        if (isset($this->OriginType)) $o['OriginType'] = $this->OriginType;
        if (isset($this->OriginRef)) $o['OriginRef'] = $this->OriginRef;
        return empty($o) ? new class(){} : $o;
    }
}

PHP PunchCreateRequest DTOs

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

HTTP + XML

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

POST /v1/projects/{ProjectID}/punch HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<PunchCreateRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Area>String</Area>
  <AssignedSub>String</AssignedSub>
  <AssignedSubContactID>0</AssignedSubContactID>
  <AssignedTo>String</AssignedTo>
  <Description>String</Description>
  <OriginRef>String</OriginRef>
  <OriginType>String</OriginType>
  <Priority>String</Priority>
  <ProjectID>0</ProjectID>
  <PunchNo>String</PunchNo>
  <Title>String</Title>
  <Trade>String</Trade>
</PunchCreateRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<PunchItemResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Item>
    <Area>String</Area>
    <AssignedSub>String</AssignedSub>
    <AssignedSubContactID>0</AssignedSubContactID>
    <AssignedTo>String</AssignedTo>
    <ClosedAt>0001-01-01T00:00:00</ClosedAt>
    <CreatedAt>0001-01-01T00:00:00</CreatedAt>
    <CreatedBy>String</CreatedBy>
    <Description>String</Description>
    <OpenedAt>0001-01-01T00:00:00</OpenedAt>
    <OriginRef>String</OriginRef>
    <OriginType>String</OriginType>
    <PhotoCount>0</PhotoCount>
    <Priority>String</Priority>
    <ProjectID>0</ProjectID>
    <PunchItemID>0</PunchItemID>
    <PunchItemUID>00000000-0000-0000-0000-000000000000</PunchItemUID>
    <PunchNo>String</PunchNo>
    <Status>String</Status>
    <Title>String</Title>
    <Trade>String</Trade>
    <UpdatedAt>0001-01-01T00:00:00</UpdatedAt>
    <VerifiedAt>0001-01-01T00:00:00</VerifiedAt>
  </Item>
  <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>
  <Summary>
    <ClosedCount>0</ClosedCount>
    <OpenCount>0</OpenCount>
    <PercentComplete>0</PercentComplete>
    <ProjectID>0</ProjectID>
    <RejectedCount>0</RejectedCount>
    <TotalItems>0</TotalItems>
    <VerifyCount>0</VerifyCount>
  </Summary>
</PunchItemResponse>