Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
DELETE | /customers/{Id} | Delete an existing customer | Delete an existing user if the current logged in user is allowed to update the specified customer. All connected information to the customer will be deleted. |
---|
<?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;
}
}
// @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 DeleteCustomer 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,
/** @description customer id */
// @ApiMember(Description="customer id", IsRequired=true, ParameterType="path")
/** @var string */
public string $Id=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
if (isset($o['Id'])) $this->Id = $o['Id'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
if (isset($this->Id)) $o['Id'] = $this->Id;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
DELETE /customers/{Id} HTTP/1.1 Host: api.bokamera.se Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <CustomerQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <AccessKeys xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Db"> <d2p1:UserAccessKeys> <d2p1:AccessKeyTypeId>0</d2p1:AccessKeyTypeId> <d2p1:CompanyId>00000000-0000-0000-0000-000000000000</d2p1:CompanyId> <d2p1:CustomerId>00000000-0000-0000-0000-000000000000</d2p1:CustomerId> <d2p1:Description>String</d2p1:Description> <d2p1:Id>00000000-0000-0000-0000-000000000000</d2p1:Id> <d2p1:Value>String</d2p1:Value> </d2p1:UserAccessKeys> </AccessKeys> <Comments> <CustomerCommentsResponse> <Comments>String</Comments> <Created>0001-01-01T00:00:00</Created> <CustomerId>00000000-0000-0000-0000-000000000000</CustomerId> <Id>0</Id> <ImageUrl i:nil="true" /> <Updated>0001-01-01T00:00:00</Updated> </CustomerCommentsResponse> </Comments> <Created>0001-01-01T00:00:00</Created> <CustomFieldValues> <CustomFieldDataResponse> <Column>String</Column> <DataType>String</DataType> <Description>String</Description> <Id>0</Id> <Name>String</Name> <Value>String</Value> </CustomFieldDataResponse> </CustomFieldValues> <CustomFields> <CustomFieldConfigData> <DataType>String</DataType> <DefaultValue>String</DefaultValue> <Description>String</Description> <Id>0</Id> <IsMandatory>false</IsMandatory> <MandatoryErrorMessage>String</MandatoryErrorMessage> <MaxLength>0</MaxLength> <MultipleLineText>false</MultipleLineText> <Name>String</Name> <RegEx>String</RegEx> <RegExErrorMessage>String</RegExErrorMessage> <Values> <CustomFieldValueResponse> <Value>String</Value> </CustomFieldValueResponse> </Values> <Width>0</Width> </CustomFieldConfigData> </CustomFields> <Email>String</Email> <Firstname>String</Firstname> <Id>00000000-0000-0000-0000-000000000000</Id> <ImageUrl>String</ImageUrl> <InvoiceAddress> <CorporateIdentityNumber>String</CorporateIdentityNumber> <InvoiceAddress1>String</InvoiceAddress1> <InvoiceAddress2>String</InvoiceAddress2> <InvoiceCity>String</InvoiceCity> <InvoiceCountryCode>String</InvoiceCountryCode> <InvoicePostalCode>String</InvoicePostalCode> </InvoiceAddress> <Lastname>String</Lastname> <Phone>String</Phone> <ResponseStatus /> <SubscribedToNewsletter>false</SubscribedToNewsletter> <Updated>0001-01-01T00:00:00</Updated> </CustomerQueryResponse>