| GET | /api/automation/{ObjectId}/list |
|---|
<?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 AutomationModel implements JsonSerializable
{
public function __construct(
/** @description The unique automation Id */
// @ApiMember(Description="The unique automation Id", ParameterType="query")
/** @var string */
public string $AutomationId='',
/** @description The automation type Id */
// @ApiMember(Description="The automation type Id", ParameterType="query")
/** @var string */
public string $AutomationTypeId='',
/** @description The automation type */
// @ApiMember(Description="The automation type", ParameterType="query")
/** @var string|null */
public ?string $AutomationType=null,
/** @description The object this automation applies to */
// @ApiMember(Description="The object this automation applies to", ParameterType="query")
/** @var string */
public string $ObjectId='',
/** @description The object name this automation applies to */
// @ApiMember(Description="The object name this automation applies to", ParameterType="query")
/** @var string|null */
public ?string $ObjectName=null,
/** @description The Id of the object type that this automation applies to. */
// @ApiMember(Description="The Id of the object type that this automation applies to. ", ParameterType="query")
/** @var string */
public string $RmsTableCtxIdObject='',
/** @description The name of the object type that this automation applies to. */
// @ApiMember(Description="The name of the object type that this automation applies to.", ParameterType="query")
/** @var string|null */
public ?string $RmsTableCtxName=null,
/** @description A guid list containing the selected system action Id's that trigger this automation. */
// @ApiMember(Description="A guid list containing the selected system action Id's that trigger this automation.", ParameterType="query")
/** @var array<string>|null */
public ?array $ActionList=null,
/** @description A comma separated string of the selected system action names that trigger this automation. */
// @ApiMember(Description="A comma separated string of the selected system action names that trigger this automation.", ParameterType="query")
/** @var string|null */
public ?string $Actions=null,
/** @description Name of the automation. */
// @ApiMember(Description="Name of the automation.", ParameterType="query")
/** @var string|null */
public ?string $Name=null,
/** @description Description of the automation */
// @ApiMember(Description="Description of the automation", ParameterType="query")
/** @var string|null */
public ?string $Description=null,
/** @description Owner Contact Id */
// @ApiMember(Description="Owner Contact Id", ParameterType="query")
/** @var string */
public string $OwnerContactId='',
/** @description Record Status of the automation. */
// @ApiMember(Description="Record Status of the automation.", ParameterType="query")
/** @var string|null */
public ?string $RecordStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['AutomationId'])) $this->AutomationId = $o['AutomationId'];
if (isset($o['AutomationTypeId'])) $this->AutomationTypeId = $o['AutomationTypeId'];
if (isset($o['AutomationType'])) $this->AutomationType = $o['AutomationType'];
if (isset($o['ObjectId'])) $this->ObjectId = $o['ObjectId'];
if (isset($o['ObjectName'])) $this->ObjectName = $o['ObjectName'];
if (isset($o['RmsTableCtxIdObject'])) $this->RmsTableCtxIdObject = $o['RmsTableCtxIdObject'];
if (isset($o['RmsTableCtxName'])) $this->RmsTableCtxName = $o['RmsTableCtxName'];
if (isset($o['ActionList'])) $this->ActionList = JsonConverters::fromArray('Guid', $o['ActionList']);
if (isset($o['Actions'])) $this->Actions = $o['Actions'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['OwnerContactId'])) $this->OwnerContactId = $o['OwnerContactId'];
if (isset($o['RecordStatus'])) $this->RecordStatus = $o['RecordStatus'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->AutomationId)) $o['AutomationId'] = $this->AutomationId;
if (isset($this->AutomationTypeId)) $o['AutomationTypeId'] = $this->AutomationTypeId;
if (isset($this->AutomationType)) $o['AutomationType'] = $this->AutomationType;
if (isset($this->ObjectId)) $o['ObjectId'] = $this->ObjectId;
if (isset($this->ObjectName)) $o['ObjectName'] = $this->ObjectName;
if (isset($this->RmsTableCtxIdObject)) $o['RmsTableCtxIdObject'] = $this->RmsTableCtxIdObject;
if (isset($this->RmsTableCtxName)) $o['RmsTableCtxName'] = $this->RmsTableCtxName;
if (isset($this->ActionList)) $o['ActionList'] = JsonConverters::toArray('Guid', $this->ActionList);
if (isset($this->Actions)) $o['Actions'] = $this->Actions;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->OwnerContactId)) $o['OwnerContactId'] = $this->OwnerContactId;
if (isset($this->RecordStatus)) $o['RecordStatus'] = $this->RecordStatus;
return empty($o) ? new class(){} : $o;
}
}
// @ApiResponse(Description="List of automations that are setup for an object")
class GetAutomationsForObjectResponse implements JsonSerializable
{
public function __construct(
/** @description List of automations. */
// @ApiMember(Description="List of automations.")
/** @var array<AutomationModel>|null */
public ?array $Automations=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Automations'])) $this->Automations = JsonConverters::fromArray('AutomationModel', $o['Automations']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Automations)) $o['Automations'] = JsonConverters::toArray('AutomationModel', $this->Automations);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
/** @description Get automations that are setup for an object */
// @Api(Description="Get automations that are setup for an object")
class GetAutomationsForObject implements JsonSerializable
{
public function __construct(
/** @description Object to retrieve automations for. */
// @ApiMember(Description="Object to retrieve automations for.", ParameterType="path")
/** @var string */
public string $ObjectId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ObjectId'])) $this->ObjectId = $o['ObjectId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ObjectId)) $o['ObjectId'] = $this->ObjectId;
return empty($o) ? new class(){} : $o;
}
}
PHP GetAutomationsForObject DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /api/automation/{ObjectId}/list HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"Automations":[{"AutomationId":"00000000-0000-0000-0000-000000000000","AutomationTypeId":"00000000-0000-0000-0000-000000000000","AutomationType":"String","ObjectId":"00000000-0000-0000-0000-000000000000","ObjectName":"String","RmsTableCtxIdObject":"00000000-0000-0000-0000-000000000000","RmsTableCtxName":"String","ActionList":["00000000-0000-0000-0000-000000000000"],"Actions":"String","Name":"String","Description":"String","OwnerContactId":"00000000-0000-0000-0000-000000000000","RecordStatus":"String"}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}