@slotchain/sdk 1.3.0 → 1.4.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/dist/index.cjs.js +42 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +105 -8
- package/dist/index.d.ts +105 -8
- package/dist/index.esm.js +42 -10
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/clients/slot-client.ts +44 -10
- package/src/index.ts +3 -0
- package/src/types/api.ts +68 -0
package/dist/index.d.mts
CHANGED
|
@@ -160,16 +160,81 @@ interface Service {
|
|
|
160
160
|
created_at: string;
|
|
161
161
|
updated_at: string;
|
|
162
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Metadata bag for a slot — open-ended key/value store, with well-known
|
|
165
|
+
* optional fields for childcare / nursery term-based scheduling.
|
|
166
|
+
*/
|
|
167
|
+
interface SlotMetadata {
|
|
168
|
+
/** Human-readable term name, e.g. "Autumn Term 2024" */
|
|
169
|
+
term_name?: string;
|
|
170
|
+
/** Season identifier, e.g. "autumn" | "spring" | "summer" */
|
|
171
|
+
season?: string;
|
|
172
|
+
/** ISO date string for when the half-term break starts */
|
|
173
|
+
half_term_start?: string;
|
|
174
|
+
/** ISO date string for when the half-term break ends */
|
|
175
|
+
half_term_end?: string;
|
|
176
|
+
/** Maximum number of children / participants in this slot */
|
|
177
|
+
capacity?: number;
|
|
178
|
+
/**
|
|
179
|
+
* Headcount at -2 weeks (used for register generation / staffing).
|
|
180
|
+
* Negative prefix avoids collision with positive operational fields.
|
|
181
|
+
*/
|
|
182
|
+
neg_headcount_neg2?: number;
|
|
183
|
+
/**
|
|
184
|
+
* Headcount at -3 weeks (used for register generation / staffing).
|
|
185
|
+
*/
|
|
186
|
+
neg_headcount_neg3?: number;
|
|
187
|
+
/** Arbitrary additional metadata */
|
|
188
|
+
[key: string]: unknown;
|
|
189
|
+
}
|
|
163
190
|
interface Slot {
|
|
164
191
|
id: string;
|
|
165
192
|
tenant_id: string;
|
|
193
|
+
/** Display name / title of the slot */
|
|
166
194
|
name: string;
|
|
167
195
|
description?: string;
|
|
168
196
|
status?: string;
|
|
169
197
|
is_active?: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* ISO 8601 datetime when the slot opens (combines start_date + start_time from the DB).
|
|
200
|
+
* Present when the API serialises scheduled slots.
|
|
201
|
+
*/
|
|
202
|
+
starts_at?: string;
|
|
203
|
+
/**
|
|
204
|
+
* ISO 8601 datetime when the slot closes (combines end_date + end_time from the DB).
|
|
205
|
+
* Absent for open-ended / on-demand slots.
|
|
206
|
+
*/
|
|
207
|
+
ends_at?: string;
|
|
208
|
+
/** Arbitrary metadata bag — see SlotMetadata for well-known keys */
|
|
209
|
+
metadata?: SlotMetadata;
|
|
170
210
|
created_at: string;
|
|
171
211
|
updated_at: string;
|
|
172
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Input shape for creating or updating a slot.
|
|
215
|
+
* Omits server-generated fields; all scheduling fields optional.
|
|
216
|
+
*/
|
|
217
|
+
interface CreateSlotInput {
|
|
218
|
+
name: string;
|
|
219
|
+
description?: string;
|
|
220
|
+
tenant_id: string;
|
|
221
|
+
status?: 'draft' | 'live' | 'archived';
|
|
222
|
+
/**
|
|
223
|
+
* ISO 8601 datetime for when the slot opens.
|
|
224
|
+
* The API splits this into start_date + start_time before persisting.
|
|
225
|
+
*/
|
|
226
|
+
starts_at?: string;
|
|
227
|
+
/**
|
|
228
|
+
* ISO 8601 datetime for when the slot closes.
|
|
229
|
+
* Omit for on-demand / open-ended slots.
|
|
230
|
+
*/
|
|
231
|
+
ends_at?: string;
|
|
232
|
+
metadata?: SlotMetadata;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Partial update shape — all fields optional except id (supplied as path param).
|
|
236
|
+
*/
|
|
237
|
+
type UpdateSlotInput = Partial<Omit<CreateSlotInput, 'tenant_id'>>;
|
|
173
238
|
/**
|
|
174
239
|
* Customer record — matches the `customers` table.
|
|
175
240
|
*/
|
|
@@ -923,19 +988,41 @@ declare class SlotClient {
|
|
|
923
988
|
limit?: number;
|
|
924
989
|
}): Promise<ApiResponse<Slot[]>>;
|
|
925
990
|
/**
|
|
926
|
-
* Create a new slot
|
|
991
|
+
* Create a new slot.
|
|
927
992
|
* POST /api/v1/slots
|
|
928
993
|
*
|
|
929
|
-
*
|
|
994
|
+
* Accepts any subset of `Slot` fields. For new integrations, prefer the
|
|
995
|
+
* exported `CreateSlotInput` type which documents the recommended shape
|
|
996
|
+
* and will become the enforced signature in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
|
|
997
|
+
*
|
|
998
|
+
* New fields available as of v1.4:
|
|
999
|
+
* - `starts_at` — ISO 8601 datetime when the slot opens
|
|
1000
|
+
* - `ends_at` — ISO 8601 datetime when the slot closes (omit for open-ended slots)
|
|
1001
|
+
* - `metadata` — term enrichment bag (term_name, season, half_term_start,
|
|
1002
|
+
* half_term_end, capacity); see `SlotMetadata` type
|
|
1003
|
+
*
|
|
1004
|
+
* @param data - Slot creation data
|
|
930
1005
|
* @returns Created slot
|
|
1006
|
+
*
|
|
1007
|
+
* @example
|
|
1008
|
+
* // Recommended — opt into stricter typing now:
|
|
1009
|
+
* import { CreateSlotInput } from '@slotly/sdk';
|
|
1010
|
+
* const input: CreateSlotInput = { name: 'Autumn Term', tenant_id: '...', starts_at: '...' };
|
|
1011
|
+
* sdk.slots.create(input);
|
|
931
1012
|
*/
|
|
932
1013
|
create(data: Partial<Slot>): Promise<ApiResponse<Slot>>;
|
|
933
1014
|
/**
|
|
934
|
-
* Update slot by ID
|
|
1015
|
+
* Update slot by ID.
|
|
935
1016
|
* PUT /api/v1/slots/:id
|
|
936
1017
|
*
|
|
937
|
-
*
|
|
938
|
-
*
|
|
1018
|
+
* Accepts any subset of `Slot` fields. For new integrations, prefer the
|
|
1019
|
+
* exported `UpdateSlotInput` type — it will become the enforced signature
|
|
1020
|
+
* in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
|
|
1021
|
+
*
|
|
1022
|
+
* New fields available as of v1.4: `starts_at`, `ends_at`, `metadata`.
|
|
1023
|
+
*
|
|
1024
|
+
* @param id - Slot ID
|
|
1025
|
+
* @param data - Fields to update
|
|
939
1026
|
* @returns Updated slot
|
|
940
1027
|
*/
|
|
941
1028
|
update(id: string, data: Partial<Slot>): Promise<ApiResponse<Slot>>;
|
|
@@ -954,10 +1041,20 @@ declare class SlotClient {
|
|
|
954
1041
|
* @param slots - Array of slots to create
|
|
955
1042
|
* @returns Created slots
|
|
956
1043
|
*/
|
|
1044
|
+
/**
|
|
1045
|
+
* Bulk create slots.
|
|
1046
|
+
* POST /api/v1/slots/bulk
|
|
1047
|
+
*
|
|
1048
|
+
* For new integrations, prefer passing `CreateSlotInput[]` — it will become
|
|
1049
|
+
* the enforced signature in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
|
|
1050
|
+
*/
|
|
957
1051
|
bulkCreate(slots: Partial<Slot>[]): Promise<ApiResponse<Slot[]>>;
|
|
958
1052
|
/**
|
|
959
|
-
* Mark slot as available
|
|
960
|
-
*
|
|
1053
|
+
* Mark slot as available (live) or unavailable (archived).
|
|
1054
|
+
*
|
|
1055
|
+
* Note: previous versions sent 'active'/'inactive' which were not valid DB
|
|
1056
|
+
* enum values. Fixed in v1.4 to use 'live'/'archived' — the only valid
|
|
1057
|
+
* non-draft statuses. If you need 'draft', use update() directly.
|
|
961
1058
|
*/
|
|
962
1059
|
setAvailability(id: string, available: boolean): Promise<ApiResponse<Slot>>;
|
|
963
1060
|
/**
|
|
@@ -1696,4 +1793,4 @@ interface SlotlyApi {
|
|
|
1696
1793
|
*/
|
|
1697
1794
|
declare const useSlotly: (options: SlotlyClientOptions) => SlotlyApi;
|
|
1698
1795
|
|
|
1699
|
-
export { type ApiResponse, type Artifact, type ArtifactEntityType, type ArtifactMimeCategory, type ArtifactWithUrl, type Booking, type BookingWithSlot, type Category, type Customer, type CustomerIdentity, type CustomerWithBookings, type CustomerWithIdentities, type DataQualityIssue, type FindOrCreateCustomerOptions, type Flow, type FlowStep, type GetOrganizationOptions, type ListArtifactsOptions, type ListBookingsOptions, type Notification, type NotificationPreferences, type Organization, type OrganizationFullConfig, type ResolveCustomerOptions, type Service, type ServiceItem, type ServiceItemWithService, type ServiceWithItems, type Slot, type SlotServiceWithItems, type SlotlyApi, SlotlyApiError, type SlotlyAuthContext, SlotlyAuthError, type SlotlyClientOptions, SlotlyConfigurationError, SlotlyNetworkError, type SlotlyRequest, type Studio, type Tenant, type TenantBranding, type TenantFullConfig, type UploadArtifactOptions, useSlotly as default, getSlotlyContext, useSlotly, validateSlotlyRequest };
|
|
1796
|
+
export { type ApiResponse, type Artifact, type ArtifactEntityType, type ArtifactMimeCategory, type ArtifactWithUrl, type Booking, type BookingWithSlot, type Category, type CreateSlotInput, type Customer, type CustomerIdentity, type CustomerWithBookings, type CustomerWithIdentities, type DataQualityIssue, type FindOrCreateCustomerOptions, type Flow, type FlowStep, type GetOrganizationOptions, type ListArtifactsOptions, type ListBookingsOptions, type Notification, type NotificationPreferences, type Organization, type OrganizationFullConfig, type ResolveCustomerOptions, type Service, type ServiceItem, type ServiceItemWithService, type ServiceWithItems, type Slot, type SlotMetadata, type SlotServiceWithItems, type SlotlyApi, SlotlyApiError, type SlotlyAuthContext, SlotlyAuthError, type SlotlyClientOptions, SlotlyConfigurationError, SlotlyNetworkError, type SlotlyRequest, type Studio, type Tenant, type TenantBranding, type TenantFullConfig, type UpdateSlotInput, type UploadArtifactOptions, useSlotly as default, getSlotlyContext, useSlotly, validateSlotlyRequest };
|
package/dist/index.d.ts
CHANGED
|
@@ -160,16 +160,81 @@ interface Service {
|
|
|
160
160
|
created_at: string;
|
|
161
161
|
updated_at: string;
|
|
162
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Metadata bag for a slot — open-ended key/value store, with well-known
|
|
165
|
+
* optional fields for childcare / nursery term-based scheduling.
|
|
166
|
+
*/
|
|
167
|
+
interface SlotMetadata {
|
|
168
|
+
/** Human-readable term name, e.g. "Autumn Term 2024" */
|
|
169
|
+
term_name?: string;
|
|
170
|
+
/** Season identifier, e.g. "autumn" | "spring" | "summer" */
|
|
171
|
+
season?: string;
|
|
172
|
+
/** ISO date string for when the half-term break starts */
|
|
173
|
+
half_term_start?: string;
|
|
174
|
+
/** ISO date string for when the half-term break ends */
|
|
175
|
+
half_term_end?: string;
|
|
176
|
+
/** Maximum number of children / participants in this slot */
|
|
177
|
+
capacity?: number;
|
|
178
|
+
/**
|
|
179
|
+
* Headcount at -2 weeks (used for register generation / staffing).
|
|
180
|
+
* Negative prefix avoids collision with positive operational fields.
|
|
181
|
+
*/
|
|
182
|
+
neg_headcount_neg2?: number;
|
|
183
|
+
/**
|
|
184
|
+
* Headcount at -3 weeks (used for register generation / staffing).
|
|
185
|
+
*/
|
|
186
|
+
neg_headcount_neg3?: number;
|
|
187
|
+
/** Arbitrary additional metadata */
|
|
188
|
+
[key: string]: unknown;
|
|
189
|
+
}
|
|
163
190
|
interface Slot {
|
|
164
191
|
id: string;
|
|
165
192
|
tenant_id: string;
|
|
193
|
+
/** Display name / title of the slot */
|
|
166
194
|
name: string;
|
|
167
195
|
description?: string;
|
|
168
196
|
status?: string;
|
|
169
197
|
is_active?: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* ISO 8601 datetime when the slot opens (combines start_date + start_time from the DB).
|
|
200
|
+
* Present when the API serialises scheduled slots.
|
|
201
|
+
*/
|
|
202
|
+
starts_at?: string;
|
|
203
|
+
/**
|
|
204
|
+
* ISO 8601 datetime when the slot closes (combines end_date + end_time from the DB).
|
|
205
|
+
* Absent for open-ended / on-demand slots.
|
|
206
|
+
*/
|
|
207
|
+
ends_at?: string;
|
|
208
|
+
/** Arbitrary metadata bag — see SlotMetadata for well-known keys */
|
|
209
|
+
metadata?: SlotMetadata;
|
|
170
210
|
created_at: string;
|
|
171
211
|
updated_at: string;
|
|
172
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Input shape for creating or updating a slot.
|
|
215
|
+
* Omits server-generated fields; all scheduling fields optional.
|
|
216
|
+
*/
|
|
217
|
+
interface CreateSlotInput {
|
|
218
|
+
name: string;
|
|
219
|
+
description?: string;
|
|
220
|
+
tenant_id: string;
|
|
221
|
+
status?: 'draft' | 'live' | 'archived';
|
|
222
|
+
/**
|
|
223
|
+
* ISO 8601 datetime for when the slot opens.
|
|
224
|
+
* The API splits this into start_date + start_time before persisting.
|
|
225
|
+
*/
|
|
226
|
+
starts_at?: string;
|
|
227
|
+
/**
|
|
228
|
+
* ISO 8601 datetime for when the slot closes.
|
|
229
|
+
* Omit for on-demand / open-ended slots.
|
|
230
|
+
*/
|
|
231
|
+
ends_at?: string;
|
|
232
|
+
metadata?: SlotMetadata;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Partial update shape — all fields optional except id (supplied as path param).
|
|
236
|
+
*/
|
|
237
|
+
type UpdateSlotInput = Partial<Omit<CreateSlotInput, 'tenant_id'>>;
|
|
173
238
|
/**
|
|
174
239
|
* Customer record — matches the `customers` table.
|
|
175
240
|
*/
|
|
@@ -923,19 +988,41 @@ declare class SlotClient {
|
|
|
923
988
|
limit?: number;
|
|
924
989
|
}): Promise<ApiResponse<Slot[]>>;
|
|
925
990
|
/**
|
|
926
|
-
* Create a new slot
|
|
991
|
+
* Create a new slot.
|
|
927
992
|
* POST /api/v1/slots
|
|
928
993
|
*
|
|
929
|
-
*
|
|
994
|
+
* Accepts any subset of `Slot` fields. For new integrations, prefer the
|
|
995
|
+
* exported `CreateSlotInput` type which documents the recommended shape
|
|
996
|
+
* and will become the enforced signature in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
|
|
997
|
+
*
|
|
998
|
+
* New fields available as of v1.4:
|
|
999
|
+
* - `starts_at` — ISO 8601 datetime when the slot opens
|
|
1000
|
+
* - `ends_at` — ISO 8601 datetime when the slot closes (omit for open-ended slots)
|
|
1001
|
+
* - `metadata` — term enrichment bag (term_name, season, half_term_start,
|
|
1002
|
+
* half_term_end, capacity); see `SlotMetadata` type
|
|
1003
|
+
*
|
|
1004
|
+
* @param data - Slot creation data
|
|
930
1005
|
* @returns Created slot
|
|
1006
|
+
*
|
|
1007
|
+
* @example
|
|
1008
|
+
* // Recommended — opt into stricter typing now:
|
|
1009
|
+
* import { CreateSlotInput } from '@slotly/sdk';
|
|
1010
|
+
* const input: CreateSlotInput = { name: 'Autumn Term', tenant_id: '...', starts_at: '...' };
|
|
1011
|
+
* sdk.slots.create(input);
|
|
931
1012
|
*/
|
|
932
1013
|
create(data: Partial<Slot>): Promise<ApiResponse<Slot>>;
|
|
933
1014
|
/**
|
|
934
|
-
* Update slot by ID
|
|
1015
|
+
* Update slot by ID.
|
|
935
1016
|
* PUT /api/v1/slots/:id
|
|
936
1017
|
*
|
|
937
|
-
*
|
|
938
|
-
*
|
|
1018
|
+
* Accepts any subset of `Slot` fields. For new integrations, prefer the
|
|
1019
|
+
* exported `UpdateSlotInput` type — it will become the enforced signature
|
|
1020
|
+
* in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
|
|
1021
|
+
*
|
|
1022
|
+
* New fields available as of v1.4: `starts_at`, `ends_at`, `metadata`.
|
|
1023
|
+
*
|
|
1024
|
+
* @param id - Slot ID
|
|
1025
|
+
* @param data - Fields to update
|
|
939
1026
|
* @returns Updated slot
|
|
940
1027
|
*/
|
|
941
1028
|
update(id: string, data: Partial<Slot>): Promise<ApiResponse<Slot>>;
|
|
@@ -954,10 +1041,20 @@ declare class SlotClient {
|
|
|
954
1041
|
* @param slots - Array of slots to create
|
|
955
1042
|
* @returns Created slots
|
|
956
1043
|
*/
|
|
1044
|
+
/**
|
|
1045
|
+
* Bulk create slots.
|
|
1046
|
+
* POST /api/v1/slots/bulk
|
|
1047
|
+
*
|
|
1048
|
+
* For new integrations, prefer passing `CreateSlotInput[]` — it will become
|
|
1049
|
+
* the enforced signature in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
|
|
1050
|
+
*/
|
|
957
1051
|
bulkCreate(slots: Partial<Slot>[]): Promise<ApiResponse<Slot[]>>;
|
|
958
1052
|
/**
|
|
959
|
-
* Mark slot as available
|
|
960
|
-
*
|
|
1053
|
+
* Mark slot as available (live) or unavailable (archived).
|
|
1054
|
+
*
|
|
1055
|
+
* Note: previous versions sent 'active'/'inactive' which were not valid DB
|
|
1056
|
+
* enum values. Fixed in v1.4 to use 'live'/'archived' — the only valid
|
|
1057
|
+
* non-draft statuses. If you need 'draft', use update() directly.
|
|
961
1058
|
*/
|
|
962
1059
|
setAvailability(id: string, available: boolean): Promise<ApiResponse<Slot>>;
|
|
963
1060
|
/**
|
|
@@ -1696,4 +1793,4 @@ interface SlotlyApi {
|
|
|
1696
1793
|
*/
|
|
1697
1794
|
declare const useSlotly: (options: SlotlyClientOptions) => SlotlyApi;
|
|
1698
1795
|
|
|
1699
|
-
export { type ApiResponse, type Artifact, type ArtifactEntityType, type ArtifactMimeCategory, type ArtifactWithUrl, type Booking, type BookingWithSlot, type Category, type Customer, type CustomerIdentity, type CustomerWithBookings, type CustomerWithIdentities, type DataQualityIssue, type FindOrCreateCustomerOptions, type Flow, type FlowStep, type GetOrganizationOptions, type ListArtifactsOptions, type ListBookingsOptions, type Notification, type NotificationPreferences, type Organization, type OrganizationFullConfig, type ResolveCustomerOptions, type Service, type ServiceItem, type ServiceItemWithService, type ServiceWithItems, type Slot, type SlotServiceWithItems, type SlotlyApi, SlotlyApiError, type SlotlyAuthContext, SlotlyAuthError, type SlotlyClientOptions, SlotlyConfigurationError, SlotlyNetworkError, type SlotlyRequest, type Studio, type Tenant, type TenantBranding, type TenantFullConfig, type UploadArtifactOptions, useSlotly as default, getSlotlyContext, useSlotly, validateSlotlyRequest };
|
|
1796
|
+
export { type ApiResponse, type Artifact, type ArtifactEntityType, type ArtifactMimeCategory, type ArtifactWithUrl, type Booking, type BookingWithSlot, type Category, type CreateSlotInput, type Customer, type CustomerIdentity, type CustomerWithBookings, type CustomerWithIdentities, type DataQualityIssue, type FindOrCreateCustomerOptions, type Flow, type FlowStep, type GetOrganizationOptions, type ListArtifactsOptions, type ListBookingsOptions, type Notification, type NotificationPreferences, type Organization, type OrganizationFullConfig, type ResolveCustomerOptions, type Service, type ServiceItem, type ServiceItemWithService, type ServiceWithItems, type Slot, type SlotMetadata, type SlotServiceWithItems, type SlotlyApi, SlotlyApiError, type SlotlyAuthContext, SlotlyAuthError, type SlotlyClientOptions, SlotlyConfigurationError, SlotlyNetworkError, type SlotlyRequest, type Studio, type Tenant, type TenantBranding, type TenantFullConfig, type UpdateSlotInput, type UploadArtifactOptions, useSlotly as default, getSlotlyContext, useSlotly, validateSlotlyRequest };
|
package/dist/index.esm.js
CHANGED
|
@@ -699,11 +699,27 @@ var SlotClient = class {
|
|
|
699
699
|
return response.data;
|
|
700
700
|
}
|
|
701
701
|
/**
|
|
702
|
-
* Create a new slot
|
|
702
|
+
* Create a new slot.
|
|
703
703
|
* POST /api/v1/slots
|
|
704
|
-
*
|
|
705
|
-
*
|
|
704
|
+
*
|
|
705
|
+
* Accepts any subset of `Slot` fields. For new integrations, prefer the
|
|
706
|
+
* exported `CreateSlotInput` type which documents the recommended shape
|
|
707
|
+
* and will become the enforced signature in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
|
|
708
|
+
*
|
|
709
|
+
* New fields available as of v1.4:
|
|
710
|
+
* - `starts_at` — ISO 8601 datetime when the slot opens
|
|
711
|
+
* - `ends_at` — ISO 8601 datetime when the slot closes (omit for open-ended slots)
|
|
712
|
+
* - `metadata` — term enrichment bag (term_name, season, half_term_start,
|
|
713
|
+
* half_term_end, capacity); see `SlotMetadata` type
|
|
714
|
+
*
|
|
715
|
+
* @param data - Slot creation data
|
|
706
716
|
* @returns Created slot
|
|
717
|
+
*
|
|
718
|
+
* @example
|
|
719
|
+
* // Recommended — opt into stricter typing now:
|
|
720
|
+
* import { CreateSlotInput } from '@slotly/sdk';
|
|
721
|
+
* const input: CreateSlotInput = { name: 'Autumn Term', tenant_id: '...', starts_at: '...' };
|
|
722
|
+
* sdk.slots.create(input);
|
|
707
723
|
*/
|
|
708
724
|
async create(data) {
|
|
709
725
|
const response = await this.client.post(
|
|
@@ -713,11 +729,17 @@ var SlotClient = class {
|
|
|
713
729
|
return response.data;
|
|
714
730
|
}
|
|
715
731
|
/**
|
|
716
|
-
* Update slot by ID
|
|
732
|
+
* Update slot by ID.
|
|
717
733
|
* PUT /api/v1/slots/:id
|
|
718
|
-
*
|
|
719
|
-
*
|
|
720
|
-
*
|
|
734
|
+
*
|
|
735
|
+
* Accepts any subset of `Slot` fields. For new integrations, prefer the
|
|
736
|
+
* exported `UpdateSlotInput` type — it will become the enforced signature
|
|
737
|
+
* in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
|
|
738
|
+
*
|
|
739
|
+
* New fields available as of v1.4: `starts_at`, `ends_at`, `metadata`.
|
|
740
|
+
*
|
|
741
|
+
* @param id - Slot ID
|
|
742
|
+
* @param data - Fields to update
|
|
721
743
|
* @returns Updated slot
|
|
722
744
|
*/
|
|
723
745
|
async update(id, data) {
|
|
@@ -747,6 +769,13 @@ var SlotClient = class {
|
|
|
747
769
|
* @param slots - Array of slots to create
|
|
748
770
|
* @returns Created slots
|
|
749
771
|
*/
|
|
772
|
+
/**
|
|
773
|
+
* Bulk create slots.
|
|
774
|
+
* POST /api/v1/slots/bulk
|
|
775
|
+
*
|
|
776
|
+
* For new integrations, prefer passing `CreateSlotInput[]` — it will become
|
|
777
|
+
* the enforced signature in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
|
|
778
|
+
*/
|
|
750
779
|
async bulkCreate(slots) {
|
|
751
780
|
const response = await this.client.post(
|
|
752
781
|
"/api/v1/slots/bulk",
|
|
@@ -755,11 +784,14 @@ var SlotClient = class {
|
|
|
755
784
|
return response.data;
|
|
756
785
|
}
|
|
757
786
|
/**
|
|
758
|
-
* Mark slot as available
|
|
759
|
-
*
|
|
787
|
+
* Mark slot as available (live) or unavailable (archived).
|
|
788
|
+
*
|
|
789
|
+
* Note: previous versions sent 'active'/'inactive' which were not valid DB
|
|
790
|
+
* enum values. Fixed in v1.4 to use 'live'/'archived' — the only valid
|
|
791
|
+
* non-draft statuses. If you need 'draft', use update() directly.
|
|
760
792
|
*/
|
|
761
793
|
async setAvailability(id, available) {
|
|
762
|
-
return this.update(id, { status: available ? "
|
|
794
|
+
return this.update(id, { status: available ? "live" : "archived" });
|
|
763
795
|
}
|
|
764
796
|
/**
|
|
765
797
|
* Get all active services for a slot with their items
|