@chronary/sdk 0.5.1 → 0.7.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/CHANGELOG.md +9 -0
- package/dist/index.cjs +58 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +141 -4
- package/dist/index.d.ts +141 -4
- package/dist/index.js +57 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -180,6 +180,90 @@ interface ListCalendarsParams {
|
|
|
180
180
|
limit?: number;
|
|
181
181
|
offset?: number;
|
|
182
182
|
}
|
|
183
|
+
interface BookingPage {
|
|
184
|
+
id: string;
|
|
185
|
+
org_id: string;
|
|
186
|
+
calendar_id: string;
|
|
187
|
+
agent_id: string | null;
|
|
188
|
+
slug: string;
|
|
189
|
+
title: string;
|
|
190
|
+
description: string | null;
|
|
191
|
+
duration_minutes: number;
|
|
192
|
+
buffer_minutes: number;
|
|
193
|
+
window_days: number;
|
|
194
|
+
min_notice_minutes: number;
|
|
195
|
+
timezone: string;
|
|
196
|
+
/** Weekly working hours; null = any time inside the window (calendar events still block). */
|
|
197
|
+
availability_constraints: WorkingHours | null;
|
|
198
|
+
active: boolean;
|
|
199
|
+
bookings_count: number;
|
|
200
|
+
/** Public hosted URL to share with humans. */
|
|
201
|
+
booking_url: string;
|
|
202
|
+
created_at: string;
|
|
203
|
+
updated_at: string;
|
|
204
|
+
}
|
|
205
|
+
interface CreateBookingPageParams {
|
|
206
|
+
calendar_id: string;
|
|
207
|
+
title: string;
|
|
208
|
+
description?: string;
|
|
209
|
+
duration_minutes?: number;
|
|
210
|
+
buffer_minutes?: number;
|
|
211
|
+
window_days?: number;
|
|
212
|
+
min_notice_minutes?: number;
|
|
213
|
+
timezone?: string;
|
|
214
|
+
availability_constraints?: WorkingHours | null;
|
|
215
|
+
active?: boolean;
|
|
216
|
+
}
|
|
217
|
+
interface UpdateBookingPageParams {
|
|
218
|
+
title?: string;
|
|
219
|
+
description?: string | null;
|
|
220
|
+
duration_minutes?: number;
|
|
221
|
+
buffer_minutes?: number;
|
|
222
|
+
window_days?: number;
|
|
223
|
+
min_notice_minutes?: number;
|
|
224
|
+
timezone?: string;
|
|
225
|
+
availability_constraints?: WorkingHours | null;
|
|
226
|
+
active?: boolean;
|
|
227
|
+
}
|
|
228
|
+
interface ListBookingPagesParams {
|
|
229
|
+
limit?: number;
|
|
230
|
+
offset?: number;
|
|
231
|
+
}
|
|
232
|
+
/** A single bookable slot returned by the public slots endpoint. */
|
|
233
|
+
interface BookingSlot {
|
|
234
|
+
start: string;
|
|
235
|
+
end: string;
|
|
236
|
+
}
|
|
237
|
+
interface BookingSlotsResponse {
|
|
238
|
+
booking_page: {
|
|
239
|
+
slug: string;
|
|
240
|
+
title: string;
|
|
241
|
+
description: string | null;
|
|
242
|
+
duration_minutes: number;
|
|
243
|
+
timezone: string;
|
|
244
|
+
};
|
|
245
|
+
slots: BookingSlot[];
|
|
246
|
+
}
|
|
247
|
+
interface SubmitBookingParams {
|
|
248
|
+
name: string;
|
|
249
|
+
email: string;
|
|
250
|
+
notes?: string;
|
|
251
|
+
start: string;
|
|
252
|
+
}
|
|
253
|
+
/** Minimal event confirmation returned by the public booking endpoint. The
|
|
254
|
+
* full event (with tenant identifiers) is available to the owning agent via
|
|
255
|
+
* the authenticated events API and the `event.created` webhook. */
|
|
256
|
+
interface BookingSubmissionEvent {
|
|
257
|
+
id: string;
|
|
258
|
+
title: string;
|
|
259
|
+
start_time: string;
|
|
260
|
+
end_time: string;
|
|
261
|
+
status: string;
|
|
262
|
+
}
|
|
263
|
+
interface BookingSubmissionResult {
|
|
264
|
+
booking_page_id: string;
|
|
265
|
+
event: BookingSubmissionEvent;
|
|
266
|
+
}
|
|
183
267
|
type EventStatus = 'confirmed' | 'tentative' | 'cancelled' | 'hold';
|
|
184
268
|
interface CalendarEvent {
|
|
185
269
|
id: string;
|
|
@@ -303,6 +387,8 @@ interface AvailabilityParams {
|
|
|
303
387
|
/** @deprecated Use `duration` instead. */
|
|
304
388
|
slot_duration?: SlotDuration;
|
|
305
389
|
include_busy?: boolean;
|
|
390
|
+
/** Return slots from usable stale human-calendar cache. Defaults false (fail closed). */
|
|
391
|
+
allow_stale?: boolean;
|
|
306
392
|
}
|
|
307
393
|
interface CrossAgentAvailabilityParams {
|
|
308
394
|
agents: string[];
|
|
@@ -314,12 +400,35 @@ interface CrossAgentAvailabilityParams {
|
|
|
314
400
|
slot_duration?: SlotDuration;
|
|
315
401
|
calendars?: string[];
|
|
316
402
|
include_busy?: boolean;
|
|
403
|
+
/** Return slots from usable stale human-calendar cache. Defaults false (fail closed). */
|
|
404
|
+
allow_stale?: boolean;
|
|
405
|
+
}
|
|
406
|
+
type AvailabilityState = 'complete' | 'stale' | 'partial' | 'unavailable';
|
|
407
|
+
type AvailabilitySourceState = 'current' | 'stale' | 'partial' | 'unavailable';
|
|
408
|
+
interface AvailabilitySources {
|
|
409
|
+
chronary: 'current';
|
|
410
|
+
external: AvailabilitySourceState;
|
|
411
|
+
last_synced_at?: string | null;
|
|
412
|
+
}
|
|
413
|
+
interface AvailabilityWarning {
|
|
414
|
+
code: 'availability_incomplete';
|
|
415
|
+
message: string;
|
|
317
416
|
}
|
|
318
|
-
interface
|
|
417
|
+
interface AvailabilityHealth {
|
|
418
|
+
availability_state: AvailabilityState;
|
|
419
|
+
sources: AvailabilitySources;
|
|
420
|
+
warnings: AvailabilityWarning[];
|
|
421
|
+
}
|
|
422
|
+
interface AvailabilityResponse extends AvailabilityHealth {
|
|
319
423
|
agents: string[];
|
|
320
424
|
slots: AvailabilitySlot[];
|
|
321
425
|
per_agent_busy?: Record<string, BusyBlock[]>;
|
|
322
426
|
}
|
|
427
|
+
interface CalendarAvailabilityResponse extends AvailabilityHealth {
|
|
428
|
+
calendar_id: string;
|
|
429
|
+
slots: AvailabilitySlot[];
|
|
430
|
+
busy?: AvailabilitySlot[];
|
|
431
|
+
}
|
|
323
432
|
type AgentStatus = 'idle' | 'working' | 'waiting' | 'error';
|
|
324
433
|
interface CalendarContext {
|
|
325
434
|
calendar_id: string;
|
|
@@ -568,6 +677,8 @@ interface Usage {
|
|
|
568
677
|
proposals: UsageMetric;
|
|
569
678
|
/** Active recurring series masters vs. the plan cap (free: 5, Pro: 250; null = unlimited). */
|
|
570
679
|
recurring_events: UsageMetric;
|
|
680
|
+
/** Active booking pages vs. the plan cap (free: 1, Pro: 25; null = unlimited). */
|
|
681
|
+
booking_pages: UsageMetric;
|
|
571
682
|
holds: HoldsUsage;
|
|
572
683
|
cross_calendar_queries: CrossCalendarQueriesUsage;
|
|
573
684
|
}
|
|
@@ -834,6 +945,31 @@ declare class CalendarsClient {
|
|
|
834
945
|
deleteAvailabilityRules(id: string, options?: RequestOptions): Promise<void>;
|
|
835
946
|
}
|
|
836
947
|
|
|
948
|
+
declare class BookingPagesClient {
|
|
949
|
+
private readonly client;
|
|
950
|
+
constructor(client: CoreClient);
|
|
951
|
+
create(params: CreateBookingPageParams, options?: RequestOptions): Promise<BookingPage>;
|
|
952
|
+
get(id: string, options?: RequestOptions): Promise<BookingPage>;
|
|
953
|
+
list(params?: ListBookingPagesParams): PageIterator<BookingPage>;
|
|
954
|
+
update(id: string, params: UpdateBookingPageParams, options?: RequestOptions): Promise<BookingPage>;
|
|
955
|
+
delete(id: string, options?: RequestOptions): Promise<void>;
|
|
956
|
+
/**
|
|
957
|
+
* Public: list available slots for a booking page by its slug. No API key is
|
|
958
|
+
* required for this endpoint (the slug is the credential); any key set on the
|
|
959
|
+
* client is simply ignored by the server.
|
|
960
|
+
*/
|
|
961
|
+
listSlots(slug: string, params?: {
|
|
962
|
+
from?: string;
|
|
963
|
+
to?: string;
|
|
964
|
+
}, options?: RequestOptions): Promise<BookingSlotsResponse>;
|
|
965
|
+
/**
|
|
966
|
+
* Public: submit a booking against a page's slug. Creates a confirmed event
|
|
967
|
+
* on the underlying calendar and fires an `event.created` webhook with a
|
|
968
|
+
* `booking_page_id` correlation field.
|
|
969
|
+
*/
|
|
970
|
+
submit(slug: string, params: SubmitBookingParams, options?: RequestOptions): Promise<BookingSubmissionResult>;
|
|
971
|
+
}
|
|
972
|
+
|
|
837
973
|
declare class EventsClient {
|
|
838
974
|
private readonly client;
|
|
839
975
|
constructor(client: CoreClient);
|
|
@@ -885,7 +1021,7 @@ declare class AvailabilityClient {
|
|
|
885
1021
|
private readonly client;
|
|
886
1022
|
constructor(client: CoreClient);
|
|
887
1023
|
forAgent(agentId: string, params: AvailabilityParams, options?: RequestOptions): Promise<AvailabilityResponse>;
|
|
888
|
-
forCalendar(calendarId: string, params: AvailabilityParams, options?: RequestOptions): Promise<
|
|
1024
|
+
forCalendar(calendarId: string, params: AvailabilityParams, options?: RequestOptions): Promise<CalendarAvailabilityResponse>;
|
|
889
1025
|
check(params: CrossAgentAvailabilityParams, options?: RequestOptions): Promise<AvailabilityResponse>;
|
|
890
1026
|
}
|
|
891
1027
|
|
|
@@ -1106,7 +1242,7 @@ declare class ConnectionLinksClient {
|
|
|
1106
1242
|
declare function verifySignature(rawBody: string, headers: Headers | Record<string, string>, secret: string, options?: VerifyOptions): Promise<void>;
|
|
1107
1243
|
declare function constructEvent(rawBody: string, headers: Headers | Record<string, string>, secret: string, options?: VerifyOptions): Promise<WebhookEvent>;
|
|
1108
1244
|
|
|
1109
|
-
declare const VERSION = "0.
|
|
1245
|
+
declare const VERSION = "0.7.0";
|
|
1110
1246
|
|
|
1111
1247
|
declare class ChronaryError extends Error {
|
|
1112
1248
|
readonly status: number;
|
|
@@ -1141,6 +1277,7 @@ declare class ConnectionError extends ChronaryError {
|
|
|
1141
1277
|
declare class Chronary {
|
|
1142
1278
|
readonly agents: AgentsClient;
|
|
1143
1279
|
readonly calendars: CalendarsClient;
|
|
1280
|
+
readonly bookingPages: BookingPagesClient;
|
|
1144
1281
|
readonly events: EventsClient;
|
|
1145
1282
|
readonly availability: AvailabilityClient;
|
|
1146
1283
|
readonly webhooks: WebhooksClient;
|
|
@@ -1163,4 +1300,4 @@ declare class Chronary {
|
|
|
1163
1300
|
};
|
|
1164
1301
|
}
|
|
1165
1302
|
|
|
1166
|
-
export { APIPromise, type AcceptTermsParams, type AcceptTermsResult, type Agent, type AgentSignUpExistingOrgResponse, type AgentSignUpNewOrgResponse, type AgentSignUpParams, type AgentSignUpResponse, type AgentStatus, type AgentVerifyParams, type AgentVerifyResponse, type AppInfo, type AuditLogEntry, type AuditLogResponse, AuthenticationError, type AvailabilityParams, type AvailabilityResponse, type AvailabilityRules, type AvailabilitySlot, type BusyBlock, type Calendar, type CalendarContext, type CalendarEvent, type CancelProposalResponse, Chronary, type ChronaryConfig, ChronaryError, ConnectionError, type ConnectionLink, ConnectionLinksClient, CoreClient, type CreateAgentParams, type CreateCalendarParams, type CreateConnectionLinkParams, type CreateEventParams, type CreateICalSubscriptionParams, type CreateProposalParams, type CreateScopedApiKeyParams, type CreateWebhookParams, type CreatedScopedApiKey, type CrossAgentAvailabilityParams, type DataExport, type DeleteEventOptions, type FeedbackAcceptedResponse, type FeedbackType, type ICalSubscription, type ListAgentsParams, type ListAuditLogParams, type ListCalendarsParams, type ListEventsParams, type ListICalSubscriptionsParams, type ListProposalsParams, type ListWebhookDeliveriesParams, type ListWebhooksParams, type LogLevel, NotFoundError, type Page, PageIterator, type PageResponse, type Plan, type PlanId, type PlanLimits, type PlansListResponse, type Proposal, type ProposalResponse, type ProposalResponseAction, type ProposalSlot, type ProposalStatus, type ProposalSummary, QuotaExceededError, type QuotaSnapshot, RateLimitError, type RawResponse, type RequestOptions, type ResolveProposalResponse, type RespondToProposalParams, type ScopedApiKey, type SetAvailabilityRulesParams, type SlotDuration, type SubmitFeedbackParams, TimeoutError, type UpdateAgentParams, type UpdateCalendarParams, type UpdateEventParams, type UpdateICalSubscriptionParams, type UpdateWebhookParams, type Usage, type UsageMetric, VERSION, ValidationError, type VerifyOptions, type WaitlistJoinParams, type WaitlistJoinResponse, type WaitlistedOrg, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryStats, type WebhookEvent, type WebhookEventType, type WithResponse, type WorkingHours, type WorkingHoursDay, constructEvent, Chronary as default, isAgentSignUpNewOrg, verifySignature };
|
|
1303
|
+
export { APIPromise, type AcceptTermsParams, type AcceptTermsResult, type Agent, type AgentSignUpExistingOrgResponse, type AgentSignUpNewOrgResponse, type AgentSignUpParams, type AgentSignUpResponse, type AgentStatus, type AgentVerifyParams, type AgentVerifyResponse, type AppInfo, type AuditLogEntry, type AuditLogResponse, AuthenticationError, type AvailabilityParams, type AvailabilityResponse, type AvailabilityRules, type AvailabilitySlot, type AvailabilitySourceState, type AvailabilitySources, type AvailabilityState, type AvailabilityWarning, type BookingPage, BookingPagesClient, type BookingSlot, type BookingSlotsResponse, type BookingSubmissionEvent, type BookingSubmissionResult, type BusyBlock, type Calendar, type CalendarAvailabilityResponse, type CalendarContext, type CalendarEvent, type CancelProposalResponse, Chronary, type ChronaryConfig, ChronaryError, ConnectionError, type ConnectionLink, ConnectionLinksClient, CoreClient, type CreateAgentParams, type CreateBookingPageParams, type CreateCalendarParams, type CreateConnectionLinkParams, type CreateEventParams, type CreateICalSubscriptionParams, type CreateProposalParams, type CreateScopedApiKeyParams, type CreateWebhookParams, type CreatedScopedApiKey, type CrossAgentAvailabilityParams, type DataExport, type DeleteEventOptions, type FeedbackAcceptedResponse, type FeedbackType, type ICalSubscription, type ListAgentsParams, type ListAuditLogParams, type ListBookingPagesParams, type ListCalendarsParams, type ListEventsParams, type ListICalSubscriptionsParams, type ListProposalsParams, type ListWebhookDeliveriesParams, type ListWebhooksParams, type LogLevel, NotFoundError, type Page, PageIterator, type PageResponse, type Plan, type PlanId, type PlanLimits, type PlansListResponse, type Proposal, type ProposalResponse, type ProposalResponseAction, type ProposalSlot, type ProposalStatus, type ProposalSummary, QuotaExceededError, type QuotaSnapshot, RateLimitError, type RawResponse, type RequestOptions, type ResolveProposalResponse, type RespondToProposalParams, type ScopedApiKey, type SetAvailabilityRulesParams, type SlotDuration, type SubmitBookingParams, type SubmitFeedbackParams, TimeoutError, type UpdateAgentParams, type UpdateBookingPageParams, type UpdateCalendarParams, type UpdateEventParams, type UpdateICalSubscriptionParams, type UpdateWebhookParams, type Usage, type UsageMetric, VERSION, ValidationError, type VerifyOptions, type WaitlistJoinParams, type WaitlistJoinResponse, type WaitlistedOrg, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryStats, type WebhookEvent, type WebhookEventType, type WithResponse, type WorkingHours, type WorkingHoursDay, constructEvent, Chronary as default, isAgentSignUpNewOrg, verifySignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -180,6 +180,90 @@ interface ListCalendarsParams {
|
|
|
180
180
|
limit?: number;
|
|
181
181
|
offset?: number;
|
|
182
182
|
}
|
|
183
|
+
interface BookingPage {
|
|
184
|
+
id: string;
|
|
185
|
+
org_id: string;
|
|
186
|
+
calendar_id: string;
|
|
187
|
+
agent_id: string | null;
|
|
188
|
+
slug: string;
|
|
189
|
+
title: string;
|
|
190
|
+
description: string | null;
|
|
191
|
+
duration_minutes: number;
|
|
192
|
+
buffer_minutes: number;
|
|
193
|
+
window_days: number;
|
|
194
|
+
min_notice_minutes: number;
|
|
195
|
+
timezone: string;
|
|
196
|
+
/** Weekly working hours; null = any time inside the window (calendar events still block). */
|
|
197
|
+
availability_constraints: WorkingHours | null;
|
|
198
|
+
active: boolean;
|
|
199
|
+
bookings_count: number;
|
|
200
|
+
/** Public hosted URL to share with humans. */
|
|
201
|
+
booking_url: string;
|
|
202
|
+
created_at: string;
|
|
203
|
+
updated_at: string;
|
|
204
|
+
}
|
|
205
|
+
interface CreateBookingPageParams {
|
|
206
|
+
calendar_id: string;
|
|
207
|
+
title: string;
|
|
208
|
+
description?: string;
|
|
209
|
+
duration_minutes?: number;
|
|
210
|
+
buffer_minutes?: number;
|
|
211
|
+
window_days?: number;
|
|
212
|
+
min_notice_minutes?: number;
|
|
213
|
+
timezone?: string;
|
|
214
|
+
availability_constraints?: WorkingHours | null;
|
|
215
|
+
active?: boolean;
|
|
216
|
+
}
|
|
217
|
+
interface UpdateBookingPageParams {
|
|
218
|
+
title?: string;
|
|
219
|
+
description?: string | null;
|
|
220
|
+
duration_minutes?: number;
|
|
221
|
+
buffer_minutes?: number;
|
|
222
|
+
window_days?: number;
|
|
223
|
+
min_notice_minutes?: number;
|
|
224
|
+
timezone?: string;
|
|
225
|
+
availability_constraints?: WorkingHours | null;
|
|
226
|
+
active?: boolean;
|
|
227
|
+
}
|
|
228
|
+
interface ListBookingPagesParams {
|
|
229
|
+
limit?: number;
|
|
230
|
+
offset?: number;
|
|
231
|
+
}
|
|
232
|
+
/** A single bookable slot returned by the public slots endpoint. */
|
|
233
|
+
interface BookingSlot {
|
|
234
|
+
start: string;
|
|
235
|
+
end: string;
|
|
236
|
+
}
|
|
237
|
+
interface BookingSlotsResponse {
|
|
238
|
+
booking_page: {
|
|
239
|
+
slug: string;
|
|
240
|
+
title: string;
|
|
241
|
+
description: string | null;
|
|
242
|
+
duration_minutes: number;
|
|
243
|
+
timezone: string;
|
|
244
|
+
};
|
|
245
|
+
slots: BookingSlot[];
|
|
246
|
+
}
|
|
247
|
+
interface SubmitBookingParams {
|
|
248
|
+
name: string;
|
|
249
|
+
email: string;
|
|
250
|
+
notes?: string;
|
|
251
|
+
start: string;
|
|
252
|
+
}
|
|
253
|
+
/** Minimal event confirmation returned by the public booking endpoint. The
|
|
254
|
+
* full event (with tenant identifiers) is available to the owning agent via
|
|
255
|
+
* the authenticated events API and the `event.created` webhook. */
|
|
256
|
+
interface BookingSubmissionEvent {
|
|
257
|
+
id: string;
|
|
258
|
+
title: string;
|
|
259
|
+
start_time: string;
|
|
260
|
+
end_time: string;
|
|
261
|
+
status: string;
|
|
262
|
+
}
|
|
263
|
+
interface BookingSubmissionResult {
|
|
264
|
+
booking_page_id: string;
|
|
265
|
+
event: BookingSubmissionEvent;
|
|
266
|
+
}
|
|
183
267
|
type EventStatus = 'confirmed' | 'tentative' | 'cancelled' | 'hold';
|
|
184
268
|
interface CalendarEvent {
|
|
185
269
|
id: string;
|
|
@@ -303,6 +387,8 @@ interface AvailabilityParams {
|
|
|
303
387
|
/** @deprecated Use `duration` instead. */
|
|
304
388
|
slot_duration?: SlotDuration;
|
|
305
389
|
include_busy?: boolean;
|
|
390
|
+
/** Return slots from usable stale human-calendar cache. Defaults false (fail closed). */
|
|
391
|
+
allow_stale?: boolean;
|
|
306
392
|
}
|
|
307
393
|
interface CrossAgentAvailabilityParams {
|
|
308
394
|
agents: string[];
|
|
@@ -314,12 +400,35 @@ interface CrossAgentAvailabilityParams {
|
|
|
314
400
|
slot_duration?: SlotDuration;
|
|
315
401
|
calendars?: string[];
|
|
316
402
|
include_busy?: boolean;
|
|
403
|
+
/** Return slots from usable stale human-calendar cache. Defaults false (fail closed). */
|
|
404
|
+
allow_stale?: boolean;
|
|
405
|
+
}
|
|
406
|
+
type AvailabilityState = 'complete' | 'stale' | 'partial' | 'unavailable';
|
|
407
|
+
type AvailabilitySourceState = 'current' | 'stale' | 'partial' | 'unavailable';
|
|
408
|
+
interface AvailabilitySources {
|
|
409
|
+
chronary: 'current';
|
|
410
|
+
external: AvailabilitySourceState;
|
|
411
|
+
last_synced_at?: string | null;
|
|
412
|
+
}
|
|
413
|
+
interface AvailabilityWarning {
|
|
414
|
+
code: 'availability_incomplete';
|
|
415
|
+
message: string;
|
|
317
416
|
}
|
|
318
|
-
interface
|
|
417
|
+
interface AvailabilityHealth {
|
|
418
|
+
availability_state: AvailabilityState;
|
|
419
|
+
sources: AvailabilitySources;
|
|
420
|
+
warnings: AvailabilityWarning[];
|
|
421
|
+
}
|
|
422
|
+
interface AvailabilityResponse extends AvailabilityHealth {
|
|
319
423
|
agents: string[];
|
|
320
424
|
slots: AvailabilitySlot[];
|
|
321
425
|
per_agent_busy?: Record<string, BusyBlock[]>;
|
|
322
426
|
}
|
|
427
|
+
interface CalendarAvailabilityResponse extends AvailabilityHealth {
|
|
428
|
+
calendar_id: string;
|
|
429
|
+
slots: AvailabilitySlot[];
|
|
430
|
+
busy?: AvailabilitySlot[];
|
|
431
|
+
}
|
|
323
432
|
type AgentStatus = 'idle' | 'working' | 'waiting' | 'error';
|
|
324
433
|
interface CalendarContext {
|
|
325
434
|
calendar_id: string;
|
|
@@ -568,6 +677,8 @@ interface Usage {
|
|
|
568
677
|
proposals: UsageMetric;
|
|
569
678
|
/** Active recurring series masters vs. the plan cap (free: 5, Pro: 250; null = unlimited). */
|
|
570
679
|
recurring_events: UsageMetric;
|
|
680
|
+
/** Active booking pages vs. the plan cap (free: 1, Pro: 25; null = unlimited). */
|
|
681
|
+
booking_pages: UsageMetric;
|
|
571
682
|
holds: HoldsUsage;
|
|
572
683
|
cross_calendar_queries: CrossCalendarQueriesUsage;
|
|
573
684
|
}
|
|
@@ -834,6 +945,31 @@ declare class CalendarsClient {
|
|
|
834
945
|
deleteAvailabilityRules(id: string, options?: RequestOptions): Promise<void>;
|
|
835
946
|
}
|
|
836
947
|
|
|
948
|
+
declare class BookingPagesClient {
|
|
949
|
+
private readonly client;
|
|
950
|
+
constructor(client: CoreClient);
|
|
951
|
+
create(params: CreateBookingPageParams, options?: RequestOptions): Promise<BookingPage>;
|
|
952
|
+
get(id: string, options?: RequestOptions): Promise<BookingPage>;
|
|
953
|
+
list(params?: ListBookingPagesParams): PageIterator<BookingPage>;
|
|
954
|
+
update(id: string, params: UpdateBookingPageParams, options?: RequestOptions): Promise<BookingPage>;
|
|
955
|
+
delete(id: string, options?: RequestOptions): Promise<void>;
|
|
956
|
+
/**
|
|
957
|
+
* Public: list available slots for a booking page by its slug. No API key is
|
|
958
|
+
* required for this endpoint (the slug is the credential); any key set on the
|
|
959
|
+
* client is simply ignored by the server.
|
|
960
|
+
*/
|
|
961
|
+
listSlots(slug: string, params?: {
|
|
962
|
+
from?: string;
|
|
963
|
+
to?: string;
|
|
964
|
+
}, options?: RequestOptions): Promise<BookingSlotsResponse>;
|
|
965
|
+
/**
|
|
966
|
+
* Public: submit a booking against a page's slug. Creates a confirmed event
|
|
967
|
+
* on the underlying calendar and fires an `event.created` webhook with a
|
|
968
|
+
* `booking_page_id` correlation field.
|
|
969
|
+
*/
|
|
970
|
+
submit(slug: string, params: SubmitBookingParams, options?: RequestOptions): Promise<BookingSubmissionResult>;
|
|
971
|
+
}
|
|
972
|
+
|
|
837
973
|
declare class EventsClient {
|
|
838
974
|
private readonly client;
|
|
839
975
|
constructor(client: CoreClient);
|
|
@@ -885,7 +1021,7 @@ declare class AvailabilityClient {
|
|
|
885
1021
|
private readonly client;
|
|
886
1022
|
constructor(client: CoreClient);
|
|
887
1023
|
forAgent(agentId: string, params: AvailabilityParams, options?: RequestOptions): Promise<AvailabilityResponse>;
|
|
888
|
-
forCalendar(calendarId: string, params: AvailabilityParams, options?: RequestOptions): Promise<
|
|
1024
|
+
forCalendar(calendarId: string, params: AvailabilityParams, options?: RequestOptions): Promise<CalendarAvailabilityResponse>;
|
|
889
1025
|
check(params: CrossAgentAvailabilityParams, options?: RequestOptions): Promise<AvailabilityResponse>;
|
|
890
1026
|
}
|
|
891
1027
|
|
|
@@ -1106,7 +1242,7 @@ declare class ConnectionLinksClient {
|
|
|
1106
1242
|
declare function verifySignature(rawBody: string, headers: Headers | Record<string, string>, secret: string, options?: VerifyOptions): Promise<void>;
|
|
1107
1243
|
declare function constructEvent(rawBody: string, headers: Headers | Record<string, string>, secret: string, options?: VerifyOptions): Promise<WebhookEvent>;
|
|
1108
1244
|
|
|
1109
|
-
declare const VERSION = "0.
|
|
1245
|
+
declare const VERSION = "0.7.0";
|
|
1110
1246
|
|
|
1111
1247
|
declare class ChronaryError extends Error {
|
|
1112
1248
|
readonly status: number;
|
|
@@ -1141,6 +1277,7 @@ declare class ConnectionError extends ChronaryError {
|
|
|
1141
1277
|
declare class Chronary {
|
|
1142
1278
|
readonly agents: AgentsClient;
|
|
1143
1279
|
readonly calendars: CalendarsClient;
|
|
1280
|
+
readonly bookingPages: BookingPagesClient;
|
|
1144
1281
|
readonly events: EventsClient;
|
|
1145
1282
|
readonly availability: AvailabilityClient;
|
|
1146
1283
|
readonly webhooks: WebhooksClient;
|
|
@@ -1163,4 +1300,4 @@ declare class Chronary {
|
|
|
1163
1300
|
};
|
|
1164
1301
|
}
|
|
1165
1302
|
|
|
1166
|
-
export { APIPromise, type AcceptTermsParams, type AcceptTermsResult, type Agent, type AgentSignUpExistingOrgResponse, type AgentSignUpNewOrgResponse, type AgentSignUpParams, type AgentSignUpResponse, type AgentStatus, type AgentVerifyParams, type AgentVerifyResponse, type AppInfo, type AuditLogEntry, type AuditLogResponse, AuthenticationError, type AvailabilityParams, type AvailabilityResponse, type AvailabilityRules, type AvailabilitySlot, type BusyBlock, type Calendar, type CalendarContext, type CalendarEvent, type CancelProposalResponse, Chronary, type ChronaryConfig, ChronaryError, ConnectionError, type ConnectionLink, ConnectionLinksClient, CoreClient, type CreateAgentParams, type CreateCalendarParams, type CreateConnectionLinkParams, type CreateEventParams, type CreateICalSubscriptionParams, type CreateProposalParams, type CreateScopedApiKeyParams, type CreateWebhookParams, type CreatedScopedApiKey, type CrossAgentAvailabilityParams, type DataExport, type DeleteEventOptions, type FeedbackAcceptedResponse, type FeedbackType, type ICalSubscription, type ListAgentsParams, type ListAuditLogParams, type ListCalendarsParams, type ListEventsParams, type ListICalSubscriptionsParams, type ListProposalsParams, type ListWebhookDeliveriesParams, type ListWebhooksParams, type LogLevel, NotFoundError, type Page, PageIterator, type PageResponse, type Plan, type PlanId, type PlanLimits, type PlansListResponse, type Proposal, type ProposalResponse, type ProposalResponseAction, type ProposalSlot, type ProposalStatus, type ProposalSummary, QuotaExceededError, type QuotaSnapshot, RateLimitError, type RawResponse, type RequestOptions, type ResolveProposalResponse, type RespondToProposalParams, type ScopedApiKey, type SetAvailabilityRulesParams, type SlotDuration, type SubmitFeedbackParams, TimeoutError, type UpdateAgentParams, type UpdateCalendarParams, type UpdateEventParams, type UpdateICalSubscriptionParams, type UpdateWebhookParams, type Usage, type UsageMetric, VERSION, ValidationError, type VerifyOptions, type WaitlistJoinParams, type WaitlistJoinResponse, type WaitlistedOrg, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryStats, type WebhookEvent, type WebhookEventType, type WithResponse, type WorkingHours, type WorkingHoursDay, constructEvent, Chronary as default, isAgentSignUpNewOrg, verifySignature };
|
|
1303
|
+
export { APIPromise, type AcceptTermsParams, type AcceptTermsResult, type Agent, type AgentSignUpExistingOrgResponse, type AgentSignUpNewOrgResponse, type AgentSignUpParams, type AgentSignUpResponse, type AgentStatus, type AgentVerifyParams, type AgentVerifyResponse, type AppInfo, type AuditLogEntry, type AuditLogResponse, AuthenticationError, type AvailabilityParams, type AvailabilityResponse, type AvailabilityRules, type AvailabilitySlot, type AvailabilitySourceState, type AvailabilitySources, type AvailabilityState, type AvailabilityWarning, type BookingPage, BookingPagesClient, type BookingSlot, type BookingSlotsResponse, type BookingSubmissionEvent, type BookingSubmissionResult, type BusyBlock, type Calendar, type CalendarAvailabilityResponse, type CalendarContext, type CalendarEvent, type CancelProposalResponse, Chronary, type ChronaryConfig, ChronaryError, ConnectionError, type ConnectionLink, ConnectionLinksClient, CoreClient, type CreateAgentParams, type CreateBookingPageParams, type CreateCalendarParams, type CreateConnectionLinkParams, type CreateEventParams, type CreateICalSubscriptionParams, type CreateProposalParams, type CreateScopedApiKeyParams, type CreateWebhookParams, type CreatedScopedApiKey, type CrossAgentAvailabilityParams, type DataExport, type DeleteEventOptions, type FeedbackAcceptedResponse, type FeedbackType, type ICalSubscription, type ListAgentsParams, type ListAuditLogParams, type ListBookingPagesParams, type ListCalendarsParams, type ListEventsParams, type ListICalSubscriptionsParams, type ListProposalsParams, type ListWebhookDeliveriesParams, type ListWebhooksParams, type LogLevel, NotFoundError, type Page, PageIterator, type PageResponse, type Plan, type PlanId, type PlanLimits, type PlansListResponse, type Proposal, type ProposalResponse, type ProposalResponseAction, type ProposalSlot, type ProposalStatus, type ProposalSummary, QuotaExceededError, type QuotaSnapshot, RateLimitError, type RawResponse, type RequestOptions, type ResolveProposalResponse, type RespondToProposalParams, type ScopedApiKey, type SetAvailabilityRulesParams, type SlotDuration, type SubmitBookingParams, type SubmitFeedbackParams, TimeoutError, type UpdateAgentParams, type UpdateBookingPageParams, type UpdateCalendarParams, type UpdateEventParams, type UpdateICalSubscriptionParams, type UpdateWebhookParams, type Usage, type UsageMetric, VERSION, ValidationError, type VerifyOptions, type WaitlistJoinParams, type WaitlistJoinResponse, type WaitlistedOrg, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryStats, type WebhookEvent, type WebhookEventType, type WithResponse, type WorkingHours, type WorkingHoursDay, constructEvent, Chronary as default, isAgentSignUpNewOrg, verifySignature };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var VERSION = "0.
|
|
2
|
+
var VERSION = "0.7.0";
|
|
3
3
|
|
|
4
4
|
// src/error.ts
|
|
5
5
|
var ChronaryError = class extends Error {
|
|
@@ -488,6 +488,53 @@ var CalendarsClient = class {
|
|
|
488
488
|
}
|
|
489
489
|
};
|
|
490
490
|
|
|
491
|
+
// src/resources/booking-pages.ts
|
|
492
|
+
var BookingPagesClient = class {
|
|
493
|
+
constructor(client) {
|
|
494
|
+
this.client = client;
|
|
495
|
+
}
|
|
496
|
+
client;
|
|
497
|
+
async create(params, options) {
|
|
498
|
+
return this.client.request("POST", "/v1/booking-pages", params, void 0, options);
|
|
499
|
+
}
|
|
500
|
+
async get(id, options) {
|
|
501
|
+
return this.client.request("GET", `/v1/booking-pages/${id}`, void 0, void 0, options);
|
|
502
|
+
}
|
|
503
|
+
list(params = {}) {
|
|
504
|
+
const { limit = 50, offset = 0 } = params;
|
|
505
|
+
return new PageIterator(
|
|
506
|
+
(offset2, l) => this.client.request("GET", "/v1/booking-pages", void 0, {
|
|
507
|
+
limit: l,
|
|
508
|
+
offset: offset2
|
|
509
|
+
}),
|
|
510
|
+
limit,
|
|
511
|
+
offset
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
async update(id, params, options) {
|
|
515
|
+
return this.client.request("PATCH", `/v1/booking-pages/${id}`, params, void 0, options);
|
|
516
|
+
}
|
|
517
|
+
async delete(id, options) {
|
|
518
|
+
await this.client.request("DELETE", `/v1/booking-pages/${id}`, void 0, void 0, options);
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Public: list available slots for a booking page by its slug. No API key is
|
|
522
|
+
* required for this endpoint (the slug is the credential); any key set on the
|
|
523
|
+
* client is simply ignored by the server.
|
|
524
|
+
*/
|
|
525
|
+
async listSlots(slug, params = {}, options) {
|
|
526
|
+
return this.client.request("GET", `/book/${slug}/slots`, void 0, params, options);
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Public: submit a booking against a page's slug. Creates a confirmed event
|
|
530
|
+
* on the underlying calendar and fires an `event.created` webhook with a
|
|
531
|
+
* `booking_page_id` correlation field.
|
|
532
|
+
*/
|
|
533
|
+
async submit(slug, params, options) {
|
|
534
|
+
return this.client.request("POST", `/book/${slug}`, params, void 0, options);
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
|
|
491
538
|
// src/resources/events.ts
|
|
492
539
|
var EventsClient = class {
|
|
493
540
|
constructor(client) {
|
|
@@ -647,7 +694,8 @@ var AvailabilityClient = class {
|
|
|
647
694
|
end: params.end,
|
|
648
695
|
duration: params.duration,
|
|
649
696
|
slot_duration: params.slot_duration,
|
|
650
|
-
include_busy: params.include_busy
|
|
697
|
+
include_busy: params.include_busy,
|
|
698
|
+
allow_stale: params.allow_stale
|
|
651
699
|
},
|
|
652
700
|
options
|
|
653
701
|
);
|
|
@@ -662,7 +710,8 @@ var AvailabilityClient = class {
|
|
|
662
710
|
end: params.end,
|
|
663
711
|
duration: params.duration,
|
|
664
712
|
slot_duration: params.slot_duration,
|
|
665
|
-
include_busy: params.include_busy
|
|
713
|
+
include_busy: params.include_busy,
|
|
714
|
+
allow_stale: params.allow_stale
|
|
666
715
|
},
|
|
667
716
|
options
|
|
668
717
|
);
|
|
@@ -679,7 +728,8 @@ var AvailabilityClient = class {
|
|
|
679
728
|
duration: params.duration,
|
|
680
729
|
slot_duration: params.slot_duration,
|
|
681
730
|
calendars: params.calendars?.join(","),
|
|
682
|
-
include_busy: params.include_busy
|
|
731
|
+
include_busy: params.include_busy,
|
|
732
|
+
allow_stale: params.allow_stale
|
|
683
733
|
},
|
|
684
734
|
options
|
|
685
735
|
);
|
|
@@ -1214,6 +1264,7 @@ async function constructEvent(rawBody, headers, secret, options) {
|
|
|
1214
1264
|
var Chronary = class {
|
|
1215
1265
|
agents;
|
|
1216
1266
|
calendars;
|
|
1267
|
+
bookingPages;
|
|
1217
1268
|
events;
|
|
1218
1269
|
availability;
|
|
1219
1270
|
webhooks;
|
|
@@ -1233,6 +1284,7 @@ var Chronary = class {
|
|
|
1233
1284
|
const client = new CoreClient(config);
|
|
1234
1285
|
this.agents = new AgentsClient(client);
|
|
1235
1286
|
this.calendars = new CalendarsClient(client);
|
|
1287
|
+
this.bookingPages = new BookingPagesClient(client);
|
|
1236
1288
|
this.events = new EventsClient(client);
|
|
1237
1289
|
this.availability = new AvailabilityClient(client);
|
|
1238
1290
|
this.webhooks = new WebhooksClient(client);
|
|
@@ -1258,6 +1310,7 @@ var index_default = Chronary;
|
|
|
1258
1310
|
export {
|
|
1259
1311
|
APIPromise,
|
|
1260
1312
|
AuthenticationError,
|
|
1313
|
+
BookingPagesClient,
|
|
1261
1314
|
Chronary,
|
|
1262
1315
|
ChronaryError,
|
|
1263
1316
|
ConnectionError,
|