@stack0/sdk 0.5.9 → 0.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -416,6 +416,69 @@ var Events = class {
416
416
  }
417
417
  };
418
418
 
419
+ // src/mail/mailboxes.ts
420
+ var Mailboxes = class {
421
+ constructor(http) {
422
+ this.http = http;
423
+ }
424
+ /**
425
+ * Create a new mailbox
426
+ */
427
+ async create(request) {
428
+ return this.http.post("/mail/mailboxes", request);
429
+ }
430
+ /**
431
+ * Get a mailbox by ID
432
+ */
433
+ async get(id) {
434
+ return this.http.get(`/mail/mailboxes/${id}`);
435
+ }
436
+ /**
437
+ * List mailboxes with optional filters
438
+ */
439
+ async list(request) {
440
+ const params = new URLSearchParams();
441
+ if (request?.projectSlug) params.set("projectSlug", request.projectSlug);
442
+ if (request?.environment) params.set("environment", request.environment);
443
+ if (request?.domain) params.set("domain", request.domain);
444
+ if (request?.status) params.set("status", request.status);
445
+ if (request?.limit) params.set("limit", String(request.limit));
446
+ if (request?.cursor) params.set("cursor", request.cursor);
447
+ const qs = params.toString();
448
+ return this.http.get(`/mail/mailboxes${qs ? `?${qs}` : ""}`);
449
+ }
450
+ /**
451
+ * Update a mailbox
452
+ */
453
+ async update(request) {
454
+ const { id, ...data } = request;
455
+ return this.http.patch(`/mail/mailboxes/${id}`, data);
456
+ }
457
+ /**
458
+ * Delete a mailbox
459
+ */
460
+ async delete(id) {
461
+ return this.http.delete(`/mail/mailboxes/${id}`);
462
+ }
463
+ /**
464
+ * List inbound messages across mailboxes
465
+ */
466
+ async listMessages(request) {
467
+ const params = new URLSearchParams();
468
+ if (request?.mailboxId) params.set("mailboxId", request.mailboxId);
469
+ if (request?.limit) params.set("limit", String(request.limit));
470
+ if (request?.cursor) params.set("cursor", request.cursor);
471
+ const qs = params.toString();
472
+ return this.http.get(`/mail/mailboxes/messages${qs ? `?${qs}` : ""}`);
473
+ }
474
+ /**
475
+ * Get an inbound message by ID
476
+ */
477
+ async getMessage(id) {
478
+ return this.http.get(`/mail/mailboxes/messages/${id}`);
479
+ }
480
+ };
481
+
419
482
  // src/mail/sequences.ts
