@gethydra/sdk 0.1.16 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1172 -103
- package/dist/index.js +62 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1646,6 +1646,65 @@ var MembershipPlansResource = class {
|
|
|
1646
1646
|
}
|
|
1647
1647
|
};
|
|
1648
1648
|
|
|
1649
|
+
// src/resources/bookings.ts
|
|
1650
|
+
var BookingsResource = class {
|
|
1651
|
+
constructor(client) {
|
|
1652
|
+
this.client = client;
|
|
1653
|
+
}
|
|
1654
|
+
client;
|
|
1655
|
+
// ── Bookable locations ──
|
|
1656
|
+
async listLocations() {
|
|
1657
|
+
return this.client.request("GET", "/v1/bookings/locations");
|
|
1658
|
+
}
|
|
1659
|
+
// ── Availability ──
|
|
1660
|
+
async getAvailability(params) {
|
|
1661
|
+
return this.client.request("GET", "/v1/bookings/availability", { params });
|
|
1662
|
+
}
|
|
1663
|
+
// ── Appointments ──
|
|
1664
|
+
async createAppointment(body, options) {
|
|
1665
|
+
return this.client.request("POST", "/v1/bookings/appointments", {
|
|
1666
|
+
body,
|
|
1667
|
+
...options
|
|
1668
|
+
});
|
|
1669
|
+
}
|
|
1670
|
+
async confirmAppointment(id) {
|
|
1671
|
+
return this.client.request("POST", `/v1/bookings/appointments/${id}/confirm`);
|
|
1672
|
+
}
|
|
1673
|
+
async listAppointments(params) {
|
|
1674
|
+
return this.client.request("GET", "/v1/bookings/appointments", { params });
|
|
1675
|
+
}
|
|
1676
|
+
iterateAppointments(params, options) {
|
|
1677
|
+
return paginate(
|
|
1678
|
+
(cursor) => this.listAppointments({ ...params, cursor }),
|
|
1679
|
+
options
|
|
1680
|
+
);
|
|
1681
|
+
}
|
|
1682
|
+
async toArrayAppointments(params, options) {
|
|
1683
|
+
return toArray(this.iterateAppointments(params, options), options);
|
|
1684
|
+
}
|
|
1685
|
+
async getAppointment(id) {
|
|
1686
|
+
return this.client.request("GET", `/v1/bookings/appointments/${id}`);
|
|
1687
|
+
}
|
|
1688
|
+
async updateAppointment(id, body) {
|
|
1689
|
+
return this.client.request("PATCH", `/v1/bookings/appointments/${id}`, {
|
|
1690
|
+
body
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1693
|
+
// ── Availability overrides ──
|
|
1694
|
+
async createOverride(body, options) {
|
|
1695
|
+
return this.client.request("POST", "/v1/bookings/overrides", {
|
|
1696
|
+
body,
|
|
1697
|
+
...options
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1700
|
+
async listOverrides(params) {
|
|
1701
|
+
return this.client.request("GET", "/v1/bookings/overrides", { params });
|
|
1702
|
+
}
|
|
1703
|
+
async deleteOverride(id) {
|
|
1704
|
+
return this.client.request("DELETE", `/v1/bookings/overrides/${id}`);
|
|
1705
|
+
}
|
|
1706
|
+
};
|
|
1707
|
+
|
|
1649
1708
|
// src/client.ts
|
|
1650
1709
|
var SDK_VERSION = "0.1.0";
|
|
1651
1710
|
var INITIAL_RETRY_DELAY = 0.5;
|
|
@@ -1726,6 +1785,8 @@ var Hydra = class {
|
|
|
1726
1785
|
contentCategories = new ContentCategoriesResource(this);
|
|
1727
1786
|
// P8: Subscriptions
|
|
1728
1787
|
membershipPlans = new MembershipPlansResource(this);
|
|
1788
|
+
// P9: Bookings
|
|
1789
|
+
bookings = new BookingsResource(this);
|
|
1729
1790
|
constructor(config) {
|
|
1730
1791
|
for (const key of Object.keys(config)) {
|
|
1731
1792
|
if (!VALID_CONFIG_KEYS.has(key)) {
|
|
@@ -1934,6 +1995,7 @@ var Hydra = class {
|
|
|
1934
1995
|
export {
|
|
1935
1996
|
AddressesResource,
|
|
1936
1997
|
AnalyticsResource,
|
|
1998
|
+
BookingsResource,
|
|
1937
1999
|
CartResource,
|
|
1938
2000
|
ChannelsResource,
|
|
1939
2001
|
CheckoutResource,
|