Reservation Station API

<back to all web services

MakeBooking

Requires Authentication
import 'package:servicestack/servicestack.dart';

class ApiServiceRequest implements IServiceRequest, IHasApiKey, IHasDeviceInfo, IConvertible
{
    /**
    * The API Key required for authentication
    */
    // @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
    String? apiKey;

    /**
    * Latitude of the user making this request
    */
    // @ApiMember(DataType="double", Description="Latitude of the user making this request")
    double? latitude;

    /**
    * Longitude of the user making this request
    */
    // @ApiMember(DataType="double", Description="Longitude of the user making this request")
    double? longitude;

    ApiServiceRequest({this.apiKey,this.latitude,this.longitude});
    ApiServiceRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        apiKey = json['apiKey'];
        latitude = JsonConverters.toDouble(json['latitude']);
        longitude = JsonConverters.toDouble(json['longitude']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'apiKey': apiKey,
        'latitude': latitude,
        'longitude': longitude
    };

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

class ApiServiceResponse implements IServiceResponse, IConvertible
{
    String? description;
    String? heading;
    bool? wasSuccessful;
    dynamic? modelState;

    ApiServiceResponse({this.description,this.heading,this.wasSuccessful,this.modelState});
    ApiServiceResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        description = json['description'];
        heading = json['heading'];
        wasSuccessful = json['wasSuccessful'];
        modelState = JsonConverters.fromJson(json['modelState'],'dynamic',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'description': description,
        'heading': heading,
        'wasSuccessful': wasSuccessful,
        'modelState': JsonConverters.toJson(modelState,'dynamic',context!)
    };

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

class MakeBookingResponse extends ApiServiceResponse implements IConvertible
{
    bool? reloadSchedule;

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

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

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'reloadSchedule': reloadSchedule
    });

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

class SlotStatus
{
    static const SlotStatus Available = const SlotStatus._(0);
    static const SlotStatus Closed = const SlotStatus._(1);
    static const SlotStatus Booked = const SlotStatus._(2);
    static const SlotStatus UserBooked = const SlotStatus._(3);
    static const SlotStatus GroupBooked = const SlotStatus._(4);
    static const SlotStatus ToBook = const SlotStatus._(5);

    final int _value;
    const SlotStatus._(this._value);
    int get value => _value;
    static List<SlotStatus> get values => const [Available,Closed,Booked,UserBooked,GroupBooked,ToBook];
}

class UserCustomFieldData implements IConvertible
{
    String? id;
    String? value;
    String? name;
    bool? optional;

    UserCustomFieldData({this.id,this.value,this.name,this.optional});
    UserCustomFieldData.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        value = json['value'];
        name = json['name'];
        optional = json['optional'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'value': value,
        'name': name,
        'optional': optional
    };

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

class GuestData implements IConvertible
{
    String? name;
    String? emailAddress;
    String? mobileNumber;
    List<UserCustomFieldData>? userCustomFields;
    bool? isAlreadyUser;
    int? systemUserId;

    GuestData({this.name,this.emailAddress,this.mobileNumber,this.userCustomFields,this.isAlreadyUser,this.systemUserId});
    GuestData.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        name = json['name'];
        emailAddress = json['emailAddress'];
        mobileNumber = json['mobileNumber'];
        userCustomFields = JsonConverters.fromJson(json['userCustomFields'],'List<UserCustomFieldData>',context!);
        isAlreadyUser = json['isAlreadyUser'];
        systemUserId = json['systemUserId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'name': name,
        'emailAddress': emailAddress,
        'mobileNumber': mobileNumber,
        'userCustomFields': JsonConverters.toJson(userCustomFields,'List<UserCustomFieldData>',context!),
        'isAlreadyUser': isAlreadyUser,
        'systemUserId': systemUserId
    };

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

class SlotData implements IConvertible
{
    String? start;
    String? end;
    SlotStatus? status;
    int? bookingId;
    bool? remindStart;
    bool? remind30Mins;
    bool? remind1Hour;
    bool? remind6Hours;
    bool? remind12Hours;
    bool? remind1Day;
    bool? remind1Week;
    double? billableAmount;
    String? bookedByName;
    double? billableHours;
    double? slotLength;
    GuestData? userData;
    String? extraRequirements;

