Requires the role: | superadmin |
POST | /superadmin/incentives | Add a new incentive |
---|
<?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 IncentiveActionType : int
{
case Upgrade = 1;
case AddOn = 2;
case Information = 3;
}
class LicenseItemsResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @var string|null */
public ?string $Name=null,
/** @var int */
public int $AllowedItems=0
) {
}
/** @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['AllowedItems'])) $this->AllowedItems = $o['AllowedItems'];
}
/** @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->AllowedItems)) $o['AllowedItems'] = $this->AllowedItems;
return empty($o) ? new class(){} : $o;
}
}
class BaseModel implements JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
class Currency extends BaseModel implements JsonSerializable
{
public function __construct(
// @Required()
/** @var string */
public string $Name='',
// @Required()
/** @var string */
public string $CurrencySign='',
// @Required()
/** @var bool|null */
public ?bool $Active=null,
/** @var DateTime|null */
public ?DateTime $ModifiedDate=null,
// @Required()
/** @var string */
public string $Id=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['CurrencySign'])) $this->CurrencySign = $o['CurrencySign'];
if (isset($o['Active'])) $this->Active = $o['Active'];
if (isset($o['ModifiedDate'])) $this->ModifiedDate = JsonConverters::from('DateTimeOffset', $o['ModifiedDate']);
if (isset($o['Id'])) $this->Id = $o['Id'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->CurrencySign)) $o['CurrencySign'] = $this->CurrencySign;
if (isset($this->Active)) $o['Active'] = $this->Active;
if (isset($this->ModifiedDate)) $o['ModifiedDate'] = JsonConverters::to('DateTimeOffset', $this->ModifiedDate);
if (isset($this->Id)) $o['Id'] = $this->Id;
return empty($o) ? new class(){} : $o;
}
}
class Country extends BaseModel implements JsonSerializable
{
public function __construct(
// @References("typeof(BokaMera.API.ServiceModel.Db.Currency)")
/** @var string|null */
public ?string $CurrencyId=null,
/** @var Currency|null */
public ?Currency $CurrencyInfo=null,
// @Required()
/** @var string */
public string $Name='',
/** @var string|null */
public ?string $Culture=null,
/** @var string|null */
public ?string $TimeZone=null,
/** @var DateTime|null */
public ?DateTime $ModifiedDate=null,
// @Required()
/** @var string */
public string $Id=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['CurrencyId'])) $this->CurrencyId = $o['CurrencyId'];
if (isset($o['CurrencyInfo'])) $this->CurrencyInfo = JsonConverters::from('Currency', $o['CurrencyInfo']);
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Culture'])) $this->Culture = $o['Culture'];
if (isset($o['TimeZone'])) $this->TimeZone = $o['TimeZone'];
if (isset($o['ModifiedDate'])) $this->ModifiedDate = JsonConverters::from('DateTimeOffset', $o['ModifiedDate']);
if (isset($o['Id'])) $this->Id = $o['Id'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->CurrencyId)) $o['CurrencyId'] = $this->CurrencyId;
if (isset($this->CurrencyInfo)) $o['CurrencyInfo'] = JsonConverters::to('Currency', $this->CurrencyInfo);
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Culture)) $o['Culture'] = $this->Culture;
if (isset($this->TimeZone)) $o['TimeZone'] = $this->TimeZone;
if (isset($this->ModifiedDate)) $o['ModifiedDate'] = JsonConverters::to('DateTimeOffset', $this->ModifiedDate);
if (isset($this->Id)) $o['Id'] = $this->Id;
return empty($o) ? new class(){} : $o;
}
}
class LicensePriceResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $LicenseTypeId=0,
/** @var string|null */
public ?string $CountryId=null,
/** @var int */
public int $Price=0,
/** @var Country|null */
public ?Country $Country=null,
/** @var int */
public int $LicensePlanId=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['LicenseTypeId'])) $this->LicenseTypeId = $o['LicenseTypeId'];
if (isset($o['CountryId'])) $this->CountryId = $o['CountryId'];
if (isset($o['Price'])) $this->Price = $o['Price'];
if (isset($o['Country'])) $this->Country = JsonConverters::from('Country', $o['Country']);
if (isset($o['LicensePlanId'])) $this->LicensePlanId = $o['LicensePlanId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->LicenseTypeId)) $o['LicenseTypeId'] = $this->LicenseTypeId;
if (isset($this->CountryId)) $o['CountryId'] = $this->CountryId;
if (isset($this->Price)) $o['Price'] = $this->Price;
if (isset($this->Country)) $o['Country'] = JsonConverters::to('Country', $this->Country);
if (isset($this->LicensePlanId)) $o['LicensePlanId'] = $this->LicensePlanId;
return empty($o) ? new class(){} : $o;
}
}
class LicenseTypeQueryResponse implements JsonSerializable
{
public function __construct(
/** @description The license type id */
// @ApiMember(Description="The license type id")
/** @var int */
public int $Id=0,
/** @description The license type name */
// @ApiMember(Description="The license type name")
/** @var string|null */
public ?string $Name=null,
/** @description The license type description */
// @ApiMember(Description="The license type description")
/** @var string|null */
public ?string $Description=null,
/** @description If the license type is not a standard license but instead an extra license option. An example would be sending new letter license. */
// @ApiMember(Description="If the license type is not a standard license but instead an extra license option. An example would be sending new letter license.")
/** @var bool|null */
public ?bool $IsExtraLicenseOption=null,
/** @description The period of notice for the license in days. */
// @ApiMember(Description="The period of notice for the license in days.")
/** @var int */
public int $PeriodOfNoticeDays=0,
/** @description The license items for the license type */
// @ApiMember(Description="The license items for the license type")
/** @var array<LicenseItemsResponse>|null */
public ?array $Items=null,
/** @description The license prices in each country for the license type */
// @ApiMember(Description="The license prices in each country for the license type")
/** @var array<LicensePriceResponse>|null */
public ?array $Prices=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['Description'])) $this->Description = $o['Description'];
if (isset($o['IsExtraLicenseOption'])) $this->IsExtraLicenseOption = $o['IsExtraLicenseOption'];
if (isset($o['PeriodOfNoticeDays'])) $this->PeriodOfNoticeDays = $o['PeriodOfNoticeDays'];
if (isset($o['Items'])) $this->Items = JsonConverters::fromArray('LicenseItemsResponse', $o['Items']);
if (isset($o['Prices'])) $this->Prices = JsonConverters::fromArray('LicensePriceResponse', $o['Prices']);
}
/** @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->Description)) $o['Description'] = $this->Description;
if (isset($this->IsExtraLicenseOption)) $o['IsExtraLicenseOption'] = $this->IsExtraLicenseOption;
if (isset($this->PeriodOfNoticeDays)) $o['PeriodOfNoticeDays'] = $this->PeriodOfNoticeDays;
if (isset($this->Items)) $o['Items'] = JsonConverters::toArray('LicenseItemsResponse', $this->Items);
if (isset($this->Prices)) $o['Prices'] = JsonConverters::toArray('LicensePriceResponse', $this->Prices);
return empty($o) ? new class(){} : $o;
}
}
class IncentiveActionResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @var IncentiveActionType|null */
public ?IncentiveActionType $ActionType=null,
/** @var string|null */
public ?string $Page=null,
/** @var string|null */
public ?string $Segment=null,
/** @var string|null */
public ?string $Element=null,
/** @var int|null */
public ?int $LicenseTypeId=null,
/** @var LicenseTypeQueryResponse|null */
public ?LicenseTypeQueryResponse $SuggestedLicenseToUpgrade=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['ActionType'])) $this->ActionType = JsonConverters::from('IncentiveActionType', $o['ActionType']);
if (isset($o['Page'])) $this->Page = $o['Page'];
if (isset($o['Segment'])) $this->Segment = $o['Segment'];
if (isset($o['Element'])) $this->Element = $o['Element'];
if (isset($o['LicenseTypeId'])) $this->LicenseTypeId = $o['LicenseTypeId'];
if (isset($o['SuggestedLicenseToUpgrade'])) $this->SuggestedLicenseToUpgrade = JsonConverters::from('LicenseTypeQueryResponse', $o['SuggestedLicenseToUpgrade']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->ActionType)) $o['ActionType'] = JsonConverters::to('IncentiveActionType', $this->ActionType);
if (isset($this->Page)) $o['Page'] = $this->Page;
if (isset($this->Segment)) $o['Segment'] = $this->Segment;
if (isset($this->Element)) $o['Element'] = $this->Element;
if (isset($this->LicenseTypeId)) $o['LicenseTypeId'] = $this->LicenseTypeId;
if (isset($this->SuggestedLicenseToUpgrade)) $o['SuggestedLicenseToUpgrade'] = JsonConverters::to('LicenseTypeQueryResponse', $this->SuggestedLicenseToUpgrade);
return empty($o) ? new class(){} : $o;
}
}
class CompanyIncentiveResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @var string|null */
public ?string $Heading=null,
/** @var string|null */
public ?string $StorageUrl=null,
/** @var string|null */
public ?string $SuccessButtonText=null,
/** @var int */
public int $ActionId=0,
/** @var int */
public int $InitialDelayInSeconds=0,
/** @var int|null */
public ?int $MaxDisplayCount=null,
/** @var DateTime */
public DateTime $ValidFrom=new DateTime(),
/** @var DateTime */
public DateTime $ValidTo=new DateTime(),
/** @var IncentiveActionResponse|null */
public ?IncentiveActionResponse $Action=null,
/** @var string|null */
public ?string $Payload=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['Heading'])) $this->Heading = $o['Heading'];
if (isset($o['StorageUrl'])) $this->StorageUrl = $o['StorageUrl'];
if (isset($o['SuccessButtonText'])) $this->SuccessButtonText = $o['SuccessButtonText'];
if (isset($o['ActionId'])) $this->ActionId = $o['ActionId'];
if (isset($o['InitialDelayInSeconds'])) $this->InitialDelayInSeconds = $o['InitialDelayInSeconds'];
if (isset($o['MaxDisplayCount'])) $this->MaxDisplayCount = $o['MaxDisplayCount'];
if (isset($o['ValidFrom'])) $this->ValidFrom = JsonConverters::from('DateTime', $o['ValidFrom']);
if (isset($o['ValidTo'])) $this->ValidTo = JsonConverters::from('DateTime', $o['ValidTo']);
if (isset($o['Action'])) $this->Action = JsonConverters::from('IncentiveActionResponse', $o['Action']);
if (isset($o['Payload'])) $this->Payload = $o['Payload'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->Heading)) $o['Heading'] = $this->Heading;
if (isset($this->StorageUrl)) $o['StorageUrl'] = $this->StorageUrl;
if (isset($this->SuccessButtonText)) $o['SuccessButtonText'] = $this->SuccessButtonText;
if (isset($this->ActionId)) $o['ActionId'] = $this->ActionId;
if (isset($this->InitialDelayInSeconds)) $o['InitialDelayInSeconds'] = $this->InitialDelayInSeconds;
if (isset($this->MaxDisplayCount)) $o['MaxDisplayCount'] = $this->MaxDisplayCount;
if (isset($this->ValidFrom)) $o['ValidFrom'] = JsonConverters::to('DateTime', $this->ValidFrom);
if (isset($this->ValidTo)) $o['ValidTo'] = JsonConverters::to('DateTime', $this->ValidTo);
if (isset($this->Action)) $o['Action'] = JsonConverters::to('IncentiveActionResponse', $this->Action);
if (isset($this->Payload)) $o['Payload'] = $this->Payload;
return empty($o) ? new class(){} : $o;
}
}
enum IncentiveRecurrenceFrequency : int
{
case OneTime = 1;
case Weekly = 2;
case Monthly = 3;
}
enum CriteriaType : string
{
case LicenseAvailability = 'LicenseAvailability';
case SmsActivation = 'SmsActivation';
case eAccountingActivation = 'eAccountingActivation';
case CodeLockActivation = 'CodeLockActivation';
case SocialActivation = 'SocialActivation';
case OnlinePaymentActivation = 'OnlinePaymentActivation';
case FollowUpMessageActivation = 'FollowUpMessageActivation';
case RatingActivation = 'RatingActivation';
}
class IncentiveCriteria extends BaseModel implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @var int */
public int $IncentiveId=0,
/** @var CriteriaType|null */
public ?CriteriaType $CriteriaType=null,
/** @var string|null */
public ?string $Value=null,
/** @var bool|null */
public ?bool $InvertCondition=null,
/** @var DateTime */
public DateTime $CreatedDate=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['IncentiveId'])) $this->IncentiveId = $o['IncentiveId'];
if (isset($o['CriteriaType'])) $this->CriteriaType = JsonConverters::from('CriteriaType', $o['CriteriaType']);
if (isset($o['Value'])) $this->Value = $o['Value'];
if (isset($o['InvertCondition'])) $this->InvertCondition = $o['InvertCondition'];
if (isset($o['CreatedDate'])) $this->CreatedDate = JsonConverters::from('DateTime', $o['CreatedDate']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->IncentiveId)) $o['IncentiveId'] = $this->IncentiveId;
if (isset($this->CriteriaType)) $o['CriteriaType'] = JsonConverters::to('CriteriaType', $this->CriteriaType);
if (isset($this->Value)) $o['Value'] = $this->Value;
if (isset($this->InvertCondition)) $o['InvertCondition'] = $this->InvertCondition;
if (isset($this->CreatedDate)) $o['CreatedDate'] = JsonConverters::to('DateTime', $this->CreatedDate);
return empty($o) ? new class(){} : $o;
}
}
class AdminIncentiveQueryResponse extends CompanyIncentiveResponse implements JsonSerializable
{
/**
* @param int $Id
* @param string|null $Heading
* @param string|null $StorageUrl
* @param string|null $SuccessButtonText
* @param int $ActionId
* @param int $InitialDelayInSeconds
* @param int|null $MaxDisplayCount
* @param DateTime $ValidFrom
* @param DateTime $ValidTo
* @param IncentiveActionResponse|null $Action
* @param string|null $Payload
*/
public function __construct(
int $Id=0,
?string $Heading=null,
?string $StorageUrl=null,
?string $SuccessButtonText=null,
int $ActionId=0,
int $InitialDelayInSeconds=0,
?int $MaxDisplayCount=null,
DateTime $ValidFrom=new DateTime(),
DateTime $ValidTo=new DateTime(),
?IncentiveActionResponse $Action=null,
?string $Payload=null,
/** @var IncentiveRecurrenceFrequency|null */
public ?IncentiveRecurrenceFrequency $Frequency=null,
/** @var int */
public int $RecurrenceInterval=0,
/** @var DateTime */
public DateTime $CreatedDate=new DateTime(),
/** @var DateTime */
public DateTime $ModifiedDate=new DateTime(),
/** @var array<string>|null */
public ?array $CompanyIds=null,
/** @var array<IncentiveCriteria>|null */
public ?array $Criteria=null,
/** @var bool|null */
public ?bool $ApplyToAllCompanies=null
) {
parent::__construct($Id,$Heading,$StorageUrl,$SuccessButtonText,$ActionId,$InitialDelayInSeconds,$MaxDisplayCount,$ValidFrom,$ValidTo,$Action,$Payload);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['Frequency'])) $this->Frequency = JsonConverters::from('IncentiveRecurrenceFrequency', $o['Frequency']);
if (isset($o['RecurrenceInterval'])) $this->RecurrenceInterval = $o['RecurrenceInterval'];
if (isset($o['CreatedDate'])) $this->CreatedDate = JsonConverters::from('DateTime', $o['CreatedDate']);
if (isset($o['ModifiedDate'])) $this->ModifiedDate = JsonConverters::from('DateTime', $o['ModifiedDate']);
if (isset($o['CompanyIds'])) $this->CompanyIds = JsonConverters::fromArray('Guid', $o['CompanyIds']);
if (isset($o['Criteria'])) $this->Criteria = JsonConverters::fromArray('IncentiveCriteria', $o['Criteria']);
if (isset($o['ApplyToAllCompanies'])) $this->ApplyToAllCompanies = $o['ApplyToAllCompanies'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->Frequency)) $o['Frequency'] = JsonConverters::to('IncentiveRecurrenceFrequency', $this->Frequency);
if (isset($this->RecurrenceInterval)) $o['RecurrenceInterval'] = $this->RecurrenceInterval;
if (isset($this->CreatedDate)) $o['CreatedDate'] = JsonConverters::to('DateTime', $this->CreatedDate);
if (isset($this->ModifiedDate)) $o['ModifiedDate'] = JsonConverters::to('DateTime', $this->ModifiedDate);
if (isset($this->CompanyIds)) $o['CompanyIds'] = JsonConverters::toArray('Guid', $this->CompanyIds);
if (isset($this->Criteria)) $o['Criteria'] = JsonConverters::toArray('IncentiveCriteria', $this->Criteria);
if (isset($this->ApplyToAllCompanies)) $o['ApplyToAllCompanies'] = $this->ApplyToAllCompanies;
return empty($o) ? new class(){} : $o;
}
}
class IncentiveCriteriaDto implements JsonSerializable
{
public function __construct(
/** @var CriteriaType|null */
public ?CriteriaType $CriteriaType=null,
/** @var string|null */
public ?string $Value=null,
/** @var bool|null */
public ?bool $InvertCondition=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CriteriaType'])) $this->CriteriaType = JsonConverters::from('CriteriaType', $o['CriteriaType']);
if (isset($o['Value'])) $this->Value = $o['Value'];
if (isset($o['InvertCondition'])) $this->InvertCondition = $o['InvertCondition'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CriteriaType)) $o['CriteriaType'] = JsonConverters::to('CriteriaType', $this->CriteriaType);
if (isset($this->Value)) $o['Value'] = $this->Value;
if (isset($this->InvertCondition)) $o['InvertCondition'] = $this->InvertCondition;
return empty($o) ? new class(){} : $o;
}
}
// @ValidateRequest(Validator="IsAuthenticated")
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
class CreateIncentive implements JsonSerializable
{
public function __construct(
// @ApiMember(IsRequired=true)
/** @var string */
public string $Heading='',
// @ApiMember()
/** @var string|null */
public ?string $StorageUrl=null,
// @ApiMember()
/** @var string|null */
public ?string $Body=null,
// @ApiMember(IsRequired=true)
/** @var string */
public string $SuccessButtonText='',
// @ApiMember(IsRequired=true)
/** @var int */
public int $ActionId=0,
// @ApiMember(IsRequired=true)
/** @var IncentiveRecurrenceFrequency|null */
public ?IncentiveRecurrenceFrequency $Frequency=null,
// @ApiMember()
/** @var int */
public int $RecurrenceInterval=0,
// @ApiMember(IsRequired=true)
/** @var int */
public int $InitialDelayInSeconds=0,
// @ApiMember(IsRequired=true)
/** @var int */
public int $MaxDisplayCount=0,
// @ApiMember(IsRequired=true)
/** @var DateTime */
public DateTime $ValidFrom=new DateTime(),
// @ApiMember(IsRequired=true)
/** @var DateTime */
public DateTime $ValidTo=new DateTime(),
// @ApiMember()
/** @var bool|null */
public ?bool $Active=null,
// @ApiMember()
/** @var string|null */
public ?string $Payload=null,
/** @var array<string>|null */
public ?array $CompanyIds=null,
/** @var array<IncentiveCriteriaDto>|null */
public ?array $Criteria=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Heading'])) $this->Heading = $o['Heading'];
if (isset($o['StorageUrl'])) $this->StorageUrl = $o['StorageUrl'];
if (isset($o['Body'])) $this->Body = $o['Body'];
if (isset($o['SuccessButtonText'])) $this->SuccessButtonText = $o['SuccessButtonText'];
if (isset($o['ActionId'])) $this->ActionId = $o['ActionId'];
if (isset($o['Frequency'])) $this->Frequency = JsonConverters::from('IncentiveRecurrenceFrequency', $o['Frequency']);
if (isset($o['RecurrenceInterval'])) $this->RecurrenceInterval = $o['RecurrenceInterval'];
if (isset($o['InitialDelayInSeconds'])) $this->InitialDelayInSeconds = $o['InitialDelayInSeconds'];
if (isset($o['MaxDisplayCount'])) $this->MaxDisplayCount = $o['MaxDisplayCount'];
if (isset($o['ValidFrom'])) $this->ValidFrom = JsonConverters::from('DateTime', $o['ValidFrom']);
if (isset($o['ValidTo'])) $this->ValidTo = JsonConverters::from('DateTime', $o['ValidTo']);
if (isset($o['Active'])) $this->Active = $o['Active'];
if (isset($o['Payload'])) $this->Payload = $o['Payload'];
if (isset($o['CompanyIds'])) $this->CompanyIds = JsonConverters::fromArray('Guid', $o['CompanyIds']);
if (isset($o['Criteria'])) $this->Criteria = JsonConverters::fromArray('IncentiveCriteriaDto', $o['Criteria']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Heading)) $o['Heading'] = $this->Heading;
if (isset($this->StorageUrl)) $o['StorageUrl'] = $this->StorageUrl;
if (isset($this->Body)) $o['Body'] = $this->Body;
if (isset($this->SuccessButtonText)) $o['SuccessButtonText'] = $this->SuccessButtonText;
if (isset($this->ActionId)) $o['ActionId'] = $this->ActionId;
if (isset($this->Frequency)) $o['Frequency'] = JsonConverters::to('IncentiveRecurrenceFrequency', $this->Frequency);
if (isset($this->RecurrenceInterval)) $o['RecurrenceInterval'] = $this->RecurrenceInterval;
if (isset($this->InitialDelayInSeconds)) $o['InitialDelayInSeconds'] = $this->InitialDelayInSeconds;
if (isset($this->MaxDisplayCount)) $o['MaxDisplayCount'] = $this->MaxDisplayCount;
if (isset($this->ValidFrom)) $o['ValidFrom'] = JsonConverters::to('DateTime', $this->ValidFrom);
if (isset($this->ValidTo)) $o['ValidTo'] = JsonConverters::to('DateTime', $this->ValidTo);
if (isset($this->Active)) $o['Active'] = $this->Active;
if (isset($this->Payload)) $o['Payload'] = $this->Payload;
if (isset($this->CompanyIds)) $o['CompanyIds'] = JsonConverters::toArray('Guid', $this->CompanyIds);
if (isset($this->Criteria)) $o['Criteria'] = JsonConverters::toArray('IncentiveCriteriaDto', $this->Criteria);
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 /superadmin/incentives HTTP/1.1
Host: testapi.bokamera.se
Accept: application/json
Content-Type: application/json
Content-Length: length
{"Heading":"String","StorageUrl":"String","Body":"String","SuccessButtonText":"String","ActionId":0,"Frequency":"OneTime","RecurrenceInterval":0,"InitialDelayInSeconds":0,"MaxDisplayCount":0,"ValidFrom":"0001-01-01T00:00:00.0000000+00:00","ValidTo":"0001-01-01T00:00:00.0000000+00:00","Active":false,"Payload":"String","CompanyIds":["00000000-0000-0000-0000-000000000000"],"Criteria":[{"CriteriaType":"LicenseAvailability","Value":"String","InvertCondition":false}]}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"Frequency":"OneTime","RecurrenceInterval":0,"CreatedDate":"0001-01-01T00:00:00.0000000+00:00","ModifiedDate":"0001-01-01T00:00:00.0000000+00:00","CompanyIds":["00000000-0000-0000-0000-000000000000"],"Criteria":[{"Id":0,"IncentiveId":0,"CriteriaType":"LicenseAvailability","Value":"String","InvertCondition":false,"CreatedDate":"0001-01-01T00:00:00.0000000+00:00"}],"ApplyToAllCompanies":false,"Id":0,"Heading":"String","StorageUrl":"String","SuccessButtonText":"String","ActionId":0,"InitialDelayInSeconds":0,"MaxDisplayCount":0,"ValidFrom":"0001-01-01T00:00:00.0000000+00:00","ValidTo":"0001-01-01T00:00:00.0000000+00:00","Action":{"Id":0,"ActionType":"Upgrade","Page":"String","Segment":"String","Element":"String","LicenseTypeId":0,"SuggestedLicenseToUpgrade":{"Id":0,"Name":"String","Description":"String","IsExtraLicenseOption":false,"PeriodOfNoticeDays":0,"Items":[{"Id":0,"Name":"String","AllowedItems":0}],"Prices":[{"LicenseTypeId":0,"CountryId":"String","Price":0,"Country":{"CurrencyId":"String","CurrencyInfo":{"Name":"String","CurrencySign":"String","Active":false,"ModifiedDate":"0001-01-01T00:00:00.0000000+00:00","Id":"String"},"Name":"String","Culture":"String","TimeZone":"String","ModifiedDate":"0001-01-01T00:00:00.0000000+00:00","Id":"String"},"LicensePlanId":0}]}},"Payload":"String"}