Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
DELETE | /customfields/{Id} | Delete a custom field | Delete a custom field for the currently logged in user, only administrators are allowed to delete custom fields. |
---|
<?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 CustomFieldLookupResponse implements JsonSerializable
{
public function __construct(
/** @var int|null */
public ?int $Id=null,
/** @var bool|null */
public ?bool $Active=null,
/** @var int|null */
public ?int $SortOrder=null,
/** @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['Active'])) $this->Active = $o['Active'];
if (isset($o['SortOrder'])) $this->SortOrder = $o['SortOrder'];
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->Active)) $o['Active'] = $this->Active;
if (isset($this->SortOrder)) $o['SortOrder'] = $this->SortOrder;
if (isset($this->Value)) $o['Value'] = $this->Value;
return empty($o) ? new class(){} : $o;
}
}
class CustomFieldServices implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @description Name of the service */
// @ApiMember(Description="Name of the service")
/** @var string|null */
public ?string $Name=null,
/** @description The image url of the service */
// @ApiMember(Description="The image url of the service")
/** @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['Name'])) $this->Name = $o['Name'];
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->Name)) $o['Name'] = $this->Name;
if (isset($this->ImageUrl)) $o['ImageUrl'] = JsonConverters::to('string', $this->ImageUrl);
return empty($o) ? new class(){} : $o;
}
}
class CustomFieldQueryResponse implements JsonSerializable
{
public function __construct(
/** @description Custom field id */
// @ApiMember(Description="Custom field id")
/** @var int */
public int $Id=0,
/** @description Reference to company that owns the custom field configuration */
// @ApiMember(Description="Reference to company that owns the custom field configuration")
/** @var string */
public string $CompanyId='',
/** @description Group id */
// @ApiMember(Description="Group id")
/** @var int|null */
public ?int $GroupId=null,
/** @description Field id */
// @ApiMember(Description="Field id")
/** @var int */
public int $FieldId=0,
/** @description Configuration name. Example: 'Number of persons'. */
// @ApiMember(Description="Configuration name. Example: 'Number of persons'.")
/** @var string|null */
public ?string $Name=null,
/** @description Field width. Example: 20 */
// @ApiMember(Description="Field width. Example: 20")
/** @var int */
public int $Width=0,
/** @description Column in database where to store the information. Example: 'TextField1' */
// @ApiMember(Description="Column in database where to store the information. Example: 'TextField1'")
/** @var string|null */
public ?string $Column=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 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 Regular expression id for validation of the field */
// @ApiMember(Description="Regular expression id for validation of the field")
/** @var int|null */
public ?int $RegExId=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 If the field is visible to the customer */
// @ApiMember(Description="If the field is visible to the customer")
/** @var bool|null */
public ?bool $IsPublic=null,
/** @description If the field should be hidden in lists */
// @ApiMember(Description="If the field should be hidden in lists")
/** @var bool|null */
public ?bool $IsHidden=null,
/** @description Table to which the field belongs */
// @ApiMember(Description="Table to which the field belongs")
/** @var string|null */
public ?string $Table=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<CustomFieldLookupResponse>|null */
public ?array $Values=null,
/** @description The services that is connected to the custom field */
// @ApiMember(Description="The services that is connected to the custom field")
/** @var array<CustomFieldServices>|null */
public ?array $Services=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['GroupId'])) $this->GroupId = $o['GroupId'];
if (isset($o['FieldId'])) $this->FieldId = $o['FieldId'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Width'])) $this->Width = $o['Width'];
if (isset($o['Column'])) $this->Column = $o['Column'];
if (isset($o['Description'])) $this->Description = $o['Description'];
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['RegExId'])) $this->RegExId = $o['RegExId'];
if (isset($o['RegExErrorMessage'])) $this->RegExErrorMessage = $o['RegExErrorMessage'];
if (isset($o['IsPublic'])) $this->IsPublic = $o['IsPublic'];
if (isset($o['IsHidden'])) $this->IsHidden = $o['IsHidden'];
if (isset($o['Table'])) $this->Table = $o['Table'];
if (isset($o['Values'])) $this->Values = JsonConverters::fromArray('CustomFieldLookupResponse', $o['Values']);
if (isset($o['Services'])) $this->Services = JsonConverters::fromArray('CustomFieldServices', $o['Services']);
}
/** @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->GroupId)) $o['GroupId'] = $this->GroupId;
if (isset($this->FieldId)) $o['FieldId'] = $this->FieldId;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Width)) $o['Width'] = $this->Width;
if (isset($this->Column)) $o['Column'] = $this->Column;
if (isset($this->Description)) $o['Description'] = $this->Description;
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->RegExId)) $o['RegExId'] = $this->RegExId;
if (isset($this->RegExErrorMessage)) $o['RegExErrorMessage'] = $this->RegExErrorMessage;
if (isset($this->IsPublic)) $o['IsPublic'] = $this->IsPublic;
if (isset($this->IsHidden)) $o['IsHidden'] = $this->IsHidden;
if (isset($this->Table)) $o['Table'] = $this->Table;
if (isset($this->Values)) $o['Values'] = JsonConverters::toArray('CustomFieldLookupResponse', $this->Values);
if (isset($this->Services)) $o['Services'] = JsonConverters::toArray('CustomFieldServices', $this->Services);
return empty($o) ? new class(){} : $o;
}
}
// @ValidateRequest(Validator="IsAuthenticated")
class DeleteCustomField implements ICompany, JsonSerializable
{
public function __construct(
/** @description The company id, if empty will use the company id for the user you are logged in with. */
// @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
/** @var string|null */
public ?string $CompanyId=null,
/** @description Id of the custom field to delete */
// @ApiMember(Description="Id of the custom field to delete", IsRequired=true, ParameterType="path")
/** @var int */
public int $Id=0
) {
}
/** @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 .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
DELETE /customfields/{Id} HTTP/1.1 Host: api.bokamera.se Accept: text/jsonl
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"Id":0,"GroupId":0,"FieldId":0,"Name":"String","Width":0,"Column":"String","Description":"String","DataType":"String","DefaultValue":"String","IsMandatory":false,"MandatoryErrorMessage":"String","MaxLength":0,"MultipleLineText":false,"RegEx":"String","RegExId":0,"RegExErrorMessage":"String","IsPublic":false,"IsHidden":false,"Table":"String","Values":[{"Id":0,"Active":false,"SortOrder":0,"Value":"String"}],"Services":[{"Id":0,"Name":"String"}]}