@attrove/sdk 0.1.7 → 0.1.9

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.
Files changed (58) hide show
  1. package/README.md +52 -0
  2. package/cjs/admin-client.js +2 -22
  3. package/cjs/client.js +8 -74
  4. package/cjs/constants.js +1 -1
  5. package/cjs/resources/calendars.js +112 -0
  6. package/cjs/resources/events.js +90 -0
  7. package/cjs/resources/index.js +11 -1
  8. package/cjs/resources/integrations.js +32 -2
  9. package/cjs/resources/meetings.js +171 -0
  10. package/cjs/resources/settings.js +71 -0
  11. package/cjs/resources/threads.js +103 -0
  12. package/cjs/types/index.js +1 -0
  13. package/esm/admin-client.d.ts +5 -19
  14. package/esm/admin-client.d.ts.map +1 -1
  15. package/esm/admin-client.js +2 -22
  16. package/esm/admin-client.js.map +1 -1
  17. package/esm/client.d.ts +20 -65
  18. package/esm/client.d.ts.map +1 -1
  19. package/esm/client.js +8 -74
  20. package/esm/client.js.map +1 -1
  21. package/esm/constants.d.ts +1 -1
  22. package/esm/constants.js +1 -1
  23. package/esm/index.d.ts +4 -0
  24. package/esm/index.d.ts.map +1 -1
  25. package/esm/index.js.map +1 -1
  26. package/esm/resources/calendars.d.ts +91 -0
  27. package/esm/resources/calendars.d.ts.map +1 -0
  28. package/esm/resources/calendars.js +109 -0
  29. package/esm/resources/calendars.js.map +1 -0
  30. package/esm/resources/events.d.ts +68 -0
  31. package/esm/resources/events.d.ts.map +1 -0
  32. package/esm/resources/events.js +87 -0
  33. package/esm/resources/events.js.map +1 -0
  34. package/esm/resources/index.d.ts +9 -0
  35. package/esm/resources/index.d.ts.map +1 -1
  36. package/esm/resources/index.js +5 -0
  37. package/esm/resources/index.js.map +1 -1
  38. package/esm/resources/integrations.d.ts +27 -3
  39. package/esm/resources/integrations.d.ts.map +1 -1
  40. package/esm/resources/integrations.js +32 -2
  41. package/esm/resources/integrations.js.map +1 -1
  42. package/esm/resources/meetings.d.ts +120 -0
  43. package/esm/resources/meetings.d.ts.map +1 -0
  44. package/esm/resources/meetings.js +168 -0
  45. package/esm/resources/meetings.js.map +1 -0
  46. package/esm/resources/settings.d.ts +62 -0
  47. package/esm/resources/settings.d.ts.map +1 -0
  48. package/esm/resources/settings.js +68 -0
  49. package/esm/resources/settings.js.map +1 -0
  50. package/esm/resources/threads.d.ts +74 -0
  51. package/esm/resources/threads.d.ts.map +1 -0
  52. package/esm/resources/threads.js +100 -0
  53. package/esm/resources/threads.js.map +1 -0
  54. package/esm/types/index.d.ts +252 -14
  55. package/esm/types/index.d.ts.map +1 -1
  56. package/esm/types/index.js +1 -0
  57. package/esm/types/index.js.map +1 -1
  58. package/package.json +1 -1
