@savvycal/appointments-core 0.1.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/LICENSE +21 -0
- package/README.md +148 -0
- package/dist/index.cjs +527 -0
- package/dist/index.d.cts +24945 -0
- package/dist/index.d.ts +24945 -0
- package/dist/index.js +432 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 SavvyCal
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# @savvycal/appointments-core
|
|
2
|
+
|
|
3
|
+
TypeScript/JavaScript client library for the [SavvyCal Appointments API](https://developers.savvycal.app).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @savvycal/appointments-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Creating a Client
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { createFetchClient } from "@savvycal/appointments-core";
|
|
17
|
+
|
|
18
|
+
const client = createFetchClient({
|
|
19
|
+
fetchAccessToken: async () => {
|
|
20
|
+
// Return a JWT access token
|
|
21
|
+
return "your-jwt-token";
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Authentication
|
|
27
|
+
|
|
28
|
+
The client requires a `fetchAccessToken` callback that returns a JWT token. The client automatically handles token caching and refresh when tokens expire.
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
const client = createFetchClient({
|
|
32
|
+
fetchAccessToken: async () => {
|
|
33
|
+
const response = await fetch("/api/token");
|
|
34
|
+
const { token } = await response.json();
|
|
35
|
+
return token;
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Demo Mode
|
|
41
|
+
|
|
42
|
+
For development and testing, you can use demo mode:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
const client = createFetchClient({
|
|
46
|
+
demo: "demo-token",
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Account Scoping
|
|
51
|
+
|
|
52
|
+
To scope requests to a specific account, pass the `account` option:
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
const client = createFetchClient({
|
|
56
|
+
account: "account-id",
|
|
57
|
+
fetchAccessToken: async () => "your-jwt-token",
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Making API Calls
|
|
62
|
+
|
|
63
|
+
The client provides typed methods for all API endpoints:
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
// GET request
|
|
67
|
+
const { data, error } = await client.GET("/v1/appointments/{appointment_id}", {
|
|
68
|
+
params: {
|
|
69
|
+
path: { appointment_id: "apt_123" },
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// POST request
|
|
74
|
+
const { data, error } = await client.POST("/v1/appointments", {
|
|
75
|
+
body: {
|
|
76
|
+
service_id: "svc_123",
|
|
77
|
+
start_time: "2024-01-15T10:00:00Z",
|
|
78
|
+
client: {
|
|
79
|
+
name: "John Doe",
|
|
80
|
+
email: "john@example.com",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Using Operation Functions
|
|
87
|
+
|
|
88
|
+
The package also exports typed operation functions for common actions:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import {
|
|
92
|
+
createFetchClient,
|
|
93
|
+
getAppointment,
|
|
94
|
+
cancelAppointment,
|
|
95
|
+
listServices,
|
|
96
|
+
} from "@savvycal/appointments-core";
|
|
97
|
+
|
|
98
|
+
const client = createFetchClient({
|
|
99
|
+
fetchAccessToken: async () => "your-jwt-token",
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Get an appointment
|
|
103
|
+
const appointment = await getAppointment(client, {
|
|
104
|
+
appointment_id: "apt_123",
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// Cancel an appointment
|
|
108
|
+
await cancelAppointment(
|
|
109
|
+
client,
|
|
110
|
+
{ appointment_id: "apt_123" },
|
|
111
|
+
{ reason: "Schedule conflict" },
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
// List services
|
|
115
|
+
const services = await listServices(client);
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Type Utilities
|
|
119
|
+
|
|
120
|
+
The package exports type utilities for extracting parameter types from API paths:
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import type {
|
|
124
|
+
PathParams,
|
|
125
|
+
QueryParams,
|
|
126
|
+
RequestBody,
|
|
127
|
+
} from "@savvycal/appointments-core";
|
|
128
|
+
|
|
129
|
+
// Extract path parameters
|
|
130
|
+
type AppointmentPath = PathParams<"/v1/appointments/{appointment_id}", "get">;
|
|
131
|
+
// => { appointment_id: string }
|
|
132
|
+
|
|
133
|
+
// Extract query parameters
|
|
134
|
+
type SlotsQuery = QueryParams<"/v1/public/services/{service_id}/slots", "get">;
|
|
135
|
+
// => { from: string; until: string; time_zone?: string; ... }
|
|
136
|
+
|
|
137
|
+
// Extract request body type
|
|
138
|
+
type CreateAppointmentBody = RequestBody<"/v1/appointments", "post">;
|
|
139
|
+
// => { service_id: string; start_time: string; client: { ... }; ... }
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## API Reference
|
|
143
|
+
|
|
144
|
+
See the [SavvyCal Appointments API documentation](https://developers.savvycal.app) for full API details.
|
|
145
|
+
|
|
146
|
+
## License
|
|
147
|
+
|
|
148
|
+
MIT
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
cancelAppointment: () => cancelAppointment,
|
|
34
|
+
cancelPublicAppointment: () => cancelPublicAppointment,
|
|
35
|
+
confirmAppointment: () => confirmAppointment,
|
|
36
|
+
createAccount: () => createAccount,
|
|
37
|
+
createAccountUser: () => createAccountUser,
|
|
38
|
+
createAppointment: () => createAppointment,
|
|
39
|
+
createBlock: () => createBlock,
|
|
40
|
+
createCancellationReason: () => createCancellationReason,
|
|
41
|
+
createClient: () => createClient2,
|
|
42
|
+
createDashboardSession: () => createDashboardSession,
|
|
43
|
+
createFetchClient: () => createFetchClient,
|
|
44
|
+
createProvider: () => createProvider,
|
|
45
|
+
createProviderSchedule: () => createProviderSchedule,
|
|
46
|
+
createPublicAppointment: () => createPublicAppointment,
|
|
47
|
+
createService: () => createService,
|
|
48
|
+
createServiceProvider: () => createServiceProvider,
|
|
49
|
+
deactivateProvider: () => deactivateProvider,
|
|
50
|
+
deleteBlock: () => deleteBlock,
|
|
51
|
+
deleteCancellationReason: () => deleteCancellationReason,
|
|
52
|
+
deleteClient: () => deleteClient,
|
|
53
|
+
deleteProviderSchedule: () => deleteProviderSchedule,
|
|
54
|
+
deleteService: () => deleteService,
|
|
55
|
+
deleteServiceProvider: () => deleteServiceProvider,
|
|
56
|
+
getAccountById: () => getAccountById,
|
|
57
|
+
getAppointment: () => getAppointment,
|
|
58
|
+
getBlock: () => getBlock,
|
|
59
|
+
getCancellationReason: () => getCancellationReason,
|
|
60
|
+
getClient: () => getClient,
|
|
61
|
+
getCurrentAccount: () => getCurrentAccount,
|
|
62
|
+
getCurrentAccountUser: () => getCurrentAccountUser,
|
|
63
|
+
getCurrentPlatform: () => getCurrentPlatform,
|
|
64
|
+
getEarliestPublicServiceSlot: () => getEarliestPublicServiceSlot,
|
|
65
|
+
getProvider: () => getProvider,
|
|
66
|
+
getProviderSchedule: () => getProviderSchedule,
|
|
67
|
+
getPublicAppointment: () => getPublicAppointment,
|
|
68
|
+
getService: () => getService,
|
|
69
|
+
listAccountUsers: () => listAccountUsers,
|
|
70
|
+
listAccounts: () => listAccounts,
|
|
71
|
+
listAppointments: () => listAppointments,
|
|
72
|
+
listBlocks: () => listBlocks,
|
|
73
|
+
listCancellationReasons: () => listCancellationReasons,
|
|
74
|
+
listClients: () => listClients,
|
|
75
|
+
listProviderSchedules: () => listProviderSchedules,
|
|
76
|
+
listProviders: () => listProviders,
|
|
77
|
+
listPublicCancellationReasons: () => listPublicCancellationReasons,
|
|
78
|
+
listPublicServiceSlots: () => listPublicServiceSlots,
|
|
79
|
+
listRoles: () => listRoles,
|
|
80
|
+
listServiceProviders: () => listServiceProviders,
|
|
81
|
+
listServiceSlots: () => listServiceSlots,
|
|
82
|
+
listServices: () => listServices,
|
|
83
|
+
rescheduleAppointment: () => rescheduleAppointment,
|
|
84
|
+
reschedulePublicAppointment: () => reschedulePublicAppointment,
|
|
85
|
+
updateAccount: () => updateAccount,
|
|
86
|
+
updateBlock: () => updateBlock,
|
|
87
|
+
updateCancellationReason: () => updateCancellationReason,
|
|
88
|
+
updateClient: () => updateClient,
|
|
89
|
+
updateProvider: () => updateProvider,
|
|
90
|
+
updateProviderSchedule: () => updateProviderSchedule,
|
|
91
|
+
updateService: () => updateService
|
|
92
|
+
});
|
|
93
|
+
module.exports = __toCommonJS(index_exports);
|
|
94
|
+
|
|
95
|
+
// src/client.ts
|
|
96
|
+
var import_openapi_fetch = __toESM(require("openapi-fetch"), 1);
|
|
97
|
+
var DEFAULT_BASE_URL = "https://api.savvycal.app";
|
|
98
|
+
var UNPROTECTED_PATHS = ["/v1/public"];
|
|
99
|
+
var isValidJwt = (token) => {
|
|
100
|
+
const parts = token.split(".");
|
|
101
|
+
if (parts.length !== 3) return false;
|
|
102
|
+
try {
|
|
103
|
+
JSON.parse(atob(parts[1]));
|
|
104
|
+
return true;
|
|
105
|
+
} catch {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var isTokenExpired = (token) => {
|
|
110
|
+
try {
|
|
111
|
+
const payload = token.split(".")[1];
|
|
112
|
+
if (!payload) return true;
|
|
113
|
+
const decoded = JSON.parse(atob(payload));
|
|
114
|
+
if (!decoded.exp) return false;
|
|
115
|
+
return decoded.exp * 1e3 < Date.now();
|
|
116
|
+
} catch {
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
var createFetchClient = (options = {}) => {
|
|
121
|
+
let accessToken;
|
|
122
|
+
const authMiddleware = {
|
|
123
|
+
async onRequest({ request, schemaPath }) {
|
|
124
|
+
if (UNPROTECTED_PATHS.some((path) => schemaPath.startsWith(path))) {
|
|
125
|
+
return void 0;
|
|
126
|
+
}
|
|
127
|
+
if (options.demo) {
|
|
128
|
+
request.headers.set("Authorization", `Demo ${options.demo}`);
|
|
129
|
+
return request;
|
|
130
|
+
}
|
|
131
|
+
if (!options.fetchAccessToken) {
|
|
132
|
+
throw new Error("No fetchAccessToken provided");
|
|
133
|
+
}
|
|
134
|
+
if (!accessToken || isTokenExpired(accessToken)) {
|
|
135
|
+
const authRes = await options.fetchAccessToken();
|
|
136
|
+
if (!authRes) {
|
|
137
|
+
throw new Error("No access token");
|
|
138
|
+
}
|
|
139
|
+
if (!isValidJwt(authRes)) {
|
|
140
|
+
throw new Error("Invalid access token: expected a JWT");
|
|
141
|
+
}
|
|
142
|
+
accessToken = authRes;
|
|
143
|
+
}
|
|
144
|
+
request.headers.set("Authorization", `Bearer ${accessToken}`);
|
|
145
|
+
return request;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
const clientOptions = {
|
|
149
|
+
baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,
|
|
150
|
+
headers: {},
|
|
151
|
+
...options
|
|
152
|
+
};
|
|
153
|
+
if (options.demo) {
|
|
154
|
+
clientOptions.headers = {
|
|
155
|
+
...clientOptions.headers,
|
|
156
|
+
Authorization: `Demo ${options.demo}`
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
if (options.account) {
|
|
160
|
+
clientOptions.headers = {
|
|
161
|
+
...clientOptions.headers,
|
|
162
|
+
"X-SavvyCal-Account": options.account
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const client = (0, import_openapi_fetch.default)(clientOptions);
|
|
166
|
+
client.use(authMiddleware);
|
|
167
|
+
return client;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
// src/operations.ts
|
|
171
|
+
function cancelAppointment(client, path, body) {
|
|
172
|
+
return client.POST("/v1/appointments/{appointment_id}/cancel", {
|
|
173
|
+
body,
|
|
174
|
+
params: { path }
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
function cancelPublicAppointment(client, path, body) {
|
|
178
|
+
return client.POST("/v1/public/appointments/{appointment_id}/cancel", {
|
|
179
|
+
body,
|
|
180
|
+
params: { path }
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function confirmAppointment(client, path, body) {
|
|
184
|
+
return client.POST("/v1/appointments/{appointment_id}/confirm", {
|
|
185
|
+
body,
|
|
186
|
+
params: { path }
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function createAccount(client, body) {
|
|
190
|
+
return client.POST("/v1/accounts", {
|
|
191
|
+
body
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function createAccountUser(client, body) {
|
|
195
|
+
return client.POST("/v1/users", {
|
|
196
|
+
body
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function createAppointment(client, body) {
|
|
200
|
+
return client.POST("/v1/appointments", {
|
|
201
|
+
body
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function createBlock(client, body) {
|
|
205
|
+
return client.POST("/v1/blocks", {
|
|
206
|
+
body
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function createCancellationReason(client, body) {
|
|
210
|
+
return client.POST("/v1/cancellation_reasons", {
|
|
211
|
+
body
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
function createClient2(client, body) {
|
|
215
|
+
return client.POST("/v1/clients", {
|
|
216
|
+
body
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function createDashboardSession(client, body) {
|
|
220
|
+
return client.POST("/v1/dashboard_sessions", {
|
|
221
|
+
body
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
function createProvider(client, body) {
|
|
225
|
+
return client.POST("/v1/providers", {
|
|
226
|
+
body
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
function createProviderSchedule(client, path, body) {
|
|
230
|
+
return client.POST("/v1/providers/{provider_id}/schedules", {
|
|
231
|
+
body,
|
|
232
|
+
params: { path }
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
function createPublicAppointment(client, body) {
|
|
236
|
+
return client.POST("/v1/public/appointments", {
|
|
237
|
+
body
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
function createService(client, body) {
|
|
241
|
+
return client.POST("/v1/services", {
|
|
242
|
+
body
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
function createServiceProvider(client, path, body) {
|
|
246
|
+
return client.POST("/v1/services/{service_id}/providers", {
|
|
247
|
+
body,
|
|
248
|
+
params: { path }
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function deactivateProvider(client, path) {
|
|
252
|
+
return client.DELETE("/v1/providers/{provider_id}", {
|
|
253
|
+
params: { path }
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function deleteBlock(client, path) {
|
|
257
|
+
return client.DELETE("/v1/blocks/{block_id}", {
|
|
258
|
+
params: { path }
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
function deleteCancellationReason(client, path) {
|
|
262
|
+
return client.DELETE("/v1/cancellation_reasons/{cancellation_reason_id}", {
|
|
263
|
+
params: { path }
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
function deleteClient(client, path) {
|
|
267
|
+
return client.DELETE("/v1/clients/{client_id}", {
|
|
268
|
+
params: { path }
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
function deleteProviderSchedule(client, path) {
|
|
272
|
+
return client.DELETE("/v1/provider_schedules/{provider_schedule_id}", {
|
|
273
|
+
params: { path }
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
function deleteService(client, path) {
|
|
277
|
+
return client.DELETE("/v1/services/{service_id}", {
|
|
278
|
+
params: { path }
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
function deleteServiceProvider(client, path) {
|
|
282
|
+
return client.DELETE("/v1/service_providers/{service_provider_id}", {
|
|
283
|
+
params: { path }
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
function getAccountById(client, path) {
|
|
287
|
+
return client.GET("/v1/accounts/{account_id}", {
|
|
288
|
+
params: { path }
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
function getAppointment(client, path, query) {
|
|
292
|
+
return client.GET("/v1/appointments/{appointment_id}", {
|
|
293
|
+
params: { path, query }
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function getBlock(client, path) {
|
|
297
|
+
return client.GET("/v1/blocks/{block_id}", {
|
|
298
|
+
params: { path }
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
function getCancellationReason(client, path) {
|
|
302
|
+
return client.GET("/v1/cancellation_reasons/{cancellation_reason_id}", {
|
|
303
|
+
params: { path }
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
function getClient(client, path) {
|
|
307
|
+
return client.GET("/v1/clients/{client_id}", {
|
|
308
|
+
params: { path }
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
function getCurrentAccount(client) {
|
|
312
|
+
return client.GET("/v1/account");
|
|
313
|
+
}
|
|
314
|
+
function getCurrentAccountUser(client) {
|
|
315
|
+
return client.GET("/v1/user");
|
|
316
|
+
}
|
|
317
|
+
function getCurrentPlatform(client) {
|
|
318
|
+
return client.GET("/v1/platform");
|
|
319
|
+
}
|
|
320
|
+
function getEarliestPublicServiceSlot(client, path, query) {
|
|
321
|
+
return client.GET("/v1/public/services/{service_id}/earliest_slot", {
|
|
322
|
+
params: { path, query }
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
function getProvider(client, path) {
|
|
326
|
+
return client.GET("/v1/providers/{provider_id}", {
|
|
327
|
+
params: { path }
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
function getProviderSchedule(client, path) {
|
|
331
|
+
return client.GET("/v1/provider_schedules/{provider_schedule_id}", {
|
|
332
|
+
params: { path }
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
function getPublicAppointment(client, path) {
|
|
336
|
+
return client.GET("/v1/public/appointments/{appointment_id}", {
|
|
337
|
+
params: { path }
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
function getService(client, path) {
|
|
341
|
+
return client.GET("/v1/services/{service_id}", {
|
|
342
|
+
params: { path }
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
function listAccounts(client, query) {
|
|
346
|
+
return client.GET("/v1/accounts", {
|
|
347
|
+
params: { query }
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
function listAccountUsers(client) {
|
|
351
|
+
return client.GET("/v1/users");
|
|
352
|
+
}
|
|
353
|
+
function listAppointments(client, query) {
|
|
354
|
+
return client.GET("/v1/appointments", {
|
|
355
|
+
params: { query }
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
function listBlocks(client, query) {
|
|
359
|
+
return client.GET("/v1/blocks", {
|
|
360
|
+
params: { query }
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
function listCancellationReasons(client) {
|
|
364
|
+
return client.GET("/v1/cancellation_reasons");
|
|
365
|
+
}
|
|
366
|
+
function listClients(client, query) {
|
|
367
|
+
return client.GET("/v1/clients", {
|
|
368
|
+
params: { query }
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
function listProviders(client, query) {
|
|
372
|
+
return client.GET("/v1/providers", {
|
|
373
|
+
params: { query }
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
function listProviderSchedules(client, query) {
|
|
377
|
+
return client.GET("/v1/provider_schedules", {
|
|
378
|
+
params: { query }
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
function listPublicCancellationReasons(client, path) {
|
|
382
|
+
return client.GET(
|
|
383
|
+
"/v1/public/appointments/{appointment_id}/cancellation_reasons",
|
|
384
|
+
{
|
|
385
|
+
params: { path }
|
|
386
|
+
}
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
function listPublicServiceSlots(client, path, query) {
|
|
390
|
+
return client.GET("/v1/public/services/{service_id}/slots", {
|
|
391
|
+
params: { path, query }
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
function listRoles(client) {
|
|
395
|
+
return client.GET("/v1/roles");
|
|
396
|
+
}
|
|
397
|
+
function listServiceProviders(client, path) {
|
|
398
|
+
return client.GET("/v1/services/{service_id}/providers", {
|
|
399
|
+
params: { path }
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
function listServices(client, query) {
|
|
403
|
+
return client.GET("/v1/services", {
|
|
404
|
+
params: { query }
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
function listServiceSlots(client, path, query) {
|
|
408
|
+
return client.GET("/v1/services/{service_id}/slots", {
|
|
409
|
+
params: { path, query }
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
function rescheduleAppointment(client, path, body) {
|
|
413
|
+
return client.POST("/v1/appointments/{appointment_id}/reschedule", {
|
|
414
|
+
body,
|
|
415
|
+
params: { path }
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
function reschedulePublicAppointment(client, path, body) {
|
|
419
|
+
return client.POST("/v1/public/appointments/{appointment_id}/reschedule", {
|
|
420
|
+
body,
|
|
421
|
+
params: { path }
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
function updateAccount(client, path, body) {
|
|
425
|
+
return client.PATCH("/v1/accounts/{account_id}", {
|
|
426
|
+
body,
|
|
427
|
+
params: { path }
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
function updateBlock(client, path, body) {
|
|
431
|
+
return client.PATCH("/v1/blocks/{block_id}", {
|
|
432
|
+
body,
|
|
433
|
+
params: { path }
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
function updateCancellationReason(client, path, body) {
|
|
437
|
+
return client.PATCH("/v1/cancellation_reasons/{cancellation_reason_id}", {
|
|
438
|
+
body,
|
|
439
|
+
params: { path }
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
function updateClient(client, path, body) {
|
|
443
|
+
return client.PATCH("/v1/clients/{client_id}", {
|
|
444
|
+
body,
|
|
445
|
+
params: { path }
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
function updateProvider(client, path, body) {
|
|
449
|
+
return client.PATCH("/v1/providers/{provider_id}", {
|
|
450
|
+
body,
|
|
451
|
+
params: { path }
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
function updateProviderSchedule(client, path, body) {
|
|
455
|
+
return client.PATCH("/v1/provider_schedules/{provider_schedule_id}", {
|
|
456
|
+
body,
|
|
457
|
+
params: { path }
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
function updateService(client, path, body) {
|
|
461
|
+
return client.PATCH("/v1/services/{service_id}", {
|
|
462
|
+
body,
|
|
463
|
+
params: { path }
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
467
|
+
0 && (module.exports = {
|
|
468
|
+
cancelAppointment,
|
|
469
|
+
cancelPublicAppointment,
|
|
470
|
+
confirmAppointment,
|
|
471
|
+
createAccount,
|
|
472
|
+
createAccountUser,
|
|
473
|
+
createAppointment,
|
|
474
|
+
createBlock,
|
|
475
|
+
createCancellationReason,
|
|
476
|
+
createClient,
|
|
477
|
+
createDashboardSession,
|
|
478
|
+
createFetchClient,
|
|
479
|
+
createProvider,
|
|
480
|
+
createProviderSchedule,
|
|
481
|
+
createPublicAppointment,
|
|
482
|
+
createService,
|
|
483
|
+
createServiceProvider,
|
|
484
|
+
deactivateProvider,
|
|
485
|
+
deleteBlock,
|
|
486
|
+
deleteCancellationReason,
|
|
487
|
+
deleteClient,
|
|
488
|
+
deleteProviderSchedule,
|
|
489
|
+
deleteService,
|
|
490
|
+
deleteServiceProvider,
|
|
491
|
+
getAccountById,
|
|
492
|
+
getAppointment,
|
|
493
|
+
getBlock,
|
|
494
|
+
getCancellationReason,
|
|
495
|
+
getClient,
|
|
496
|
+
getCurrentAccount,
|
|
497
|
+
getCurrentAccountUser,
|
|
498
|
+
getCurrentPlatform,
|
|
499
|
+
getEarliestPublicServiceSlot,
|
|
500
|
+
getProvider,
|
|
501
|
+
getProviderSchedule,
|
|
502
|
+
getPublicAppointment,
|
|
503
|
+
getService,
|
|
504
|
+
listAccountUsers,
|
|
505
|
+
listAccounts,
|
|
506
|
+
listAppointments,
|
|
507
|
+
listBlocks,
|
|
508
|
+
listCancellationReasons,
|
|
509
|
+
listClients,
|
|
510
|
+
listProviderSchedules,
|
|
511
|
+
listProviders,
|
|
512
|
+
listPublicCancellationReasons,
|
|
513
|
+
listPublicServiceSlots,
|
|
514
|
+
listRoles,
|
|
515
|
+
listServiceProviders,
|
|
516
|
+
listServiceSlots,
|
|
517
|
+
listServices,
|
|
518
|
+
rescheduleAppointment,
|
|
519
|
+
reschedulePublicAppointment,
|
|
520
|
+
updateAccount,
|
|
521
|
+
updateBlock,
|
|
522
|
+
updateCancellationReason,
|
|
523
|
+
updateClient,
|
|
524
|
+
updateProvider,
|
|
525
|
+
updateProviderSchedule,
|
|
526
|
+
updateService
|
|
527
|
+
});
|