BokaMera.API.Host

<back to all web services

CreateResource

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/resourceAdd a new resourceAdd a new resource to the company of the currently logged in user, only administrators are allowed to add resources.
<?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 TimeException implements ITimeException, JsonSerializable
{
    public function __construct(
        /** @description Time exception id */
        // @ApiMember(Description="Time exception id")
        /** @var int */
        public int $Id=0,

        /** @description Indicates whether or not the time exception is recurring */
        // @ApiMember(Description="Indicates whether or not the time exception is recurring")
        /** @var bool|null */
        public ?bool $IsRecurring=null,

        /** @description Indicates whether the time exception is blocking the time or not */
        // @ApiMember(Description="Indicates whether the time exception is blocking the time or not")
        /** @var bool|null */
        public ?bool $IsBlock=null,

        /** @description The reason of the time exception, example: Vacation, doctors appointment, ... */
        // @ApiMember(Description="The reason of the time exception, example: Vacation, doctors appointment, ...")
        /** @var string|null */
        public ?string $ReasonText=null,

        /** @description The public reason of the time exception, example: Vacation, doctors appointment, ... */
        // @ApiMember(Description="The public reason of the time exception, example: Vacation, doctors appointment, ...")
        /** @var string|null */
        public ?string $ReasonTextPublic=null,

        /** @description Time exception start */
        // @ApiMember(Description="Time exception start")
        /** @var DateTime */
        public DateTime $From=new DateTime(),

        /** @description Time exception end */
        // @ApiMember(Description="Time exception end")
        /** @var DateTime */
        public DateTime $To=new DateTime(),

        /** @description Resources that owns this exception */
        // @ApiMember(Description="Resources that owns this exception")
        /** @var int[]|null */
        public ?array $ResourceIds=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['IsRecurring'])) $this->IsRecurring = $o['IsRecurring'];
        if (isset($o['IsBlock'])) $this->IsBlock = $o['IsBlock'];
        if (isset($o['ReasonText'])) $this->ReasonText = $o['ReasonText'];
        if (isset($o['ReasonTextPublic'])) $this->ReasonTextPublic = $o['ReasonTextPublic'];
        if (isset($o['From'])) $this->From = JsonConverters::from('DateTime', $o['From']);
        if (isset($o['To'])) $this->To = JsonConverters::from('DateTime', $o['To']);
        if (isset($o['ResourceIds'])) $this->ResourceIds = JsonConverters::fromArray('int', $o['ResourceIds']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->IsRecurring)) $o['IsRecurring'] = $this->IsRecurring;
        if (isset($this->IsBlock)) $o['IsBlock'] = $this->IsBlock;
        if (isset($this->ReasonText)) $o['ReasonText'] = $this->ReasonText;
        if (isset($this->ReasonTextPublic)) $o['ReasonTextPublic'] = $this->ReasonTextPublic;
        if (isset($this->From)) $o['From'] = JsonConverters::to('DateTime', $this->From);
        if (isset($this->To)) $o['To'] = JsonConverters::to('DateTime', $this->To);
        if (isset($this->ResourceIds)) $o['ResourceIds'] = JsonConverters::toArray('int', $this->ResourceIds);
        return empty($o) ? new class(){} : $o;
    }
}

enum BookingStatusEnum : int
{
    case Booked = 1;
    case Unbooked = 2;
    case Reserved = 3;
    case Canceled = 4;
    case AwaitingPayment = 5;
    case AwaitingPaymentNoTimeLimit = 6;
    case Payed = 7;
    case AwaitingPaymentRequestFromAdmin = 8;
    case AwaitingPaymentFromProvider = 9;
    case Invoiced = 10;
}