package/README.md CHANGED
@@ -129,10 +129,62 @@ await attrove.conversations.updateSync([
129
129
  // List integrations
130
130
  const integrations = await attrove.integrations.list();
131
131
 
132
+ // Get a single integration
133
+ const integration = await attrove.integrations.get('integration-id');
134
+ console.log(`${integration.provider}: last synced ${integration.last_synced_at}`);
135
+
132
136
  // Disconnect an integration
133
137
  await attrove.integrations.disconnect('integration-uuid');
134
138
  ```
135
139
 
140
+ ### Threads
141
+
142
+ ```typescript
143
+ // Discover relevant threads via semantic search
144
+ const { threads } = await attrove.threads.discover('Q4 budget discussion', {
145
+ integrationTypes: ['slack'],
146
+ afterDate: '2024-01-01T00:00:00Z',
147
+ limit: 5,
148
+ });
149
+
150
+ for (const thread of threads) {
151
+ console.log(`${thread.title} (score: ${thread.relevance_score})`);
152
+ }
153
+
154
+ // Analyze a thread for structured insights
155
+ const analysis = await attrove.threads.analyze('conversation-uuid');
156
+ console.log(analysis.summary);
157
+ console.log(`Sentiment: ${analysis.sentiment}`);
158
+ console.log(`Action items: ${analysis.action_items.length}`);
159
+ console.log(`Decisions: ${analysis.decisions.length}`);
160
+ ```
161
+
162
+ ### Meetings
163
+
164
+ ```typescript
165
+ // List meetings
166
+ const { data: meetings } = await attrove.meetings.list({
167
+ expand: ['summary', 'action_items', 'attendees'],
168
+ });
169
+
170
+ // Get a single meeting
171
+ const meeting = await attrove.meetings.get('meeting-id');
172
+
173
+ // Update a meeting's summary or action items
174
+ const updated = await attrove.meetings.update('meeting-id', {
175
+ summary: 'Revised meeting summary.',
176
+ shortSummary: 'Brief revision.',
177
+ actionItems: [
178
+ { description: 'Follow up with client', assignee: 'Alice' },
179
+ ],
180
+ });
181
+
182
+ // Regenerate the AI summary from the transcript
183
+ const result = await attrove.meetings.regenerateSummary('meeting-id');
184
+ console.log(result.summary);
185
+ console.log(`Action items: ${result.action_items.length}`);
186
+ ```
187
+
136
188
  ## Server-to-Server (Admin) API
137
189
 
138
190
  Use the admin client for operations that require partner authentication:
@@ -12,6 +12,7 @@ const index_js_1 = require("./errors/index.js");
12
12
  const index_js_2 = require("./types/index.js");
13
13
  const index_js_3 = require("./types/index.js");
14
14
  const constants_js_1 = require("./constants.js");
15
+ const settings_js_1 = require("./resources/settings.js");
15
16
  /**
16
17
  * Validate the admin client configuration.
17
18
  *
@@ -130,28 +131,6 @@ class AdminUsersResource {
130
131
  // Route: POST /v1/users/:user_id/tokens with X-Auth-Type: partner header
131
132
  return this.http.post(`/v1/users/${userId}/tokens`, body);
132
133
  }
133
- /**
134
- * Delete a user.
135
- *
136
- * Permanently deletes a user and all associated data.
137
- *
138
- * @experimental This method is not yet implemented and will throw an error.
139
- *
140
- * @param userId - User ID (UUID format)
141
- *
142
- * @throws {Error} Always throws - not yet implemented
143
- *
144
- * @example
145
- * ```ts
146
- * // Not yet available
147
- * const admin = Attrove.admin({ clientId, clientSecret });
148
- * await admin.users.delete(userId);
149
- * ```
150
- */
151
- async delete(userId) {
152
- // TODO: Implement user deletion endpoint
153
- throw new Error("User deletion not yet implemented. This feature is coming soon.");
154
- }
155
134
  }
156
135
  exports.AdminUsersResource = AdminUsersResource;
157
136
  /**
@@ -217,6 +196,7 @@ class AttroveAdmin {
217
196
  });
218
197
  // Initialize resources
219
198
  this.users = new AdminUsersResource(this.http, this.config.clientId);
199
+ this.settings = new settings_js_1.AdminSettingsResource(this.http, this.config.clientId);
220
200
  }
221
201
  }
222
202
  exports.AttroveAdmin = AttroveAdmin;
package/cjs/client.js CHANGED
@@ -13,6 +13,10 @@ const users_js_1 = require("./resources/users.js");
13
13
  const messages_js_1 = require("./resources/messages.js");
14
14
  const conversations_js_1 = require("./resources/conversations.js");
15
15
  const integrations_js_1 = require("./resources/integrations.js");
16
+ const calendars_js_1 = require("./resources/calendars.js");
17
+ const events_js_1 = require("./resources/events.js");
18
+ const meetings_js_1 = require("./resources/meetings.js");
19
+ const threads_js_1 = require("./resources/threads.js");
16
20
  const query_js_1 = require("./resources/query.js");
17
21
  const index_js_1 = require("./errors/index.js");
18
22
  const index_js_2 = require("./types/index.js");
@@ -114,6 +118,10 @@ class Attrove {
114
118
  this.messages = new messages_js_1.MessagesResource(this.http, this.config.userId);
115
119
  this.conversations = new conversations_js_1.ConversationsResource(this.http, this.config.userId);
116
120
  this.integrations = new integrations_js_1.IntegrationsResource(this.http, this.config.userId);
121
+ this.calendars = new calendars_js_1.CalendarsResource(this.http, this.config.userId);
122
+ this.events = new events_js_1.EventsResource(this.http, this.config.userId);
123
+ this.meetings = new meetings_js_1.MeetingsResource(this.http, this.config.userId);
124
+ this.threads = new threads_js_1.ThreadsResource(this.http, this.config.userId);
117
125
  this.queryResource = new query_js_1.QueryResource(this.http, this.config.userId);
118
126
  }
119
127
  /**
@@ -235,79 +243,5 @@ class Attrove {
235
243
  streaming.close();
236
244
  }
237
245
  }
238
- /**
239
- * Get meeting preparation brief.
240
- *
241
- * Retrieves context about attendees, recent conversations, and relevant
242
- * information to help prepare for an upcoming meeting.
243
- *
244
- * @experimental This method is not yet implemented and will throw an error.
245
- *
246
- * @param meetingId - Meeting ID (UUID format)
247
- * @returns Meeting brief with attendee info and relevant context
248
- *
249
- * @throws {Error} Always throws - not yet implemented
250
- *
251
- * @example
252
- * ```ts
253
- * // Not yet available
254
- * const brief = await attrove.brief('meeting-uuid-here');
255
- * console.log(brief.summary);
256
- * console.log('Attendees:', brief.attendees);
257
- * ```
258
- */
259
- async brief(meetingId) {
260
- // TODO: Implement meeting brief endpoint
261
- throw new Error("Meeting brief not yet implemented. This feature is coming soon.");
262
- }
263
- /**
264
- * Get information about an entity (person, company, etc.).
265
- *
266
- * Retrieves profile information and interaction history for an entity
267
- * identified from the user's communications.
268
- *
269
- * @experimental This method is not yet implemented and will throw an error.
270
- *
271
- * @param entityId - Entity ID (UUID format)
272
- * @returns Entity profile with interaction history
273
- *
274
- * @throws {Error} Always throws - not yet implemented
275
- *
276
- * @example
277
- * ```ts
278
- * // Not yet available
279
- * const entity = await attrove.entity('entity-uuid');
280
- * console.log(`${entity.name}: ${entity.message_count} messages`);
281
- * ```
282
- */
283
- async entity(entityId) {
284
- // TODO: Implement entity endpoint
285
- throw new Error("Entity lookup not yet implemented. This feature is coming soon.");
286
- }
287
- /**
288
- * Get a conversation thread.
289
- *
290
- * Retrieves all messages in a specific conversation thread.
291
- *
292
- * @experimental This method is not yet implemented and will throw an error.
293
- *
294
- * @param conversationId - Conversation ID (UUID format)
295
- * @returns Conversation thread with messages
296
- *
297
- * @throws {Error} Always throws - not yet implemented
298
- *
299
- * @example
300
- * ```ts
301
- * // Not yet available
302
- * const thread = await attrove.thread('conversation-uuid-here');
303
- * for (const msg of thread.messages) {
304
- * console.log(`${msg.sender_name}: ${msg.body_text}`);
305
- * }
306
- * ```
307
- */
308
- async thread(conversationId) {
309
- // TODO: Implement thread endpoint
310
- throw new Error("Thread retrieval not yet implemented. This feature is coming soon.");
311
- }
312
246
  }
313
247
  exports.Attrove = Attrove;
package/cjs/constants.js CHANGED
@@ -13,7 +13,7 @@ exports.getWsCloseReason = exports.WS_CLOSE_CODES = exports.RETRYABLE_STATUS_SET
13
13
  * Automatically synchronized with package.json during the release process.
14
14
  * For programmatic access, use `getVersion()` from './version'.
15
15
  */
16
- exports.SDK_VERSION = "0.1.7"; // auto-synced from package.json during release
16
+ exports.SDK_VERSION = "0.1.9"; // auto-synced from package.json during release
17
17
  /**
18
18
  * Default API base URL for Attrove services.
19
19
  */
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ /**
3
+ * Calendars Resource
4
+ *
5
+ * Provides methods for listing, retrieving, and updating calendars
6
+ * from connected calendar integrations (e.g. Google Calendar).
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.CalendarsResource = void 0;
10
+ /**
11
+ * Calendars resource for managing calendar sync preferences.
12
+ *
13
+ * Users may have multiple calendars per integration (e.g. "Work", "Personal",
14
+ * "Holidays" in Google Calendar). By default only the primary calendar is
15
+ * active. Use `update()` to activate or deactivate calendars — only active
16
+ * calendars have their events synced.
17
+ */
18
+ class CalendarsResource {
19
+ constructor(http, userId) {
20
+ this.http = http;
21
+ this.userId = userId;
22
+ }
23
+ /**
24
+ * List calendars with optional filtering.
25
+ *
26
+ * @param options - Filtering, pagination, and expansion options
27
+ * @returns Paginated list of calendars
28
+ * @throws {AuthenticationError} If the API key is invalid
29
+ * @throws {AuthorizationError} If the user lacks access
30
+ * @throws {NetworkError} If the request fails due to a network issue
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * // List all calendars
35
+ * const { data } = await attrove.calendars.list();
36
+ *
37
+ * // List only active calendars
38
+ * const { data } = await attrove.calendars.list({ active: true });
39
+ *
40
+ * // List calendars for a specific integration
41
+ * const { data } = await attrove.calendars.list({ integrationId: '67890' });
42
+ * ```
43
+ */
44
+ async list(options = {}) {
45
+ const params = {};
46
+ if (options.integrationId) {
47
+ params.integration_id = options.integrationId;
48
+ }
49
+ if (options.active !== undefined) {
50
+ params.active = String(options.active);
51
+ }
52
+ if (options.limit !== undefined) {
53
+ params.limit = String(options.limit);
54
+ }
55
+ if (options.offset !== undefined) {
56
+ params.offset = String(options.offset);
57
+ }
58
+ if (options.expand?.length) {
59
+ params.expand = options.expand.join(",");
60
+ }
61
+ const response = await this.http.request(`/v1/users/${this.userId}/calendars`, { method: "GET" }, params);
62
+ return {
63
+ data: response.data,
64
+ pagination: response.pagination,
65
+ };
66
+ }
67
+ /**
68
+ * Get a single calendar by ID.
69
+ *
70
+ * @param id - Calendar ID
71
+ * @returns The requested calendar
72
+ * @throws {NotFoundError} If the calendar does not exist
73
+ * @throws {AuthenticationError} If the API key is invalid
74
+ * @throws {NetworkError} If the request fails due to a network issue
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * const calendar = await attrove.calendars.get('12345');
79
+ * console.log(calendar.title, calendar.active);
80
+ * ```
81
+ */
82
+ async get(id) {
83
+ return this.http.get(`/v1/users/${this.userId}/calendars/${id}`);
84
+ }
85
+ /**
86
+ * Update a calendar's properties (e.g. toggle sync on/off).
87
+ *
88
+ * When a calendar is activated, its events begin syncing on the next
89
+ * sync cycle (within 5 minutes).
90
+ *
91
+ * @param id - Calendar ID
92
+ * @param options - Fields to update (currently only `active`)
93
+ * @returns The updated calendar
94
+ * @throws {NotFoundError} If the calendar does not exist
95
+ * @throws {ValidationError} If the options are invalid
96
+ * @throws {AuthenticationError} If the API key is invalid
97
+ * @throws {NetworkError} If the request fails due to a network issue
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * // Activate a calendar for syncing
102
+ * const updated = await attrove.calendars.update('12345', { active: true });
103
+ *
104
+ * // Deactivate a calendar
105
+ * const updated = await attrove.calendars.update('12345', { active: false });
106
+ * ```
107
+ */
108
+ async update(id, options) {
109
+ return this.http.patch(`/v1/users/${this.userId}/calendars/${id}`, options);
110
+ }
111
+ }
112
+ exports.CalendarsResource = CalendarsResource;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ /**
3
+ * Events Resource
4
+ *
5
+ * Provides methods for accessing calendar events from connected integrations.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.EventsResource = void 0;
9
+ /**
10
+ * Events resource for accessing calendar event data.
11
+ *
12
+ * Provides methods for listing and retrieving calendar events from
13
+ * connected integrations (Google Calendar, etc.).
14
+ */
15
+ class EventsResource {
16
+ constructor(http, userId) {
17
+ this.http = http;
18
+ this.userId = userId;
19
+ }
20
+ /**
21
+ * List calendar events with optional filtering.
22
+ *
23
+ * @param options - Filtering, pagination, and expansion options
24
+ * @returns Paginated list of calendar events
25
+ *
26
+ * @throws {AuthenticationError} If the API key is invalid or expired
27
+ * @throws {ValidationError} If the filter parameters are invalid
28
+ * @throws {NetworkError} If unable to reach the API
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * // List upcoming events
33
+ * const { data, pagination } = await attrove.events.list({
34
+ * startDate: '2025-01-15T00:00:00Z',
35
+ * endDate: '2025-01-16T00:00:00Z',
36
+ * });
37
+ *
38
+ * // List events with attendee details
39
+ * const { data } = await attrove.events.list({
40
+ * expand: ['attendees', 'description'],
41
+ * });
42
+ * ```
43
+ */
44
+ async list(options = {}) {
45
+ const params = {};
46
+ if (options.calendarId) {
47
+ params.calendar_id = options.calendarId;
48
+ }
49
+ if (options.startDate) {
50
+ params.start_date = options.startDate;
51
+ }
52
+ if (options.endDate) {
53
+ params.end_date = options.endDate;
54
+ }
55
+ if (options.limit !== undefined) {
56
+ params.limit = String(options.limit);
57
+ }
58
+ if (options.offset !== undefined) {
59
+ params.offset = String(options.offset);
60
+ }
61
+ if (options.expand?.length) {
62
+ params.expand = options.expand.join(",");
63
+ }
64
+ const response = await this.http.request(`/v1/users/${this.userId}/events`, { method: "GET" }, params);
65
+ return {
66
+ data: response.data,
67
+ pagination: response.pagination,
68
+ };
69
+ }
70
+ /**
71
+ * Get a single calendar event by ID.
72
+ *
73
+ * @param id - Event ID
74
+ * @returns The requested calendar event
75
+ *
76
+ * @throws {AuthenticationError} If the API key is invalid or expired
77
+ * @throws {NotFoundError} If the event does not exist
78
+ * @throws {NetworkError} If unable to reach the API
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * const event = await attrove.events.get('event-id');
83
+ * console.log(event.title, event.start_time);
84
+ * ```
85
+ */
86
+ async get(id) {
87
+ return this.http.get(`/v1/users/${this.userId}/events/${id}`);
88
+ }
89
+ }
90
+ exports.EventsResource = EventsResource;
@@ -3,7 +3,7 @@
3
3
  * Resource exports
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.QueryResource = exports.IntegrationsResource = exports.ConversationsResource = exports.MessagesResource = exports.UsersResource = void 0;
6
+ exports.AdminSettingsResource = exports.QueryResource = exports.ThreadsResource = exports.MeetingsResource = exports.EventsResource = exports.CalendarsResource = exports.IntegrationsResource = exports.ConversationsResource = exports.MessagesResource = exports.UsersResource = void 0;
7
7
  var users_js_1 = require("./users.js");
8
8
  Object.defineProperty(exports, "UsersResource", { enumerable: true, get: function () { return users_js_1.UsersResource; } });
9
9
  var messages_js_1 = require("./messages.js");
@@ -12,5 +12,15 @@ var conversations_js_1 = require("./conversations.js");
12
12
  Object.defineProperty(exports, "ConversationsResource", { enumerable: true, get: function () { return conversations_js_1.ConversationsResource; } });
13
13
  var integrations_js_1 = require("./integrations.js");
14
14
  Object.defineProperty(exports, "IntegrationsResource", { enumerable: true, get: function () { return integrations_js_1.IntegrationsResource; } });
15
+ var calendars_js_1 = require("./calendars.js");
16
+ Object.defineProperty(exports, "CalendarsResource", { enumerable: true, get: function () { return calendars_js_1.CalendarsResource; } });
17
+ var events_js_1 = require("./events.js");
18
+ Object.defineProperty(exports, "EventsResource", { enumerable: true, get: function () { return events_js_1.EventsResource; } });
19
+ var meetings_js_1 = require("./meetings.js");
20
+ Object.defineProperty(exports, "MeetingsResource", { enumerable: true, get: function () { return meetings_js_1.MeetingsResource; } });
21
+ var threads_js_1 = require("./threads.js");
22
+ Object.defineProperty(exports, "ThreadsResource", { enumerable: true, get: function () { return threads_js_1.ThreadsResource; } });
15
23
  var query_js_1 = require("./query.js");
16
24
  Object.defineProperty(exports, "QueryResource", { enumerable: true, get: function () { return query_js_1.QueryResource; } });
25
+ var settings_js_1 = require("./settings.js");
26
+ Object.defineProperty(exports, "AdminSettingsResource", { enumerable: true, get: function () { return settings_js_1.AdminSettingsResource; } });
@@ -6,11 +6,12 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.IntegrationsResource = void 0;
9
+ const index_js_1 = require("../errors/index.js");
9
10
  /**
10
11
  * Integrations resource for managing connected services.
11
12
  *
12
- * Provides methods for listing and disconnecting integrations
13
- * (Gmail, Slack, Google Calendar, etc.).
13
+ * Provides methods for listing, retrieving, and disconnecting
14
+ * integrations (Gmail, Slack, Google Calendar, etc.).
14
15
  */
15
16
  class IntegrationsResource {
16
17
  constructor(http, userId) {
@@ -38,6 +39,35 @@ class IntegrationsResource {
38
39
  const response = await this.http.get(`/v1/users/${this.userId}`);
39
40
  return response.integrations;
40
41
  }
42
+ /**
43
+ * Get a single integration by ID.
44
+ *
45
+ * Returns detailed information including type, email, and last sync time.
46
+ *
47
+ * @param id - Integration ID
48
+ * @returns Detailed integration information
49
+ *
50
+ * @throws {ValidationError} If id is empty (client-side)
51
+ * @throws {AuthenticationError} If the API key is invalid or expired
52
+ * @throws {NotFoundError} If the integration does not exist
53
+ * @throws {ServerError} If the server encounters an internal error
54
+ * @throws {TimeoutError} If the request times out
55
+ * @throws {RateLimitError} If the API rate limit is exceeded
56
+ * @throws {NetworkError} If unable to reach the API
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const integration = await attrove.integrations.get('integration-id');
61
+ * console.log(`${integration.provider}: ${integration.auth_status}`);
62
+ * console.log(`Last synced: ${integration.last_synced_at}`);
63
+ * ```
64
+ */
65
+ async get(id) {
66
+ if (!id) {
67
+ throw new index_js_1.ValidationError("id is required and must be a non-empty string");
68
+ }
69
+ return this.http.get(`/v1/users/${this.userId}/integrations/${id}`);
70
+ }
41
71
  /**
42
72
  * Disconnect an integration.
43
73
  *
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+ /**
3
+ * Meetings Resource
4
+ *
5
+ * Provides methods for accessing meetings with AI-generated summaries.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.MeetingsResource = void 0;
9
+ const index_js_1 = require("../errors/index.js");
10
+ /**
11
+ * Meetings resource for accessing meeting data with AI summaries.
12
+ *
13
+ * Provides methods for listing, retrieving, updating, and regenerating
14
+ * summaries for meetings from connected integrations (Google Meet, Zoom, Teams).
15
+ */
16
+ class MeetingsResource {
17
+ constructor(http, userId) {
18
+ this.http = http;
19
+ this.userId = userId;
20
+ }
21
+ /**
22
+ * List meetings with optional filtering.
23
+ *
24
+ * @param options - Filtering, pagination, and expansion options
25
+ * @returns Paginated list of meetings
26
+ *
27
+ * @throws {AuthenticationError} If the API key is invalid or expired
28
+ * @throws {ValidationError} If the filter parameters are invalid
29
+ * @throws {NetworkError} If unable to reach the API
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * // List recent meetings with summaries
34
+ * const { data, pagination } = await attrove.meetings.list({
35
+ * expand: ['summary', 'action_items', 'attendees'],
36
+ * });
37
+ *
38
+ * // List meetings from a specific provider
39
+ * const { data } = await attrove.meetings.list({
40
+ * provider: 'google_meet',
41
+ * hasSummary: true,
42
+ * });
43
+ * ```
44
+ */
45
+ async list(options = {}) {
46
+ const params = {};
47
+ if (options.startDate) {
48
+ params.start_date = options.startDate;
49
+ }
50
+ if (options.endDate) {
51
+ params.end_date = options.endDate;
52
+ }
53
+ if (options.provider) {
54
+ params.provider = options.provider;
55
+ }
56
+ if (options.hasSummary !== undefined) {
57
+ params.has_summary = String(options.hasSummary);
58
+ }
59
+ if (options.limit !== undefined) {
60
+ params.limit = String(options.limit);
61
+ }
62
+ if (options.offset !== undefined) {
63
+ params.offset = String(options.offset);
64
+ }
65
+ if (options.expand?.length) {
66
+ params.expand = options.expand.join(",");
67
+ }
68
+ const response = await this.http.request(`/v1/users/${this.userId}/meetings`, { method: "GET" }, params);
69
+ return {
70
+ data: response.data,
71
+ pagination: response.pagination,
72
+ };
73
+ }
74
+ /**
75
+ * Get a single meeting by ID.
76
+ *
77
+ * @param id - Meeting ID
78
+ * @returns The requested meeting
79
+ *
80
+ * @throws {AuthenticationError} If the API key is invalid or expired
81
+ * @throws {NotFoundError} If the meeting does not exist
82
+ * @throws {NetworkError} If unable to reach the API
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * const meeting = await attrove.meetings.get('meeting-id');
87
+ * console.log(meeting.title, meeting.summary);
88
+ * ```
89
+ */
90
+ async get(id) {
91
+ return this.http.get(`/v1/users/${this.userId}/meetings/${id}`);
92
+ }
93
+ /**
94
+ * Update a meeting's summary and action items.
95
+ *
96
+ * @param id - Meeting ID
97
+ * @param options - Fields to update (summary, shortSummary, actionItems)
98
+ * @returns The updated meeting
99
+ *
100
+ * @throws {ValidationError} If id is empty or no fields are provided (client-side), or if the server rejects the update parameters
101
+ * @throws {AuthenticationError} If the API key is invalid or expired
102
+ * @throws {NotFoundError} If the meeting does not exist
103
+ * @throws {ServerError} If the server encounters an internal error
104
+ * @throws {TimeoutError} If the request times out
105
+ * @throws {RateLimitError} If the API rate limit is exceeded
106
+ * @throws {NetworkError} If unable to reach the API
107
+ *
108
+ * @example
109
+ * ```ts
110
+ * const updated = await attrove.meetings.update('meeting-id', {
111
+ * summary: 'Revised summary of the meeting.',
112
+ * actionItems: [
113
+ * { description: 'Follow up with client', assignee: 'Alice' },
114
+ * ],
115
+ * });
116
+ * ```
117
+ */
118
+ async update(id, options) {
119
+ if (!id) {
120
+ throw new index_js_1.ValidationError("id is required and must be a non-empty string");
121
+ }
122
+ if (options.summary == null &&
123
+ options.shortSummary == null &&
124
+ options.actionItems == null) {
125
+ throw new index_js_1.ValidationError("At least one field (summary, shortSummary, or actionItems) must be provided");
126
+ }
127
+ const body = {};
128
+ if (options.summary != null) {
129
+ body.summary = options.summary;
130
+ }
131
+ if (options.shortSummary != null) {
132
+ body.short_summary = options.shortSummary;
133
+ }
134
+ if (options.actionItems != null) {
135
+ body.action_items = options.actionItems;
136
+ }
137
+ return this.http.patch(`/v1/users/${this.userId}/meetings/${id}`, body);
138
+ }
139
+ /**
140
+ * Regenerate the AI summary for a meeting from its transcript.
141
+ *
142
+ * Triggers server-side AI processing and may take longer than typical
143
+ * API calls. The response contains the newly generated summary without
144
+ * the full meeting object.
145
+ *
146
+ * @param id - Meeting ID
147
+ * @returns The regenerated summary, short summary, and action items
148
+ *
149
+ * @throws {ValidationError} If id is empty (client-side)
150
+ * @throws {AuthenticationError} If the API key is invalid or expired
151
+ * @throws {NotFoundError} If the meeting does not exist
152
+ * @throws {ServerError} If the server encounters an internal error
153
+ * @throws {TimeoutError} If the request times out
154
+ * @throws {RateLimitError} If the API rate limit is exceeded
155
+ * @throws {NetworkError} If unable to reach the API
156
+ *
157
+ * @example
158
+ * ```ts
159
+ * const result = await attrove.meetings.regenerateSummary('meeting-id');
160
+ * console.log(result.summary);
161
+ * console.log(`Action items: ${result.action_items.length}`);
162
+ * ```
163
+ */
164
+ async regenerateSummary(id) {
165
+ if (!id) {
166
+ throw new index_js_1.ValidationError("id is required and must be a non-empty string");
167
+ }
168
+ return this.http.post(`/v1/users/${this.userId}/meetings/${id}/regenerate-summary`);
169
+ }
170
+ }
171
+ exports.MeetingsResource = MeetingsResource;