    SlotData({this.start,this.end,this.status,this.bookingId,this.remindStart,this.remind30Mins,this.remind1Hour,this.remind6Hours,this.remind12Hours,this.remind1Day,this.remind1Week,this.billableAmount,this.bookedByName,this.billableHours,this.slotLength,this.userData,this.extraRequirements});
    SlotData.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        start = json['start'];
        end = json['end'];
        status = JsonConverters.fromJson(json['status'],'SlotStatus',context!);
        bookingId = json['bookingId'];
        remindStart = json['remindStart'];
        remind30Mins = json['remind30Mins'];
        remind1Hour = json['remind1Hour'];
        remind6Hours = json['remind6Hours'];
        remind12Hours = json['remind12Hours'];
        remind1Day = json['remind1Day'];
        remind1Week = json['remind1Week'];
        billableAmount = JsonConverters.toDouble(json['billableAmount']);
        bookedByName = json['bookedByName'];
        billableHours = JsonConverters.toDouble(json['billableHours']);
        slotLength = JsonConverters.toDouble(json['slotLength']);
        userData = JsonConverters.fromJson(json['userData'],'GuestData',context!);
        extraRequirements = json['extraRequirements'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'start': start,
        'end': end,
        'status': JsonConverters.toJson(status,'SlotStatus',context!),
        'bookingId': bookingId,
        'remindStart': remindStart,
        'remind30Mins': remind30Mins,
        'remind1Hour': remind1Hour,
        'remind6Hours': remind6Hours,
        'remind12Hours': remind12Hours,
        'remind1Day': remind1Day,
        'remind1Week': remind1Week,
        'billableAmount': billableAmount,
        'bookedByName': bookedByName,
        'billableHours': billableHours,
        'slotLength': slotLength,
        'userData': JsonConverters.toJson(userData,'GuestData',context!),
        'extraRequirements': extraRequirements
    };

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

class MakeBooking extends ApiServiceRequest implements IConvertible
{
    int? facilityId;
    int? bookingUserId;
    List<SlotData>? requestedSlots;
    bool? remindStart;
    bool? remind30Mins;
    bool? remind1Hour;
    bool? remind6Hours;
    bool? remind12Hours;
    bool? remind1Day;
    bool? remind1Week;
    GuestData? guestData;
    int? utcOffset;
    String? extraRequirements;

    MakeBooking({this.facilityId,this.bookingUserId,this.requestedSlots,this.remindStart,this.remind30Mins,this.remind1Hour,this.remind6Hours,this.remind12Hours,this.remind1Day,this.remind1Week,this.guestData,this.utcOffset,this.extraRequirements});
    MakeBooking.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        facilityId = json['facilityId'];
        bookingUserId = json['bookingUserId'];
        requestedSlots = JsonConverters.fromJson(json['requestedSlots'],'List<SlotData>',context!);
        remindStart = json['remindStart'];
        remind30Mins = json['remind30Mins'];
        remind1Hour = json['remind1Hour'];
        remind6Hours = json['remind6Hours'];
        remind12Hours = json['remind12Hours'];
        remind1Day = json['remind1Day'];
        remind1Week = json['remind1Week'];
        guestData = JsonConverters.fromJson(json['guestData'],'GuestData',context!);
        utcOffset = json['utcOffset'];
        extraRequirements = json['extraRequirements'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'facilityId': facilityId,
        'bookingUserId': bookingUserId,
        'requestedSlots': JsonConverters.toJson(requestedSlots,'List<SlotData>',context!),
        'remindStart': remindStart,
        'remind30Mins': remind30Mins,
        'remind1Hour': remind1Hour,
        'remind6Hours': remind6Hours,
        'remind12Hours': remind12Hours,
        'remind1Day': remind1Day,
        'remind1Week': remind1Week,
        'guestData': JsonConverters.toJson(guestData,'GuestData',context!),
        'utcOffset': utcOffset,
        'extraRequirements': extraRequirements
    });

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

TypeContext _ctx = TypeContext(library: 'reservation.api.dev.86degrees.com', types: <String, TypeInfo> {
    'ApiServiceRequest': TypeInfo(TypeOf.Class, create:() => ApiServiceRequest()),
    'ApiServiceResponse': TypeInfo(TypeOf.Class, create:() => ApiServiceResponse()),
    'MakeBookingResponse': TypeInfo(TypeOf.Class, create:() => MakeBookingResponse()),
    'SlotStatus': TypeInfo(TypeOf.Enum, enumValues:SlotStatus.values),
    'UserCustomFieldData': TypeInfo(TypeOf.Class, create:() => UserCustomFieldData()),
    'GuestData': TypeInfo(TypeOf.Class, create:() => GuestData()),
    'List<UserCustomFieldData>': TypeInfo(TypeOf.Class, create:() => <UserCustomFieldData>[]),
    'SlotData': TypeInfo(TypeOf.Class, create:() => SlotData()),
    'MakeBooking': TypeInfo(TypeOf.Class, create:() => MakeBooking()),
    'List<SlotData>': TypeInfo(TypeOf.Class, create:() => <SlotData>[]),
});

Dart MakeBooking DTOs

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

HTTP + JSV

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

POST /jsv/reply/MakeBooking HTTP/1.1 
Host: reservation.api.dev.86degrees.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	facilityId: 0,
	bookingUserId: 0,
	requestedSlots: 
	[
		{
			start: String,
			end: String,
			status: 0,
			bookingId: 0,
			remindStart: False,
			remind30Mins: False,
			remind1Hour: False,
			remind6Hours: False,
			remind12Hours: False,
			remind1Day: False,
			remind1Week: False,
			billableAmount: 0,
			bookedByName: String,
			billableHours: 0,
			slotLength: 0,
			extraRequirements: String
		}
	],
	remindStart: False,
	remind30Mins: False,
	remind1Hour: False,
	remind6Hours: False,
	remind12Hours: False,
	remind1Day: False,
	remind1Week: False,
	utcOffset: 0,
	extraRequirements: String,
	apiKey: String,
	latitude: 0,
	longitude: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	reloadSchedule: False,
	description: String,
	heading: String,
	wasSuccessful: False,
	modelState: {}
}