class BookedCustomer 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 $FacebookUserName=null,
        /** @var string|null */
        public ?string $ImageUrl=null,
        /** @var string|null */
        public ?string $CorporateIdentityNumber=null,
        /** @var string|null */
        public ?string $InvoiceAddress1=null,
        /** @var string|null */
        public ?string $InvoiceAddress2=null,
        /** @var string|null */
        public ?string $InvoiceCity=null,
        /** @var string|null */
        public ?string $InvoicePostalCode=null,
        /** @var string|null */
        public ?string $InvoiceCountryCode=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['FacebookUserName'])) $this->FacebookUserName = $o['FacebookUserName'];
        if (isset($o['ImageUrl'])) $this->ImageUrl = $o['ImageUrl'];
        if (isset($o['CorporateIdentityNumber'])) $this->CorporateIdentityNumber = $o['CorporateIdentityNumber'];
        if (isset($o['InvoiceAddress1'])) $this->InvoiceAddress1 = $o['InvoiceAddress1'];
        if (isset($o['InvoiceAddress2'])) $this->InvoiceAddress2 = $o['InvoiceAddress2'];
        if (isset($o['InvoiceCity'])) $this->InvoiceCity = $o['InvoiceCity'];
        if (isset($o['InvoicePostalCode'])) $this->InvoicePostalCode = $o['InvoicePostalCode'];
        if (isset($o['InvoiceCountryCode'])) $this->InvoiceCountryCode = $o['InvoiceCountryCode'];
    }
    
    /** @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->FacebookUserName)) $o['FacebookUserName'] = $this->FacebookUserName;
        if (isset($this->ImageUrl)) $o['ImageUrl'] = $this->ImageUrl;
        if (isset($this->CorporateIdentityNumber)) $o['CorporateIdentityNumber'] = $this->CorporateIdentityNumber;
        if (isset($this->InvoiceAddress1)) $o['InvoiceAddress1'] = $this->InvoiceAddress1;
        if (isset($this->InvoiceAddress2)) $o['InvoiceAddress2'] = $this->InvoiceAddress2;
        if (isset($this->InvoiceCity)) $o['InvoiceCity'] = $this->InvoiceCity;
        if (isset($this->InvoicePostalCode)) $o['InvoicePostalCode'] = $this->InvoicePostalCode;
        if (isset($this->InvoiceCountryCode)) $o['InvoiceCountryCode'] = $this->InvoiceCountryCode;
        return empty($o) ? new class(){} : $o;
    }
}

class BookedTime implements IBookedTime, JsonSerializable
{
    public function __construct(
        /** @description Booking id */
        // @ApiMember(Description="Booking id")
        /** @var int */
        public int $Id=0,

        /** @description The booked service */
        // @ApiMember(Description="The booked service")
        /** @var int */
        public int $ServiceId=0,

        /** @description Booking start */
        // @ApiMember(Description="Booking start")
        /** @var DateTime */
        public DateTime $From=new DateTime(),

        /** @description Booking end */
        // @ApiMember(Description="Booking end")
        /** @var DateTime */
        public DateTime $To=new DateTime(),

        /** @description Number of booked spots */
        // @ApiMember(Description="Number of booked spots")
        /** @var int */
        public int $BookedSpots=0,

        /** @description Number of total spots for the service */
        // @ApiMember(Description="Number of total spots for the service")
        /** @var int */
        public int $TotalSpots=0,

        /** @description The pause after the booking */
        // @ApiMember(Description="The pause after the booking")
        /** @var int */
        public int $PauseAfterInMinutes=0,

        /** @description The booking status */
        // @ApiMember(Description="The booking status")
        /** @var int */
        public int $StatusId=0,

        /** @var BookingStatusEnum|null */
        public ?BookingStatusEnum $Status=null,
        /** @description The customer the booking belongs to */
        // @ApiMember(Description="The customer the booking belongs to")
        /** @var BookedCustomer|null */
        public ?BookedCustomer $Customer=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['ServiceId'])) $this->ServiceId = $o['ServiceId'];
        if (isset($o['From'])) $this->From = JsonConverters::from('DateTime', $o['From']);
        if (isset($o['To'])) $this->To = JsonConverters::from('DateTime', $o['To']);
        if (isset($o['BookedSpots'])) $this->BookedSpots = $o['BookedSpots'];
        if (isset($o['TotalSpots'])) $this->TotalSpots = $o['TotalSpots'];
        if (isset($o['PauseAfterInMinutes'])) $this->PauseAfterInMinutes = $o['PauseAfterInMinutes'];
        if (isset($o['StatusId'])) $this->StatusId = $o['StatusId'];
        if (isset($o['Status'])) $this->Status = JsonConverters::from('BookingStatusEnum', $o['Status']);
        if (isset($o['Customer'])) $this->Customer = JsonConverters::from('BookedCustomer', $o['Customer']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->ServiceId)) $o['ServiceId'] = $this->ServiceId;
        if (isset($this->From)) $o['From'] = JsonConverters::to('DateTime', $this->From);
        if (isset($this->To)) $o['To'] = JsonConverters::to('DateTime', $this->To);
        if (isset($this->BookedSpots)) $o['BookedSpots'] = $this->BookedSpots;
        if (isset($this->TotalSpots)) $o['TotalSpots'] = $this->TotalSpots;
        if (isset($this->PauseAfterInMinutes)) $o['PauseAfterInMinutes'] = $this->PauseAfterInMinutes;
        if (isset($this->StatusId)) $o['StatusId'] = $this->StatusId;
        if (isset($this->Status)) $o['Status'] = JsonConverters::to('BookingStatusEnum', $this->Status);
        if (isset($this->Customer)) $o['Customer'] = JsonConverters::to('BookedCustomer', $this->Customer);
        return empty($o) ? new class(){} : $o;
    }
}

class ResourceQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @description The resource id */
        // @ApiMember(Description="The resource id")
        /** @var int */
        public int $Id=0,

        /** @description The resource name */
        // @ApiMember(Description="The resource name")
        /** @var string|null */
        public ?string $Name=null,

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

        /** @description If resource is active or not */
        // @ApiMember(Description="If resource is active or not")
        /** @var bool|null */
        public ?bool $Active=null,

        /** @description The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue. */
        // @ApiMember(Description="The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue.")
        /** @var string|null */
        public ?string $Color=null,

        /** @description The email of the resource */
        // @ApiMember(Description="The email of the resource")
        /** @var string|null */
        public ?string $Email=null,

        /** @description The image url of the resource */
        // @ApiMember(Description="The image url of the resource")
        /** @var string|null */
        public ?string $ImageUrl=null,

        /** @description The mobile phone number of the resource */
        // @ApiMember(Description="The mobile phone number of the resource")
        /** @var string|null */
        public ?string $MobilePhone=null,

        /** @description Used by example code locks to know what access group the resource is assigned to */
        // @ApiMember(Description="Used by example code locks to know what access group the resource is assigned to")
        /** @var string|null */
        public ?string $AccessGroup=null,

        /** @description If the resource should receive email notification when booked */
        // @ApiMember(Description="If the resource should receive email notification when booked")
        /** @var bool|null */
        public ?bool $EmailNotification=null,

        /** @description If the resource should receive SMS notification when booked */
        // @ApiMember(Description="If the resource should receive SMS notification when booked")
        /** @var bool|null */
        public ?bool $SMSNotification=null,

        /** @description If the resource should receive email reminders on bookings */
        // @ApiMember(Description="If the resource should receive email reminders on bookings")
        /** @var bool|null */
        public ?bool $SendEmailReminder=null,

        /** @description If the resource should receive SMS reminders on bookings */
        // @ApiMember(Description="If the resource should receive SMS reminders on bookings")
        /** @var bool|null */
        public ?bool $SendSMSReminder=null,

        /** @description The resource time exceptions */
        // @ApiMember(Description="The resource time exceptions")
        /** @var array<TimeException>|null */
        public ?array $Exceptions=null,

        /** @description The resource bookings */
        // @ApiMember(Description="The resource bookings")
        /** @var array<BookedTime>|null */
        public ?array $Bookings=null,

        /** @description Then date when the resource was created */
        // @ApiMember(Description="Then date when the resource was created")
        /** @var DateTime */
        public DateTime $Created=new DateTime(),

        /** @description Then date when the resource was updated */
        // @ApiMember(Description="Then date when the resource was updated")
        /** @var DateTime */
        public DateTime $Updated=new DateTime(),

        /** @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['Name'])) $this->Name = $o['Name'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['Active'])) $this->Active = $o['Active'];
        if (isset($o['Color'])) $this->Color = $o['Color'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['ImageUrl'])) $this->ImageUrl = JsonConverters::from('string', $o['ImageUrl']);
        if (isset($o['MobilePhone'])) $this->MobilePhone = $o['MobilePhone'];
        if (isset($o['AccessGroup'])) $this->AccessGroup = $o['AccessGroup'];
        if (isset($o['EmailNotification'])) $this->EmailNotification = $o['EmailNotification'];
        if (isset($o['SMSNotification'])) $this->SMSNotification = $o['SMSNotification'];
        if (isset($o['SendEmailReminder'])) $this->SendEmailReminder = $o['SendEmailReminder'];
        if (isset($o['SendSMSReminder'])) $this->SendSMSReminder = $o['SendSMSReminder'];
        if (isset($o['Exceptions'])) $this->Exceptions = JsonConverters::fromArray('TimeException', $o['Exceptions']);
        if (isset($o['Bookings'])) $this->Bookings = JsonConverters::fromArray('BookedTime', $o['Bookings']);
        if (isset($o['Created'])) $this->Created = JsonConverters::from('DateTime', $o['Created']);
        if (isset($o['Updated'])) $this->Updated = JsonConverters::from('DateTime', $o['Updated']);
        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->Name)) $o['Name'] = $this->Name;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->Active)) $o['Active'] = $this->Active;
        if (isset($this->Color)) $o['Color'] = $this->Color;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->ImageUrl)) $o['ImageUrl'] = JsonConverters::to('string', $this->ImageUrl);
        if (isset($this->MobilePhone)) $o['MobilePhone'] = $this->MobilePhone;
        if (isset($this->AccessGroup)) $o['AccessGroup'] = $this->AccessGroup;
        if (isset($this->EmailNotification)) $o['EmailNotification'] = $this->EmailNotification;
        if (isset($this->SMSNotification)) $o['SMSNotification'] = $this->SMSNotification;
        if (isset($this->SendEmailReminder)) $o['SendEmailReminder'] = $this->SendEmailReminder;
        if (isset($this->SendSMSReminder)) $o['SendSMSReminder'] = $this->SendSMSReminder;
        if (isset($this->Exceptions)) $o['Exceptions'] = JsonConverters::toArray('TimeException', $this->Exceptions);
        if (isset($this->Bookings)) $o['Bookings'] = JsonConverters::toArray('BookedTime', $this->Bookings);
        if (isset($this->Created)) $o['Created'] = JsonConverters::to('DateTime', $this->Created);
        if (isset($this->Updated)) $o['Updated'] = JsonConverters::to('DateTime', $this->Updated);
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

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

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

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ApiResponse(Description="You have too low privilegies to call this service", StatusCode=403)
// @ValidateRequest(Validator="IsAuthenticated")
class CreateResource implements ICompany, JsonSerializable
{
    public function __construct(
        /** @description Enter the company id, if blank company id and you are an admin, your company id will be used. */
        // @ApiMember(Description="Enter the company id, if blank company id and you are an admin, your company id will be used.", IsRequired=true)
        /** @var string */
        public string $CompanyId='',

        /** @description The resource name */
        // @ApiMember(Description="The resource name")
        /** @var string|null */
        public ?string $Name=null,

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

        /** @description If resource is active or not. Default is active. */
        // @ApiMember(Description="If resource is active or not. Default is active.")
        /** @var bool|null */
        public ?bool $Active=null,

        /** @description The resource color in scheduler */
        // @ApiMember(Description="The resource color in scheduler")
        /** @var string|null */
        public ?string $Color=null,

        /** @description The email of the resource */
        // @ApiMember(Description="The email of the resource")
        /** @var string|null */
        public ?string $Email=null,

        /** @description The image url of the resource */
        // @ApiMember(Description="The image url of the resource")
        /** @var string|null */
        public ?string $ImageUrl=null,

        /** @description Used by example code locks to know what access group the resource is assigned to */
        // @ApiMember(Description="Used by example code locks to know what access group the resource is assigned to")
        /** @var string|null */
        public ?string $AccessGroup=null,

        /** @description The mobile phone number of the resource */
        // @ApiMember(Description="The mobile phone number of the resource")
        /** @var string|null */
        public ?string $MobilePhone=null,

        /** @description If the resource should receive email notification when booked */
        // @ApiMember(Description="If the resource should receive email notification when booked")
        /** @var bool|null */
        public ?bool $EmailNotification=null,

        /** @description If the resource should receive SMS notification when booked */
        // @ApiMember(Description="If the resource should receive SMS notification when booked")
        /** @var bool|null */
        public ?bool $SMSNotification=null,

        /** @description If the resource should receive email reminders on bookings */
        // @ApiMember(Description="If the resource should receive email reminders on bookings")
        /** @var bool|null */
        public ?bool $SendEmailReminder=null,

        /** @description If the resource should receive SMS reminders on bookings */
        // @ApiMember(Description="If the resource should receive SMS reminders on bookings")
        /** @var bool|null */
        public ?bool $SendSMSReminder=null,

        /** @description If Custom Fields are added to the resource, here you will send the id and the value for each custom field to be saved */
        // @ApiMember(Description="If Custom Fields are added to the resource, here you will send the id and the value for each custom field to be saved")
        /** @var array<AddCustomField>|null */
        public ?array $CustomFields=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['Active'])) $this->Active = $o['Active'];
        if (isset($o['Color'])) $this->Color = $o['Color'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['ImageUrl'])) $this->ImageUrl = JsonConverters::from('string', $o['ImageUrl']);
        if (isset($o['AccessGroup'])) $this->AccessGroup = $o['AccessGroup'];
        if (isset($o['MobilePhone'])) $this->MobilePhone = $o['MobilePhone'];
        if (isset($o['EmailNotification'])) $this->EmailNotification = $o['EmailNotification'];
        if (isset($o['SMSNotification'])) $this->SMSNotification = $o['SMSNotification'];
        if (isset($o['SendEmailReminder'])) $this->SendEmailReminder = $o['SendEmailReminder'];
        if (isset($o['SendSMSReminder'])) $this->SendSMSReminder = $o['SendSMSReminder'];
        if (isset($o['CustomFields'])) $this->CustomFields = JsonConverters::fromArray('AddCustomField', $o['CustomFields']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->Active)) $o['Active'] = $this->Active;
        if (isset($this->Color)) $o['Color'] = $this->Color;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->ImageUrl)) $o['ImageUrl'] = JsonConverters::to('string', $this->ImageUrl);
        if (isset($this->AccessGroup)) $o['AccessGroup'] = $this->AccessGroup;
        if (isset($this->MobilePhone)) $o['MobilePhone'] = $this->MobilePhone;
        if (isset($this->EmailNotification)) $o['EmailNotification'] = $this->EmailNotification;
        if (isset($this->SMSNotification)) $o['SMSNotification'] = $this->SMSNotification;
        if (isset($this->SendEmailReminder)) $o['SendEmailReminder'] = $this->SendEmailReminder;
        if (isset($this->SendSMSReminder)) $o['SendSMSReminder'] = $this->SendSMSReminder;
        if (isset($this->CustomFields)) $o['CustomFields'] = JsonConverters::toArray('AddCustomField', $this->CustomFields);
        return empty($o) ? new class(){} : $o;
    }
}

