BokaMera.API.Host

<back to all web services

AvaiableTimesGroupedQuery

The following routes are available for this service:
GET/services/{ServiceId}/availabletimes/groupedGet availabletimes for the serviceGet availabletimes for the service and it's connected schedules
import 'package:servicestack/servicestack.dart';

class ExceptionText implements IConvertible
{
    String? Reason;
    String? ReasonPublic;

    ExceptionText({this.Reason,this.ReasonPublic});
    ExceptionText.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

class AvailableTimesSum implements IAvailableTime, IConvertible
{
    DateTime? From;
    DateTime? To;
    int? Free;
    int? FreeSpots;
    List<ExceptionText>? ExceptionTexts;

    AvailableTimesSum({this.From,this.To,this.Free,this.FreeSpots,this.ExceptionTexts});
    AvailableTimesSum.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        From = JsonConverters.fromJson(json['From'],'DateTime',context!);
        To = JsonConverters.fromJson(json['To'],'DateTime',context!);
        Free = json['Free'];
        FreeSpots = json['FreeSpots'];
        ExceptionTexts = JsonConverters.fromJson(json['ExceptionTexts'],'List<ExceptionText>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'From': JsonConverters.toJson(From,'DateTime',context!),
        'To': JsonConverters.toJson(To,'DateTime',context!),
        'Free': Free,
        'FreeSpots': FreeSpots,
        'ExceptionTexts': JsonConverters.toJson(ExceptionTexts,'List<ExceptionText>',context!)
    };

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

class AvailableTimesGroupedDates implements IConvertible
{
    DateTime? Group;
    List<AvailableTimesSum>? Times;

    AvailableTimesGroupedDates({this.Group,this.Times});
    AvailableTimesGroupedDates.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Group = JsonConverters.fromJson(json['Group'],'DateTime',context!);
        Times = JsonConverters.fromJson(json['Times'],'List<AvailableTimesSum>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Group': JsonConverters.toJson(Group,'DateTime',context!),
        'Times': JsonConverters.toJson(Times,'List<AvailableTimesSum>',context!)
    };

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

class AvailableTimesGroupedDatesResponse implements IConvertible
{
    String? CompanyId;
    int? ServiceId;
    String? TimesFreeTextSingle;
    String? TimesFreeTextMultiple;
    List<AvailableTimesGroupedDates>? Items;

    AvailableTimesGroupedDatesResponse({this.CompanyId,this.ServiceId,this.TimesFreeTextSingle,this.TimesFreeTextMultiple,this.Items});
    AvailableTimesGroupedDatesResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        ServiceId = json['ServiceId'];
        TimesFreeTextSingle = json['TimesFreeTextSingle'];
        TimesFreeTextMultiple = json['TimesFreeTextMultiple'];
        Items = JsonConverters.fromJson(json['Items'],'List<AvailableTimesGroupedDates>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'ServiceId': ServiceId,
        'TimesFreeTextSingle': TimesFreeTextSingle,
        'TimesFreeTextMultiple': TimesFreeTextMultiple,
        'Items': JsonConverters.toJson(Items,'List<AvailableTimesGroupedDates>',context!)
    };

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

class AvailableTimesResourceTypeResource implements IConvertible
{
    /**
    * The resourcetype id
    */
    // @ApiMember(Description="The resourcetype id")
    int? ResourceTypeId;

    /**
    * The resource id
    */
    // @ApiMember(Description="The resource id")
    int? ResourceId;

    AvailableTimesResourceTypeResource({this.ResourceTypeId,this.ResourceId});
    AvailableTimesResourceTypeResource.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

class AvaiableTimesGroupedQuery implements IInterval, IConvertible
{
    /**
    * Company to show services for
    */
    // @ApiMember(Description="Company to show services for", ParameterType="query")
    String? CompanyId;

    /**
    * Service id
    */
    // @ApiMember(Description="Service id", IsRequired=true, ParameterType="path")
    int? ServiceId;

    /**
    * From what datetime to show available times
    */
    // @ApiMember(DataType="dateTime", Description="From what datetime to show available times", IsRequired=true, ParameterType="query")
    DateTime? From;

    /**
    * To what datetime to show available times
    */
    // @ApiMember(DataType="dateTime", Description="To what datetime to show available times", IsRequired=true, ParameterType="query")
    DateTime? To;

