Trendsic Platform Service

<back to all web services

EngineRunsRequest

Requires Authentication
The following routes are available for this service:
GET,OPTIONS/v1/engine/runs
<?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 WorkflowRunStepView implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $StepId=0,
        /** @var string|null */
        public ?string $NodeId=null,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Kind=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var int */
        public int $DurationMs=0,
        /** @var string|null */
        public ?string $Input=null,
        /** @var string|null */
        public ?string $Output=null,
        /** @var string|null */
        public ?string $Note=null,
        /** @var string|null */
        public ?string $BranchReason=null,
        /** @var int */
        public int $Attempts=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['StepId'])) $this->StepId = $o['StepId'];
        if (isset($o['NodeId'])) $this->NodeId = $o['NodeId'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Kind'])) $this->Kind = $o['Kind'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['DurationMs'])) $this->DurationMs = $o['DurationMs'];
        if (isset($o['Input'])) $this->Input = $o['Input'];
        if (isset($o['Output'])) $this->Output = $o['Output'];
        if (isset($o['Note'])) $this->Note = $o['Note'];
        if (isset($o['BranchReason'])) $this->BranchReason = $o['BranchReason'];
        if (isset($o['Attempts'])) $this->Attempts = $o['Attempts'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->StepId)) $o['StepId'] = $this->StepId;
        if (isset($this->NodeId)) $o['NodeId'] = $this->NodeId;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Kind)) $o['Kind'] = $this->Kind;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->DurationMs)) $o['DurationMs'] = $this->DurationMs;
        if (isset($this->Input)) $o['Input'] = $this->Input;
        if (isset($this->Output)) $o['Output'] = $this->Output;
        if (isset($this->Note)) $o['Note'] = $this->Note;
        if (isset($this->BranchReason)) $o['BranchReason'] = $this->BranchReason;
        if (isset($this->Attempts)) $o['Attempts'] = $this->Attempts;
        return empty($o) ? new class(){} : $o;
    }
}

class WorkflowRunView implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $RunId=0,
        /** @var string|null */
        public ?string $RunKey=null,
        /** @var int */
        public int $WorkflowId=0,
        /** @var string|null */
        public ?string $WorkflowName=null,
        /** @var int */
        public int $VersionNum=0,
        /** @var string|null */
        public ?string $Status=null,
        /** @var string|null */
        public ?string $RecordLabel=null,
        /** @var string|null */
        public ?string $RecordHref=null,
        /** @var string|null */
        public ?string $WaitReason=null,
        /** @var DateTime|null */
        public ?DateTime $RunAfter=null,
        /** @var int */
        public int $Attempts=0,
        /** @var int */
        public int $MaxAttempts=0,
        /** @var DateTime */
        public DateTime $StartedAt=new DateTime(),
        /** @var DateTime|null */
        public ?DateTime $FinishedAt=null,
        /** @var int */
        public int $DurationMs=0,
        /** @var array<WorkflowRunStepView>|null */
        public ?array $Steps=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['RunId'])) $this->RunId = $o['RunId'];
        if (isset($o['RunKey'])) $this->RunKey = $o['RunKey'];
        if (isset($o['WorkflowId'])) $this->WorkflowId = $o['WorkflowId'];
        if (isset($o['WorkflowName'])) $this->WorkflowName = $o['WorkflowName'];
        if (isset($o['VersionNum'])) $this->VersionNum = $o['VersionNum'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['RecordLabel'])) $this->RecordLabel = $o['RecordLabel'];
        if (isset($o['RecordHref'])) $this->RecordHref = $o['RecordHref'];
        if (isset($o['WaitReason'])) $this->WaitReason = $o['WaitReason'];
        if (isset($o['RunAfter'])) $this->RunAfter = JsonConverters::from('DateTime', $o['RunAfter']);
        if (isset($o['Attempts'])) $this->Attempts = $o['Attempts'];
        if (isset($o['MaxAttempts'])) $this->MaxAttempts = $o['MaxAttempts'];
        if (isset($o['StartedAt'])) $this->StartedAt = JsonConverters::from('DateTime', $o['StartedAt']);
        if (isset($o['FinishedAt'])) $this->FinishedAt = JsonConverters::from('DateTime', $o['FinishedAt']);
        if (isset($o['DurationMs'])) $this->DurationMs = $o['DurationMs'];
        if (isset($o['Steps'])) $this->Steps = JsonConverters::fromArray('WorkflowRunStepView', $o['Steps']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->RunId)) $o['RunId'] = $this->RunId;
        if (isset($this->RunKey)) $o['RunKey'] = $this->RunKey;
        if (isset($this->WorkflowId)) $o['WorkflowId'] = $this->WorkflowId;
        if (isset($this->WorkflowName)) $o['WorkflowName'] = $this->WorkflowName;
        if (isset($this->VersionNum)) $o['VersionNum'] = $this->VersionNum;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->RecordLabel)) $o['RecordLabel'] = $this->RecordLabel;
        if (isset($this->RecordHref)) $o['RecordHref'] = $this->RecordHref;
        if (isset($this->WaitReason)) $o['WaitReason'] = $this->WaitReason;
        if (isset($this->RunAfter)) $o['RunAfter'] = JsonConverters::to('DateTime', $this->RunAfter);
        if (isset($this->Attempts)) $o['Attempts'] = $this->Attempts;
        if (isset($this->MaxAttempts)) $o['MaxAttempts'] = $this->MaxAttempts;
        if (isset($this->StartedAt)) $o['StartedAt'] = JsonConverters::to('DateTime', $this->StartedAt);
        if (isset($this->FinishedAt)) $o['FinishedAt'] = JsonConverters::to('DateTime', $this->FinishedAt);
        if (isset($this->DurationMs)) $o['DurationMs'] = $this->DurationMs;
        if (isset($this->Steps)) $o['Steps'] = JsonConverters::toArray('WorkflowRunStepView', $this->Steps);
        return empty($o) ? new class(){} : $o;
    }
}

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

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

class EngineRunsRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Status=null,
        /** @var int */
        public int $WorkflowId=0,
        /** @var int */
        public int $Top=0
    ) {
    }

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

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

GET /v1/engine/runs HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<EngineRunsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <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>
  <Runs>
    <WorkflowRunView>
      <Attempts>0</Attempts>
      <DurationMs>0</DurationMs>
      <FinishedAt>0001-01-01T00:00:00</FinishedAt>
      <MaxAttempts>0</MaxAttempts>
      <RecordHref>String</RecordHref>
      <RecordLabel>String</RecordLabel>
      <RunAfter>0001-01-01T00:00:00</RunAfter>
      <RunId>0</RunId>
      <RunKey>String</RunKey>
      <StartedAt>0001-01-01T00:00:00</StartedAt>
      <Status>String</Status>
      <Steps>
        <WorkflowRunStepView>
          <Attempts>0</Attempts>
          <BranchReason>String</BranchReason>
          <DurationMs>0</DurationMs>
          <Input>String</Input>
          <Kind>String</Kind>
          <Name>String</Name>
          <NodeId>String</NodeId>
          <Note>String</Note>
          <Output>String</Output>
          <Status>String</Status>
          <StepId>0</StepId>
        </WorkflowRunStepView>
      </Steps>
      <VersionNum>0</VersionNum>
      <WaitReason>String</WaitReason>
      <WorkflowId>0</WorkflowId>
      <WorkflowName>String</WorkflowName>
    </WorkflowRunView>
  </Runs>
</EngineRunsResponse>