PHP CreateResource DTOs

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

HTTP + JSON

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

POST /resource HTTP/1.1 
Host: api.bokamera.se 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","Name":"String","Description":"String","Active":false,"Color":"String","Email":"String","AccessGroup":"String","MobilePhone":"String","EmailNotification":false,"SMSNotification":false,"SendEmailReminder":false,"SendSMSReminder":false,"CustomFields":[{"Id":0,"Value":"String"}]}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Id":0,"Name":"String","Description":"String","Active":false,"Color":"String","Email":"String","MobilePhone":"String","AccessGroup":"String","EmailNotification":false,"SMSNotification":false,"SendEmailReminder":false,"SendSMSReminder":false,"Exceptions":[{"Id":0,"IsRecurring":false,"IsBlock":false,"ReasonText":"String","ReasonTextPublic":"String","ResourceIds":[0]}],"Bookings":[{"Id":0,"ServiceId":0,"BookedSpots":0,"TotalSpots":0,"PauseAfterInMinutes":0,"StatusId":0,"Status":"Booked","Customer":{"Firstname":"String","Lastname":"String","Email":"String","Phone":"String","FacebookUserName":"String","ImageUrl":"String","CorporateIdentityNumber":"String","InvoiceAddress1":"String","InvoiceAddress2":"String","InvoiceCity":"String","InvoicePostalCode":"String","InvoiceCountryCode":"String"}}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}