BokaMera.API.Host

<back to all web services

AddTagsToCustomer

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/customers/{CustomerId}/tagsAdd tags to a customerAttaches one or more tags to an existing customer.
import 'package:servicestack/servicestack.dart';

class CustomFieldValueResponse implements IConvertible
{
    String Value = "";

    CustomFieldValueResponse({this.Value});
    CustomFieldValueResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Value = json['Value'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Value': Value
    };

    getTypeName() => "CustomFieldValueResponse";
    TypeContext? context = _ctx;
}

class CustomFieldConfigData implements IConvertible
{
    /**
    * Custom field id
    */
    // @ApiMember(Description="Custom field id")
    int Id = 0;

    /**
    * Configuration name. Example: 'Number of persons'.
    */
    // @ApiMember(Description="Configuration name. Example: 'Number of persons'.")
    String Name = "";

    /**
    * 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 = "";

    /**
    * Field width. Example: 20 for 20px
    */
    // @ApiMember(Description="Field width. Example: 20 for 20px")
    int? Width;

    /**
    * 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 = 0;

    /**
    * 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 = "";

    /**
    * Error message shown if the regular expression validation failed
    */
    // @ApiMember(Description="Error message shown if the regular expression validation failed")
    String RegExErrorMessage = "";

    /**
    * 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<CustomFieldValueResponse> Values = [];

    CustomFieldConfigData({this.Id,this.Name,this.Description,this.Width,this.DataType,this.DefaultValue,this.IsMandatory,this.MandatoryErrorMessage,this.MaxLength,this.MultipleLineText,this.RegEx,this.RegExErrorMessage,this.Values});
    CustomFieldConfigData.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Name = json['Name'];
        Description = json['Description'];
        Width = json['Width'];
        DataType = json['DataType'];
        DefaultValue = json['DefaultValue'];
        IsMandatory = json['IsMandatory'];
        MandatoryErrorMessage = json['MandatoryErrorMessage'];
        MaxLength = json['MaxLength'];
        MultipleLineText = json['MultipleLineText'];
        RegEx = json['RegEx'];
        RegExErrorMessage = json['RegExErrorMessage'];
        Values = JsonConverters.fromJson(json['Values'],'List<CustomFieldValueResponse>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Name': Name,
        'Description': Description,
        'Width': Width,
        'DataType': DataType,
        'DefaultValue': DefaultValue,
        'IsMandatory': IsMandatory,
        'MandatoryErrorMessage': MandatoryErrorMessage,
        'MaxLength': MaxLength,
        'MultipleLineText': MultipleLineText,
        'RegEx': RegEx,
        'RegExErrorMessage': RegExErrorMessage,
        'Values': JsonConverters.toJson(Values,'List<CustomFieldValueResponse>',context!)
    };

    getTypeName() => "CustomFieldConfigData";
    TypeContext? context = _ctx;
}

class CustomFieldDataResponse implements IConvertible
{
    int Id = 0;
    String Column = "";
    String Name = "";
    String Description = "";
    String Value = "";
    /**
    * 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 = "";

    CustomFieldDataResponse({this.Id,this.Column,this.Name,this.Description,this.Value,this.DataType});
    CustomFieldDataResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Column = json['Column'];
        Name = json['Name'];
        Description = json['Description'];
        Value = json['Value'];
        DataType = json['DataType'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Column': Column,
        'Name': Name,
        'Description': Description,
        'Value': Value,
        'DataType': DataType
    };

    getTypeName() => "CustomFieldDataResponse";
    TypeContext? context = _ctx;
}

class CustomerCommentsResponse implements IConvertible
{
    int Id = 0;
    String CustomerId = "";
    String Comments = "";
    DateTime Updated = DateTime(0);
    DateTime Created = DateTime(0);
    Uri ImageUrl;

    CustomerCommentsResponse({this.Id,this.CustomerId,this.Comments,this.Updated,this.Created,this.ImageUrl});
    CustomerCommentsResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        CustomerId = json['CustomerId'];
        Comments = json['Comments'];
        Updated = JsonConverters.fromJson(json['Updated'],'DateTime',context!);
        Created = JsonConverters.fromJson(json['Created'],'DateTime',context!);
        ImageUrl = JsonConverters.fromJson(json['ImageUrl'],'Uri',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'CustomerId': CustomerId,
        'Comments': Comments,
        'Updated': JsonConverters.toJson(Updated,'DateTime',context!),
        'Created': JsonConverters.toJson(Created,'DateTime',context!),
        'ImageUrl': JsonConverters.toJson(ImageUrl,'Uri',context!)
    };

    getTypeName() => "CustomerCommentsResponse";
    TypeContext? context = _ctx;
}

class BaseModel implements IConvertible
{
    BaseModel();
    BaseModel.fromJson(Map<String, dynamic> json) : super();
    fromMap(Map<String, dynamic> json) {
        return this;
    }

    Map<String, dynamic> toJson() => {};
    getTypeName() => "BaseModel";
    TypeContext? context = _ctx;
}

class UserAccessKeys extends BaseModel implements IConvertible
{
    // @Required()
    String CompanyId = "";

    // @Required()
    int AccessKeyTypeId = 0;

    // @Required()
    String Value = "";

    // @Required()
    String CustomerId = "";

    String? Description;
    // @Required()
    String Id = "";

    UserAccessKeys({this.CompanyId,this.AccessKeyTypeId,this.Value,this.CustomerId,this.Description,this.Id});
    UserAccessKeys.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        CompanyId = json['CompanyId'];
        AccessKeyTypeId = json['AccessKeyTypeId'];
        Value = json['Value'];
        CustomerId = json['CustomerId'];
        Description = json['Description'];
        Id = json['Id'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'CompanyId': CompanyId,
        'AccessKeyTypeId': AccessKeyTypeId,
        'Value': Value,
        'CustomerId': CustomerId,
        'Description': Description,
        'Id': Id
    });

    getTypeName() => "UserAccessKeys";
    TypeContext? context = _ctx;
}

class InvoiceAddressResponse implements IConvertible
{
    String InvoiceAddressId = "";
    String? UserId;
    String CorporateIdentityNumber = "";
    String InvoiceAddress1 = "";
    String InvoiceAddress2 = "";
    String InvoiceCity = "";
    String InvoicePostalCode = "";
    String InvoiceCountryCode = "";

    InvoiceAddressResponse({this.InvoiceAddressId,this.UserId,this.CorporateIdentityNumber,this.InvoiceAddress1,this.InvoiceAddress2,this.InvoiceCity,this.InvoicePostalCode,this.InvoiceCountryCode});
    InvoiceAddressResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        InvoiceAddressId = json['InvoiceAddressId'];
        UserId = json['UserId'];
        CorporateIdentityNumber = json['CorporateIdentityNumber'];
        InvoiceAddress1 = json['InvoiceAddress1'];
        InvoiceAddress2 = json['InvoiceAddress2'];
        InvoiceCity = json['InvoiceCity'];
        InvoicePostalCode = json['InvoicePostalCode'];
        InvoiceCountryCode = json['InvoiceCountryCode'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'InvoiceAddressId': InvoiceAddressId,
        'UserId': UserId,
        'CorporateIdentityNumber': CorporateIdentityNumber,
        'InvoiceAddress1': InvoiceAddress1,
        'InvoiceAddress2': InvoiceAddress2,
        'InvoiceCity': InvoiceCity,
        'InvoicePostalCode': InvoicePostalCode,
        'InvoiceCountryCode': InvoiceCountryCode
    };

    getTypeName() => "InvoiceAddressResponse";
    TypeContext? context = _ctx;
}

class TagResponse implements IConvertible
{
    int Id = 0;
    String CompanyId = "";
    String Name = "";
    int Scope = 0;
    String Color = "";
    int SortOrder = 0;
    bool Active;
    DateTime CreatedDate = DateTime(0);
    ResponseStatus ResponseStatus;

    TagResponse({this.Id,this.CompanyId,this.Name,this.Scope,this.Color,this.SortOrder,this.Active,this.CreatedDate,this.ResponseStatus});
    TagResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        CompanyId = json['CompanyId'];
        Name = json['Name'];
        Scope = json['Scope'];
        Color = json['Color'];
        SortOrder = json['SortOrder'];
        Active = json['Active'];
        CreatedDate = JsonConverters.fromJson(json['CreatedDate'],'DateTime',context!);
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'CompanyId': CompanyId,
        'Name': Name,
        'Scope': Scope,
        'Color': Color,
        'SortOrder': SortOrder,
        'Active': Active,
        'CreatedDate': JsonConverters.toJson(CreatedDate,'DateTime',context!),
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!)
    };

    getTypeName() => "TagResponse";
    TypeContext? context = _ctx;
}

class CustomerQueryResponse implements IConvertible
{
    String Id = "";
    String Firstname = "";
    String Lastname = "";
    String Email = "";
    String Phone = "";
    String ImageUrl = "";
    String PersonalIdentityNumber = "";
    List<CustomFieldConfigData> CustomFields = [];
    List<CustomFieldDataResponse> CustomFieldValues = [];
    List<CustomerCommentsResponse> Comments = [];
    List<UserAccessKeys> AccessKeys = [];
    DateTime Updated = DateTime(0);
    DateTime Created = DateTime(0);
    dynamic ResponseStatus;
    bool SubscribedToNewsletter;
    InvoiceAddressResponse InvoiceAddress;
    List<TagResponse> Tags = [];

    CustomerQueryResponse({this.Id,this.Firstname,this.Lastname,this.Email,this.Phone,this.ImageUrl,this.PersonalIdentityNumber,this.CustomFields,this.CustomFieldValues,this.Comments,this.AccessKeys,this.Updated,this.Created,this.ResponseStatus,this.SubscribedToNewsletter,this.InvoiceAddress,this.Tags});
    CustomerQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Firstname = json['Firstname'];
        Lastname = json['Lastname'];
        Email = json['Email'];
        Phone = json['Phone'];
        ImageUrl = json['ImageUrl'];
        PersonalIdentityNumber = json['PersonalIdentityNumber'];
        CustomFields = JsonConverters.fromJson(json['CustomFields'],'List<CustomFieldConfigData>',context!);
        CustomFieldValues = JsonConverters.fromJson(json['CustomFieldValues'],'List<CustomFieldDataResponse>',context!);
        Comments = JsonConverters.fromJson(json['Comments'],'List<CustomerCommentsResponse>',context!);
        AccessKeys = JsonConverters.fromJson(json['AccessKeys'],'List<UserAccessKeys>',context!);
        Updated = JsonConverters.fromJson(json['Updated'],'DateTime',context!);
        Created = JsonConverters.fromJson(json['Created'],'DateTime',context!);
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'dynamic',context!);
        SubscribedToNewsletter = json['SubscribedToNewsletter'];
        InvoiceAddress = JsonConverters.fromJson(json['InvoiceAddress'],'InvoiceAddressResponse',context!);
        Tags = JsonConverters.fromJson(json['Tags'],'List<TagResponse>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Firstname': Firstname,
        'Lastname': Lastname,
        'Email': Email,
        'Phone': Phone,
        'ImageUrl': ImageUrl,
        'PersonalIdentityNumber': PersonalIdentityNumber,
        'CustomFields': JsonConverters.toJson(CustomFields,'List<CustomFieldConfigData>',context!),
        'CustomFieldValues': JsonConverters.toJson(CustomFieldValues,'List<CustomFieldDataResponse>',context!),
        'Comments': JsonConverters.toJson(Comments,'List<CustomerCommentsResponse>',context!),
        'AccessKeys': JsonConverters.toJson(AccessKeys,'List<UserAccessKeys>',context!),
        'Updated': JsonConverters.toJson(Updated,'DateTime',context!),
        'Created': JsonConverters.toJson(Created,'DateTime',context!),
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'dynamic',context!),
        'SubscribedToNewsletter': SubscribedToNewsletter,
        'InvoiceAddress': JsonConverters.toJson(InvoiceAddress,'InvoiceAddressResponse',context!),
        'Tags': JsonConverters.toJson(Tags,'List<TagResponse>',context!)
    };

    getTypeName() => "CustomerQueryResponse";
    TypeContext? context = _ctx;
}

// @ApiResponse(Description="Returned if a tag does not belong to this company or has the wrong scope", StatusCode=400)
// @ApiResponse(Description="Returned if the customer was not found", StatusCode=404)
// @ApiResponse(Description="Returned if the current user is not allowed to perform the action", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class AddTagsToCustomer 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;

    /**
    * The customer id.
    */
    // @ApiMember(Description="The customer id.", IsRequired=true, ParameterType="path")
    String CustomerId = "";

