<?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};
enum LicenseAction : string
{
case Check = 'Check';
case IsOK = 'IsOK';
case KombinationNotOK = 'KombinationNotOK';
case LicenseUnknown = 'LicenseUnknown';
case RegisterLicense = 'RegisterLicense';
case HasFreeLicense = 'HasFreeLicense';
case NoFreeLicense = 'NoFreeLicense';
case LicenseIsNowRegistered = 'LicenseIsNowRegistered';
case Error = 'Error';
case WarningExceeded = 'WarningExceeded';
}
class LicenseActionResponse implements JsonSerializable
{
public function __construct(
/** @var LicenseAction|null */
public ?LicenseAction $Answer=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Answer'])) $this->Answer = JsonConverters::from('LicenseAction', $o['Answer']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Answer)) $o['Answer'] = JsonConverters::to('LicenseAction', $this->Answer);
return empty($o) ? new class(){} : $o;
}
}
class LicenseActionRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $CryptedLicenseNr=null,
/** @var string|null */
public ?string $CryptedStamp=null,
/** @var string|null */
public ?string $HostName=null,
/** @var LicenseAction|null */
public ?LicenseAction $Action=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CryptedLicenseNr'])) $this->CryptedLicenseNr = $o['CryptedLicenseNr'];
if (isset($o['CryptedStamp'])) $this->CryptedStamp = $o['CryptedStamp'];
if (isset($o['HostName'])) $this->HostName = $o['HostName'];
if (isset($o['Action'])) $this->Action = JsonConverters::from('LicenseAction', $o['Action']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CryptedLicenseNr)) $o['CryptedLicenseNr'] = $this->CryptedLicenseNr;
if (isset($this->CryptedStamp)) $o['CryptedStamp'] = $this->CryptedStamp;
if (isset($this->HostName)) $o['HostName'] = $this->HostName;
if (isset($this->Action)) $o['Action'] = JsonConverters::to('LicenseAction', $this->Action);
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 /xml/reply/LicenseActionRequest HTTP/1.1
Host: 52.142.207.43
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<ecUpdaterLicenseCommModel.LicenseActionRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/EndianUpdaterLicenser">
<Action>Check</Action>
<CryptedLicenseNr>String</CryptedLicenseNr>
<CryptedStamp>String</CryptedStamp>
<HostName>String</HostName>
</ecUpdaterLicenseCommModel.LicenseActionRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <ecUpdaterLicenseCommModel.LicenseActionResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/EndianUpdaterLicenser"> <Answer>Check</Answer> </ecUpdaterLicenseCommModel.LicenseActionResponse>