GET | /RestApi/sitefinity/data-intelligence/persona |
---|
<?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 PersonaRequestDto implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Filter=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Filter'])) $this->Filter = $o['Filter'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Filter)) $o['Filter'] = $this->Filter;
return empty($o) ? new class(){} : $o;
}
}
enum PersonaState : string
{
case Inactive = 'Inactive';
case Active = 'Active';
case ToBeDeleted = 'ToBeDeleted';
}
class Persona implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Description=null,
/** @var string|null */
public ?string $PhotoUrl=null,
/** @var PersonaState|null */
public ?PersonaState $State=null,
/** @var int */
public int $Threshold=0,
/** @var DateTime|null */
public ?DateTime $CreatedOn=null,
/** @var string|null */
public ?string $CreatedByUserId=null,
/** @var DateTime|null */
public ?DateTime $ModifiedOn=null,
/** @var string|null */
public ?string $ModifiedByUserId=null,
/** @var DateTime|null */
public ?DateTime $ToBeReinitializedAt=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['PhotoUrl'])) $this->PhotoUrl = $o['PhotoUrl'];
if (isset($o['State'])) $this->State = JsonConverters::from('PersonaState', $o['State']);
if (isset($o['Threshold'])) $this->Threshold = $o['Threshold'];
if (isset($o['CreatedOn'])) $this->CreatedOn = JsonConverters::from('DateTime', $o['CreatedOn']);
if (isset($o['CreatedByUserId'])) $this->CreatedByUserId = $o['CreatedByUserId'];
if (isset($o['ModifiedOn'])) $this->ModifiedOn = JsonConverters::from('DateTime', $o['ModifiedOn']);
if (isset($o['ModifiedByUserId'])) $this->ModifiedByUserId = $o['ModifiedByUserId'];
if (isset($o['ToBeReinitializedAt'])) $this->ToBeReinitializedAt = JsonConverters::from('DateTime', $o['ToBeReinitializedAt']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->PhotoUrl)) $o['PhotoUrl'] = $this->PhotoUrl;
if (isset($this->State)) $o['State'] = JsonConverters::to('PersonaState', $this->State);
if (isset($this->Threshold)) $o['Threshold'] = $this->Threshold;
if (isset($this->CreatedOn)) $o['CreatedOn'] = JsonConverters::to('DateTime', $this->CreatedOn);
if (isset($this->CreatedByUserId)) $o['CreatedByUserId'] = $this->CreatedByUserId;
if (isset($this->ModifiedOn)) $o['ModifiedOn'] = JsonConverters::to('DateTime', $this->ModifiedOn);
if (isset($this->ModifiedByUserId)) $o['ModifiedByUserId'] = $this->ModifiedByUserId;
if (isset($this->ToBeReinitializedAt)) $o['ToBeReinitializedAt'] = JsonConverters::to('DateTime', $this->ToBeReinitializedAt);
return empty($o) ? new class(){} : $o;
}
}
class PersonaListViewModel implements JsonSerializable
{
public function __construct(
/** @var array<Persona>|null */
public ?array $Personаs=null,
/** @var string|null */
public ?string $DecAppUrl=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Personаs'])) $this->Personаs = JsonConverters::fromArray('Persona', $o['Personаs']);
if (isset($o['DecAppUrl'])) $this->DecAppUrl = $o['DecAppUrl'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Personаs)) $o['Personаs'] = JsonConverters::toArray('Persona', $this->Personаs);
if (isset($this->DecAppUrl)) $o['DecAppUrl'] = $this->DecAppUrl;
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.
GET /RestApi/sitefinity/data-intelligence/persona HTTP/1.1 Host: www.asg.com.au Accept: text/jsonl
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"DecAppUrl":"String"}