    /**
    * Here you can select one of the resource in each resourcetype connected to the service, if none is selected it will show available times for all
    */
    // @ApiMember(Description="Here you can select one of the resource in each resourcetype connected to the service, if none is selected it will show available times for all", ParameterType="query")
    List<AvailableTimesResourceTypeResource>? Resources;

    /**
    * Here you select number of resources to book (in each resourcetype). Default is 1.
    */
    // @ApiMember(Description="Here you select number of resources to book (in each resourcetype). Default is 1.", ParameterType="query")
    int? NumberOfResources;

    /**
    * If you want to include the connected resourcetypes and resources
    */
    // @ApiMember(Description="If you want to include the connected resourcetypes and resources", ParameterType="query")
    bool? ShowPerResource;

    /**
    * Both start and time time should be inside test interval. Default is false which means only start time needs to be inside.
    */
    // @ApiMember(DataType="bool", Description="Both start and time time should be inside test interval. Default is false which means only start time needs to be inside.", ParameterType="query")
    bool? InsideSearchInterval;

    /**
    * The duration you want to book. Needs to withing the service Min and Max. If not set it will use the service duration
    */
    // @ApiMember(DataType="bool", Description="The duration you want to book. Needs to withing the service Min and Max. If not set it will use the service duration", ParameterType="query")
    int? Duration;

    ResponseStatus? ResponseStatus;

    AvaiableTimesGroupedQuery({this.CompanyId,this.ServiceId,this.From,this.To,this.Resources,this.NumberOfResources,this.ShowPerResource,this.InsideSearchInterval,this.Duration,this.ResponseStatus});
    AvaiableTimesGroupedQuery.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        ServiceId = json['ServiceId'];
        From = JsonConverters.fromJson(json['From'],'DateTime',context!);
        To = JsonConverters.fromJson(json['To'],'DateTime',context!);
        Resources = JsonConverters.fromJson(json['Resources'],'List<AvailableTimesResourceTypeResource>',context!);
        NumberOfResources = json['NumberOfResources'];
        ShowPerResource = json['ShowPerResource'];
        InsideSearchInterval = json['InsideSearchInterval'];
        Duration = json['Duration'];
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'ServiceId': ServiceId,
        'From': JsonConverters.toJson(From,'DateTime',context!),
        'To': JsonConverters.toJson(To,'DateTime',context!),
        'Resources': JsonConverters.toJson(Resources,'List<AvailableTimesResourceTypeResource>',context!),
        'NumberOfResources': NumberOfResources,
        'ShowPerResource': ShowPerResource,
        'InsideSearchInterval': InsideSearchInterval,
        'Duration': Duration,
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!)
    };

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

TypeContext _ctx = TypeContext(library: 'testapi.bokamera.se', types: <String, TypeInfo> {
    'ExceptionText': TypeInfo(TypeOf.Class, create:() => ExceptionText()),
    'AvailableTimesSum': TypeInfo(TypeOf.Class, create:() => AvailableTimesSum()),
    'List<ExceptionText>': TypeInfo(TypeOf.Class, create:() => <ExceptionText>[]),
    'AvailableTimesGroupedDates': TypeInfo(TypeOf.Class, create:() => AvailableTimesGroupedDates()),
    'List<AvailableTimesSum>': TypeInfo(TypeOf.Class, create:() => <AvailableTimesSum>[]),
    'AvailableTimesGroupedDatesResponse': TypeInfo(TypeOf.Class, create:() => AvailableTimesGroupedDatesResponse()),
    'List<AvailableTimesGroupedDates>': TypeInfo(TypeOf.Class, create:() => <AvailableTimesGroupedDates>[]),
    'AvailableTimesResourceTypeResource': TypeInfo(TypeOf.Class, create:() => AvailableTimesResourceTypeResource()),
    'AvaiableTimesGroupedQuery': TypeInfo(TypeOf.Class, create:() => AvaiableTimesGroupedQuery()),
    'List<AvailableTimesResourceTypeResource>': TypeInfo(TypeOf.Class, create:() => <AvailableTimesResourceTypeResource>[]),
});

Dart AvaiableTimesGroupedQuery DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

GET /services/{ServiceId}/availabletimes/grouped HTTP/1.1 
Host: testapi.bokamera.se 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"ServiceId":0,"TimesFreeTextSingle":"String","TimesFreeTextMultiple":"String","Items":[{"Times":[{"Free":0,"FreeSpots":0}]}]}