| GET | /bookings | ||
|---|---|---|---|
| GET | /bookings/{Id} |
const std = @import("std");
pub const RoomType = enum {
Single,
Double,
Queen,
Twin,
Suite,
};
/// Discount Coupons
pub const Coupon = struct {
id: ?[]const u8 = null,
description: ?[]const u8 = null,
discount: i32 = 0,
expiryDate: ?[]const u8 = null,
};
pub const User = struct {
id: ?[]const u8 = null,
userName: ?[]const u8 = null,
firstName: ?[]const u8 = null,
lastName: ?[]const u8 = null,
displayName: ?[]const u8 = null,
profileUrl: ?[]const u8 = null,
};
/// Booking Details
pub const Booking = struct {
// @DataMember(Order=1)
createdDate: ?[]const u8 = null,
// @DataMember(Order=2)
// @Required()
createdBy: ?[]const u8 = null,
// @DataMember(Order=3)
modifiedDate: ?[]const u8 = null,
// @DataMember(Order=4)
// @Required()
modifiedBy: ?[]const u8 = null,
// @DataMember(Order=5)
deletedDate: ?[]const u8 = null,
// @DataMember(Order=6)
deletedBy: ?[]const u8 = null,
id: i32 = 0,
name: ?[]const u8 = null,
roomType: ?RoomType = null,
roomNumber: i32 = 0,
bookingStartDate: ?[]const u8 = null,
bookingEndDate: ?[]const u8 = null,
cost: f64 = 0,
// @References(typeof(Coupon))
couponId: ?[]const u8 = null,
discount: ?Coupon = null,
notes: ?[]const u8 = null,
cancelled: ?bool = null,
employee: ?User = null,
};
/// Find Bookings
pub const QueryBookings = struct {
// @DataMember(Order=1)
skip: ?i32 = null,
// @DataMember(Order=2)
take: ?i32 = null,
// @DataMember(Order=3)
orderBy: ?[]const u8 = null,
// @DataMember(Order=4)
orderByDesc: ?[]const u8 = null,
// @DataMember(Order=5)
include: ?[]const u8 = null,
// @DataMember(Order=6)
fields: ?[]const u8 = null,
// @DataMember(Order=7)
meta: ?std.json.Value = null,
id: ?i32 = null,
};
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /bookings HTTP/1.1 Host: blazor-vue.web-templates.io Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
offset: 0,
total: 0,
results:
[
{
id: 0,
name: String,
roomType: Single,
roomNumber: 0,
bookingStartDate: 0001-01-01,
bookingEndDate: 0001-01-01,
cost: 0,
couponId: String,
discount:
{
id: String,
description: String,
discount: 0,
expiryDate: 0001-01-01
},
notes: String,
cancelled: False,
employee:
{
id: String,
userName: String,
firstName: String,
lastName: String,
displayName: String,
profileUrl: String
},
createdDate: 0001-01-01,
createdBy: String,
modifiedDate: 0001-01-01,
modifiedBy: String,
deletedDate: 0001-01-01,
deletedBy: String
}
],
meta:
{
String: String
},
responseStatus:
{
errorCode: String,
message: String,
stackTrace: String,
errors:
[
{
errorCode: String,
fieldName: String,
message: String,
meta:
{
String: String
}
}
],
meta:
{
String: String
}
}
}