@foxscheduling/sdk 0.1.1 → 0.2.0

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/README.md CHANGED
@@ -69,7 +69,97 @@ After creating a client, use:
69
69
  - `fox.customers` — customers
70
70
  - `fox.webhooks` — webhook subscriptions
71
71
 
72
- All methods return typed data and throw on API errors.
72
+ All methods are fully typed (no `unknown` inputs or outputs) and throw a
73
+ `FoxSchedulingError` on API errors.
74
+
75
+ ### Lists are paginated (max 100 per page)
76
+
77
+ Pagination is enforced by the API — every `list()` method sends `limit`/`offset`
78
+ to the server and returns a typed `Page<T>`, never a raw array:
79
+
80
+ ```typescript
81
+ interface Page<T> {
82
+ items: T[]; // at most 100
83
+ total: number; // total across all pages
84
+ limit: number; // effective page size
85
+ offset: number; // current offset
86
+ hasMore: boolean; // true if more items exist
87
+ }
88
+ ```
89
+
90
+ Pass `limit` (1–100, default 100) and `offset` to page through results:
91
+
92
+ ```typescript
93
+ const first = await fox.customers.list({ limit: 50, offset: 0 });
94
+ console.log(first.items.length, first.total, first.hasMore);
95
+
96
+ if (first.hasMore) {
97
+ const next = await fox.customers.list({ limit: 50, offset: 50 });
98
+ }
99
+ ```
100
+
101
+ `limit` is clamped to a maximum of 100.
102
+
103
+ ### Bookings require a month
104
+
105
+ `fox.bookings.list()` **requires** a `month` (format `YYYY-MM`) so responses stay
106
+ small. Other filters are optional and typed:
107
+
108
+ ```typescript
109
+ const page = await fox.bookings.list({
110
+ month: "2026-06", // required
111
+ status: "booked", // optional, typed union
112
+ serviceId: "…", // optional
113
+ limit: 100, // optional
114
+ });
115
+ ```
116
+
117
+ Omitting or malformatting `month` throws a `FoxSchedulingError` before any
118
+ request is sent.
119
+
120
+ ### Typed create & update
121
+
122
+ Create and update bodies are typed — for example:
123
+
124
+ ```typescript
125
+ // Create a customer
126
+ const customer = await fox.customers.create({
127
+ name: "Jane Doe",
128
+ email: "jane@example.com",
129
+ });
130
+
131
+ // Create a booking
132
+ const result = await fox.bookings.create({
133
+ serviceId: "…",
134
+ name: "Jane Doe",
135
+ email: "jane@example.com",
136
+ slots: [{ date: "2026-06-12", start: "09:00", end: "09:30" }],
137
+ });
138
+ console.log(result.bookingSummary, result.customerId);
139
+ ```
140
+
141
+ ### Get booking embed code
142
+
143
+ `fox.business.getEmbedCode()` returns ready-to-paste embed snippets for the
144
+ connected business: an inline `iframe`, a popup `<script>` widget, and the raw
145
+ `bookingUrl`. All options are optional and typed:
146
+
147
+ ```typescript
148
+ const embed = await fox.business.getEmbedCode({
149
+ theme: "dark", // "light" | "dark" | "auto" (default)
150
+ servicePath: "haircut", // optional: link straight to one service
151
+ hidePageDetails: false, // hide business header inside the embed
152
+ heightPx: 760, // inline iframe height
153
+ iframeBorderRadius: "medium", // none | sm | medium | lg | xl | 2xl
154
+ openMode: "popup", // "popup" | "newTab" for the script widget
155
+ buttonText: "Book now", // popup button label
156
+ });
157
+
158
+ console.log(embed.bookingUrl); // shareable URL
159
+ console.log(embed.iframe); // <style>…</style><div>…<iframe …></div>
160
+ console.log(embed.popupScript); // <script … data-booking-url="…"></script>
161
+ console.log(embed.appliedOptions); // options after defaults applied
162
+ ```
73
163
 
74
164
  ---
75
165
 
@@ -165,7 +255,7 @@ Once `exchangeCode` succeeds, the SDK stores tokens and attaches them to every r
165
255
 
166
256
  ```typescript
167
257
  const business = await fox.business.get();
168
- const bookings = await fox.bookings.list();
258
+ const bookings = await fox.bookings.list({ month: "2026-06" });
169
259
  ```
170
260
 
171
261
  The SDK refreshes access tokens automatically before they expire.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_BASE_URL = exports.verifyFoxWebhookSignature = exports.generateState = exports.generateCodeChallengeS256 = exports.generateCodeVerifier = exports.FileTokenStore = exports.MemoryTokenStore = exports.isFoxSchedulingError = exports.FoxSchedulingError = exports.FoxScheduling = void 0;
3
+ exports.isValidMonth = exports.MAX_PAGE_SIZE = exports.DEFAULT_BASE_URL = exports.verifyFoxWebhookSignature = exports.generateState = exports.generateCodeChallengeS256 = exports.generateCodeVerifier = exports.FileTokenStore = exports.MemoryTokenStore = exports.isFoxSchedulingError = exports.FoxSchedulingError = exports.FoxScheduling = void 0;
4
4
  var client_js_1 = require("./client.cjs");
5
5
  Object.defineProperty(exports, "FoxScheduling", { enumerable: true, get: function () { return client_js_1.FoxScheduling; } });
6
6
  var errors_js_1 = require("./errors.cjs");
@@ -17,3 +17,5 @@ var verify_js_1 = require("./webhooks/verify.cjs");
17
17
  Object.defineProperty(exports, "verifyFoxWebhookSignature", { enumerable: true, get: function () { return verify_js_1.verifyFoxWebhookSignature; } });
18
18
  var types_js_1 = require("./types.cjs");
