| PUT | /api/dynamiccontent/{ObjectDynamicContentId} | ||
|---|---|---|---|
| POST | /api/dynamiccontent/ |
<?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 ObjectDynamicContentModel implements JsonSerializable
{
public function __construct(
/** @description The dynamic content Id (PKID) */
// @ApiMember(Description="The dynamic content Id (PKID)", ParameterType="query")
/** @var string */
public string $ObjectDynamicContentId='',
/** @description The object Id this dynamic content record is for. */
// @ApiMember(Description="The object Id this dynamic content record is for.", ParameterType="query")
/** @var string */
public string $ObjectId='',
/** @description The dynamic content definition id that indicates what this dynamic content contains */
// @ApiMember(Description="The dynamic content definition id that indicates what this dynamic content contains", ParameterType="query")
/** @var string */
public string $DynamicContentDefinitionId='',
/** @description Name of the dynamic content definition */
// @ApiMember(Description="Name of the dynamic content definition", ParameterType="query")
/** @var string|null */
public ?string $DefinitionName=null,
/** @description The format Id the dynamic content is saved as */
// @ApiMember(Description="The format Id the dynamic content is saved as", ParameterType="query")
/** @var string */
public string $ContentFormatId='',
/** @description Name of the content format */
// @ApiMember(Description="Name of the content format", ParameterType="query")
/** @var string|null */
public ?string $ContentFormat=null,
/** @description The content string regardless of the format. */
// @ApiMember(Description="The content string regardless of the format.", ParameterType="query")
/** @var string|null */
public ?string $Content=null,
/** @description XML content if the format is XML */
// @ApiMember(Description="XML content if the format is XML", ParameterType="query")
/** @var string|null */
public ?string $XmlContent=null,
/** @description The contact id of the licensee who owns this record */
// @ApiMember(Description="The contact id of the licensee who owns this record", ParameterType="query")
/** @var string */
public string $OwnerContactId='',
/** @description Record Status of the dynamic content */
// @ApiMember(Description="Record Status of the dynamic content", ParameterType="query")
/** @var string|null */
public ?string $RecordStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ObjectDynamicContentId'])) $this->ObjectDynamicContentId = $o['ObjectDynamicContentId'];
if (isset($o['ObjectId'])) $this->ObjectId = $o['ObjectId'];
if (isset($o['DynamicContentDefinitionId'])) $this->DynamicContentDefinitionId = $o['DynamicContentDefinitionId'];
if (isset($o['DefinitionName'])) $this->DefinitionName = $o['DefinitionName'];
if (isset($o['ContentFormatId'])) $this->ContentFormatId = $o['ContentFormatId'];
if (isset($o['ContentFormat'])) $this->ContentFormat = $o['ContentFormat'];
if (isset($o['Content'])) $this->Content = $o['Content'];
if (isset($o['XmlContent'])) $this->XmlContent = $o['XmlContent'];
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->ObjectDynamicContentId)) $o['ObjectDynamicContentId'] = $this->ObjectDynamicContentId;
if (isset($this->ObjectId)) $o['ObjectId'] = $this->ObjectId;
if (isset($this->DynamicContentDefinitionId)) $o['DynamicContentDefinitionId'] = $this->DynamicContentDefinitionId;
if (isset($this->DefinitionName)) $o['DefinitionName'] = $this->DefinitionName;
if (isset($this->ContentFormatId)) $o['ContentFormatId'] = $this->ContentFormatId;
if (isset($this->ContentFormat)) $o['ContentFormat'] = $this->ContentFormat;
if (isset($this->Content)) $o['Content'] = $this->Content;
if (isset($this->XmlContent)) $o['XmlContent'] = $this->XmlContent;
if (isset($this->OwnerContactId)) $o['OwnerContactId'] = $this->OwnerContactId;
if (isset($this->RecordStatus)) $o['RecordStatus'] = $this->RecordStatus;
return empty($o) ? new class(){} : $o;
}
}
// @ApiResponse(Description="Dynamic Content Value")
class GetDynamicContentResponse implements JsonSerializable
{
public function __construct(
/** @description Dynamic Content Value. */
// @ApiMember(Description="Dynamic Content Value.")
/** @var ObjectDynamicContentModel|null */
public ?ObjectDynamicContentModel $DynamicContent=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['DynamicContent'])) $this->DynamicContent = JsonConverters::from('ObjectDynamicContentModel', $o['DynamicContent']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->DynamicContent)) $o['DynamicContent'] = JsonConverters::to('ObjectDynamicContentModel', $this->DynamicContent);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
/** @description Add or update dynamic content. */
// @Api(Description="Add or update dynamic content.")
class SaveDynamicContent implements JsonSerializable
{
public function __construct(
/** @description Dynamic Content details. */
// @ApiMember(Description="Dynamic Content details.")
/** @var ObjectDynamicContentModel|null */
public ?ObjectDynamicContentModel $DynamicContent=null,
/** @description Id of the Dynamic Content record. */
// @ApiMember(Description="Id of the Dynamic Content record.", ParameterType="path")
/** @var string */
public string $ObjectDynamicContentId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['DynamicContent'])) $this->DynamicContent = JsonConverters::from('ObjectDynamicContentModel', $o['DynamicContent']);
if (isset($o['ObjectDynamicContentId'])) $this->ObjectDynamicContentId = $o['ObjectDynamicContentId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->DynamicContent)) $o['DynamicContent'] = JsonConverters::to('ObjectDynamicContentModel', $this->DynamicContent);
if (isset($this->ObjectDynamicContentId)) $o['ObjectDynamicContentId'] = $this->ObjectDynamicContentId;
return empty($o) ? new class(){} : $o;
}
}
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.
POST /api/dynamiccontent/ HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"DynamicContent":{"ObjectDynamicContentId":"00000000-0000-0000-0000-000000000000","ObjectId":"00000000-0000-0000-0000-000000000000","DynamicContentDefinitionId":"00000000-0000-0000-0000-000000000000","DefinitionName":"String","ContentFormatId":"00000000-0000-0000-0000-000000000000","ContentFormat":"String","Content":"String","XmlContent":"String","OwnerContactId":"00000000-0000-0000-0000-000000000000","RecordStatus":"String"},"ObjectDynamicContentId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"DynamicContent":{"ObjectDynamicContentId":"00000000-0000-0000-0000-000000000000","ObjectId":"00000000-0000-0000-0000-000000000000","DynamicContentDefinitionId":"00000000-0000-0000-0000-000000000000","DefinitionName":"String","ContentFormatId":"00000000-0000-0000-0000-000000000000","ContentFormat":"String","Content":"String","XmlContent":"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"}}}