GET POST | /RestApi/Sitefinity/packaging/add-on |
---|
<?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 AddonMessage implements JsonSerializable
{
public function __construct(
/** @var string */
public string $Id='',
/** @var bool|null */
public ?bool $IncludeContent=null,
/** @var bool|null */
public ?bool $Deactivate=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['IncludeContent'])) $this->IncludeContent = $o['IncludeContent'];
if (isset($o['Deactivate'])) $this->Deactivate = $o['Deactivate'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->IncludeContent)) $o['IncludeContent'] = $this->IncludeContent;
if (isset($this->Deactivate)) $o['Deactivate'] = $this->Deactivate;
return empty($o) ? new class(){} : $o;
}
}
enum AddOnEntryType : string
{
case Content = 'Content';
case Template = 'Template';
case Custom = 'Custom';
case Module = 'Module';
case Form = 'Form';
case Classification = 'Classification';
case WebService = 'WebService';
}
class AddOnEntry implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $DisplayName=null,
/** @var int */
public int $Count=0,
/** @var AddOnEntryType|null */
public ?AddOnEntryType $AddonEntryType=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['DisplayName'])) $this->DisplayName = $o['DisplayName'];
if (isset($o['Count'])) $this->Count = $o['Count'];
if (isset($o['AddonEntryType'])) $this->AddonEntryType = JsonConverters::from('AddOnEntryType', $o['AddonEntryType']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->DisplayName)) $o['DisplayName'] = $this->DisplayName;
if (isset($this->Count)) $o['Count'] = $this->Count;
if (isset($this->AddonEntryType)) $o['AddonEntryType'] = JsonConverters::to('AddOnEntryType', $this->AddonEntryType);
return empty($o) ? new class(){} : $o;
}
}
class AddonInfo implements JsonSerializable
{
public function __construct(
/** @var string */
public string $Id='',
/** @var string|null */
public ?string $Name=null,
/** @var bool|null */
public ?bool $IsActive=null,
/** @var string|null */
public ?string $Description=null,
/** @var bool|null */
public ?bool $IsDataImported=null,
/** @var string|null */
public ?string $Version=null,
/** @var string|null */
public ?string $Author=null,
/** @var string|null */
public ?string $DataImportedToSiteName=null,
/** @var array<AddOnEntry>|null */
public ?array $Entries=null,
/** @var bool|null */
public ?bool $HasErrorsOnContentImport=null,
/** @var bool|null */
public ?bool $HasErrorsOnStructureImport=null,
/** @var bool|null */
public ?bool $HasErrorsOnActivate=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['IsActive'])) $this->IsActive = $o['IsActive'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['IsDataImported'])) $this->IsDataImported = $o['IsDataImported'];
if (isset($o['Version'])) $this->Version = $o['Version'];
if (isset($o['Author'])) $this->Author = $o['Author'];
if (isset($o['DataImportedToSiteName'])) $this->DataImportedToSiteName = $o['DataImportedToSiteName'];
if (isset($o['Entries'])) $this->Entries = JsonConverters::fromArray('AddOnEntry', $o['Entries']);
if (isset($o['HasErrorsOnContentImport'])) $this->HasErrorsOnContentImport = $o['HasErrorsOnContentImport'];
if (isset($o['HasErrorsOnStructureImport'])) $this->HasErrorsOnStructureImport = $o['HasErrorsOnStructureImport'];
if (isset($o['HasErrorsOnActivate'])) $this->HasErrorsOnActivate = $o['HasErrorsOnActivate'];
}
/** @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->IsActive)) $o['IsActive'] = $this->IsActive;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->IsDataImported)) $o['IsDataImported'] = $this->IsDataImported;
if (isset($this->Version)) $o['Version'] = $this->Version;
if (isset($this->Author)) $o['Author'] = $this->Author;
if (isset($this->DataImportedToSiteName)) $o['DataImportedToSiteName'] = $this->DataImportedToSiteName;
if (isset($this->Entries)) $o['Entries'] = JsonConverters::toArray('AddOnEntry', $this->Entries);
if (isset($this->HasErrorsOnContentImport)) $o['HasErrorsOnContentImport'] = $this->HasErrorsOnContentImport;
if (isset($this->HasErrorsOnStructureImport)) $o['HasErrorsOnStructureImport'] = $this->HasErrorsOnStructureImport;
if (isset($this->HasErrorsOnActivate)) $o['HasErrorsOnActivate'] = $this->HasErrorsOnActivate;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /RestApi/Sitefinity/packaging/add-on HTTP/1.1
Host: www.asg.com.au
Accept: application/json
Content-Type: application/json
Content-Length: length
{"IncludeContent":false,"Deactivate":false}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"Name":"String","IsActive":false,"Description":"String","IsDataImported":false,"Version":"String","Author":"String","DataImportedToSiteName":"String","HasErrorsOnContentImport":false,"HasErrorsOnStructureImport":false,"HasErrorsOnActivate":false}