@foxscheduling/sdk 0.1.0 → 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
@@ -2,27 +2,195 @@
2
2
 
3
3
  Official Node.js SDK for the [Fox Scheduling Partner API](https://foxscheduling.com/developers).
4
4
 
5
+ Use this package to read and manage bookings, customers, availability, and more on behalf of a Fox Scheduling business — from your own server or integration.
6
+
7
+ **Requirements:** Node.js 18+
8
+
9
+ **Full API reference:** [foxscheduling.com/developers](https://foxscheduling.com/developers)
10
+
11
+ ---
12
+
5
13
  ## Install
6
14
 
7
15
  ```bash
8
16
  npm install @foxscheduling/sdk @foxscheduling/shared
9
17
  ```
10
18
 
11
- ## API key (single business)
19
+ Both packages are required. `@foxscheduling/shared` provides shared types and scope names.
20
+
21
+ ---
22
+
23
+ ## Choose how to authenticate
24
+
25
+ | Method | Best for | Dashboard setup |
26
+ | --- | --- | --- |
27
+ | **API key** | Scripts, cron jobs, or automation for **your own** Fox business | [Developers → API keys](https://foxscheduling.com/dashboard/developers?tab=api-keys) |
28
+ | **OAuth** | SaaS apps where **other people** connect their Fox business to your product | [Developers → OAuth apps](https://foxscheduling.com/dashboard/developers) |
29
+
30
+ If you only need to access a business you own, start with an **API key**. It is the fastest path.
31
+
32
+ ---
33
+
34
+ ## Quick start: API key
35
+
36
+ ### 1. Create a key
37
+
38
+ 1. Sign in to [Fox Scheduling](https://foxscheduling.com).
39
+ 2. Open **Developers → API keys**.
40
+ 3. Pick the business, choose scopes (e.g. `business:read`, `bookings:read`), and create a key.
41
+ 4. Copy the key immediately — it is shown only once. Keys look like `fx_live_...`.
42
+
43
+ ### 2. Call the API
12
44
 
13
45
  ```typescript
14
46
  import { FoxScheduling } from "@foxscheduling/sdk";
15
47
 
16
48
  const fox = new FoxScheduling({
17
- auth: { type: "apiKey", apiKey: process.env.FOX_API_KEY! },
49
+ auth: {
50
+ type: "apiKey",
51
+ apiKey: process.env.FOX_API_KEY!, // fx_live_...
52
+ },
18
53
  });
19
54
 
55
+ // Example: read the connected business profile
20
56
  const business = await fox.business.get();
57
+ console.log(business.name);
21
58
  ```
22
59
 
23
- Create keys under **Settings → API keys** in the Fox Scheduling dashboard.
60
+ ### Available resources
24
61
 
25
- ## OAuth (multi-tenant integrations)
62
+ After creating a client, use:
63
+
64
+ - `fox.business` — business profile
65
+ - `fox.services` — services
66
+ - `fox.staff` — staff members
67
+ - `fox.availability` — availability rules
68
+ - `fox.bookings` — bookings
69
+ - `fox.customers` — customers
70
+ - `fox.webhooks` — webhook subscriptions
71
+
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
+ ```
163
+
164
+ ---
165
+
166
+ ## OAuth: connect other users' businesses
167
+
168
+ Use OAuth when you are building an integration (e.g. a CRM or reporting tool) and Fox Scheduling **users** need to authorize your app to access **their** business.
169
+
170
+ OAuth is a browser-based flow. At a high level:
171
+
172
+ ```
173
+ Your app Fox Scheduling User's browser
174
+ | | |
175
+ |-- 1. Build authorize URL --->| |
176
+ |-- 2. Redirect user -------------------------------------->|
177
+ | |<-- 3. User signs in & allows
178
+ |<-- 4. Redirect to your URL with ?code=... ---------------|
179
+ |-- 5. Exchange code for tokens ->| |
180
+ |-- 6. Call Partner API with stored tokens |
181
+ ```
182
+
183
+ You never type the authorization `code` yourself. Fox appends it to your redirect URL after the user clicks **Allow**.
184
+
185
+ ### Before you write code
186
+
187
+ 1. Create an OAuth app under **Developers → OAuth apps**.
188
+ 2. Note the **client ID** and **client secret** (secret is shown once).
189
+ 3. Add a **redirect URI** — the exact URL Fox will send users back to, e.g. `https://your-app.com/oauth/callback`. It must match character-for-character in your code.
190
+
191
+ ### Step 1 — Send the user to Fox
192
+
193
+ Create the SDK client and build the authorization URL:
26
194
 
27
195
  ```typescript
28
196
  import { FoxScheduling, FileTokenStore } from "@foxscheduling/sdk";
@@ -32,27 +200,148 @@ const fox = new FoxScheduling({
32
200
  type: "oauth",
33
201
  clientId: process.env.FOX_CLIENT_ID!,
34
202
  clientSecret: process.env.FOX_CLIENT_SECRET!,
35
- redirectUri: "https://your-domain.com/oauth/callback",
203
+ redirectUri: "https://your-app.com/oauth/callback", // must match dashboard
36
204
  tokenStore: new FileTokenStore("./fox-tokens.json"),
37
205
  },
38
206
  });
39
207
 
40
- const { url, codeVerifier } = fox.oauth!.getAuthorizationUrl({
208
+ const { url, codeVerifier, state } = fox.oauth!.getAuthorizationUrl({
41
209
  scopes: ["business:read", "bookings:read"],
42
210
  });
43
- // Redirect user to url, then on callback:
44
- await fox.oauth!.exchangeCode(code, codeVerifier);
45
211
  ```
46
212
 
47
- ## Webhook verification
213
+ **Important:** Before redirecting the user, save `codeVerifier` and `state` somewhere tied to that user session (memory, Redis, database, encrypted cookie, etc.). You need them on the next step.
214
+
215
+ Then redirect the user's browser to `url` (e.g. `res.redirect(url)` in Express).
216
+
217
+ ### Step 2 — Handle the callback
218
+
219
+ When the user approves, Fox redirects to your `redirectUri` with query parameters:
220
+
221
+ ```
222
+ https://your-app.com/oauth/callback?code=AUTHORIZATION_CODE&state=SAME_STATE_YOU_SAVED
223
+ ```
224
+
225
+ In your callback route:
226
+
227
+ 1. Read `code` and `state` from the query string.
228
+ 2. Confirm `state` matches what you saved (prevents CSRF).
229
+ 3. Load the saved `codeVerifier` for that session.
230
+ 4. Exchange the code for tokens.
231
+
232
+ ```typescript
233
+ // Example: Express route GET /oauth/callback
234
+ app.get("/oauth/callback", async (req, res) => {
235
+ const code = req.query.code as string | undefined;
236
+ const returnedState = req.query.state as string | undefined;
237
+
238
+ if (!code) {
239
+ return res.status(400).send("Authorization was denied or failed.");
240
+ }
241
+ if (returnedState !== savedState) {
242
+ return res.status(400).send("Invalid state — possible CSRF.");
243
+ }
244
+
245
+ await fox.oauth!.exchangeCode(code, savedCodeVerifier);
246
+
247
+ // Tokens are saved automatically. Redirect to your app.
248
+ res.redirect("/dashboard");
249
+ });
250
+ ```
251
+
252
+ ### Step 3 — Use the API
253
+
254
+ Once `exchangeCode` succeeds, the SDK stores tokens and attaches them to every request. You can call the same resources as with an API key:
255
+
256
+ ```typescript
257
+ const business = await fox.business.get();
258
+ const bookings = await fox.bookings.list({ month: "2026-06" });
259
+ ```
260
+
261
+ The SDK refreshes access tokens automatically before they expire.
262
+
263
+ ### What is `fox-tokens.json`?
264
+
265
+ In the examples above, `FileTokenStore("./fox-tokens.json")` tells the SDK **where to save OAuth tokens on disk**.
266
+
267
+ - **You do not create this file.** The SDK writes it after a successful `exchangeCode`.
268
+ - The path is just an example — use any path you like.
269
+ - **Keep it secret** — it contains refresh tokens. Add it to `.gitignore`.
270
+ - **One file = one connection.** Fine for local scripts or a single test business.
271
+
272
+ Example contents (written by the SDK):
273
+
274
+ ```json
275
+ {
276
+ "accessToken": "eyJhbGciOiJSUzI1NiIs...",
277
+ "refreshToken": "opaque-refresh-token",
278
+ "expiresAt": 1710003600000,
279
+ "scope": "business:read bookings:read",
280
+ "tokenType": "Bearer"
281
+ }
282
+ ```
283
+
284
+ ### Production OAuth apps
285
+
286
+ If many Fox users will connect their businesses, **do not** use one shared file. Implement the `TokenStore` interface and save tokens in your database, keyed by your user ID (or Fox `tenant_id`):
287
+
288
+ ```typescript
289
+ import type { TokenStore, TokenSet } from "@foxscheduling/sdk";
290
+
291
+ class DatabaseTokenStore implements TokenStore {
292
+ constructor(private userId: string) {}
293
+ async load(): Promise<TokenSet | null> { /* read from DB */ }
294
+ async save(tokens: TokenSet): Promise<void> { /* write to DB */ }
295
+ async clear(): Promise<void> { /* delete from DB */ }
296
+ }
297
+ ```
298
+
299
+ For unit tests, use `MemoryTokenStore()` (tokens disappear when the process exits).
300
+
301
+ More detail: [OAuth2 integration guide](https://foxscheduling.com/developers/oauth2)
302
+
303
+ ---
304
+
305
+ ## Webhook signature verification
306
+
307
+ When Fox sends a webhook to your server, verify the `X-Fox-Signature` header:
48
308
 
49
309
  ```typescript
50
310
  import { verifyFoxWebhookSignature } from "@foxscheduling/sdk";
51
311
 
52
312
  const ok = verifyFoxWebhookSignature({
53
- secret: webhookSecret,
313
+ secret: process.env.FOX_WEBHOOK_SECRET!,
54
314
  timestamp: req.headers["x-fox-timestamp"],
55
- rawBody: req.rawBody,
315
+ rawBody: req.rawBody, // unparsed request body string
56
316
  signatureHex: req.headers["x-fox-signature"],
57
317
  });
318
+
319
+ if (!ok) {
320
+ return res.status(401).send("Invalid signature");
321
+ }
58
322
  ```
323
+
324
+ Your HTTP framework must give you the **raw** body (before JSON parsing) for verification to work.
325
+
326
+ ---
327
+
328
+ ## Scopes
329
+
330
+ Each API key or OAuth request uses scopes such as:
331
+
332
+ `business:read`, `services:read`, `staff:read`, `availability:read`, `availability:write`, `bookings:read`, `bookings:write`, `customers:read`, `customers:write`, `webhooks:read`, `webhooks:write`
333
+
334
+ Request only the scopes your integration needs. See the [scope reference](https://foxscheduling.com/developers/oauth2#scopes).
335
+
336
+ ---
337
+
338
+ ## Links
339
+
340
+ - [Developers hub](https://foxscheduling.com/developers)
341
+ - [OAuth2 guide](https://foxscheduling.com/developers/oauth2)
342
+ - [API key guide](https://foxscheduling.com/developers/api-key)
343
+ - [Developers dashboard](https://foxscheduling.com/dashboard/developers)
344
+
345
+ ## Support
346
+
347
+ Questions or integration help: [foxscheduling.com/contact](https://foxscheduling.com/contact)
@@ -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;gBAA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AAG,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,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,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M,WAAW,mBAAmB;IAClC,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,CAAC,EAAE,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/index.d.ts CHANGED
@@ -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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K,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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AAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAO1D,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAI5C,MAAM,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAI9D,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;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,gBA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AAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,sBAAsB,EAAE,UAAU,CAAC;CACvD;AAED,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,sBAAsB,CAAC;AAEjF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,CAAC,EAAE,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.0",
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",