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. |
---|
import 'package:servicestack/servicestack.dart';
class CustomFieldLookupResponse implements IConvertible
{
int? Id;
bool? Active;
int? SortOrder;
String? Value;
CustomFieldLookupResponse({this.Id,this.Active,this.SortOrder,this.Value});
CustomFieldLookupResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
Active = json['Active'];
SortOrder = json['SortOrder'];
Value = json['Value'];
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'Active': Active,
'SortOrder': SortOrder,
'Value': Value
};
getTypeName() => "CustomFieldLookupResponse";
TypeContext? context = _ctx;
}
class CustomFieldServices implements IConvertible
{
int? Id;
/**
* Name of the service
*/
// @ApiMember(Description="Name of the service")
String? Name;
/**
* The image url of the service
*/
// @ApiMember(Description="The image url of the service")
Uri? ImageUrl;
CustomFieldServices({this.Id,this.Name,this.ImageUrl});
CustomFieldServices.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
Name = json['Name'];
ImageUrl = JsonConverters.fromJson(json['ImageUrl'],'Uri',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'Name': Name,
'ImageUrl': JsonConverters.toJson(ImageUrl,'Uri',context!)
};
getTypeName() => "CustomFieldServices";
TypeContext? context = _ctx;
}
class CustomFieldQueryResponse implements IConvertible
{
/**
* Custom field id
*/
// @ApiMember(Description="Custom field id")
int? Id;
/**
* Reference to company that owns the custom field configuration
*/
// @ApiMember(Description="Reference to company that owns the custom field configuration")
String? CompanyId;
/**
* Group id
*/
// @ApiMember(Description="Group id")
int? GroupId;
/**
* Field id
*/
// @ApiMember(Description="Field id")
int? FieldId;
/**
* Configuration name. Example: 'Number of persons'.
*/
// @ApiMember(Description="Configuration name. Example: 'Number of persons'.")
String? Name;
/**
* Field width. Example: 20
*/
// @ApiMember(Description="Field width. Example: 20")
int? Width;
/**
* Column in database where to store the information. Example: 'TextField1'
*/
// @ApiMember(Description="Column in database where to store the information. Example: 'TextField1'")
String? Column;
/**
* Custom field description. Example: 'For how many persons is this booking?'
*/
// @ApiMember(Description="Custom field description. Example: 'For how many persons is this booking?'")
String? 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'")
String? DataType;
/**
* Default value of the field. Example: '3'
*/
// @ApiMember(Description="Default value of the field. Example: '3'")
String? DefaultValue;
/**
* 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")
bool? IsMandatory;
/**
* 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")
String? MandatoryErrorMessage;
/**
* Max lenght of the field
*/
// @ApiMember(Description="Max lenght of the field")
int? MaxLength;
/**
* If the field should have multiple lines
*/
// @ApiMember(Description="If the field should have multiple lines")
bool? MultipleLineText;
/**
* Regular expression used for validation of the field
*/
// @ApiMember(Description="Regular expression used for validation of the field")
String? RegEx;
/**
* Regular expression id for validation of the field
*/
// @ApiMember(Description="Regular expression id for validation of the field")
int? RegExId;
/**
* Error message shown if the regular expression validation failed
*/
// @ApiMember(Description="Error message shown if the regular expression validation failed")
String? RegExErrorMessage;
/**
* If the field is visible to the customer
*/
// @ApiMember(Description="If the field is visible to the customer")
bool? IsPublic;
/**
* If the field should be hidden in lists
*/
// @ApiMember(Description="If the field should be hidden in lists")
bool? IsHidden;
/**
* Table to which the field belongs
*/
// @ApiMember(Description="Table to which the field belongs")
String? Table;
/**
* 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")
List<CustomFieldLookupResponse>? Values;
/**
* The services that is connected to the custom field
*/
// @ApiMember(Description="The services that is connected to the custom field")
List<CustomFieldServices>? Services;
CustomFieldQueryResponse({this.Id,this.CompanyId,this.GroupId,this.FieldId,this.Name,this.Width,this.Column,this.Description,this.DataType,this.DefaultValue,this.IsMandatory,this.MandatoryErrorMessage,this.MaxLength,this.MultipleLineText,this.RegEx,this.RegExId,this.RegExErrorMessage,this.IsPublic,this.IsHidden,this.Table,this.Values,this.Services});
CustomFieldQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
CompanyId = json['CompanyId'];
GroupId = json['GroupId'];
FieldId = json['FieldId'];
Name = json['Name'];
Width = json['Width'];
Column = json['Column'];
Description = json['Description'];
DataType = json['DataType'];
DefaultValue = json['DefaultValue'];
IsMandatory = json['IsMandatory'];
MandatoryErrorMessage = json['MandatoryErrorMessage'];
MaxLength = json['MaxLength'];
MultipleLineText = json['MultipleLineText'];
RegEx = json['RegEx'];
RegExId = json['RegExId'];
RegExErrorMessage = json['RegExErrorMessage'];
IsPublic = json['IsPublic'];
IsHidden = json['IsHidden'];
Table = json['Table'];
Values = JsonConverters.fromJson(json['Values'],'List<CustomFieldLookupResponse>',context!);
Services = JsonConverters.fromJson(json['Services'],'List<CustomFieldServices>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'CompanyId': CompanyId,
'GroupId': GroupId,
'FieldId': FieldId,
'Name': Name,
'Width': Width,
'Column': Column,
'Description': Description,
'DataType': DataType,
'DefaultValue': DefaultValue,
'IsMandatory': IsMandatory,
'MandatoryErrorMessage': MandatoryErrorMessage,
'MaxLength': MaxLength,
'MultipleLineText': MultipleLineText,
'RegEx': RegEx,
'RegExId': RegExId,
'RegExErrorMessage': RegExErrorMessage,
'IsPublic': IsPublic,
'IsHidden': IsHidden,
'Table': Table,
'Values': JsonConverters.toJson(Values,'List<CustomFieldLookupResponse>',context!),
'Services': JsonConverters.toJson(Services,'List<CustomFieldServices>',context!)
};
getTypeName() => "CustomFieldQueryResponse";
TypeContext? context = _ctx;
}
// @ValidateRequest(Validator="IsAuthenticated")
class DeleteCustomField implements ICompany, IConvertible
{
/**
* 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.")
String? CompanyId;
/**
* Id of the custom field to delete
*/
// @ApiMember(Description="Id of the custom field to delete", IsRequired=true, ParameterType="path")
int? Id;
DeleteCustomField({this.CompanyId,this.Id});
DeleteCustomField.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
CompanyId = json['CompanyId'];
Id = json['Id'];
return this;
}
Map<String, dynamic> toJson() => {
'CompanyId': CompanyId,
'Id': Id
};
getTypeName() => "DeleteCustomField";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'api.bokamera.se', types: <String, TypeInfo> {
'CustomFieldLookupResponse': TypeInfo(TypeOf.Class, create:() => CustomFieldLookupResponse()),
'CustomFieldServices': TypeInfo(TypeOf.Class, create:() => CustomFieldServices()),
'Uri': TypeInfo(TypeOf.Class, create:() => Uri()),
'CustomFieldQueryResponse': TypeInfo(TypeOf.Class, create:() => CustomFieldQueryResponse()),
'List<CustomFieldLookupResponse>': TypeInfo(TypeOf.Class, create:() => <CustomFieldLookupResponse>[]),
'List<CustomFieldServices>': TypeInfo(TypeOf.Class, create:() => <CustomFieldServices>[]),
'DeleteCustomField': TypeInfo(TypeOf.Class, create:() => DeleteCustomField()),
});
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.
DELETE /customfields/{Id} HTTP/1.1 Host: api.bokamera.se Accept: text/jsv
HTTP/1.1 200 OK Content-Type: text/jsv 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 } ] }