420
483
  var Sequences = class {
421
484
  constructor(http) {
@@ -698,6 +761,8 @@ var Mail = class {
698
761
  sequences;
699
762
  /** Track and manage custom events */
700
763
  events;
764
+ /** Manage agent mailboxes */
765
+ mailboxes;
701
766
  constructor(config) {
702
767
  this.http = new HttpClient(config);
703
768
  this.domains = new Domains(this.http);
@@ -707,6 +772,7 @@ var Mail = class {
707
772
  this.campaigns = new Campaigns(this.http);
708
773
  this.sequences = new Sequences(this.http);
709
774
  this.events = new Events(this.http);
775
+ this.mailboxes = new Mailboxes(this.http);
710
776
  }
711
777
  // ============================================================================
712
778
  // TRANSACTIONAL EMAILS
@@ -3822,18 +3888,104 @@ var Productivity = class {
3822
3888
  return this.http.delete(`/integrations/productivity/tables/${tableId}/rows/${rowId}?connectionId=${connectionId}`);
3823
3889
  }
3824
3890
  };
3891
+ var CalendarClient = class {
3892
+ http;
3893
+ constructor(http) {
3894
+ this.http = http;
3895
+ }
3896
+ async listCalendars(connectionId, options) {
3897
+ const params = new URLSearchParams({ connectionId });
3898
+ if (options?.cursor) params.set("cursor", options.cursor);
3899
+ if (options?.limit) params.set("limit", String(options.limit));
3900
+ return this.http.get(`/integrations/calendar/calendars?${params}`);
3901
+ }
3902
+ async listEvents(connectionId, calendarId, options) {
3903
+ const params = new URLSearchParams({ connectionId, calendarId });
3904
+ if (options?.cursor) params.set("cursor", options.cursor);
3905
+ if (options?.limit) params.set("limit", String(options.limit));
3906
+ if (options?.timeMin) params.set("timeMin", options.timeMin.toISOString());
3907
+ if (options?.timeMax) params.set("timeMax", options.timeMax.toISOString());
3908
+ if (options?.query) params.set("query", options.query);
3909
+ return this.http.get(`/integrations/calendar/events?${params}`);
3910
+ }
3911
+ async getEvent(connectionId, calendarId, eventId) {
3912
+ return this.http.get(
3913
+ `/integrations/calendar/events/${eventId}?connectionId=${connectionId}&calendarId=${calendarId}`
3914
+ );
3915
+ }
3916
+ async createEvent(connectionId, calendarId, data) {
3917
+ return this.http.post("/integrations/calendar/events", { connectionId, calendarId, data });
3918
+ }
3919
+ async updateEvent(connectionId, calendarId, eventId, data) {
3920
+ return this.http.patch(`/integrations/calendar/events/${eventId}`, { connectionId, calendarId, data });
3921
+ }
3922
+ async deleteEvent(connectionId, calendarId, eventId) {
3923
+ return this.http.delete(
3924
+ `/integrations/calendar/events/${eventId}?connectionId=${connectionId}&calendarId=${calendarId}`
3925
+ );
3926
+ }
3927
+ };
3928
+ var Mail2 = class {
3929
+ http;
3930
+ constructor(http) {
3931
+ this.http = http;
3932
+ }
3933
+ async listMessages(connectionId, options) {
3934
+ const params = new URLSearchParams({ connectionId });
3935
+ if (options?.cursor) params.set("cursor", options.cursor);
3936
+ if (options?.limit) params.set("limit", String(options.limit));
3937
+ if (options?.query) params.set("query", options.query);
3938
+ if (options?.labelIds) {
3939
+ for (const labelId of options.labelIds) {
3940
+ params.append("labelIds", labelId);
3941
+ }
3942
+ }
3943
+ return this.http.get(`/integrations/email/messages?${params}`);
3944
+ }
3945
+ async getMessage(connectionId, messageId) {
3946
+ return this.http.get(`/integrations/email/messages/${messageId}?connectionId=${connectionId}`);
3947
+ }
3948
+ async sendMessage(connectionId, data) {
3949
+ return this.http.post("/integrations/email/messages/send", { connectionId, data });
3950
+ }
3951
+ async listThreads(connectionId, options) {
3952
+ const params = new URLSearchParams({ connectionId });
3953
+ if (options?.cursor) params.set("cursor", options.cursor);
3954
+ if (options?.limit) params.set("limit", String(options.limit));
3955
+ if (options?.query) params.set("query", options.query);
3956
+ if (options?.labelIds) {
3957
+ for (const labelId of options.labelIds) {
3958
+ params.append("labelIds", labelId);
3959
+ }
3960
+ }
3961
+ return this.http.get(`/integrations/email/threads?${params}`);
3962
+ }
3963
+ async getThread(connectionId, threadId) {
3964
+ return this.http.get(`/integrations/email/threads/${threadId}?connectionId=${connectionId}`);
3965
+ }
3966
+ async listLabels(connectionId) {
3967
+ const result = await this.http.get(
3968
+ `/integrations/email/labels?connectionId=${connectionId}`
3969
+ );
3970
+ return result.labels;
3971
+ }
3972
+ };
3825
3973
  var Integrations = class {
3826
3974
  http;
3827
3975
  crm;
3828
3976
  storage;
3829
3977
  communication;
3830
3978
  productivity;
3979
+ calendar;
3980
+ mail;
3831
3981
  constructor(config) {
3832
3982
  this.http = new HttpClient(config);
3833
3983
  this.crm = new CRM(this.http);
3834
3984
  this.storage = new Storage(this.http);
3835
3985
  this.communication = new Communication(this.http);
3836
3986
  this.productivity = new Productivity(this.http);
3987
+ this.calendar = new CalendarClient(this.http);
3988
+ this.mail = new Mail2(this.http);
3837
3989
  }
3838
3990
  // ============================================================================
3839
3991
  // CONNECTORS
@@ -3871,6 +4023,7 @@ var Integrations = class {
3871
4023
  if (request?.environment) params.set("environment", request.environment);
3872
4024
  if (request?.connectorSlug) params.set("connectorSlug", request.connectorSlug);
3873
4025
  if (request?.status) params.set("status", request.status);
4026
+ if (request?.endUserId) params.set("endUserId", request.endUserId);
3874
4027
  if (request?.limit) params.set("limit", request.limit.toString());
3875
4028
  const queryString = params.toString();
3876
4029
  const response = await this.http.get(
@@ -3904,6 +4057,22 @@ var Integrations = class {
3904
4057
  async initiateOAuth(request) {
3905
4058
  return this.http.post("/integrations/connections/oauth/initiate", request);
3906
4059
  }
4060
+ /**
4061
+ * Create a connection session for an end user
4062
+ *
4063
+ * @example
4064
+ * ```typescript
4065
+ * const { authUrl, sessionId } = await integrations.createConnectionSession({
4066
+ * endUserId: 'user_123',
4067
+ * connectorSlug: 'google-calendar',
4068
+ * redirectUrl: 'https://yourapp.com/oauth/callback',
4069
+ * });
4070
+ * // Redirect user to authUrl
4071
+ * ```
4072
+ */
4073
+ async createConnectionSession(request) {
4074
+ return this.http.post("/integrations/connections/session", request);
4075
+ }
3907
4076
  /**
3908
4077
  * Complete OAuth flow with callback data
3909
4078
  *
@@ -5397,6 +5566,6 @@ var Stack0 = class {
5397
5566
  };
5398
5567
  var src_default = Stack0;
5399
5568
 
5400
- export { Audiences, CDN, Campaigns, Contacts, Domains, Events, Extraction, Integrations, Mail, Marketing, Memory, MemoryAgents, MemoryCollections, MemoryEntities, Screenshots, Sequences, Stack0, Templates, Webdata, Workflows, src_default as default };
5569
+ export { Audiences, CDN, Campaigns, Contacts, Domains, Events, Extraction, Integrations, Mail, Mailboxes, Marketing, Memory, MemoryAgents, MemoryCollections, MemoryEntities, Screenshots, Sequences, Stack0, Templates, Webdata, Workflows, src_default as default };
5401
5570
  //# sourceMappingURL=index.mjs.map
5402
5571
  //# sourceMappingURL=index.mjs.map