| All Verbs | /api/datalist/items/{DataListId} |
|---|
<?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 ListItemModel implements JsonSerializable
{
public function __construct(
/** @var string */
public string $ListItemId='',
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Description=null,
/** @var string|null */
public ?string $ShortName=null,
/** @var bool|null */
public ?bool $IsDefault=null,
/** @var int */
public int $Order=0,
/** @var string */
public string $ListItemTrafficLightId='',
/** @var string */
public string $PrimaryListItemImageId='',
/** @var string|null */
public ?string $PrimaryListItemImageUrl=null,
/** @var string|null */
public ?string $PrimaryImageThumbnailUrl=null,
/** @var string */
public string $OwnerContactId='',
/** @var string|null */
public ?string $RecordStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ListItemId'])) $this->ListItemId = $o['ListItemId'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['ShortName'])) $this->ShortName = $o['ShortName'];
if (isset($o['IsDefault'])) $this->IsDefault = $o['IsDefault'];
if (isset($o['Order'])) $this->Order = $o['Order'];
if (isset($o['ListItemTrafficLightId'])) $this->ListItemTrafficLightId = $o['ListItemTrafficLightId'];
if (isset($o['PrimaryListItemImageId'])) $this->PrimaryListItemImageId = $o['PrimaryListItemImageId'];
if (isset($o['PrimaryListItemImageUrl'])) $this->PrimaryListItemImageUrl = $o['PrimaryListItemImageUrl'];
if (isset($o['PrimaryImageThumbnailUrl'])) $this->PrimaryImageThumbnailUrl = $o['PrimaryImageThumbnailUrl'];
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->ListItemId)) $o['ListItemId'] = $this->ListItemId;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->ShortName)) $o['ShortName'] = $this->ShortName;
if (isset($this->IsDefault)) $o['IsDefault'] = $this->IsDefault;
if (isset($this->Order)) $o['Order'] = $this->Order;
if (isset($this->ListItemTrafficLightId)) $o['ListItemTrafficLightId'] = $this->ListItemTrafficLightId;
if (isset($this->PrimaryListItemImageId)) $o['PrimaryListItemImageId'] = $this->PrimaryListItemImageId;
if (isset($this->PrimaryListItemImageUrl)) $o['PrimaryListItemImageUrl'] = $this->PrimaryListItemImageUrl;
if (isset($this->PrimaryImageThumbnailUrl)) $o['PrimaryImageThumbnailUrl'] = $this->PrimaryImageThumbnailUrl;
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 items for a list")
class GetListItemsResponse implements JsonSerializable
{
public function __construct(
/** @var array<ListItemModel>|null */
public ?array $ListItems=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ListItems'])) $this->ListItems = JsonConverters::fromArray('ListItemModel', $o['ListItems']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ListItems)) $o['ListItems'] = JsonConverters::toArray('ListItemModel', $this->ListItems);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
/** @description Get list items of the specified data list */
// @Api(Description="Get list items of the specified data list")
class GetListItemsForList implements JsonSerializable
{
public function __construct(
/** @description The Data List Guid. Records retrieved will belong to this data list. */
// @ApiMember(DataType="Guid", Description="The Data List Guid. Records retrieved will belong to this data list.", Name="DataListId")
/** @var string */
public string $DataListId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['DataListId'])) $this->DataListId = $o['DataListId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->DataListId)) $o['DataListId'] = $this->DataListId;
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/datalist/items/{DataListId} HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"DataListId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"ListItems":[{"ListItemId":"00000000-0000-0000-0000-000000000000","Name":"String","Description":"String","ShortName":"String","IsDefault":false,"Order":0,"ListItemTrafficLightId":"00000000-0000-0000-0000-000000000000","PrimaryListItemImageId":"00000000-0000-0000-0000-000000000000","PrimaryListItemImageUrl":"String","PrimaryImageThumbnailUrl":"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"}}}