BokaMera.API.Host

<back to all web services

TestDateSchedule

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/schedules/date/testTest date scheduleTest date schedule, only administrators are allowed to test 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 AvailableTimesResponse implements IConvertible
{
    String? CompanyId;
    int? ServiceId;
    String? TimesFreeTextSingle;
    String? TimesFreeTextMultiple;
    List<AvailableTimesSum>? Times;

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

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

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

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

class AddDateScheduleDate implements IConvertible
{
    /**
    * The from date for the timeslot
    */
    // @ApiMember(Description="The from date for the timeslot", IsRequired=true)
    DateTime? From;

    /**
    * The to date for the timeslot
    */
    // @ApiMember(Description="The to date for the timeslot", IsRequired=true)
    DateTime? To;

    AddDateScheduleDate({this.From,this.To});
    AddDateScheduleDate.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!);
        return this;
    }

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

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

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class TestDateSchedule implements ICompany, IInterval, 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 dates for the schedule. This is the actual timeslots.
    */
    // @ApiMember(Description="The dates for the schedule. This is the actual timeslots.", IsRequired=true)
    List<AddDateScheduleDate>? ScheduleDates;

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

    /**
    * The Service Duration
    */
    // @ApiMember(Description="The Service Duration")
    int? ServiceId;

    TestDateSchedule({this.CompanyId,this.ScheduleDates,this.From,this.To,this.ServiceId});
    TestDateSchedule.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        ScheduleDates = JsonConverters.fromJson(json['ScheduleDates'],'List<AddDateScheduleDate>',context!);
        From = JsonConverters.fromJson(json['From'],'DateTime',context!);
        To = JsonConverters.fromJson(json['To'],'DateTime',context!);
        ServiceId = json['ServiceId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'ScheduleDates': JsonConverters.toJson(ScheduleDates,'List<AddDateScheduleDate>',context!),
        'From': JsonConverters.toJson(From,'DateTime',context!),
        'To': JsonConverters.toJson(To,'DateTime',context!),
        'ServiceId': ServiceId
    };

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

TypeContext _ctx = TypeContext(library: 'api.bokamera.se', types: <String, TypeInfo> {
    'ExceptionText': TypeInfo(TypeOf.Class, create:() => ExceptionText()),
    'AvailableTimesSum': TypeInfo(TypeOf.Class, create:() => AvailableTimesSum()),
    'List<ExceptionText>': TypeInfo(TypeOf.Class, create:() => <ExceptionText>[]),
    'AvailableTimesResponse': TypeInfo(TypeOf.Class, create:() => AvailableTimesResponse()),
    'List<AvailableTimesSum>': TypeInfo(TypeOf.Class, create:() => <AvailableTimesSum>[]),
    'AddDateScheduleDate': TypeInfo(TypeOf.Class, create:() => AddDateScheduleDate()),
    'TestDateSchedule': TypeInfo(TypeOf.Class, create:() => TestDateSchedule()),
    'List<AddDateScheduleDate>': TypeInfo(TypeOf.Class, create:() => <AddDateScheduleDate>[]),
});

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

POST /schedules/date/test HTTP/1.1 
Host: api.bokamera.se 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","ScheduleDates":[{}],"ServiceId":0}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

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