| PUT | /api/automation/inspection/{AutomationId} | ||
|---|---|---|---|
| POST | /api/automation/inspection |
<?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;
}
}
class AutoInspectionModel extends AutomationModel implements JsonSerializable
{
/**
* @param string $AutomationId
* @param string $AutomationTypeId
* @param string|null $AutomationType
* @param string $ObjectId
* @param string|null $ObjectName
* @param string $RmsTableCtxIdObject
* @param string|null $RmsTableCtxName
* @param array<string>|null $ActionList
* @param string|null $Actions
* @param string|null $Name
* @param string|null $Description
* @param string $OwnerContactId
* @param string|null $RecordStatus
*/
public function __construct(
string $AutomationId='',
string $AutomationTypeId='',
?string $AutomationType=null,
string $ObjectId='',
?string $ObjectName=null,
string $RmsTableCtxIdObject='',
?string $RmsTableCtxName=null,
?array $ActionList=null,
?string $Actions=null,
?string $Name=null,
?string $Description=null,
string $OwnerContactId='',
?string $RecordStatus=null,
/** @description The inspection type for the template. */
// @ApiMember(Description="The inspection type for the template.", ParameterType="query")
/** @var string */
public string $InspectionTypeId='',
/** @description The template to base the new inspection on. */
// @ApiMember(Description="The template to base the new inspection on.", ParameterType="query")
/** @var string */
public string $InspectionTemplateId='',
/** @description The inspector chosen for this inspection will be a contact linked to the project in this role. If no one matches the description, the inspector is not set. */
// @ApiMember(Description="The inspector chosen for this inspection will be a contact linked to the project in this role. If no one matches the description, the inspector is not set. ", ParameterType="query")
/** @var string */
public string $ContactRoleId='',
/** @description If this is true, then if a project inspection for this template already exists, we will not create another inspection. */
// @ApiMember(Description="If this is true, then if a project inspection for this template already exists, we will not create another inspection.", ParameterType="query")
/** @var bool|null */
public ?bool $IgnoreIfExists=null
) {
parent::__construct($AutomationId,$AutomationTypeId,$AutomationType,$ObjectId,$ObjectName,$RmsTableCtxIdObject,$RmsTableCtxName,$ActionList,$Actions,$Name,$Description,$OwnerContactId,$RecordStatus);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['InspectionTypeId'])) $this->InspectionTypeId = $o['InspectionTypeId'];
if (isset($o['InspectionTemplateId'])) $this->InspectionTemplateId = $o['InspectionTemplateId'];
if (isset($o['ContactRoleId'])) $this->ContactRoleId = $o['ContactRoleId'];
if (isset($o['IgnoreIfExists'])) $this->IgnoreIfExists = $o['IgnoreIfExists'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->InspectionTypeId)) $o['InspectionTypeId'] = $this->InspectionTypeId;
if (isset($this->InspectionTemplateId)) $o['InspectionTemplateId'] = $this->InspectionTemplateId;
if (isset($this->ContactRoleId)) $o['ContactRoleId'] = $this->ContactRoleId;
if (isset($this->IgnoreIfExists)) $o['IgnoreIfExists'] = $this->IgnoreIfExists;
return empty($o) ? new class(){} : $o;
}
}
/** @description Add or update an inspection automation for an object */
// @Api(Description="Add or update an inspection automation for an object")
class SaveAutoInspection implements JsonSerializable
{
public function __construct(
/** @description Details of the automation to be added or updated. */
// @ApiMember(Description="Details of the automation to be added or updated.", ParameterType="query")
/** @var AutoInspectionModel|null */
public ?AutoInspectionModel $Automation=null,
/** @description Id of the automation. */
// @ApiMember(Description="Id of the automation.", ParameterType="path")
/** @var string */
public string $AutomationId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Automation'])) $this->Automation = JsonConverters::from('AutoInspectionModel', $o['Automation']);
if (isset($o['AutomationId'])) $this->AutomationId = $o['AutomationId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Automation)) $o['Automation'] = JsonConverters::to('AutoInspectionModel', $this->Automation);
if (isset($this->AutomationId)) $o['AutomationId'] = $this->AutomationId;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/automation/inspection HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"Automation":{"InspectionTypeId":"00000000-0000-0000-0000-000000000000","InspectionTemplateId":"00000000-0000-0000-0000-000000000000","ContactRoleId":"00000000-0000-0000-0000-000000000000","IgnoreIfExists":false,"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"},"AutomationId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
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"}}}