@withaevum/sdk 0.0.1

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.
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Providers API methods
3
+ */
4
+ export class ProvidersAPI {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ /**
9
+ * List providers for the organization
10
+ */
11
+ async list(params) {
12
+ const query = {};
13
+ if (params?.query) {
14
+ query.search = params.query; // API uses 'search' not 'query'
15
+ }
16
+ if (params?.page !== undefined) {
17
+ query.page = params.page;
18
+ }
19
+ if (params?.pageSize !== undefined) {
20
+ query.pageSize = params.pageSize;
21
+ }
22
+ const response = await this.client.request('GET', '/api/v1/orgs/{orgId}/providers', { query });
23
+ return response.providers || [];
24
+ }
25
+ /**
26
+ * Get a single provider by ID
27
+ */
28
+ async get(providerId) {
29
+ const orgId = await this.client.resolveOrgId();
30
+ const response = await this.client.request('GET', `/api/v1/orgs/${orgId}/providers/${providerId}`);
31
+ return response.provider;
32
+ }
33
+ /**
34
+ * Create a new provider
35
+ */
36
+ async create(params) {
37
+ const body = {
38
+ name: params.name,
39
+ };
40
+ if (params.email) {
41
+ body.email = params.email;
42
+ }
43
+ if (params.phone) {
44
+ body.phone = params.phone;
45
+ }
46
+ if (params.userId !== undefined) {
47
+ body.userId = params.userId;
48
+ }
49
+ if (params.bio) {
50
+ body.bio = params.bio;
51
+ }
52
+ if (params.externalId) {
53
+ body.externalId = params.externalId;
54
+ }
55
+ const response = await this.client.request('POST', '/api/v1/orgs/{orgId}/providers', { body });
56
+ return response.provider;
57
+ }
58
+ /**
59
+ * Update an existing provider
60
+ */
61
+ async update(providerId, params) {
62
+ const body = {};
63
+ if (params.name !== undefined) {
64
+ body.name = params.name;
65
+ }
66
+ if (params.email !== undefined) {
67
+ body.email = params.email;
68
+ }
69
+ if (params.phone !== undefined) {
70
+ body.phone = params.phone;
71
+ }
72
+ if (params.userId !== undefined) {
73
+ body.userId = params.userId;
74
+ }
75
+ if (params.bio !== undefined) {
76
+ body.bio = params.bio;
77
+ }
78
+ if (params.minimum_advance_booking_minutes !== undefined) {
79
+ body.minimum_advance_booking_minutes = params.minimum_advance_booking_minutes;
80
+ }
81
+ const response = await this.client.request('PATCH', `/api/v1/orgs/{orgId}/providers/${providerId}`, { body });
82
+ return response.provider;
83
+ }
84
+ /**
85
+ * Delete a provider
86
+ */
87
+ async delete(providerId) {
88
+ await this.client.request('DELETE', `/api/v1/orgs/{orgId}/providers/${providerId}`);
89
+ }
90
+ /**
91
+ * Get Google Calendar connection status for a provider
92
+ */
93
+ async getGoogleCalendarStatus(providerId) {
94
+ return this.client.request('GET', `/api/v1/orgs/{orgId}/providers/${providerId}/google-calendar/status`);
95
+ }
96
+ /**
97
+ * Sync Google Calendar for a provider
98
+ */
99
+ async syncGoogleCalendar(providerId) {
100
+ return this.client.request('POST', `/api/v1/orgs/{orgId}/providers/${providerId}/google-calendar/sync`);
101
+ }
102
+ /**
103
+ * Disconnect Google Calendar for a provider
104
+ */
105
+ async disconnectGoogleCalendar(providerId) {
106
+ return this.client.request('POST', `/api/v1/orgs/{orgId}/providers/${providerId}/google-calendar/disconnect`);
107
+ }
108
+ }