WebService

<back to all web services

LicenseActionRequest

<?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;
    }
}

PHP LicenseActionRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /jsv/reply/LicenseActionRequest HTTP/1.1 
Host: 52.142.207.43 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	CryptedLicenseNr: String,
	CryptedStamp: String,
	HostName: String,
	Action: Check
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Answer: Check
}