    /**
    * The ids of the tags to attach.
    */
    // @ApiMember(Description="The ids of the tags to attach.", IsRequired=true)
    List<int> TagIds = [];

    AddTagsToCustomer({this.CompanyId,this.CustomerId,this.TagIds});
    AddTagsToCustomer.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        CustomerId = json['CustomerId'];
        TagIds = JsonConverters.fromJson(json['TagIds'],'List<int>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'CustomerId': CustomerId,
        'TagIds': JsonConverters.toJson(TagIds,'List<int>',context!)
    };

    getTypeName() => "AddTagsToCustomer";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'api.bookmore.com', types: <String, TypeInfo> {
    'CustomFieldValueResponse': TypeInfo(TypeOf.Class, create:() => CustomFieldValueResponse()),
    'CustomFieldConfigData': TypeInfo(TypeOf.Class, create:() => CustomFieldConfigData()),
    'List<CustomFieldValueResponse>': TypeInfo(TypeOf.Class, create:() => <CustomFieldValueResponse>[]),
    'CustomFieldDataResponse': TypeInfo(TypeOf.Class, create:() => CustomFieldDataResponse()),
    'CustomerCommentsResponse': TypeInfo(TypeOf.Class, create:() => CustomerCommentsResponse()),
    'Uri': TypeInfo(TypeOf.Class, create:() => Uri()),
    'BaseModel': TypeInfo(TypeOf.Class, create:() => BaseModel()),
    'UserAccessKeys': TypeInfo(TypeOf.Class, create:() => UserAccessKeys()),
    'InvoiceAddressResponse': TypeInfo(TypeOf.Class, create:() => InvoiceAddressResponse()),
    'TagResponse': TypeInfo(TypeOf.Class, create:() => TagResponse()),
    'CustomerQueryResponse': TypeInfo(TypeOf.Class, create:() => CustomerQueryResponse()),
    'List<CustomFieldConfigData>': TypeInfo(TypeOf.Class, create:() => <CustomFieldConfigData>[]),
    'List<CustomFieldDataResponse>': TypeInfo(TypeOf.Class, create:() => <CustomFieldDataResponse>[]),
    'List<CustomerCommentsResponse>': TypeInfo(TypeOf.Class, create:() => <CustomerCommentsResponse>[]),
    'List<UserAccessKeys>': TypeInfo(TypeOf.Class, create:() => <UserAccessKeys>[]),
    'List<TagResponse>': TypeInfo(TypeOf.Class, create:() => <TagResponse>[]),
    'AddTagsToCustomer': TypeInfo(TypeOf.Class, create:() => AddTagsToCustomer()),
});

Dart AddTagsToCustomer DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other

HTTP + OTHER

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

POST /customers/{CustomerId}/tags HTTP/1.1 
Host: api.bookmore.com 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","TagIds":[0]}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Firstname":"String","Lastname":"String","Email":"String","Phone":"String","ImageUrl":"String","PersonalIdentityNumber":"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":{"UserId":"00000000-0000-0000-0000-000000000000","CorporateIdentityNumber":"String","InvoiceAddress1":"String","InvoiceAddress2":"String","InvoiceCity":"String","InvoicePostalCode":"String","InvoiceCountryCode":"String"},"Tags":[{"Id":0,"Name":"String","Scope":0,"Color":"String","SortOrder":0,"Active":false,"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}]}