@unboundcx/sdk 4.0.3 → 4.0.4
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/package.json +1 -1
- package/services/googleCalendar.js +24 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -3,19 +3,38 @@ export class GoogleCalendarService {
|
|
|
3
3
|
this.sdk = sdk;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
async setupWebhook({
|
|
6
|
+
async setupWebhook({
|
|
7
|
+
calendarId,
|
|
8
|
+
eventTypes,
|
|
9
|
+
webhookUrl,
|
|
10
|
+
expirationTime,
|
|
11
|
+
recordTypeId,
|
|
12
|
+
} = {}) {
|
|
13
|
+
// Only calendarId is required. The server derives the webhook URL itself
|
|
14
|
+
// (per-environment: https://login.<API_BASE_URL>/webhooks/google/...) and
|
|
15
|
+
// watches all event types, so eventTypes/webhookUrl are optional. They
|
|
16
|
+
// were previously marked required, which broke the common
|
|
17
|
+
// setupWebhook({ calendarId }) call site (createRoom) with
|
|
18
|
+
// "Missing required parameter eventTypes".
|
|
19
|
+
// recordTypeId is optional: callers (e.g. createRoom) pass the meeting's
|
|
20
|
+
// already-resolved recordTypeId so the webhook row inherits it; if omitted
|
|
21
|
+
// the server resolves a fallback via findRecordTypeId.
|
|
7
22
|
this.sdk.validateParams(
|
|
8
|
-
{ calendarId, eventTypes, webhookUrl },
|
|
23
|
+
{ calendarId, eventTypes, webhookUrl, recordTypeId },
|
|
9
24
|
{
|
|
10
25
|
calendarId: { type: 'string', required: true },
|
|
11
|
-
eventTypes: { type: 'array', required:
|
|
12
|
-
webhookUrl: { type: 'string', required:
|
|
26
|
+
eventTypes: { type: 'array', required: false },
|
|
27
|
+
webhookUrl: { type: 'string', required: false },
|
|
13
28
|
expirationTime: { type: 'number', required: false },
|
|
29
|
+
recordTypeId: { type: 'string', required: false },
|
|
14
30
|
},
|
|
15
31
|
);
|
|
16
32
|
|
|
17
|
-
const webhookData = { calendarId
|
|
33
|
+
const webhookData = { calendarId };
|
|
34
|
+
if (eventTypes) webhookData.eventTypes = eventTypes;
|
|
35
|
+
if (webhookUrl) webhookData.webhookUrl = webhookUrl;
|
|
18
36
|
if (expirationTime) webhookData.expirationTime = expirationTime;
|
|
37
|
+
if (recordTypeId) webhookData.recordTypeId = recordTypeId;
|
|
19
38
|
|
|
20
39
|
const params = {
|
|
21
40
|
body: webhookData,
|