BokaMera.API.Host

<back to all web services

UpdateRebateCode

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
PUT/rebatecodes/{Id}Update RebateCode by IdUpdate RebateCode by Id)
<?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 DaysOfWeekResponse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var string|null */
        public ?string $DayOfWeek=null,
        /** @var string|null */
        public ?string $DayOfWeekTranslation=null,
        /** @var bool|null */
        public ?bool $DayOfWeekActive=null,
        /** @var int|null */
        public ?int $DayOfWeekSortOrder=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['DayOfWeek'])) $this->DayOfWeek = $o['DayOfWeek'];
        if (isset($o['DayOfWeekTranslation'])) $this->DayOfWeekTranslation = $o['DayOfWeekTranslation'];
        if (isset($o['DayOfWeekActive'])) $this->DayOfWeekActive = $o['DayOfWeekActive'];
        if (isset($o['DayOfWeekSortOrder'])) $this->DayOfWeekSortOrder = $o['DayOfWeekSortOrder'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->DayOfWeek)) $o['DayOfWeek'] = $this->DayOfWeek;
        if (isset($this->DayOfWeekTranslation)) $o['DayOfWeekTranslation'] = $this->DayOfWeekTranslation;
        if (isset($this->DayOfWeekActive)) $o['DayOfWeekActive'] = $this->DayOfWeekActive;
        if (isset($this->DayOfWeekSortOrder)) $o['DayOfWeekSortOrder'] = $this->DayOfWeekSortOrder;
        return empty($o) ? new class(){} : $o;
    }
}

class RebateCodeServiceResponse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Description=null,
        /** @var bool|null */
        public ?bool $Active=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['Active'])) $this->Active = $o['Active'];
    }
    
    /** @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->Active)) $o['Active'] = $this->Active;
        return empty($o) ? new class(){} : $o;
    }
}

class RebateCodeCustomerResponse implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $Id='',
        /** @var string|null */
        public ?string $Firstname=null,
        /** @var string|null */
        public ?string $Lastname=null,
        /** @var string|null */
        public ?string $Email=null,
        /** @var string|null */
        public ?string $Phone=null,
        /** @var string|null */
        public ?string $ImageUrl=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Firstname'])) $this->Firstname = $o['Firstname'];
        if (isset($o['Lastname'])) $this->Lastname = $o['Lastname'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['Phone'])) $this->Phone = $o['Phone'];
        if (isset($o['ImageUrl'])) $this->ImageUrl = $o['ImageUrl'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Firstname)) $o['Firstname'] = $this->Firstname;
        if (isset($this->Lastname)) $o['Lastname'] = $this->Lastname;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->Phone)) $o['Phone'] = $this->Phone;
        if (isset($this->ImageUrl)) $o['ImageUrl'] = $this->ImageUrl;
        return empty($o) ? new class(){} : $o;
    }
}

class RebateCodeTypeItem implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Description=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'];
    }
    
    /** @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;
        return empty($o) ? new class(){} : $o;
    }
}

class RebateCodeTypeResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var array<RebateCodeTypeItem>|null */
        public ?array $RebateCodeTypeItems=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
        if (isset($o['RebateCodeTypeItems'])) $this->RebateCodeTypeItems = JsonConverters::fromArray('RebateCodeTypeItem', $o['RebateCodeTypeItems']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        if (isset($this->RebateCodeTypeItems)) $o['RebateCodeTypeItems'] = JsonConverters::toArray('RebateCodeTypeItem', $this->RebateCodeTypeItems);
        return empty($o) ? new class(){} : $o;
    }
}

class RebateCodeStatusItem implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var string|null */
        public ?string $RebateCodeStatusName=null,
        /** @var string|null */
        public ?string $RebateCodeStatusDescription=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['RebateCodeStatusName'])) $this->RebateCodeStatusName = $o['RebateCodeStatusName'];
        if (isset($o['RebateCodeStatusDescription'])) $this->RebateCodeStatusDescription = $o['RebateCodeStatusDescription'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->RebateCodeStatusName)) $o['RebateCodeStatusName'] = $this->RebateCodeStatusName;
        if (isset($this->RebateCodeStatusDescription)) $o['RebateCodeStatusDescription'] = $this->RebateCodeStatusDescription;
        return empty($o) ? new class(){} : $o;
    }
}

class RebateCodeStatusResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var array<RebateCodeStatusItem>|null */
        public ?array $RebateCodeStatusItems=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
        if (isset($o['RebateCodeStatusItems'])) $this->RebateCodeStatusItems = JsonConverters::fromArray('RebateCodeStatusItem', $o['RebateCodeStatusItems']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        if (isset($this->RebateCodeStatusItems)) $o['RebateCodeStatusItems'] = JsonConverters::toArray('RebateCodeStatusItem', $this->RebateCodeStatusItems);
        return empty($o) ? new class(){} : $o;
    }
}

class RebateCodeResponse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var string|null */
        public ?string $CompanyId=null,
        /** @var DateTime */
        public DateTime $ValidFrom=new DateTime(),
        /** @var DateTime */
        public DateTime $ValidTo=new DateTime(),
        /** @description If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update. */
        // @ApiMember(Description="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")
        /** @var DateInterval|null */
        public ?DateInterval $FromTime=null,

        /** @description If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters. */
        // @ApiMember(Description="If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.")
        /** @var DateInterval|null */
        public ?DateInterval $ToTime=null,

        /** @var string|null */
        public ?string $CreatedBy=null,
        /** @var DateTime */
        public DateTime $Created=new DateTime(),
        /** @var string|null */
        public ?string $UpdatedBy=null,
        /** @var DateTime */
        public DateTime $Updated=new DateTime(),
        /** @var string|null */
        public ?string $PersonalNote=null,
        /** @var string|null */
        public ?string $RebateCodeSign=null,
        /** @var int */
        public int $RebateCodeValue=0,
        /** @var int */
        public int $RebateCodeTypeId=0,
        /** @var string|null */
        public ?string $Name=null,
        /** @var int */
        public int $RebateCodeStatusId=0,
        /** @var string|null */
        public ?string $StatusName=null,
        /** @var int */
        public int $MaxNumberOfUses=0,
        /** @var int */
        public int $MaxNumberOfUsesPerCustomer=0,
        /** @var int */
        public int $NumberOfUsesUsed=0,
        /** @var int */
        public int $NumberOfUsesPerCustomerUsed=0,
        /** @var array<DaysOfWeekResponse>|null */
        public ?array $DaysOfWeek=null,
        /** @var array<RebateCodeServiceResponse>|null */
        public ?array $Services=null,
        /** @var array<RebateCodeCustomerResponse>|null */
        public ?array $Customers=null,
        /** @var array<RebateCodeTypeResponse>|null */
        public ?array $RebateCodeTypesOptions=null,
        /** @var array<RebateCodeStatusResponse>|null */
        public ?array $RebateCodeStatusOptions=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        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['FromTime'])) $this->FromTime = JsonConverters::from('DateInterval', $o['FromTime']);
        if (isset($o['ToTime'])) $this->ToTime = JsonConverters::from('DateInterval', $o['ToTime']);
        if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
        if (isset($o['Created'])) $this->Created = JsonConverters::from('DateTime', $o['Created']);
        if (isset($o['UpdatedBy'])) $this->UpdatedBy = $o['UpdatedBy'];
        if (isset($o['Updated'])) $this->Updated = JsonConverters::from('DateTime', $o['Updated']);
        if (isset($o['PersonalNote'])) $this->PersonalNote = $o['PersonalNote'];
        if (isset($o['RebateCodeSign'])) $this->RebateCodeSign = $o['RebateCodeSign'];
        if (isset($o['RebateCodeValue'])) $this->RebateCodeValue = $o['RebateCodeValue'];
        if (isset($o['RebateCodeTypeId'])) $this->RebateCodeTypeId = $o['RebateCodeTypeId'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['RebateCodeStatusId'])) $this->RebateCodeStatusId = $o['RebateCodeStatusId'];
        if (isset($o['StatusName'])) $this->StatusName = $o['StatusName'];
        if (isset($o['MaxNumberOfUses'])) $this->MaxNumberOfUses = $o['MaxNumberOfUses'];
        if (isset($o['MaxNumberOfUsesPerCustomer'])) $this->MaxNumberOfUsesPerCustomer = $o['MaxNumberOfUsesPerCustomer'];
        if (isset($o['NumberOfUsesUsed'])) $this->NumberOfUsesUsed = $o['NumberOfUsesUsed'];
        if (isset($o['NumberOfUsesPerCustomerUsed'])) $this->NumberOfUsesPerCustomerUsed = $o['NumberOfUsesPerCustomerUsed'];
        if (isset($o['DaysOfWeek'])) $this->DaysOfWeek = JsonConverters::fromArray('DaysOfWeekResponse', $o['DaysOfWeek']);
        if (isset($o['Services'])) $this->Services = JsonConverters::fromArray('RebateCodeServiceResponse', $o['Services']);
        if (isset($o['Customers'])) $this->Customers = JsonConverters::fromArray('RebateCodeCustomerResponse', $o['Customers']);
        if (isset($o['RebateCodeTypesOptions'])) $this->RebateCodeTypesOptions = JsonConverters::fromArray('RebateCodeTypeResponse', $o['RebateCodeTypesOptions']);
        if (isset($o['RebateCodeStatusOptions'])) $this->RebateCodeStatusOptions = JsonConverters::fromArray('RebateCodeStatusResponse', $o['RebateCodeStatusOptions']);
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        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->FromTime)) $o['FromTime'] = JsonConverters::to('DateInterval', $this->FromTime);
        if (isset($this->ToTime)) $o['ToTime'] = JsonConverters::to('DateInterval', $this->ToTime);
        if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
        if (isset($this->Created)) $o['Created'] = JsonConverters::to('DateTime', $this->Created);
        if (isset($this->UpdatedBy)) $o['UpdatedBy'] = $this->UpdatedBy;
        if (isset($this->Updated)) $o['Updated'] = JsonConverters::to('DateTime', $this->Updated);
        if (isset($this->PersonalNote)) $o['PersonalNote'] = $this->PersonalNote;
        if (isset($this->RebateCodeSign)) $o['RebateCodeSign'] = $this->RebateCodeSign;
        if (isset($this->RebateCodeValue)) $o['RebateCodeValue'] = $this->RebateCodeValue;
        if (isset($this->RebateCodeTypeId)) $o['RebateCodeTypeId'] = $this->RebateCodeTypeId;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->RebateCodeStatusId)) $o['RebateCodeStatusId'] = $this->RebateCodeStatusId;
        if (isset($this->StatusName)) $o['StatusName'] = $this->StatusName;
        if (isset($this->MaxNumberOfUses)) $o['MaxNumberOfUses'] = $this->MaxNumberOfUses;
        if (isset($this->MaxNumberOfUsesPerCustomer)) $o['MaxNumberOfUsesPerCustomer'] = $this->MaxNumberOfUsesPerCustomer;
        if (isset($this->NumberOfUsesUsed)) $o['NumberOfUsesUsed'] = $this->NumberOfUsesUsed;
        if (isset($this->NumberOfUsesPerCustomerUsed)) $o['NumberOfUsesPerCustomerUsed'] = $this->NumberOfUsesPerCustomerUsed;
        if (isset($this->DaysOfWeek)) $o['DaysOfWeek'] = JsonConverters::toArray('DaysOfWeekResponse', $this->DaysOfWeek);
        if (isset($this->Services)) $o['Services'] = JsonConverters::toArray('RebateCodeServiceResponse', $this->Services);
        if (isset($this->Customers)) $o['Customers'] = JsonConverters::toArray('RebateCodeCustomerResponse', $this->Customers);
        if (isset($this->RebateCodeTypesOptions)) $o['RebateCodeTypesOptions'] = JsonConverters::toArray('RebateCodeTypeResponse', $this->RebateCodeTypesOptions);
        if (isset($this->RebateCodeStatusOptions)) $o['RebateCodeStatusOptions'] = JsonConverters::toArray('RebateCodeStatusResponse', $this->RebateCodeStatusOptions);
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class UpdateRebateCode implements ICompany, JsonSerializable
{
    public function __construct(
        /** @description Id of the rebate code */
        // @ApiMember(Description="Id of the rebate code", IsRequired=true, ParameterType="path")
        /** @var int */
        public int $Id=0,

        /** @var string|null */
        public ?string $CompanyId=null,
        /** @description The default value is 9999 */
        // @ApiMember(Description="The default value is 9999")
        /** @var int|null */
        public ?int $MaxNumberOfUses=null,

        /** @description The default value is 1 */
        // @ApiMember(Description="The default value is 1")
        /** @var int|null */
        public ?int $MaxNumberOfUsesPerCustomer=null,

        /** @description AutoGenerateRebateCodeSign=true - random generate code */
        // @ApiMember(Description="AutoGenerateRebateCodeSign=true - random generate code")
        /** @var bool|null */
        public ?bool $AutoGenerateRebateCodeSign=null,

        /** @description 1 - Percent, 2 - Сurrency */
        // @ApiMember(Description="1 - Percent, 2 - Сurrency")
        /** @var int */
        public int $RebateCodeTypeId=0,

        /** @description  */
        // @ApiMember(Description="")
        /** @var DateTime|null */
        public ?DateTime $ValidFrom=null,

        /** @description  */
        // @ApiMember(Description="")
        /** @var DateTime|null */
        public ?DateTime $ValidTo=null,

        /** @description If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update. */
        // @ApiMember(Description="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")
        /** @var DateInterval|null */
        public ?DateInterval $FromTime=null,

        /** @description If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters. */
        // @ApiMember(Description="If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.")
        /** @var DateInterval|null */
        public ?DateInterval $ToTime=null,

        /** @var int|null */
        public ?int $RebateCodeValue=null,
        /** @description Is empty - random generate code, is not empty - more than four letters, unique among active codes */
        // @ApiMember(Description="Is empty - random generate code, is not empty - more than four letters, unique among active codes")
        /** @var string|null */
        public ?string $RebateCodeSign=null,

        /** @description  */
        // @ApiMember(Description="")
        /** @var string|null */
        public ?string $PersonalNote=null,

        /** @description  */
        // @ApiMember(Description="")
        /** @var array<int>|null */
        public ?array $DaysOfWeek=null,

        /** @description  */
        // @ApiMember(Description="")
        /** @var array<int>|null */
        public ?array $Services=null,

        /** @description  */
        // @ApiMember(Description="")
        /** @var array<string>|null */
        public ?array $Customers=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['MaxNumberOfUses'])) $this->MaxNumberOfUses = $o['MaxNumberOfUses'];
        if (isset($o['MaxNumberOfUsesPerCustomer'])) $this->MaxNumberOfUsesPerCustomer = $o['MaxNumberOfUsesPerCustomer'];
        if (isset($o['AutoGenerateRebateCodeSign'])) $this->AutoGenerateRebateCodeSign = $o['AutoGenerateRebateCodeSign'];
        if (isset($o['RebateCodeTypeId'])) $this->RebateCodeTypeId = $o['RebateCodeTypeId'];
        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['FromTime'])) $this->FromTime = JsonConverters::from('TimeSpan', $o['FromTime']);
        if (isset($o['ToTime'])) $this->ToTime = JsonConverters::from('TimeSpan', $o['ToTime']);
        if (isset($o['RebateCodeValue'])) $this->RebateCodeValue = $o['RebateCodeValue'];
        if (isset($o['RebateCodeSign'])) $this->RebateCodeSign = $o['RebateCodeSign'];
        if (isset($o['PersonalNote'])) $this->PersonalNote = $o['PersonalNote'];
        if (isset($o['DaysOfWeek'])) $this->DaysOfWeek = JsonConverters::fromArray('int', $o['DaysOfWeek']);
        if (isset($o['Services'])) $this->Services = JsonConverters::fromArray('int', $o['Services']);
        if (isset($o['Customers'])) $this->Customers = JsonConverters::fromArray('Guid', $o['Customers']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->MaxNumberOfUses)) $o['MaxNumberOfUses'] = $this->MaxNumberOfUses;
        if (isset($this->MaxNumberOfUsesPerCustomer)) $o['MaxNumberOfUsesPerCustomer'] = $this->MaxNumberOfUsesPerCustomer;
        if (isset($this->AutoGenerateRebateCodeSign)) $o['AutoGenerateRebateCodeSign'] = $this->AutoGenerateRebateCodeSign;
        if (isset($this->RebateCodeTypeId)) $o['RebateCodeTypeId'] = $this->RebateCodeTypeId;
        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->FromTime)) $o['FromTime'] = JsonConverters::to('TimeSpan', $this->FromTime);
        if (isset($this->ToTime)) $o['ToTime'] = JsonConverters::to('TimeSpan', $this->ToTime);
        if (isset($this->RebateCodeValue)) $o['RebateCodeValue'] = $this->RebateCodeValue;
        if (isset($this->RebateCodeSign)) $o['RebateCodeSign'] = $this->RebateCodeSign;
        if (isset($this->PersonalNote)) $o['PersonalNote'] = $this->PersonalNote;
        if (isset($this->DaysOfWeek)) $o['DaysOfWeek'] = JsonConverters::toArray('int', $this->DaysOfWeek);
        if (isset($this->Services)) $o['Services'] = JsonConverters::toArray('int', $this->Services);
        if (isset($this->Customers)) $o['Customers'] = JsonConverters::toArray('Guid', $this->Customers);
        return empty($o) ? new class(){} : $o;
    }
}

