@chronary/sdk 0.4.2 → 0.5.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.
- package/CHANGELOG.md +4 -0
- package/dist/index.cjs +43 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +87 -5
- package/dist/index.d.ts +87 -5
- package/dist/index.js +42 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -195,6 +195,14 @@ interface CalendarEvent {
|
|
|
195
195
|
metadata: Record<string, unknown>;
|
|
196
196
|
/** Reminder offsets (minutes before start). null = inherit calendar default (then system default of 10 min); [] = no reminders. */
|
|
197
197
|
reminders: number[] | null;
|
|
198
|
+
/** RFC 5545 RRULE subset (no "RRULE:" prefix) when this event is a recurring series master, e.g. "FREQ=WEEKLY;BYDAY=MO,WE;COUNT=12". null = one-off event. */
|
|
199
|
+
recurrenceRule: string | null;
|
|
200
|
+
/** ISO 8601 starts of individually cancelled occurrences (EXDATE). */
|
|
201
|
+
recurrenceExdates: string[];
|
|
202
|
+
/** Present only on expanded instances (`expand: true` lists): id of the recurring series master this instance belongs to. */
|
|
203
|
+
recurringEventId?: string;
|
|
204
|
+
/** Present only on expanded instances: the occurrence start this instance was generated for. */
|
|
205
|
+
originalStartTime?: string;
|
|
198
206
|
holdExpiresAt: string | null;
|
|
199
207
|
holdPriority: number | null;
|
|
200
208
|
deletedAt: string | null;
|
|
@@ -215,6 +223,15 @@ interface CreateEventParams {
|
|
|
215
223
|
hold_expires_at?: string;
|
|
216
224
|
/** Priority for conflict resolution. Only valid with status='hold'. 0-100. */
|
|
217
225
|
hold_priority?: number;
|
|
226
|
+
/**
|
|
227
|
+
* RFC 5545 RRULE subset (no "RRULE:" prefix), e.g. "FREQ=WEEKLY;BYDAY=MO,WE;COUNT=12" —
|
|
228
|
+
* makes the event a recurring series master. Not allowed with status='hold'.
|
|
229
|
+
* Fails with 400 on an invalid rule; 429 when the plan's active
|
|
230
|
+
* recurring-series cap is reached (free: 5, Pro: 250 — see
|
|
231
|
+
* `usage.recurring_events`); 403 plan_required when the series is unbounded
|
|
232
|
+
* or ends more than 90 days out on the free plan (Pro allows unbounded).
|
|
233
|
+
*/
|
|
234
|
+
recurrence_rule?: string;
|
|
218
235
|
}
|
|
219
236
|
interface UpdateEventParams {
|
|
220
237
|
title?: string;
|
|
@@ -227,6 +244,16 @@ interface UpdateEventParams {
|
|
|
227
244
|
metadata?: Record<string, unknown>;
|
|
228
245
|
/** Reminder offsets in minutes before start. null = inherit calendar default; [] = no reminders. */
|
|
229
246
|
reminders?: number[] | null;
|
|
247
|
+
/**
|
|
248
|
+
* Full-series edit of the recurrence rule (RFC 5545 RRULE subset, no
|
|
249
|
+
* "RRULE:" prefix). null clears the rule, turning the series back into a
|
|
250
|
+
* one-off event. Fails with 400 on an invalid rule; 429 when converting a
|
|
251
|
+
* one-off to recurring and the plan's active recurring-series cap is
|
|
252
|
+
* reached (free: 5, Pro: 250); 403 plan_required when the series is
|
|
253
|
+
* unbounded or ends more than 90 days out on the free plan (Pro allows
|
|
254
|
+
* unbounded).
|
|
255
|
+
*/
|
|
256
|
+
recurrence_rule?: string | null;
|
|
230
257
|
}
|
|
231
258
|
interface ListEventsParams {
|
|
232
259
|
calendarId?: string;
|
|
@@ -237,6 +264,25 @@ interface ListEventsParams {
|
|
|
237
264
|
source?: 'internal' | 'external_ical';
|
|
238
265
|
limit?: number;
|
|
239
266
|
offset?: number;
|
|
267
|
+
/**
|
|
268
|
+
* Expand recurring series into individual occurrence instances within the
|
|
269
|
+
* window. When true, both `start_after` and `start_before` are required
|
|
270
|
+
* (max 366 days apart) — the API returns 400 otherwise. Expanded instances
|
|
271
|
+
* carry `recurringEventId` + `originalStartTime`.
|
|
272
|
+
*/
|
|
273
|
+
expand?: boolean;
|
|
274
|
+
}
|
|
275
|
+
/** Options for event delete calls — `RequestOptions` plus recurrence controls. */
|
|
276
|
+
interface DeleteEventOptions extends RequestOptions {
|
|
277
|
+
/**
|
|
278
|
+
* For recurring series only: ISO 8601 start of the single occurrence to
|
|
279
|
+
* cancel (recorded as an EXDATE). The series lives on and the delete call
|
|
280
|
+
* resolves to the updated series master event instead of void. Fails with
|
|
281
|
+
* 400 if the timestamp is not an active occurrence of the series, or 409
|
|
282
|
+
* if the event is not a recurring series. Omit to delete the whole
|
|
283
|
+
* event/series (resolves to void).
|
|
284
|
+
*/
|
|
285
|
+
occurrence_start?: string;
|
|
240
286
|
}
|
|
241
287
|
type SlotDuration = '15m' | '30m' | '45m' | '1h' | '2h';
|
|
242
288
|
interface AvailabilitySlot {
|
|
@@ -520,6 +566,8 @@ interface Usage {
|
|
|
520
566
|
availability_queries: UsageMetric;
|
|
521
567
|
ical_subscriptions: UsageMetric;
|
|
522
568
|
proposals: UsageMetric;
|
|
569
|
+
/** Active recurring series masters vs. the plan cap (free: 5, Pro: 250; null = unlimited). */
|
|
570
|
+
recurring_events: UsageMetric;
|
|
523
571
|
holds: HoldsUsage;
|
|
524
572
|
cross_calendar_queries: CrossCalendarQueriesUsage;
|
|
525
573
|
}
|
|
@@ -793,7 +841,15 @@ declare class EventsClient {
|
|
|
793
841
|
get(calendarId: string, eventId: string, options?: RequestOptions): Promise<CalendarEvent>;
|
|
794
842
|
list(params?: ListEventsParams): PageIterator<CalendarEvent>;
|
|
795
843
|
update(calendarId: string, eventId: string, params: UpdateEventParams, options?: RequestOptions): Promise<CalendarEvent>;
|
|
796
|
-
|
|
844
|
+
/**
|
|
845
|
+
* Delete an event (or, for a recurring series, the whole series). Pass
|
|
846
|
+
* `occurrence_start` to cancel just one occurrence of a recurring series
|
|
847
|
+
* instead — the series lives on and the updated series master is returned.
|
|
848
|
+
* Plain deletes resolve to void. With `occurrence_start`, fails with 400 if
|
|
849
|
+
* the timestamp is not an active occurrence, or 409 if the event is not a
|
|
850
|
+
* recurring series.
|
|
851
|
+
*/
|
|
852
|
+
delete(calendarId: string, eventId: string, options?: DeleteEventOptions): Promise<CalendarEvent | void>;
|
|
797
853
|
/**
|
|
798
854
|
* Fetch an event by ID alone. The calendar is resolved internally from the
|
|
799
855
|
* event, so no calendar ID is required.
|
|
@@ -806,9 +862,13 @@ declare class EventsClient {
|
|
|
806
862
|
updateById(eventId: string, params: UpdateEventParams, options?: RequestOptions): Promise<CalendarEvent>;
|
|
807
863
|
/**
|
|
808
864
|
* Delete an event by ID alone. The calendar is resolved internally from the
|
|
809
|
-
* event, so no calendar ID is required.
|
|
865
|
+
* event, so no calendar ID is required. Pass `occurrence_start` to cancel
|
|
866
|
+
* just one occurrence of a recurring series — the series lives on and the
|
|
867
|
+
* updated series master is returned; plain deletes resolve to void. With
|
|
868
|
+
* `occurrence_start`, fails with 400 if the timestamp is not an active
|
|
869
|
+
* occurrence, or 409 if the event is not a recurring series.
|
|
810
870
|
*/
|
|
811
|
-
deleteById(eventId: string, options?:
|
|
871
|
+
deleteById(eventId: string, options?: DeleteEventOptions): Promise<CalendarEvent | void>;
|
|
812
872
|
/**
|
|
813
873
|
* Promote a held event (status='hold') to status='confirmed'. Fails with 409
|
|
814
874
|
* if the event is not a hold, or if the hold has already expired.
|
|
@@ -1022,10 +1082,31 @@ declare class TermsClient {
|
|
|
1022
1082
|
accept(params: AcceptTermsParams, options?: RequestOptions): Promise<AcceptTermsResult>;
|
|
1023
1083
|
}
|
|
1024
1084
|
|
|
1085
|
+
interface CreateConnectionLinkParams {
|
|
1086
|
+
capabilities: Array<'availability' | 'publishing'>;
|
|
1087
|
+
publication_policy?: 'none' | 'confirmed' | 'confirmed_tentative';
|
|
1088
|
+
}
|
|
1089
|
+
interface ConnectionLink {
|
|
1090
|
+
id: string;
|
|
1091
|
+
calendar_id: string;
|
|
1092
|
+
setup_url?: string | null;
|
|
1093
|
+
status: 'awaiting_human' | 'in_progress' | 'completed' | 'declined' | 'expired' | 'cancelled';
|
|
1094
|
+
expires_at: string;
|
|
1095
|
+
connection_id?: string | null;
|
|
1096
|
+
reused?: boolean;
|
|
1097
|
+
}
|
|
1098
|
+
declare class ConnectionLinksClient {
|
|
1099
|
+
private readonly client;
|
|
1100
|
+
constructor(client: CoreClient);
|
|
1101
|
+
create(calendarId: string, params: CreateConnectionLinkParams, options?: RequestOptions): Promise<ConnectionLink>;
|
|
1102
|
+
get(id: string, options?: RequestOptions): Promise<ConnectionLink>;
|
|
1103
|
+
cancel(id: string, options?: RequestOptions): Promise<void>;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1025
1106
|
declare function verifySignature(rawBody: string, headers: Headers | Record<string, string>, secret: string, options?: VerifyOptions): Promise<void>;
|
|
1026
1107
|
declare function constructEvent(rawBody: string, headers: Headers | Record<string, string>, secret: string, options?: VerifyOptions): Promise<WebhookEvent>;
|
|
1027
1108
|
|
|
1028
|
-
declare const VERSION = "0.
|
|
1109
|
+
declare const VERSION = "0.5.1";
|
|
1029
1110
|
|
|
1030
1111
|
declare class ChronaryError extends Error {
|
|
1031
1112
|
readonly status: number;
|
|
@@ -1074,6 +1155,7 @@ declare class Chronary {
|
|
|
1074
1155
|
readonly plans: PlansClient;
|
|
1075
1156
|
readonly account: AccountClient;
|
|
1076
1157
|
readonly terms: TermsClient;
|
|
1158
|
+
readonly connectionLinks: ConnectionLinksClient;
|
|
1077
1159
|
constructor(config?: ChronaryConfig);
|
|
1078
1160
|
static webhooks: {
|
|
1079
1161
|
verifySignature: typeof verifySignature;
|
|
@@ -1081,4 +1163,4 @@ declare class Chronary {
|
|
|
1081
1163
|
};
|
|
1082
1164
|
}
|
|
1083
1165
|
|
|
1084
|
-
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, CoreClient, type CreateAgentParams, type CreateCalendarParams, type CreateEventParams, type CreateICalSubscriptionParams, type CreateProposalParams, type CreateScopedApiKeyParams, type CreateWebhookParams, type CreatedScopedApiKey, type CrossAgentAvailabilityParams, type DataExport, 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -195,6 +195,14 @@ interface CalendarEvent {
|
|
|
195
195
|
metadata: Record<string, unknown>;
|
|
196
196
|
/** Reminder offsets (minutes before start). null = inherit calendar default (then system default of 10 min); [] = no reminders. */
|
|
197
197
|
reminders: number[] | null;
|
|
198
|
+
/** RFC 5545 RRULE subset (no "RRULE:" prefix) when this event is a recurring series master, e.g. "FREQ=WEEKLY;BYDAY=MO,WE;COUNT=12". null = one-off event. */
|
|
199
|
+
recurrenceRule: string | null;
|
|
200
|
+
/** ISO 8601 starts of individually cancelled occurrences (EXDATE). */
|
|
201
|
+
recurrenceExdates: string[];
|
|
202
|
+
/** Present only on expanded instances (`expand: true` lists): id of the recurring series master this instance belongs to. */
|
|
203
|
+
recurringEventId?: string;
|
|
204
|
+
/** Present only on expanded instances: the occurrence start this instance was generated for. */
|
|
205
|
+
originalStartTime?: string;
|
|
198
206
|
holdExpiresAt: string | null;
|
|
199
207
|
holdPriority: number | null;
|
|
200
208
|
deletedAt: string | null;
|
|
@@ -215,6 +223,15 @@ interface CreateEventParams {
|
|
|
215
223
|
hold_expires_at?: string;
|
|
216
224
|
/** Priority for conflict resolution. Only valid with status='hold'. 0-100. */
|
|
217
225
|
hold_priority?: number;
|
|
226
|
+
/**
|
|
227
|
+
* RFC 5545 RRULE subset (no "RRULE:" prefix), e.g. "FREQ=WEEKLY;BYDAY=MO,WE;COUNT=12" —
|
|
228
|
+
* makes the event a recurring series master. Not allowed with status='hold'.
|
|
229
|
+
* Fails with 400 on an invalid rule; 429 when the plan's active
|
|
230
|
+
* recurring-series cap is reached (free: 5, Pro: 250 — see
|
|
231
|
+
* `usage.recurring_events`); 403 plan_required when the series is unbounded
|
|
232
|
+
* or ends more than 90 days out on the free plan (Pro allows unbounded).
|
|
233
|
+
*/
|
|
234
|
+
recurrence_rule?: string;
|
|
218
235
|
}
|
|
219
236
|
interface UpdateEventParams {
|
|
220
237
|
title?: string;
|
|
@@ -227,6 +244,16 @@ interface UpdateEventParams {
|
|
|
227
244
|
metadata?: Record<string, unknown>;
|
|
228
245
|
/** Reminder offsets in minutes before start. null = inherit calendar default; [] = no reminders. */
|
|
229
246
|
reminders?: number[] | null;
|
|
247
|
+
/**
|
|
248
|
+
* Full-series edit of the recurrence rule (RFC 5545 RRULE subset, no
|
|
249
|
+
* "RRULE:" prefix). null clears the rule, turning the series back into a
|
|
250
|
+
* one-off event. Fails with 400 on an invalid rule; 429 when converting a
|
|
251
|
+
* one-off to recurring and the plan's active recurring-series cap is
|
|
252
|
+
* reached (free: 5, Pro: 250); 403 plan_required when the series is
|
|
253
|
+
* unbounded or ends more than 90 days out on the free plan (Pro allows
|
|
254
|
+
* unbounded).
|
|
255
|
+
*/
|
|
256
|
+
recurrence_rule?: string | null;
|
|
230
257
|
}
|
|
231
258
|
interface ListEventsParams {
|
|
232
259
|
calendarId?: string;
|
|
@@ -237,6 +264,25 @@ interface ListEventsParams {
|
|
|
237
264
|
source?: 'internal' | 'external_ical';
|
|
238
265
|
limit?: number;
|
|
239
266
|
offset?: number;
|
|
267
|
+
/**
|
|
268
|
+
* Expand recurring series into individual occurrence instances within the
|
|
269
|
+
* window. When true, both `start_after` and `start_before` are required
|
|
270
|
+
* (max 366 days apart) — the API returns 400 otherwise. Expanded instances
|
|
271
|
+
* carry `recurringEventId` + `originalStartTime`.
|
|
272
|
+
*/
|
|
273
|
+
expand?: boolean;
|
|
274
|
+
}
|
|
275
|
+
/** Options for event delete calls — `RequestOptions` plus recurrence controls. */
|
|
276
|
+
interface DeleteEventOptions extends RequestOptions {
|
|
277
|
+
/**
|
|
278
|
+
* For recurring series only: ISO 8601 start of the single occurrence to
|
|
279
|
+
* cancel (recorded as an EXDATE). The series lives on and the delete call
|
|
280
|
+
* resolves to the updated series master event instead of void. Fails with
|
|
281
|
+
* 400 if the timestamp is not an active occurrence of the series, or 409
|
|
282
|
+
* if the event is not a recurring series. Omit to delete the whole
|
|
283
|
+
* event/series (resolves to void).
|
|
284
|
+
*/
|
|
285
|
+
occurrence_start?: string;
|
|
240
286
|
}
|
|
241
287
|
type SlotDuration = '15m' | '30m' | '45m' | '1h' | '2h';
|
|
242
288
|
interface AvailabilitySlot {
|
|
@@ -520,6 +566,8 @@ interface Usage {
|
|
|
520
566
|
availability_queries: UsageMetric;
|
|
521
567
|
ical_subscriptions: UsageMetric;
|
|
522
568
|
proposals: UsageMetric;
|
|
569
|
+
/** Active recurring series masters vs. the plan cap (free: 5, Pro: 250; null = unlimited). */
|
|
570
|
+
recurring_events: UsageMetric;
|
|
523
571
|
holds: HoldsUsage;
|
|
524
572
|
cross_calendar_queries: CrossCalendarQueriesUsage;
|
|
525
573
|
}
|
|
@@ -793,7 +841,15 @@ declare class EventsClient {
|
|
|
793
841
|
get(calendarId: string, eventId: string, options?: RequestOptions): Promise<CalendarEvent>;
|
|
794
842
|
list(params?: ListEventsParams): PageIterator<CalendarEvent>;
|
|
795
843
|
update(calendarId: string, eventId: string, params: UpdateEventParams, options?: RequestOptions): Promise<CalendarEvent>;
|
|
796
|
-
|
|
844
|
+
/**
|
|
845
|
+
* Delete an event (or, for a recurring series, the whole series). Pass
|
|
846
|
+
* `occurrence_start` to cancel just one occurrence of a recurring series
|
|
847
|
+
* instead — the series lives on and the updated series master is returned.
|
|
848
|
+
* Plain deletes resolve to void. With `occurrence_start`, fails with 400 if
|
|
849
|
+
* the timestamp is not an active occurrence, or 409 if the event is not a
|
|
850
|
+
* recurring series.
|
|
851
|
+
*/
|
|
852
|
+
delete(calendarId: string, eventId: string, options?: DeleteEventOptions): Promise<CalendarEvent | void>;
|
|
797
853
|
/**
|
|
798
854
|
* Fetch an event by ID alone. The calendar is resolved internally from the
|
|
799
855
|
* event, so no calendar ID is required.
|
|
@@ -806,9 +862,13 @@ declare class EventsClient {
|
|
|
806
862
|
updateById(eventId: string, params: UpdateEventParams, options?: RequestOptions): Promise<CalendarEvent>;
|
|
807
863
|
/**
|
|
808
864
|
* Delete an event by ID alone. The calendar is resolved internally from the
|
|
809
|
-
* event, so no calendar ID is required.
|
|
865
|
+
* event, so no calendar ID is required. Pass `occurrence_start` to cancel
|
|
866
|
+
* just one occurrence of a recurring series — the series lives on and the
|
|
867
|
+
* updated series master is returned; plain deletes resolve to void. With
|
|
868
|
+
* `occurrence_start`, fails with 400 if the timestamp is not an active
|
|
869
|
+
* occurrence, or 409 if the event is not a recurring series.
|
|
810
870
|
*/
|
|
811
|
-
deleteById(eventId: string, options?:
|
|
871
|
+
deleteById(eventId: string, options?: DeleteEventOptions): Promise<CalendarEvent | void>;
|
|
812
872
|
/**
|
|
813
873
|
* Promote a held event (status='hold') to status='confirmed'. Fails with 409
|
|
814
874
|
* if the event is not a hold, or if the hold has already expired.
|
|
@@ -1022,10 +1082,31 @@ declare class TermsClient {
|
|
|
1022
1082
|
accept(params: AcceptTermsParams, options?: RequestOptions): Promise<AcceptTermsResult>;
|
|
1023
1083
|
}
|
|
1024
1084
|
|
|
1085
|
+
interface CreateConnectionLinkParams {
|
|
1086
|
+
capabilities: Array<'availability' | 'publishing'>;
|
|
1087
|
+
publication_policy?: 'none' | 'confirmed' | 'confirmed_tentative';
|
|
1088
|
+
}
|
|
1089
|
+
interface ConnectionLink {
|
|
1090
|
+
id: string;
|
|
1091
|
+
calendar_id: string;
|
|
1092
|
+
setup_url?: string | null;
|
|
1093
|
+
status: 'awaiting_human' | 'in_progress' | 'completed' | 'declined' | 'expired' | 'cancelled';
|
|
1094
|
+
expires_at: string;
|
|
1095
|
+
connection_id?: string | null;
|
|
1096
|
+
reused?: boolean;
|
|
1097
|
+
}
|
|
1098
|
+
declare class ConnectionLinksClient {
|
|
1099
|
+
private readonly client;
|
|
1100
|
+
constructor(client: CoreClient);
|
|
1101
|
+
create(calendarId: string, params: CreateConnectionLinkParams, options?: RequestOptions): Promise<ConnectionLink>;
|
|
1102
|
+
get(id: string, options?: RequestOptions): Promise<ConnectionLink>;
|
|
1103
|
+
cancel(id: string, options?: RequestOptions): Promise<void>;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1025
1106
|
declare function verifySignature(rawBody: string, headers: Headers | Record<string, string>, secret: string, options?: VerifyOptions): Promise<void>;
|
|
1026
1107
|
declare function constructEvent(rawBody: string, headers: Headers | Record<string, string>, secret: string, options?: VerifyOptions): Promise<WebhookEvent>;
|
|
1027
1108
|
|
|
1028
|
-
declare const VERSION = "0.
|
|
1109
|
+
declare const VERSION = "0.5.1";
|
|
1029
1110
|
|
|
1030
1111
|
declare class ChronaryError extends Error {
|
|
1031
1112
|
readonly status: number;
|
|
@@ -1074,6 +1155,7 @@ declare class Chronary {
|
|
|
1074
1155
|
readonly plans: PlansClient;
|
|
1075
1156
|
readonly account: AccountClient;
|
|
1076
1157
|
readonly terms: TermsClient;
|
|
1158
|
+
readonly connectionLinks: ConnectionLinksClient;
|
|
1077
1159
|
constructor(config?: ChronaryConfig);
|
|
1078
1160
|
static webhooks: {
|
|
1079
1161
|
verifySignature: typeof verifySignature;
|
|
@@ -1081,4 +1163,4 @@ declare class Chronary {
|
|
|
1081
1163
|
};
|
|
1082
1164
|
}
|
|
1083
1165
|
|
|
1084
|
-
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, CoreClient, type CreateAgentParams, type CreateCalendarParams, type CreateEventParams, type CreateICalSubscriptionParams, type CreateProposalParams, type CreateScopedApiKeyParams, type CreateWebhookParams, type CreatedScopedApiKey, type CrossAgentAvailabilityParams, type DataExport, 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var VERSION = "0.
|
|
2
|
+
var VERSION = "0.5.1";
|
|
3
3
|
|
|
4
4
|
// src/error.ts
|
|
5
5
|
var ChronaryError = class extends Error {
|
|
@@ -541,13 +541,22 @@ var EventsClient = class {
|
|
|
541
541
|
options
|
|
542
542
|
);
|
|
543
543
|
}
|
|
544
|
+
/**
|
|
545
|
+
* Delete an event (or, for a recurring series, the whole series). Pass
|
|
546
|
+
* `occurrence_start` to cancel just one occurrence of a recurring series
|
|
547
|
+
* instead — the series lives on and the updated series master is returned.
|
|
548
|
+
* Plain deletes resolve to void. With `occurrence_start`, fails with 400 if
|
|
549
|
+
* the timestamp is not an active occurrence, or 409 if the event is not a
|
|
550
|
+
* recurring series.
|
|
551
|
+
*/
|
|
544
552
|
async delete(calendarId, eventId, options) {
|
|
545
|
-
|
|
553
|
+
const { occurrence_start, ...requestOptions } = options ?? {};
|
|
554
|
+
return this.client.request(
|
|
546
555
|
"DELETE",
|
|
547
556
|
`/v1/calendars/${calendarId}/events/${eventId}`,
|
|
548
557
|
void 0,
|
|
549
|
-
void 0,
|
|
550
|
-
|
|
558
|
+
occurrence_start !== void 0 ? { occurrence_start } : void 0,
|
|
559
|
+
requestOptions
|
|
551
560
|
);
|
|
552
561
|
}
|
|
553
562
|
/**
|
|
@@ -578,15 +587,20 @@ var EventsClient = class {
|
|
|
578
587
|
}
|
|
579
588
|
/**
|
|
580
589
|
* Delete an event by ID alone. The calendar is resolved internally from the
|
|
581
|
-
* event, so no calendar ID is required.
|
|
590
|
+
* event, so no calendar ID is required. Pass `occurrence_start` to cancel
|
|
591
|
+
* just one occurrence of a recurring series — the series lives on and the
|
|
592
|
+
* updated series master is returned; plain deletes resolve to void. With
|
|
593
|
+
* `occurrence_start`, fails with 400 if the timestamp is not an active
|
|
594
|
+
* occurrence, or 409 if the event is not a recurring series.
|
|
582
595
|
*/
|
|
583
596
|
async deleteById(eventId, options) {
|
|
584
|
-
|
|
597
|
+
const { occurrence_start, ...requestOptions } = options ?? {};
|
|
598
|
+
return this.client.request(
|
|
585
599
|
"DELETE",
|
|
586
600
|
`/v1/events/${eventId}`,
|
|
587
601
|
void 0,
|
|
588
|
-
void 0,
|
|
589
|
-
|
|
602
|
+
occurrence_start !== void 0 ? { occurrence_start } : void 0,
|
|
603
|
+
requestOptions
|
|
590
604
|
);
|
|
591
605
|
}
|
|
592
606
|
/**
|
|
@@ -1101,6 +1115,23 @@ var TermsClient = class {
|
|
|
1101
1115
|
}
|
|
1102
1116
|
};
|
|
1103
1117
|
|
|
1118
|
+
// src/resources/connection-links.ts
|
|
1119
|
+
var ConnectionLinksClient = class {
|
|
1120
|
+
constructor(client) {
|
|
1121
|
+
this.client = client;
|
|
1122
|
+
}
|
|
1123
|
+
client;
|
|
1124
|
+
async create(calendarId, params, options) {
|
|
1125
|
+
return this.client.request("POST", `/v1/calendars/${calendarId}/connection-links`, params, void 0, options);
|
|
1126
|
+
}
|
|
1127
|
+
async get(id, options) {
|
|
1128
|
+
return this.client.request("GET", `/v1/connection-links/${id}`, void 0, void 0, options);
|
|
1129
|
+
}
|
|
1130
|
+
async cancel(id, options) {
|
|
1131
|
+
await this.client.request("DELETE", `/v1/connection-links/${id}`, void 0, void 0, options);
|
|
1132
|
+
}
|
|
1133
|
+
};
|
|
1134
|
+
|
|
1104
1135
|
// src/webhook-verify.ts
|
|
1105
1136
|
var DEFAULT_TOLERANCE = 5 * 60 * 1e3;
|
|
1106
1137
|
function bufToHex(buf) {
|
|
@@ -1197,6 +1228,7 @@ var Chronary = class {
|
|
|
1197
1228
|
plans;
|
|
1198
1229
|
account;
|
|
1199
1230
|
terms;
|
|
1231
|
+
connectionLinks;
|
|
1200
1232
|
constructor(config) {
|
|
1201
1233
|
const client = new CoreClient(config);
|
|
1202
1234
|
this.agents = new AgentsClient(client);
|
|
@@ -1215,6 +1247,7 @@ var Chronary = class {
|
|
|
1215
1247
|
this.plans = new PlansClient(client);
|
|
1216
1248
|
this.account = new AccountClient(client);
|
|
1217
1249
|
this.terms = new TermsClient(client);
|
|
1250
|
+
this.connectionLinks = new ConnectionLinksClient(client);
|
|
1218
1251
|
}
|
|
1219
1252
|
static webhooks = {
|
|
1220
1253
|
verifySignature,
|
|
@@ -1228,6 +1261,7 @@ export {
|
|
|
1228
1261
|
Chronary,
|
|
1229
1262
|
ChronaryError,
|
|
1230
1263
|
ConnectionError,
|
|
1264
|
+
ConnectionLinksClient,
|
|
1231
1265
|
CoreClient,
|
|
1232
1266
|
NotFoundError,
|
|
1233
1267
|
PageIterator,
|