BokaMera.API.Host

<back to all web services

TagQuery

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
GET/tagsGet tags for the companyReturns tags for the current company, optionally filtered by scope and active status.
import 'package:servicestack/servicestack.dart';

enum TagScope
{
    Booking,
    Customer,
}

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class TagQuery implements 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;

    /**
    * Filter by tag scope. 0 = Booking, 1 = Customer.
    */
    // @ApiMember(Description="Filter by tag scope. 0 = Booking, 1 = Customer.")
    TagScope? Scope;

    /**
    * Filter by active status. If not provided, only active tags are returned.
    */
    // @ApiMember(Description="Filter by active status. If not provided, only active tags are returned.")
    bool? Active;

    /**
    * Number of records to skip
    */
    // @ApiMember(Description="Number of records to skip")
    int? Skip;

    /**
    * Number of records to take
    */
    // @ApiMember(Description="Number of records to take")
    int? Take;

    /**
    * Sort field
    */
    // @ApiMember(Description="Sort field")
    String OrderBy = "";

    TagQuery({this.CompanyId,this.Scope,this.Active,this.Skip,this.Take,this.OrderBy});
    TagQuery.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        Scope = JsonConverters.fromJson(json['Scope'],'TagScope',context!);
        Active = json['Active'];
        Skip = json['Skip'];
        Take = json['Take'];
        OrderBy = json['OrderBy'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'Scope': JsonConverters.toJson(Scope,'TagScope',context!),
        'Active': Active,
        'Skip': Skip,
        'Take': Take,
        'OrderBy': OrderBy
    };

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

class AccessKeyTypeResponse implements IConvertible
{
    int Id = 0;
    String KeyType = "";
    String Description = "";

    AccessKeyTypeResponse({this.Id,this.KeyType,this.Description});
    AccessKeyTypeResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'KeyType': KeyType,
        'Description': Description
    };

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

// @DataContract
class QueryResponse<T> implements IConvertible
{
    // @DataMember(Order=1)
    int Offset = 0;

    // @DataMember(Order=2)
    int Total = 0;

    // @DataMember(Order=3)
    List<AccessKeyTypeResponse> Results = [];

    // @DataMember(Order=4)
    Map<String,String?>? Meta;

    // @DataMember(Order=5)
    ResponseStatus? ResponseStatus;

    QueryResponse({this.Offset,this.Total,this.Results,this.Meta,this.ResponseStatus});
    QueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Offset = json['Offset'];
        Total = json['Total'];
        Results = JsonConverters.fromJson(json['Results'],'List<AccessKeyTypeResponse>',context!);
        Meta = JsonConverters.toStringMap(json['Meta']);
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Offset': Offset,
        'Total': Total,
        'Results': JsonConverters.toJson(Results,'List<AccessKeyTypeResponse>',context!),
        'Meta': Meta,
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!)
    };

    getTypeName() => "QueryResponse<$T>";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'api.bookmore.com', types: <String, TypeInfo> {
    'TagScope': TypeInfo(TypeOf.Enum, enumValues:TagScope.values),
    'TagQuery': TypeInfo(TypeOf.Class, create:() => TagQuery()),
    'AccessKeyTypeResponse': TypeInfo(TypeOf.Class, create:() => AccessKeyTypeResponse()),
    'List<AccessKeyTypeResponse>': TypeInfo(TypeOf.Class, create:() => <AccessKeyTypeResponse>[]),
});

Dart TagQuery 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.

GET /tags HTTP/1.1 
Host: api.bookmore.com 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Offset":0,"Total":0,"Results":[{"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"}}}],"Meta":{"String":"String"},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}