PHP UpdateRebateCode 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.

PUT /rebatecodes/{Id} HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Id: 0,
	CompanyId: 00000000-0000-0000-0000-000000000000,
	MaxNumberOfUses: 0,
	MaxNumberOfUsesPerCustomer: 0,
	AutoGenerateRebateCodeSign: False,
	RebateCodeTypeId: 0,
	ValidFrom: "0001-01-01T00:00:00",
	ValidTo: "0001-01-01T00:00:00",
	FromTime: PT0S,
	ToTime: PT0S,
	RebateCodeValue: 0,
	RebateCodeSign: String,
	PersonalNote: String,
	DaysOfWeek: 
	[
		0
	],
	Services: 
	[
		0
	],
	Customers: 
	[
		00000000-0000-0000-0000-000000000000
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Id: 0,
	CompanyId: 00000000-0000-0000-0000-000000000000,
	FromTime: PT0S,
	ToTime: PT0S,
	CreatedBy: String,
	UpdatedBy: String,
	PersonalNote: String,
	RebateCodeSign: String,
	RebateCodeValue: 0,
	RebateCodeTypeId: 0,
	Name: String,
	RebateCodeStatusId: 0,
	StatusName: String,
	MaxNumberOfUses: 0,
	MaxNumberOfUsesPerCustomer: 0,
	NumberOfUsesUsed: 0,
	NumberOfUsesPerCustomerUsed: 0,
	DaysOfWeek: 
	[
		{
			Id: 0,
			DayOfWeek: String,
			DayOfWeekTranslation: String,
			DayOfWeekActive: False,
			DayOfWeekSortOrder: 0
		}
	],
	Services: 
	[
		{
			Id: 0,
			Name: String,
			Description: String,
			Active: False
		}
	],
	Customers: 
	[
		{
			Firstname: String,
			Lastname: String,
			Email: String,
			Phone: String,
			ImageUrl: String
		}
	],
	RebateCodeTypesOptions: 
	[
		{
			ResponseStatus: 
			{
				ErrorCode: String,
				Message: String,
				StackTrace: String,
				Errors: 
				[
					{
						ErrorCode: String,
						FieldName: String,
						Message: String,
						Meta: 
						{
							String: String
						}
					}
				],
				Meta: 
				{
					String: String
				}
			},
			RebateCodeTypeItems: 
			[
				{
					Id: 0,
					Name: String,
					Description: String
				}
			]
		}
	],
	RebateCodeStatusOptions: 
	[
		{
			ResponseStatus: 
			{
				ErrorCode: String,
				Message: String,
				StackTrace: String,
				Errors: 
				[
					{
						ErrorCode: String,
						FieldName: String,
						Message: String,
						Meta: 
						{
							String: String
						}
					}
				],
				Meta: 
				{
					String: String
				}
			},
			RebateCodeStatusItems: 
			[
				{
					Id: 0,
					RebateCodeStatusName: String,
					RebateCodeStatusDescription: String
				}
			]
		}
	],
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}