19
19
  Object.defineProperty(exports, "DEFAULT_BASE_URL", { enumerable: true, get: function () { return types_js_1.DEFAULT_BASE_URL; } });
20
+ Object.defineProperty(exports, "MAX_PAGE_SIZE", { enumerable: true, get: function () { return types_js_1.MAX_PAGE_SIZE; } });
21
+ Object.defineProperty(exports, "isValidMonth", { enumerable: true, get: function () { return types_js_1.isValidMonth; } });
@@ -3,5 +3,6 @@ export { FoxSchedulingError, isFoxSchedulingError } from "./errors.js";
3
3
  export { MemoryTokenStore, FileTokenStore, type TokenStore, } from "./auth/tokenStore.js";
4
4
  export { generateCodeVerifier, generateCodeChallengeS256, generateState, } from "./auth/pkce.js";
5
5
  export { verifyFoxWebhookSignature } from "./webhooks/verify.js";
6
- export { DEFAULT_BASE_URL, type FoxSchedulingConfig, type FoxSchedulingAuth, type FoxSchedulingApiKeyAuth, type FoxSchedulingOAuthAuth, type TokenSet, type AuthorizationUrlResult, } from "./types.js";
6
+ export type { WebhookSubscriptionPublic, CreateWebhookResult, } from "./resources/index.js";
7
+ export { DEFAULT_BASE_URL, MAX_PAGE_SIZE, isValidMonth, type FoxSchedulingConfig, type FoxSchedulingAuth, type FoxSchedulingApiKeyAuth, type FoxSchedulingOAuthAuth, type TokenSet, type AuthorizationUrlResult, type ListQuery, type Page, type BookingStatus, type BookingListQuery, type CreateAvailabilityInput, type UpdateAvailabilityInput, type BookingSlotInput, type CreateBookingInput, type BookingCreatedResult, type CreateCustomerInput, type UpdateCustomerInput, type CreateWebhookInput, type UpdateWebhookInput, type PartnerEmbedOptions, type PartnerEmbedCodeDto, type PartnerEmbedTheme, type PartnerEmbedOpenMode, } from "./types.js";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACL,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EACb,KAAK,sBAAsB,GAC5B,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,YAAY,EACV,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B,MAAM,YAAY,CAAC"}
@@ -1,6 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WebhooksResource = exports.CustomersResource = exports.BookingsResource = exports.AvailabilityResource = exports.StaffResource = exports.ServicesResource = exports.BusinessResource = void 0;
4
+ const types_js_1 = require("../types.js");
5
+ const errors_js_1 = require("../errors.js");
6
+ /** Convert pagination options to string query params. */
7
+ function pageQuery(query) {
8
+ return {
9
+ limit: query?.limit != null ? String(query.limit) : undefined,
10
+ offset: query?.offset != null ? String(query.offset) : undefined,
11
+ };
12
+ }
4
13
  class BusinessResource {
5
14
  http;
6
15
  constructor(http) {
@@ -9,6 +18,27 @@ class BusinessResource {
9
18
  get() {
10
19
  return this.http.get("/partner/business");
11
20
  }
21
+ /**
22
+ * Get booking embed code (inline iframe + popup script + raw URL) for this
23
+ * business, with optional theming and button styling.
24
+ */
25
+ getEmbedCode(options = {}) {
26
+ return this.http.get("/partner/business/embed", {
27
+ servicePath: options.servicePath,
28
+ theme: options.theme,
29
+ hidePageDetails: options.hidePageDetails != null ? String(options.hidePageDetails) : undefined,
30
+ showThemeToggle: options.showThemeToggle != null ? String(options.showThemeToggle) : undefined,
31
+ heightPx: options.heightPx != null ? String(options.heightPx) : undefined,
32
+ iframeBorderRadius: options.iframeBorderRadius,
33
+ openMode: options.openMode,
34
+ buttonText: options.buttonText,
35
+ buttonBackgroundColor: options.buttonBackgroundColor,
36
+ buttonTextColor: options.buttonTextColor,
37
+ buttonBorderRadiusPx: options.buttonBorderRadiusPx != null
38
+ ? String(options.buttonBorderRadiusPx)
39
+ : undefined,
40
+ });
41
+ }
12
42
  }
13
43
  exports.BusinessResource = BusinessResource;
14
44
  class ServicesResource {
@@ -16,8 +46,8 @@ class ServicesResource {
16
46
  constructor(http) {
17
47
  this.http = http;
18
48
  }
19
- list() {
20
- return this.http.get("/partner/services");
49
+ list(query) {
50
+ return this.http.get("/partner/services", pageQuery(query));
21
51
  }
22
52
  get(id) {
23
53
  return this.http.get(`/partner/services/${id}`);
@@ -29,8 +59,8 @@ class StaffResource {
29
59
  constructor(http) {
30
60
  this.http = http;
31
61
  }
32
- list() {
33
- return this.http.get("/partner/staff");
62
+ list(query) {
63
+ return this.http.get("/partner/staff", pageQuery(query));
34
64
  }
35
65
  get(id) {
36
66
  return this.http.get(`/partner/staff/${id}`);
@@ -42,8 +72,8 @@ class AvailabilityResource {
42
72
  constructor(http) {
43
73
  this.http = http;
44
74
  }
45
- list() {
46
- return this.http.get("/partner/availability");
75
+ list(query) {
76
+ return this.http.get("/partner/availability", pageQuery(query));
47
77
  }
48
78
  get(id) {
49
79
  return this.http.get(`/partner/availability/${id}`);
@@ -64,19 +94,38 @@ class BookingsResource {
64
94
  constructor(http) {
65
95
  this.http = http;
66
96
  }
67
- list(query) {
68
- return this.http.get("/partner/bookings", query);
97
+ /**
98
+ * List bookings for a single month.
99
+ *
100
+ * `query.month` is required (format `YYYY-MM`, e.g. "2026-06") to keep the
101
+ * response small.
102
+ */
103
+ async list(query) {
104
+ if (!query || !query.month) {
105
+ throw new errors_js_1.FoxSchedulingError("MONTH_REQUIRED", 'bookings.list requires a "month" in YYYY-MM format, e.g. "2026-06".');
106
+ }
107
+ if (!(0, types_js_1.isValidMonth)(query.month)) {
108
+ throw new errors_js_1.FoxSchedulingError("INVALID_MONTH", `Invalid month "${query.month}". Expected YYYY-MM, e.g. "2026-06".`);
109
+ }
110
+ return this.http.get("/partner/bookings", {
111
+ yearMonth: query.month,
112
+ serviceId: query.serviceId,
113
+ providerId: query.providerId,
114
+ status: query.status,
115
+ search: query.search,
116
+ ...pageQuery(query),
117
+ });
69
118
  }
70
119
  get(id, serviceId) {
71
- return this.http.get(`/partner/bookings/${id}`, { serviceId });
120
+ return this.http.get(`/partner/bookings/${id}`, {
121
+ serviceId,
122
+ });
72
123
  }
73
124
  create(body) {
74
125
  return this.http.post("/partner/bookings", body);
75
126
  }
76
127
  cancel(id, serviceId) {
77
- return this.http.post(`/partner/bookings/${id}/cancel`, undefined, {
78
- serviceId,
79
- });
128
+ return this.http.post(`/partner/bookings/${id}/cancel`, undefined, { serviceId });
80
129
  }
81
130
  }
82
131
  exports.BookingsResource = BookingsResource;
@@ -85,8 +134,8 @@ class CustomersResource {
85
134
  constructor(http) {
86
135
  this.http = http;
87
136
  }
88
- list() {
89
- return this.http.get("/partner/customers");
137
+ list(query) {
138
+ return this.http.get("/partner/customers", pageQuery(query));
90
139
  }
91
140
  get(id) {
92
141
  return this.http.get(`/partner/customers/${id}`);
@@ -104,8 +153,8 @@ class WebhooksResource {
104
153
  constructor(http) {
105
154
  this.http = http;
106
155
  }
107
- list() {
108
- return this.http.get("/partner/webhooks");
156
+ list(query) {
157
+ return this.http.get("/partner/webhooks", pageQuery(query));
109
158
  }
110
159
  create(body) {
111
160
  return this.http.post("/partner/webhooks", body);
@@ -1,49 +1,58 @@
1
- import type { BusinessProfileDto, PartnerBookingDto, PartnerCustomerDto, PartnerServiceDto, PartnerStaffDto, PartnerWebhookEvent } from "@foxscheduling/shared";
1
+ import type { Availability, BusinessProfileDto, PartnerBookingDto, PartnerCustomerDto, PartnerEmbedCodeDto, PartnerEmbedOptions, PartnerServiceDto, PartnerStaffDto, PartnerWebhookEvent } from "@foxscheduling/shared";
2
2
  import type { HttpClient } from "../http/client.js";
3
+ import { type BookingCreatedResult, type BookingListQuery, type CreateAvailabilityInput, type CreateBookingInput, type CreateCustomerInput, type CreateWebhookInput, type ListQuery, type Page, type UpdateAvailabilityInput, type UpdateCustomerInput, type UpdateWebhookInput } from "../types.js";
3
4
  export declare class BusinessResource {
4
5
  private readonly http;
5
6
  constructor(http: HttpClient);
6
7
  get(): Promise<BusinessProfileDto>;
8
+ /**
9
+ * Get booking embed code (inline iframe + popup script + raw URL) for this
10
+ * business, with optional theming and button styling.
11
+ */
12
+ getEmbedCode(options?: PartnerEmbedOptions): Promise<PartnerEmbedCodeDto>;
7
13
  }
8
14
  export declare class ServicesResource {
9
15
  private readonly http;
10
16
  constructor(http: HttpClient);
11
- list(): Promise<PartnerServiceDto[]>;
17
+ list(query?: ListQuery): Promise<Page<PartnerServiceDto>>;
12
18
  get(id: string): Promise<PartnerServiceDto>;
13
19
  }
14
20
  export declare class StaffResource {
15
21
  private readonly http;
16
22
  constructor(http: HttpClient);
17
- list(): Promise<PartnerStaffDto[]>;
23
+ list(query?: ListQuery): Promise<Page<PartnerStaffDto>>;
18
24
  get(id: string): Promise<PartnerStaffDto>;
19
25
  }
20
26
  export declare class AvailabilityResource {
21
27
  private readonly http;
22
28
  constructor(http: HttpClient);
23
- list(): Promise<unknown[]>;
24
- get(id: string): Promise<unknown>;
25
- create(body: unknown): Promise<unknown>;
26
- update(id: string, body: unknown): Promise<unknown>;
27
- delete(id: string): Promise<unknown>;
29
+ list(query?: ListQuery): Promise<Page<Availability>>;
30
+ get(id: string): Promise<Availability>;
31
+ create(body: CreateAvailabilityInput): Promise<Availability>;
32
+ update(id: string, body: UpdateAvailabilityInput): Promise<Availability>;
33
+ delete(id: string): Promise<boolean>;
28
34
  }
29
35
  export declare class BookingsResource {
30
36
  private readonly http;
31
37
  constructor(http: HttpClient);
32
- list(query?: Record<string, string>): Promise<PartnerBookingDto[]>;
38
+ /**
39
+ * List bookings for a single month.
40
+ *
41
+ * `query.month` is required (format `YYYY-MM`, e.g. "2026-06") to keep the
42
+ * response small.
43
+ */
44
+ list(query: BookingListQuery): Promise<Page<PartnerBookingDto>>;
33
45
  get(id: string, serviceId: string): Promise<PartnerBookingDto>;
34
- create(body: unknown): Promise<unknown>;
35
- cancel(id: string, serviceId: string): Promise<unknown>;
46
+ create(body: CreateBookingInput): Promise<BookingCreatedResult>;
47
+ cancel(id: string, serviceId: string): Promise<PartnerBookingDto>;
36
48
  }
37
49
  export declare class CustomersResource {
38
50
  private readonly http;
39
51
  constructor(http: HttpClient);
40
- list(): Promise<PartnerCustomerDto[]>;
52
+ list(query?: ListQuery): Promise<Page<PartnerCustomerDto>>;
41
53
  get(id: string): Promise<PartnerCustomerDto>;
42
- create(body: {
43
- name: string;
44
- email: string;
45
- }): Promise<PartnerCustomerDto>;
46
- update(id: string, body: unknown): Promise<PartnerCustomerDto>;
54
+ create(body: CreateCustomerInput): Promise<PartnerCustomerDto>;
55
+ update(id: string, body: UpdateCustomerInput): Promise<PartnerCustomerDto>;
47
56
  }
48
57
  export interface WebhookSubscriptionPublic {
49
58
  id: string;
@@ -51,21 +60,16 @@ export interface WebhookSubscriptionPublic {
51
60
  events: PartnerWebhookEvent[];
52
61
  creationDate?: string;
53
62
  }
63
+ export interface CreateWebhookResult {
64
+ subscription: WebhookSubscriptionPublic;
65
+ secret: string;
66
+ }
54
67
  export declare class WebhooksResource {
55
68
  private readonly http;
56
69
  constructor(http: HttpClient);
57
- list(): Promise<WebhookSubscriptionPublic[]>;
58
- create(body: {
59
- url: string;
60
- events: PartnerWebhookEvent[];
61
- }): Promise<{
62
- subscription: WebhookSubscriptionPublic;
63
- secret: string;
64
- }>;
65
- update(id: string, body: Partial<{
66
- url: string;
67
- events: PartnerWebhookEvent[];
68
- }>): Promise<WebhookSubscriptionPublic>;
69
- delete(id: string): Promise<unknown>;
70
+ list(query?: ListQuery): Promise<Page<WebhookSubscriptionPublic>>;
71
+ create(body: CreateWebhookInput): Promise<CreateWebhookResult>;
72
+ update(id: string, body: UpdateWebhookInput): Promise<WebhookSubscriptionPublic>;
73
+ delete(id: string): Promise<boolean>;
70
74
  }
71
75
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,GAAG,IAAI,OAAO,CAAC,kBAAkB,CAAC;CAGnC;AAED,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,IAAI,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAIpC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAG5C;AAED,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,IAAI,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAIlC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAG1C;AAED,qBAAa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,C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,UAAU;IAE7C,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAOjE,MAAM,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI9D,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,yBAAyB,CAAC;IAOrC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGrC"}
@@ -1,4 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_BASE_URL = void 0;
3
+ exports.MAX_PAGE_SIZE = exports.DEFAULT_BASE_URL = void 0;
4
+ exports.isValidMonth = isValidMonth;
5
+ const shared_1 = require("@foxscheduling/shared");
4
6
  exports.DEFAULT_BASE_URL = "https://foxscheduling.com/api/v1";
7
+ /** Maximum number of items returned in a single page (enforced by the API). */
8
+ exports.MAX_PAGE_SIZE = shared_1.PARTNER_MAX_PAGE_SIZE;
9
+ /** True when `value` matches the `YYYY-MM` format (e.g. "2026-06"). */
10
+ function isValidMonth(value) {
11
+ return (0, shared_1.isValidYearMonth)(value);
12
+ }
@@ -1,4 +1,100 @@
1
+ import type { Availability, Booking, BookingSummary, PartnerPage, PartnerWebhookEvent } from "@foxscheduling/shared";
1
2
  export declare const DEFAULT_BASE_URL = "https://foxscheduling.com/api/v1";
3
+ /** Maximum number of items returned in a single page (enforced by the API). */
4
+ export declare const MAX_PAGE_SIZE = 100;
5
+ /** Pagination options accepted by every list endpoint. */
6
+ export interface ListQuery {
7
+ /** Items per page (1–{@link MAX_PAGE_SIZE}). The API clamps higher values. */
8
+ limit?: number;
9
+ /** Number of items to skip from the start. Defaults to 0. */
10
+ offset?: number;
11
+ }
12
+ /**
13
+ * A single page of results, returned by every `list()` method.
14
+ *
15
+ * Re-exported from `@foxscheduling/shared` as `PartnerPage<T>`.
16
+ */
17
+ export type Page<T> = PartnerPage<T>;
18
+ /** Re-export the embed options/result types for SDK consumers. */
19
+ export type { PartnerEmbedOptions, PartnerEmbedCodeDto, PartnerEmbedTheme, PartnerEmbedOpenMode, } from "@foxscheduling/shared";
20
+ /** Booking status values returned by the Partner API. */
21
+ export type BookingStatus = Booking["status"];
22
+ /**
23
+ * Query for {@link BookingsResource.list}.
24
+ *
25
+ * `month` is required to keep responses small — the API would otherwise return
26
+ * every booking for the business.
27
+ */
28
+ export interface BookingListQuery extends ListQuery {
29
+ /** Required calendar month to fetch, format `YYYY-MM` (e.g. "2026-06"). */
30
+ month: string;
31
+ /** Restrict to a single service (UUID v4). */
32
+ serviceId?: string;
33
+ /** Restrict to a single staff/provider (UUID). */
34
+ providerId?: string;
35
+ /** Restrict to a booking status. */
36
+ status?: BookingStatus;
37
+ /** Case-insensitive search over customer name, email, or slug. */
38
+ search?: string;
39
+ }
40
+ /** Body for {@link AvailabilityResource.create}. */
41
+ export type CreateAvailabilityInput = Omit<Availability, "id" | "ttl" | "sortKey" | "updatedOn" | "creationDate" | "schemaVersion" | "recordType" | "tenantId">;
42
+ /** Body for {@link AvailabilityResource.update}. */
43
+ export type UpdateAvailabilityInput = Partial<CreateAvailabilityInput>;
44
+ /** A slot to book within {@link CreateBookingInput}. */
45
+ export interface BookingSlotInput {
46
+ /** Date in `YYYY-MM-DD`. */
47
+ date: string;
48
+ /** Start time, e.g. "09:00". */
49
+ start: string;
50
+ /** End time, e.g. "09:30". */
51
+ end: string;
52
+ /** Optional specific staff member (UUID). */
53
+ staffId?: string;
54
+ }
55
+ /** Body for {@link BookingsResource.create}. */
56
+ export interface CreateBookingInput {
57
+ /** Service to book (UUID v4). */
58
+ serviceId: string;
59
+ /** One or more slots to reserve. */
60
+ slots: BookingSlotInput[];
61
+ /** Customer name. */
62
+ name: string;
63
+ /** Customer email. */
64
+ email: string;
65
+ /** Optional IANA timezone, e.g. "Europe/London". */
66
+ timezone?: string;
67
+ /** Optional answers to the service's booking questions. */
68
+ questionAnswers?: Record<string, string>;
69
+ }
70
+ /** Result of {@link BookingsResource.create}. */
71
+ export interface BookingCreatedResult {
72
+ bookingSummary: BookingSummary[];
73
+ customerId: string;
74
+ }
75
+ /** Body for {@link CustomersResource.create}. */
76
+ export interface CreateCustomerInput {
77
+ name: string;
78
+ email: string;
79
+ }
80
+ /** Body for {@link CustomersResource.update}. */
81
+ export interface UpdateCustomerInput {
82
+ name?: string;
83
+ email?: string;
84
+ blacklisted?: boolean;
85
+ }
86
+ /** Body for {@link WebhooksResource.create}. */
87
+ export interface CreateWebhookInput {
88
+ url: string;
89
+ events: PartnerWebhookEvent[];
90
+ }
91
+ /** Body for {@link WebhooksResource.update}. */
92
+ export interface UpdateWebhookInput {
93
+ url?: string;
94
+ events?: PartnerWebhookEvent[];
95
+ }
96
+ /** True when `value` matches the `YYYY-MM` format (e.g. "2026-06"). */
97
+ export declare function isValidMonth(value: string): boolean;
2
98
  export interface TokenSet {
3
99
  accessToken: string;
4
100
  refreshToken: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,qCAAqC,CAAC;AAEnE,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,sBAAsB,EAA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ED
@@ -3,5 +3,6 @@ export { FoxSchedulingError, isFoxSchedulingError } from "./errors.js";
3
3
  export { MemoryTokenStore, FileTokenStore, type TokenStore, } from "./auth/tokenStore.js";
4
4
  export { generateCodeVerifier, generateCodeChallengeS256, generateState, } from "./auth/pkce.js";
5
5
  export { verifyFoxWebhookSignature } from "./webhooks/verify.js";
6
- export { DEFAULT_BASE_URL, type FoxSchedulingConfig, type FoxSchedulingAuth, type FoxSchedulingApiKeyAuth, type FoxSchedulingOAuthAuth, type TokenSet, type AuthorizationUrlResult, } from "./types.js";
6
+ export type { WebhookSubscriptionPublic, CreateWebhookResult, } from "./resources/index.js";
7
+ export { DEFAULT_BASE_URL, MAX_PAGE_SIZE, isValidMonth, type FoxSchedulingConfig, type FoxSchedulingAuth, type FoxSchedulingApiKeyAuth, type FoxSchedulingOAuthAuth, type TokenSet, type AuthorizationUrlResult, type ListQuery, type Page, type BookingStatus, type BookingListQuery, type CreateAvailabilityInput, type UpdateAvailabilityInput, type BookingSlotInput, type CreateBookingInput, type BookingCreatedResult, type CreateCustomerInput, type UpdateCustomerInput, type CreateWebhookInput, type UpdateWebhookInput, type PartnerEmbedOptions, type PartnerEmbedCodeDto, type PartnerEmbedTheme, type PartnerEmbedOpenMode, } from "./types.js";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACL,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EACb,KAAK,sBAAsB,GAC5B,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,YAAY,EACV,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -3,4 +3,4 @@ export { FoxSchedulingError, isFoxSchedulingError } from "./errors.js";
3
3
  export { MemoryTokenStore, FileTokenStore, } from "./auth/tokenStore.js";
4
4
  export { generateCodeVerifier, generateCodeChallengeS256, generateState, } from "./auth/pkce.js";
5
5
  export { verifyFoxWebhookSignature } from "./webhooks/verify.js";
6
- export { DEFAULT_BASE_URL, } from "./types.js";
6
+ export { DEFAULT_BASE_URL, MAX_PAGE_SIZE, isValidMonth, } from "./types.js";
@@ -1,49 +1,58 @@
1
- import type { BusinessProfileDto, PartnerBookingDto, PartnerCustomerDto, PartnerServiceDto, PartnerStaffDto, PartnerWebhookEvent } from "@foxscheduling/shared";
1
+ import type { Availability, BusinessProfileDto, PartnerBookingDto, PartnerCustomerDto, PartnerEmbedCodeDto, PartnerEmbedOptions, PartnerServiceDto, PartnerStaffDto, PartnerWebhookEvent } from "@foxscheduling/shared";
2
2
  import type { HttpClient } from "../http/client.js";
3
+ import { type BookingCreatedResult, type BookingListQuery, type CreateAvailabilityInput, type CreateBookingInput, type CreateCustomerInput, type CreateWebhookInput, type ListQuery, type Page, type UpdateAvailabilityInput, type UpdateCustomerInput, type UpdateWebhookInput } from "../types.js";
3
4
  export declare class BusinessResource {
4
5
  private readonly http;
5
6
  constructor(http: HttpClient);
6
7
  get(): Promise<BusinessProfileDto>;
8
+ /**
9
+ * Get booking embed code (inline iframe + popup script + raw URL) for this
10
+ * business, with optional theming and button styling.
11
+ */
12
+ getEmbedCode(options?: PartnerEmbedOptions): Promise<PartnerEmbedCodeDto>;
7
13
  }
8
14
  export declare class ServicesResource {
9
15
  private readonly http;
10
16
  constructor(http: HttpClient);
11
- list(): Promise<PartnerServiceDto[]>;
17
+ list(query?: ListQuery): Promise<Page<PartnerServiceDto>>;
12
18
  get(id: string): Promise<PartnerServiceDto>;
13
19
  }
14
20
  export declare class StaffResource {
15
21
  private readonly http;
16
22
  constructor(http: HttpClient);
17
- list(): Promise<PartnerStaffDto[]>;
23
+ list(query?: ListQuery): Promise<Page<PartnerStaffDto>>;
18
24
  get(id: string): Promise<PartnerStaffDto>;
19
25
  }
20
26
  export declare class AvailabilityResource {
21
27
  private readonly http;
22
28
  constructor(http: HttpClient);
23
- list(): Promise<unknown[]>;
24
- get(id: string): Promise<unknown>;
25
- create(body: unknown): Promise<unknown>;
26
- update(id: string, body: unknown): Promise<unknown>;
27
- delete(id: string): Promise<unknown>;
29
+ list(query?: ListQuery): Promise<Page<Availability>>;
30
+ get(id: string): Promise<Availability>;
31
+ create(body: CreateAvailabilityInput): Promise<Availability>;
32
+ update(id: string, body: UpdateAvailabilityInput): Promise<Availability>;
33
+ delete(id: string): Promise<boolean>;
28
34
  }
29
35
  export declare class BookingsResource {
30
36
  private readonly http;
31
37
  constructor(http: HttpClient);
32
- list(query?: Record<string, string>): Promise<PartnerBookingDto[]>;
38
+ /**
39
+ * List bookings for a single month.
40
+ *
41
+ * `query.month` is required (format `YYYY-MM`, e.g. "2026-06") to keep the
42
+ * response small.
43
+ */
44
+ list(query: BookingListQuery): Promise<Page<PartnerBookingDto>>;
33
45
  get(id: string, serviceId: string): Promise<PartnerBookingDto>;
34
- create(body: unknown): Promise<unknown>;
35
- cancel(id: string, serviceId: string): Promise<unknown>;
46
+ create(body: CreateBookingInput): Promise<BookingCreatedResult>;
47
+ cancel(id: string, serviceId: string): Promise<PartnerBookingDto>;
36
48
  }
37
49
  export declare class CustomersResource {
38
50
  private readonly http;
39
51
  constructor(http: HttpClient);
40
- list(): Promise<PartnerCustomerDto[]>;
52
+ list(query?: ListQuery): Promise<Page<PartnerCustomerDto>>;
41
53
  get(id: string): Promise<PartnerCustomerDto>;
42
- create(body: {
43
- name: string;
44
- email: string;
45
- }): Promise<PartnerCustomerDto>;
46
- update(id: string, body: unknown): Promise<PartnerCustomerDto>;
54
+ create(body: CreateCustomerInput): Promise<PartnerCustomerDto>;
55
+ update(id: string, body: UpdateCustomerInput): Promise<PartnerCustomerDto>;
47
56
  }
48
57
  export interface WebhookSubscriptionPublic {
49
58
  id: string;
@@ -51,21 +60,16 @@ export interface WebhookSubscriptionPublic {
51
60
  events: PartnerWebhookEvent[];
52
61
  creationDate?: string;
53
62
  }
63
+ export interface CreateWebhookResult {
64
+ subscription: WebhookSubscriptionPublic;
65
+ secret: string;
66
+ }
54
67
  export declare class WebhooksResource {
55
68
  private readonly http;
56
69
  constructor(http: HttpClient);
57
- list(): Promise<WebhookSubscriptionPublic[]>;
58
- create(body: {
59
- url: string;
60
- events: PartnerWebhookEvent[];
61
- }): Promise<{
62
- subscription: WebhookSubscriptionPublic;
63
- secret: string;
64
- }>;
65
- update(id: string, body: Partial<{
66
- url: string;
67
- events: PartnerWebhookEvent[];
68
- }>): Promise<WebhookSubscriptionPublic>;
69
- delete(id: string): Promise<unknown>;
70
+ list(query?: ListQuery): Promise<Page<WebhookSubscriptionPublic>>;
71
+ create(body: CreateWebhookInput): Promise<CreateWebhookResult>;
72
+ update(id: string, body: UpdateWebhookInput): Promise<WebhookSubscriptionPublic>;
73
+ delete(id: string): Promise<boolean>;
70
74
  }
71
75
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,GAAG,IAAI,OAAO,CAAC,kBAAkB,CAAC;CAGnC;AAED,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,IAAI,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAIpC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CA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;CAG3E;AAED,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,yBAAyB,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAOjE,MAAM,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI9D,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,yBAAyB,CAAC;IAOrC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGrC"}
@@ -1,3 +1,12 @@
1
+ import { isValidMonth, } from "../types.js";
2
+ import { FoxSchedulingError } from "../errors.js";
3
+ /** Convert pagination options to string query params. */
4
+ function pageQuery(query) {
5
+ return {
6
+ limit: query?.limit != null ? String(query.limit) : undefined,
7
+ offset: query?.offset != null ? String(query.offset) : undefined,
8
+ };
9
+ }
1
10
  export class BusinessResource {
2
11
  http;
3
12
  constructor(http) {
@@ -6,14 +15,35 @@ export class BusinessResource {
6
15
  get() {
7
16
  return this.http.get("/partner/business");
8
17
  }
18
+ /**
19
+ * Get booking embed code (inline iframe + popup script + raw URL) for this
20
+ * business, with optional theming and button styling.
21
+ */
22
+ getEmbedCode(options = {}) {
23
+ return this.http.get("/partner/business/embed", {
24
+ servicePath: options.servicePath,
25
+ theme: options.theme,
26
+ hidePageDetails: options.hidePageDetails != null ? String(options.hidePageDetails) : undefined,
27
+ showThemeToggle: options.showThemeToggle != null ? String(options.showThemeToggle) : undefined,
28
+ heightPx: options.heightPx != null ? String(options.heightPx) : undefined,
29
+ iframeBorderRadius: options.iframeBorderRadius,
30
+ openMode: options.openMode,
31
+ buttonText: options.buttonText,
32
+ buttonBackgroundColor: options.buttonBackgroundColor,
33
+ buttonTextColor: options.buttonTextColor,
34
+ buttonBorderRadiusPx: options.buttonBorderRadiusPx != null
35
+ ? String(options.buttonBorderRadiusPx)
36
+ : undefined,
37
+ });
38
+ }
9
39
  }
10
40
  export class ServicesResource {
11
41
  http;
12
42
  constructor(http) {
13
43
  this.http = http;
14
44
  }
15
- list() {
16
- return this.http.get("/partner/services");
45
+ list(query) {
46
+ return this.http.get("/partner/services", pageQuery(query));
17
47
  }
18
48
  get(id) {
19
49
  return this.http.get(`/partner/services/${id}`);
@@ -24,8 +54,8 @@ export class StaffResource {
24
54
  constructor(http) {
25
55
  this.http = http;
26
56
  }
27
- list() {
28
- return this.http.get("/partner/staff");
57
+ list(query) {
58
+ return this.http.get("/partner/staff", pageQuery(query));
29
59
  }
30
60
  get(id) {
31
61
  return this.http.get(`/partner/staff/${id}`);
@@ -36,8 +66,8 @@ export class AvailabilityResource {
36
66
  constructor(http) {
37
67
  this.http = http;
38
68
  }
39
- list() {
40
- return this.http.get("/partner/availability");
69
+ list(query) {
70
+ return this.http.get("/partner/availability", pageQuery(query));
41
71
  }
42
72
  get(id) {
43
73
  return this.http.get(`/partner/availability/${id}`);
@@ -57,19 +87,38 @@ export class BookingsResource {
57
87
  constructor(http) {
58
88
  this.http = http;
59
89
  }
60
- list(query) {
61
- return this.http.get("/partner/bookings", query);
90
+ /**
91
+ * List bookings for a single month.
92
+ *
93
+ * `query.month` is required (format `YYYY-MM`, e.g. "2026-06") to keep the
94
+ * response small.
95
+ */
96
+ async list(query) {
97
+ if (!query || !query.month) {
98
+ throw new FoxSchedulingError("MONTH_REQUIRED", 'bookings.list requires a "month" in YYYY-MM format, e.g. "2026-06".');
99
+ }
100
+ if (!isValidMonth(query.month)) {
101
+ throw new FoxSchedulingError("INVALID_MONTH", `Invalid month "${query.month}". Expected YYYY-MM, e.g. "2026-06".`);
102
+ }
103
+ return this.http.get("/partner/bookings", {
104
+ yearMonth: query.month,
105
+ serviceId: query.serviceId,
106
+ providerId: query.providerId,
107
+ status: query.status,
108
+ search: query.search,
109
+ ...pageQuery(query),
110
+ });
62
111
  }
63
112
  get(id, serviceId) {
64
- return this.http.get(`/partner/bookings/${id}`, { serviceId });
113
+ return this.http.get(`/partner/bookings/${id}`, {
114
+ serviceId,
115
+ });
65
116
  }
66
117
  create(body) {
67
118
  return this.http.post("/partner/bookings", body);
68
119
  }
69
120
  cancel(id, serviceId) {
70
- return this.http.post(`/partner/bookings/${id}/cancel`, undefined, {
71
- serviceId,
72
- });
121
+ return this.http.post(`/partner/bookings/${id}/cancel`, undefined, { serviceId });
73
122
  }
74
123
  }
75
124
  export class CustomersResource {
@@ -77,8 +126,8 @@ export class CustomersResource {
77
126
  constructor(http) {
78
127
  this.http = http;
79
128
  }
80
- list() {
81
- return this.http.get("/partner/customers");
129
+ list(query) {
130
+ return this.http.get("/partner/customers", pageQuery(query));
82
131
  }
83
132
  get(id) {
84
133
  return this.http.get(`/partner/customers/${id}`);
@@ -95,8 +144,8 @@ export class WebhooksResource {
95
144
  constructor(http) {
96
145
  this.http = http;
97
146
  }
98
- list() {
99
- return this.http.get("/partner/webhooks");
147
+ list(query) {
148
+ return this.http.get("/partner/webhooks", pageQuery(query));
100
149
  }
101
150
  create(body) {
102
151
  return this.http.post("/partner/webhooks", body);
package/dist/types.d.ts CHANGED
@@ -1,4 +1,100 @@
1
+ import type { Availability, Booking, BookingSummary, PartnerPage, PartnerWebhookEvent } from "@foxscheduling/shared";
1
2
  export declare const DEFAULT_BASE_URL = "https://foxscheduling.com/api/v1";
3
+ /** Maximum number of items returned in a single page (enforced by the API). */
4
+ export declare const MAX_PAGE_SIZE = 100;
5
+ /** Pagination options accepted by every list endpoint. */
6
+ export interface ListQuery {
7
+ /** Items per page (1–{@link MAX_PAGE_SIZE}). The API clamps higher values. */
8
+ limit?: number;
9
+ /** Number of items to skip from the start. Defaults to 0. */
10
+ offset?: number;
11
+ }
12
+ /**
13
+ * A single page of results, returned by every `list()` method.
14
+ *
15
+ * Re-exported from `@foxscheduling/shared` as `PartnerPage<T>`.
16
+ */
17
+ export type Page<T> = PartnerPage<T>;
18
+ /** Re-export the embed options/result types for SDK consumers. */
19
+ export type { PartnerEmbedOptions, PartnerEmbedCodeDto, PartnerEmbedTheme, PartnerEmbedOpenMode, } from "@foxscheduling/shared";
20
+ /** Booking status values returned by the Partner API. */
21
+ export type BookingStatus = Booking["status"];
22
+ /**
23
+ * Query for {@link BookingsResource.list}.
24
+ *
25
+ * `month` is required to keep responses small — the API would otherwise return
26
+ * every booking for the business.
27
+ */
28
+ export interface BookingListQuery extends ListQuery {
29
+ /** Required calendar month to fetch, format `YYYY-MM` (e.g. "2026-06"). */
30
+ month: string;
31
+ /** Restrict to a single service (UUID v4). */
32
+ serviceId?: string;
33
+ /** Restrict to a single staff/provider (UUID). */
34
+ providerId?: string;
35
+ /** Restrict to a booking status. */
36
+ status?: BookingStatus;
37
+ /** Case-insensitive search over customer name, email, or slug. */
38
+ search?: string;
39
+ }
40
+ /** Body for {@link AvailabilityResource.create}. */
41
+ export type CreateAvailabilityInput = Omit<Availability, "id" | "ttl" | "sortKey" | "updatedOn" | "creationDate" | "schemaVersion" | "recordType" | "tenantId">;
42
+ /** Body for {@link AvailabilityResource.update}. */
43
+ export type UpdateAvailabilityInput = Partial<CreateAvailabilityInput>;
44
+ /** A slot to book within {@link CreateBookingInput}. */
45
+ export interface BookingSlotInput {
46
+ /** Date in `YYYY-MM-DD`. */
47
+ date: string;
48
+ /** Start time, e.g. "09:00". */
49
+ start: string;
50
+ /** End time, e.g. "09:30". */
51
+ end: string;
52
+ /** Optional specific staff member (UUID). */
53
+ staffId?: string;
54
+ }
55
+ /** Body for {@link BookingsResource.create}. */
56
+ export interface CreateBookingInput {
57
+ /** Service to book (UUID v4). */
58
+ serviceId: string;
59
+ /** One or more slots to reserve. */
60
+ slots: BookingSlotInput[];
61
+ /** Customer name. */
62
+ name: string;
63
+ /** Customer email. */
64
+ email: string;
65
+ /** Optional IANA timezone, e.g. "Europe/London". */
66
+ timezone?: string;
67
+ /** Optional answers to the service's booking questions. */
68
+ questionAnswers?: Record<string, string>;
69
+ }
70
+ /** Result of {@link BookingsResource.create}. */
71
+ export interface BookingCreatedResult {
72
+ bookingSummary: BookingSummary[];
73
+ customerId: string;
74
+ }
75
+ /** Body for {@link CustomersResource.create}. */
76
+ export interface CreateCustomerInput {
77
+ name: string;
78
+ email: string;
79
+ }
80
+ /** Body for {@link CustomersResource.update}. */
81
+ export interface UpdateCustomerInput {
82
+ name?: string;
83
+ email?: string;
84
+ blacklisted?: boolean;
85
+ }
86
+ /** Body for {@link WebhooksResource.create}. */
87
+ export interface CreateWebhookInput {
88
+ url: string;
89
+ events: PartnerWebhookEvent[];
90
+ }
91
+ /** Body for {@link WebhooksResource.update}. */
92
+ export interface UpdateWebhookInput {
93
+ url?: string;
94
+ events?: PartnerWebhookEvent[];
95
+ }
96
+ /** True when `value` matches the `YYYY-MM` format (e.g. "2026-06"). */
97
+ export declare function isValidMonth(value: string): boolean;
2
98
  export interface TokenSet {
3
99
  accessToken: string;
4
100
  refreshToken: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,qCAAqC,CAAC;AAEnE,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,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AE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf"}
package/dist/types.js CHANGED
@@ -1 +1,8 @@
1
+ import { isValidYearMonth, PARTNER_MAX_PAGE_SIZE, } from "@foxscheduling/shared";
1
2
  export const DEFAULT_BASE_URL = "https://foxscheduling.com/api/v1";
3
+ /** Maximum number of items returned in a single page (enforced by the API). */
4
+ export const MAX_PAGE_SIZE = PARTNER_MAX_PAGE_SIZE;
5
+ /** True when `value` matches the `YYYY-MM` format (e.g. "2026-06"). */
6
+ export function isValidMonth(value) {
7
+ return isValidYearMonth(value);
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foxscheduling/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Official Fox Scheduling Partner API SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.cjs",