| GET | /template-approval/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 ApiServiceRequest implements IServiceRequest, IHasApiKey, IHasDeviceInfo, JsonSerializable
{
public function __construct(
/** @description The API Key required for authentication */
// @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
/** @var string */
public string $apiKey='',
/** @description Latitude of the user making this request */
// @ApiMember(DataType="double", Description="Latitude of the user making this request")
/** @var float */
public float $latitude=0.0,
/** @description Longitude of the user making this request */
// @ApiMember(DataType="double", Description="Longitude of the user making this request")
/** @var float */
public float $longitude=0.0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['apiKey'])) $this->apiKey = $o['apiKey'];
if (isset($o['latitude'])) $this->latitude = $o['latitude'];
if (isset($o['longitude'])) $this->longitude = $o['longitude'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->apiKey)) $o['apiKey'] = $this->apiKey;
if (isset($this->latitude)) $o['latitude'] = $this->latitude;
if (isset($this->longitude)) $o['longitude'] = $this->longitude;
return empty($o) ? new class(){} : $o;
}
}
class ApiServiceResponse implements IServiceResponse, JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $description=null,
/** @var string|null */
public ?string $heading=null,
/** @var bool|null */
public ?bool $wasSuccessful=null,
/** @var Object|null */
public ?Object $modelState=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['description'])) $this->description = $o['description'];
if (isset($o['heading'])) $this->heading = $o['heading'];
if (isset($o['wasSuccessful'])) $this->wasSuccessful = $o['wasSuccessful'];
if (isset($o['modelState'])) $this->modelState = JsonConverters::from('Object', $o['modelState']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->description)) $o['description'] = $this->description;
if (isset($this->heading)) $o['heading'] = $this->heading;
if (isset($this->wasSuccessful)) $o['wasSuccessful'] = $this->wasSuccessful;
if (isset($this->modelState)) $o['modelState'] = JsonConverters::to('Object', $this->modelState);
return empty($o) ? new class(){} : $o;
}
}
enum TemplateApprovalStatus : int
{
case AwaitingApproval = 0;
case Rejected = 1;
case Approved = 2;
}
enum TemplateType : int
{
case Introductory = 0;
case Refresher = 1;
}
enum SectionTitle : int
{
case Welcome = 0;
case Cochrane = 1;
case Iconic = 2;
case OurBestWork = 3;
case RealityOfRisk = 4;
case ProductRange = 5;
case ProductDeployments = 6;
case Industries = 7;
case ClearVu = 8;
case CaseStudies = 9;
case Expertise = 10;
case Media = 11;
case ThankYou = 12;
case ClearVuRange = 13;
case Presentations = 14;
case LegacyVideos = 15;
}
class SectionSummary implements JsonSerializable
{
public function __construct(
/** @var SectionTitle|null */
public ?SectionTitle $title=null,
/** @var string|null */
public ?string $titleString=null,
/** @var int */
public int $sectionId=0,
/** @var string|null */
public ?string $sectionName=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['title'])) $this->title = JsonConverters::from('SectionTitle', $o['title']);
if (isset($o['titleString'])) $this->titleString = $o['titleString'];
if (isset($o['sectionId'])) $this->sectionId = $o['sectionId'];
if (isset($o['sectionName'])) $this->sectionName = $o['sectionName'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->title)) $o['title'] = JsonConverters::to('SectionTitle', $this->title);
if (isset($this->titleString)) $o['titleString'] = $this->titleString;
if (isset($this->sectionId)) $o['sectionId'] = $this->sectionId;
if (isset($this->sectionName)) $o['sectionName'] = $this->sectionName;
return empty($o) ? new class(){} : $o;
}
}
class TemplateApprovalListItem implements JsonSerializable
{
public function __construct(
/** @var string */
public string $userCrmId='',
/** @var string|null */
public ?string $approvalDate=null,
/** @var int */
public int $templateApprovalId=0,
/** @var TemplateApprovalStatus|null */
public ?TemplateApprovalStatus $approvalStatus=null,
/** @var string|null */
public ?string $approvalStatusString=null,
/** @var TemplateType|null */
public ?TemplateType $templateType=null,
/** @var string|null */
public ?string $templateTypeString=null,
/** @var string|null */
public ?string $templateName=null,
/** @var string|null */
public ?string $systemUserName=null,
/** @var array<SectionSummary>|null */
public ?array $templateChangeDetail=null,
/** @var array<SectionSummary>|null */
public ?array $templateDetail=null,
/** @var string|null */
public ?string $content=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['userCrmId'])) $this->userCrmId = $o['userCrmId'];
if (isset($o['approvalDate'])) $this->approvalDate = $o['approvalDate'];
if (isset($o['templateApprovalId'])) $this->templateApprovalId = $o['templateApprovalId'];
if (isset($o['approvalStatus'])) $this->approvalStatus = JsonConverters::from('TemplateApprovalStatus', $o['approvalStatus']);
if (isset($o['approvalStatusString'])) $this->approvalStatusString = $o['approvalStatusString'];
if (isset($o['templateType'])) $this->templateType = JsonConverters::from('TemplateType', $o['templateType']);
if (isset($o['templateTypeString'])) $this->templateTypeString = $o['templateTypeString'];
if (isset($o['templateName'])) $this->templateName = $o['templateName'];
if (isset($o['systemUserName'])) $this->systemUserName = $o['systemUserName'];
if (isset($o['templateChangeDetail'])) $this->templateChangeDetail = JsonConverters::fromArray('SectionSummary', $o['templateChangeDetail']);
if (isset($o['templateDetail'])) $this->templateDetail = JsonConverters::fromArray('SectionSummary', $o['templateDetail']);
if (isset($o['content'])) $this->content = $o['content'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->userCrmId)) $o['userCrmId'] = $this->userCrmId;
if (isset($this->approvalDate)) $o['approvalDate'] = $this->approvalDate;
if (isset($this->templateApprovalId)) $o['templateApprovalId'] = $this->templateApprovalId;
if (isset($this->approvalStatus)) $o['approvalStatus'] = JsonConverters::to('TemplateApprovalStatus', $this->approvalStatus);
if (isset($this->approvalStatusString)) $o['approvalStatusString'] = $this->approvalStatusString;
if (isset($this->templateType)) $o['templateType'] = JsonConverters::to('TemplateType', $this->templateType);
if (isset($this->templateTypeString)) $o['templateTypeString'] = $this->templateTypeString;
if (isset($this->templateName)) $o['templateName'] = $this->templateName;
if (isset($this->systemUserName)) $o['systemUserName'] = $this->systemUserName;
if (isset($this->templateChangeDetail)) $o['templateChangeDetail'] = JsonConverters::toArray('SectionSummary', $this->templateChangeDetail);
if (isset($this->templateDetail)) $o['templateDetail'] = JsonConverters::toArray('SectionSummary', $this->templateDetail);
if (isset($this->content)) $o['content'] = $this->content;
return empty($o) ? new class(){} : $o;
}
}
class TemplateApprovalListResponse extends ApiServiceResponse implements JsonSerializable
{
/**
* @param string|null $description
* @param string|null $heading
* @param bool|null $wasSuccessful
* @param Object|null $modelState
*/
public function __construct(
?string $description=null,
?string $heading=null,
?bool $wasSuccessful=null,
?Object $modelState=null,
/** @var array<TemplateApprovalListItem>|null */
public ?array $templates=null
) {
parent::__construct($description,$heading,$wasSuccessful,$modelState);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['templates'])) $this->templates = JsonConverters::fromArray('TemplateApprovalListItem', $o['templates']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->templates)) $o['templates'] = JsonConverters::toArray('TemplateApprovalListItem', $this->templates);
return empty($o) ? new class(){} : $o;
}
}
class TemplateApprovalList extends ApiServiceRequest implements JsonSerializable
{
/**
* @param string $apiKey
* @param float $latitude
* @param float $longitude
*/
public function __construct(
string $apiKey='',
float $latitude=0.0,
float $longitude=0.0
) {
parent::__construct($apiKey,$latitude,$longitude);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
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 /template-approval/list HTTP/1.1 Host: cochraneplus-api-dev.happen.zone Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"templates":[{}],"description":"String","heading":"String","wasSuccessful":false,"modelState":{}}