POST | /RestApi/markup/pages |
---|
<?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 PageMarkupRequest implements JsonSerializable
{
public function __construct(
/** @var array<string>|null */
public ?array $Keys=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Keys'])) $this->Keys = JsonConverters::fromArray('string', $o['Keys']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Keys)) $o['Keys'] = JsonConverters::toArray('string', $this->Keys);
return empty($o) ? new class(){} : $o;
}
}
class TemplateMarkupModel implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Markup=null,
/** @var string|null */
public ?string $FileName=null,
/** @var string|null */
public ?string $VirtualPath=null,
/** @var string|null */
public ?string $VirtualDirectory=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Markup'])) $this->Markup = $o['Markup'];
if (isset($o['FileName'])) $this->FileName = $o['FileName'];
if (isset($o['VirtualPath'])) $this->VirtualPath = $o['VirtualPath'];
if (isset($o['VirtualDirectory'])) $this->VirtualDirectory = $o['VirtualDirectory'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Markup)) $o['Markup'] = $this->Markup;
if (isset($this->FileName)) $o['FileName'] = $this->FileName;
if (isset($this->VirtualPath)) $o['VirtualPath'] = $this->VirtualPath;
if (isset($this->VirtualDirectory)) $o['VirtualDirectory'] = $this->VirtualDirectory;
return empty($o) ? new class(){} : $o;
}
}
class PageMarkupModel extends TemplateMarkupModel implements JsonSerializable
{
/**
* @param string|null $Markup
* @param string|null $FileName
* @param string|null $VirtualPath
* @param string|null $VirtualDirectory
*/
public function __construct(
?string $Markup=null,
?string $FileName=null,
?string $VirtualPath=null,
?string $VirtualDirectory=null,
/** @var string|null */
public ?string $Key=null,
/** @var string|null */
public ?string $CultureName=null,
/** @var string|null */
public ?string $VersionKey=null,
/** @var string|null */
public ?string $Url=null,
/** @var string|null */
public ?string $ErrorMessage=null
) {
parent::__construct($Markup,$FileName,$VirtualPath,$VirtualDirectory);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['Key'])) $this->Key = $o['Key'];
if (isset($o['CultureName'])) $this->CultureName = $o['CultureName'];
if (isset($o['VersionKey'])) $this->VersionKey = $o['VersionKey'];
if (isset($o['Url'])) $this->Url = $o['Url'];
if (isset($o['ErrorMessage'])) $this->ErrorMessage = $o['ErrorMessage'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->Key)) $o['Key'] = $this->Key;
if (isset($this->CultureName)) $o['CultureName'] = $this->CultureName;
if (isset($this->VersionKey)) $o['VersionKey'] = $this->VersionKey;
if (isset($this->Url)) $o['Url'] = $this->Url;
if (isset($this->ErrorMessage)) $o['ErrorMessage'] = $this->ErrorMessage;
return empty($o) ? new class(){} : $o;
}
}
/**
* @template PageMarkupModel
*/
class TemplateMarkupResponseCollection implements JsonSerializable
{
public array $genericArgs = [];
public static function create(array $genericArgs=[]): TemplateMarkupResponseCollection {
$to = new TemplateMarkupResponseCollection();
$to->genericArgs = $genericArgs;
return $to;
}
public function __construct(
/** @var array<PageMarkupModel>|null */
public mixed $Items=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Items'])) $this->Items = JsonConverters::fromArray($this->genericArgs[0], $o['Items']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Items)) $o['Items'] = JsonConverters::toArray($this->genericArgs[0], $this->Items);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /RestApi/markup/pages HTTP/1.1
Host: www.asg.com.au
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<PageMarkupRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Telerik.Sitefinity.Web.Compilation.Model">
<Keys xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />
</PageMarkupRequest>