Required role: | bookingsupplier-administrator-write |
POST | /customers | Create a new customer | Creates a new customer, if an admin user is making the request, the user will be associated with the admin user's company. |
---|
<?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 CustomFieldValueResponse implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Value=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Value'])) $this->Value = $o['Value'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Value)) $o['Value'] = $this->Value;
return empty($o) ? new class(){} : $o;
}
}
class CustomFieldConfigData implements JsonSerializable
{
public function __construct(
/** @description Custom field id */
// @ApiMember(Description="Custom field id")
/** @var int */
public int $Id=0,
/** @description Configuration name. Example: 'Number of persons'. */
// @ApiMember(Description="Configuration name. Example: 'Number of persons'.")
/** @var string|null */
public ?string $Name=null,
/** @description Custom field description. Example: 'For how many persons is this booking?' */
// @ApiMember(Description="Custom field description. Example: 'For how many persons is this booking?'")
/** @var string|null */
public ?string $Description=null,
/** @description Field width. Example: 20 for 20px */
// @ApiMember(Description="Field width. Example: 20 for 20px")
/** @var int|null */
public ?int $Width=null,
/** @description Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox' */
// @ApiMember(Description="Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'")
/** @var string|null */
public ?string $DataType=null,
/** @description Default value of the field. Example: '3' */
// @ApiMember(Description="Default value of the field. Example: '3'")
/** @var string|null */
public ?string $DefaultValue=null,
/** @description Determines if the field is required to have a value or not */
// @ApiMember(Description="Determines if the field is required to have a value or not")
/** @var bool|null */
public ?bool $IsMandatory=null,
/** @description Error message shown to the user if the field data is required but not entered */
// @ApiMember(Description="Error message shown to the user if the field data is required but not entered")
/** @var string|null */
public ?string $MandatoryErrorMessage=null,
/** @description Max lenght of the field */
// @ApiMember(Description="Max lenght of the field")
/** @var int */
public int $MaxLength=0,
/** @description If the field should have multiple lines */
// @ApiMember(Description="If the field should have multiple lines")
/** @var bool|null */
public ?bool $MultipleLineText=null,
/** @description Regular expression used for validation of the field */
// @ApiMember(Description="Regular expression used for validation of the field")
/** @var string|null */
public ?string $RegEx=null,
/** @description Error message shown if the regular expression validation failed */
// @ApiMember(Description="Error message shown if the regular expression validation failed")
/** @var string|null */
public ?string $RegExErrorMessage=null,
/** @description The values to select from if Datatype is DropDown for this custom field */
// @ApiMember(Description="The values to select from if Datatype is DropDown for this custom field")
/** @var array<CustomFieldValueResponse>|null */
public ?array $Values=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['Width'])) $this->Width = $o['Width'];
if (isset($o['DataType'])) $this->DataType = $o['DataType'];
if (isset($o['DefaultValue'])) $this->DefaultValue = $o['DefaultValue'];
if (isset($o['IsMandatory'])) $this->IsMandatory = $o['IsMandatory'];
if (isset($o['MandatoryErrorMessage'])) $this->MandatoryErrorMessage = $o['MandatoryErrorMessage'];
if (isset($o['MaxLength'])) $this->MaxLength = $o['MaxLength'];
if (isset($o['MultipleLineText'])) $this->MultipleLineText = $o['MultipleLineText'];
if (isset($o['RegEx'])) $this->RegEx = $o['RegEx'];
if (isset($o['RegExErrorMessage'])) $this->RegExErrorMessage = $o['RegExErrorMessage'];
if (isset($o['Values'])) $this->Values = JsonConverters::fromArray('CustomFieldValueResponse', $o['Values']);
}
/** @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->Width)) $o['Width'] = $this->Width;
if (isset($this->DataType)) $o['DataType'] = $this->DataType;
if (isset($this->DefaultValue)) $o['DefaultValue'] = $this->DefaultValue;
if (isset($this->IsMandatory)) $o['IsMandatory'] = $this->IsMandatory;
if (isset($this->MandatoryErrorMessage)) $o['MandatoryErrorMessage'] = $this->MandatoryErrorMessage;
if (isset($this->MaxLength)) $o['MaxLength'] = $this->MaxLength;
if (isset($this->MultipleLineText)) $o['MultipleLineText'] = $this->MultipleLineText;
if (isset($this->RegEx)) $o['RegEx'] = $this->RegEx;
if (isset($this->RegExErrorMessage)) $o['RegExErrorMessage'] = $this->RegExErrorMessage;
if (isset($this->Values)) $o['Values'] = JsonConverters::toArray('CustomFieldValueResponse', $this->Values);
return empty($o) ? new class(){} : $o;
}
}
class CustomFieldDataResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @var string|null */
public ?string $Column=null,
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Description=null,
/** @var string|null */
public ?string $Value=null,
/** @description Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox' */
// @ApiMember(Description="Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'")
/** @var string|null */
public ?string $DataType=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['Column'])) $this->Column = $o['Column'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['Value'])) $this->Value = $o['Value'];
if (isset($o['DataType'])) $this->DataType = $o['DataType'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->Column)) $o['Column'] = $this->Column;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->Value)) $o['Value'] = $this->Value;
if (isset($this->DataType)) $o['DataType'] = $this->DataType;
return empty($o) ? new class(){} : $o;
}
}
class CustomerCommentsResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @var string */
public string $CustomerId='',
/** @var string|null */
public ?string $Comments=null,
/** @var DateTime */
public DateTime $Updated=new DateTime(),
/** @var DateTime */
public DateTime $Created=new DateTime(),
/** @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['CustomerId'])) $this->CustomerId = $o['CustomerId'];
if (isset($o['Comments'])) $this->Comments = $o['Comments'];
if (isset($o['Updated'])) $this->Updated = JsonConverters::from('DateTime', $o['Updated']);
if (isset($o['Created'])) $this->Created = JsonConverters::from('DateTime', $o['Created']);
if (isset($o['ImageUrl'])) $this->ImageUrl = JsonConverters::from('string', $o['ImageUrl']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->CustomerId)) $o['CustomerId'] = $this->CustomerId;
if (isset($this->Comments)) $o['Comments'] = $this->Comments;
if (isset($this->Updated)) $o['Updated'] = JsonConverters::to('DateTime', $this->Updated);
if (isset($this->Created)) $o['Created'] = JsonConverters::to('DateTime', $this->Created);
if (isset($this->ImageUrl)) $o['ImageUrl'] = JsonConverters::to('string', $this->ImageUrl);
return empty($o) ? new class(){} : $o;
}
}
class BaseModel implements JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
class UserAccessKeys extends BaseModel implements JsonSerializable
{
public function __construct(
// @Required()
/** @var string */
public string $CompanyId='',
// @Required()
/** @var int */
public int $AccessKeyTypeId=0,
// @Required()
/** @var string */
public string $Value='',
// @Required()
/** @var string */
public string $CustomerId='',
/** @var string|null */
public ?string $Description=null,
// @Required()
/** @var string */
public string $Id=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
if (isset($o['AccessKeyTypeId'])) $this->AccessKeyTypeId = $o['AccessKeyTypeId'];
if (isset($o['Value'])) $this->Value = $o['Value'];
if (isset($o['CustomerId'])) $this->CustomerId = $o['CustomerId'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['Id'])) $this->Id = $o['Id'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
if (isset($this->AccessKeyTypeId)) $o['AccessKeyTypeId'] = $this->AccessKeyTypeId;
if (isset($this->Value)) $o['Value'] = $this->Value;
if (isset($this->CustomerId)) $o['CustomerId'] = $this->CustomerId;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->Id)) $o['Id'] = $this->Id;
return empty($o) ? new class(){} : $o;
}
}
class InvoiceAddress implements JsonSerializable
{
public function __construct(
/** @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['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->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 CustomerQueryResponse 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,
/** @var array<CustomFieldConfigData>|null */
public ?array $CustomFields=null,
/** @var array<CustomFieldDataResponse>|null */
public ?array $CustomFieldValues=null,
/** @var array<CustomerCommentsResponse>|null */
public ?array $Comments=null,
/** @var array<UserAccessKeys>|null */
public ?array $AccessKeys=null,
/** @var DateTime */
public DateTime $Updated=new DateTime(),
/** @var DateTime */
public DateTime $Created=new DateTime(),
/** @var Object|null */
public ?Object $ResponseStatus=null,
/** @var bool|null */
public ?bool $SubscribedToNewsletter=null,
/** @var InvoiceAddress|null */
public ?InvoiceAddress $InvoiceAddress=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'];
if (isset($o['CustomFields'])) $this->CustomFields = JsonConverters::fromArray('CustomFieldConfigData', $o['CustomFields']);
if (isset($o['CustomFieldValues'])) $this->CustomFieldValues = JsonConverters::fromArray('CustomFieldDataResponse', $o['CustomFieldValues']);
if (isset($o['Comments'])) $this->Comments = JsonConverters::fromArray('CustomerCommentsResponse', $o['Comments']);
if (isset($o['AccessKeys'])) $this->AccessKeys = JsonConverters::fromArray('UserAccessKeys', $o['AccessKeys']);
if (isset($o['Updated'])) $this->Updated = JsonConverters::from('DateTime', $o['Updated']);
if (isset($o['Created'])) $this->Created = JsonConverters::from('DateTime', $o['Created']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('Object', $o['ResponseStatus']);
if (isset($o['SubscribedToNewsletter'])) $this->SubscribedToNewsletter = $o['SubscribedToNewsletter'];
if (isset($o['InvoiceAddress'])) $this->InvoiceAddress = JsonConverters::from('InvoiceAddress', $o['InvoiceAddress']);
}
/** @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;
if (isset($this->CustomFields)) $o['CustomFields'] = JsonConverters::toArray('CustomFieldConfigData', $this->CustomFields);
if (isset($this->CustomFieldValues)) $o['CustomFieldValues'] = JsonConverters::toArray('CustomFieldDataResponse', $this->CustomFieldValues);
if (isset($this->Comments)) $o['Comments'] = JsonConverters::toArray('CustomerCommentsResponse', $this->Comments);
if (isset($this->AccessKeys)) $o['AccessKeys'] = JsonConverters::toArray('UserAccessKeys', $this->AccessKeys);
if (isset($this->Updated)) $o['Updated'] = JsonConverters::to('DateTime', $this->Updated);
if (isset($this->Created)) $o['Created'] = JsonConverters::to('DateTime', $this->Created);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('Object', $this->ResponseStatus);
if (isset($this->SubscribedToNewsletter)) $o['SubscribedToNewsletter'] = $this->SubscribedToNewsletter;
if (isset($this->InvoiceAddress)) $o['InvoiceAddress'] = JsonConverters::to('InvoiceAddress', $this->InvoiceAddress);
return empty($o) ? new class(){} : $o;
}
}
class UpdateCustomerResponse extends CustomerQueryResponse implements JsonSerializable
{
/**
* @param string $Id
* @param string|null $Firstname
* @param string|null $Lastname
* @param string|null $Email
* @param string|null $Phone
* @param string|null $ImageUrl
* @param array<CustomFieldConfigData>|null $CustomFields
* @param array<CustomFieldDataResponse>|null $CustomFieldValues
* @param array<CustomerCommentsResponse>|null $Comments
* @param array<UserAccessKeys>|null $AccessKeys
* @param DateTime $Updated
* @param DateTime $Created
* @param Object|null $ResponseStatus
* @param bool|null $SubscribedToNewsletter
* @param InvoiceAddress|null $InvoiceAddress
*/
public function __construct(
string $Id='',
?string $Firstname=null,
?string $Lastname=null,
?string $Email=null,
?string $Phone=null,
?string $ImageUrl=null,
?array $CustomFields=null,
?array $CustomFieldValues=null,
?array $Comments=null,
?array $AccessKeys=null,
DateTime $Updated=new DateTime(),
DateTime $Created=new DateTime(),
?Object $ResponseStatus=null,
?bool $SubscribedToNewsletter=null,
?InvoiceAddress $InvoiceAddress=null,
/** @var string|null */
public ?string $FacebookUserName=null,
/** @var string|null */
public ?string $UserId=null,
/** @var string|null */
public ?string $CompanyId=null,
/** @var DateTime|null */
public ?DateTime $CreatedDate=null,
/** @var array<UserAccessKeys>|null */
public ?array $DeletedAccessKeys=null,
/** @var array<UserAccessKeys>|null */
public ?array $CreatedOrUpdatedAccessKeys=null
) {
parent::__construct($Id,$Firstname,$Lastname,$Email,$Phone,$ImageUrl,$CustomFields,$CustomFieldValues,$Comments,$AccessKeys,$Updated,$Created,$ResponseStatus,$SubscribedToNewsletter,$InvoiceAddress);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['FacebookUserName'])) $this->FacebookUserName = $o['FacebookUserName'];
if (isset($o['UserId'])) $this->UserId = $o['UserId'];
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
if (isset($o['CreatedDate'])) $this->CreatedDate = JsonConverters::from('DateTime', $o['CreatedDate']);
if (isset($o['DeletedAccessKeys'])) $this->DeletedAccessKeys = JsonConverters::fromArray('UserAccessKeys', $o['DeletedAccessKeys']);
if (isset($o['CreatedOrUpdatedAccessKeys'])) $this->CreatedOrUpdatedAccessKeys = JsonConverters::fromArray('UserAccessKeys', $o['CreatedOrUpdatedAccessKeys']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->FacebookUserName)) $o['FacebookUserName'] = $this->FacebookUserName;
if (isset($this->UserId)) $o['UserId'] = $this->UserId;
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
if (isset($this->CreatedDate)) $o['CreatedDate'] = JsonConverters::to('DateTime', $this->CreatedDate);
if (isset($this->DeletedAccessKeys)) $o['DeletedAccessKeys'] = JsonConverters::toArray('UserAccessKeys', $this->DeletedAccessKeys);
if (isset($this->CreatedOrUpdatedAccessKeys)) $o['CreatedOrUpdatedAccessKeys'] = JsonConverters::toArray('UserAccessKeys', $this->CreatedOrUpdatedAccessKeys);
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;
}
}
class AddUserAccessKey implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Id=null,
/** @var string|null */
public ?string $CompanyId=null,
/** @var int */
public int $AccessKeyTypeId=0,
/** @var string|null */
public ?string $Value=null,
/** @var string|null */
public ?string $CustomerId=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['CompanyId'])) $this->CompanyId = $o['CompanyId'];
if (isset($o['AccessKeyTypeId'])) $this->AccessKeyTypeId = $o['AccessKeyTypeId'];
if (isset($o['Value'])) $this->Value = $o['Value'];
if (isset($o['CustomerId'])) $this->CustomerId = $o['CustomerId'];
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->CompanyId)) $o['CompanyId'] = $this->CompanyId;
if (isset($this->AccessKeyTypeId)) $o['AccessKeyTypeId'] = $this->AccessKeyTypeId;
if (isset($this->Value)) $o['Value'] = $this->Value;
if (isset($this->CustomerId)) $o['CustomerId'] = $this->CustomerId;
if (isset($this->Description)) $o['Description'] = $this->Description;
return empty($o) ? new class(){} : $o;
}
}
// @ApiResponse(Description="Returned if there is a validation error on the input parameters", StatusCode=400)
// @ApiResponse(Description="Returned if the current user is not allowed to perform the action", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class CreateCustomer implements JsonSerializable
{
public function __construct(
/** @description Enter the company and id for the customer, if blank company id and you are an admin, your company id will be used. */
// @ApiMember(Description="Enter the company and id for the customer, if blank company id and you are an admin, your company id will be used.", ParameterType="query")
/** @var string|null */
public ?string $CompanyId=null,
// @ApiMember(IsRequired=true)
/** @var string */
public string $Firstname='',
// @ApiMember(IsRequired=true)
/** @var string */
public string $Lastname='',
// @ApiMember(IsRequired=true)
/** @var string */
public string $Phone='',
// @ApiMember()
/** @var string|null */
public ?string $Email=null,
/** @description If Custom Fields are added to the customer, here you will send the id and the value for each custom field to be updated */
// @ApiMember(Description="If Custom Fields are added to the customer, here you will send the id and the value for each custom field to be updated")
/** @var array<AddCustomField>|null */
public ?array $CustomFields=null,
/** @description List of Access Keys */
// @ApiMember(Description="List of Access Keys")
/** @var array<AddUserAccessKey>|null */
public ?array $AccessKeys=null,
/** @description Customer invoice adress */
// @ApiMember(Description="Customer invoice adress")
/** @var InvoiceAddress|null */
public ?InvoiceAddress $InvoiceAddress=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
if (isset($o['Firstname'])) $this->Firstname = $o['Firstname'];
if (isset($o['Lastname'])) $this->Lastname = $o['Lastname'];
if (isset($o['Phone'])) $this->Phone = $o['Phone'];
if (isset($o['Email'])) $this->Email = $o['Email'];
if (isset($o['CustomFields'])) $this->CustomFields = JsonConverters::fromArray('AddCustomField', $o['CustomFields']);
if (isset($o['AccessKeys'])) $this->AccessKeys = JsonConverters::fromArray('AddUserAccessKey', $o['AccessKeys']);
if (isset($o['InvoiceAddress'])) $this->InvoiceAddress = JsonConverters::from('InvoiceAddress', $o['InvoiceAddress']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
if (isset($this->Firstname)) $o['Firstname'] = $this->Firstname;
if (isset($this->Lastname)) $o['Lastname'] = $this->Lastname;
if (isset($this->Phone)) $o['Phone'] = $this->Phone;
if (isset($this->Email)) $o['Email'] = $this->Email;
if (isset($this->CustomFields)) $o['CustomFields'] = JsonConverters::toArray('AddCustomField', $this->CustomFields);
if (isset($this->AccessKeys)) $o['AccessKeys'] = JsonConverters::toArray('AddUserAccessKey', $this->AccessKeys);
if (isset($this->InvoiceAddress)) $o['InvoiceAddress'] = JsonConverters::to('InvoiceAddress', $this->InvoiceAddress);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /customers HTTP/1.1
Host: api.bokamera.se
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
CompanyId: 00000000-0000-0000-0000-000000000000,
Firstname: String,
Lastname: String,
Phone: String,
Email: String,
CustomFields:
[
{
Id: 0,
Value: String
}
],
AccessKeys:
[
{
Id: 00000000-0000-0000-0000-000000000000,
CompanyId: 00000000-0000-0000-0000-000000000000,
AccessKeyTypeId: 0,
Value: String,
CustomerId: 00000000-0000-0000-0000-000000000000,
Description: String
}
],
InvoiceAddress:
{
CorporateIdentityNumber: String,
InvoiceAddress1: String,
InvoiceAddress2: String,
InvoiceCity: String,
InvoicePostalCode: String,
InvoiceCountryCode: String
}
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { FacebookUserName: String, UserId: 00000000-0000-0000-0000-000000000000, CompanyId: 00000000-0000-0000-0000-000000000000, CreatedDate: "0001-01-01T00:00:00", DeletedAccessKeys: [ { AccessKeyTypeId: 0, Value: String, Description: String } ], CreatedOrUpdatedAccessKeys: [ { AccessKeyTypeId: 0, Value: String, Description: String } ], Firstname: String, Lastname: String, Email: String, Phone: String, ImageUrl: String, CustomFields: [ { "Id": 0, "Name": "String", "Description": "String", "Width": 0, "DataType": "String", "DefaultValue": "String", "IsMandatory": false, "MandatoryErrorMessage": "String", "MaxLength": 0, "MultipleLineText": false, "RegEx": "String", "RegExErrorMessage": "String", "Values": [ { "Value": "String" } ] } ], CustomFieldValues: [ { Id: 0, Column: String, Name: String, Description: String, Value: String, DataType: String } ], Comments: [ { Id: 0, Comments: String } ], AccessKeys: [ { AccessKeyTypeId: 0, Value: String, Description: String } ], ResponseStatus: {}, SubscribedToNewsletter: False, InvoiceAddress: { CorporateIdentityNumber: String, InvoiceAddress1: String, InvoiceAddress2: String, InvoiceCity: String, InvoicePostalCode: String, InvoiceCountryCode: String } }