@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.js CHANGED
@@ -420,6 +420,69 @@ var Events = class {
420
420
  }
421
421
  };
422
422
 
423
+ // src/mail/mailboxes.ts
424
+ var Mailboxes = class {
425
+ constructor(http) {
426
+ this.http = http;
427
+ }
428
+ /**
429
+ * Create a new mailbox
430
+ */
431
+ async create(request) {
432
+ return this.http.post("/mail/mailboxes", request);
433
+ }
434
+ /**
435
+ * Get a mailbox by ID
436
+ */
437
+ async get(id) {
438
+ return this.http.get(`/mail/mailboxes/${id}`);
439
+ }
440
+ /**
441
+ * List mailboxes with optional filters
442
+ */
443
+ async list(request) {
444
+ const params = new URLSearchParams();
445
+ if (request?.projectSlug) params.set("projectSlug", request.projectSlug);
446
+ if (request?.environment) params.set("environment", request.environment);
447
+ if (request?.domain) params.set("domain", request.domain);
448
+ if (request?.status) params.set("status", request.status);
449
+ if (request?.limit) params.set("limit", String(request.limit));
450
+ if (request?.cursor) params.set("cursor", request.cursor);
451
+ const qs = params.toString();
452
+ return this.http.get(`/mail/mailboxes${qs ? `?${qs}` : ""}`);
453
+ }
454
+ /**
455
+ * Update a mailbox
456
+ */
457
+ async update(request) {
458
+ const { id, ...data } = request;
459
+ return this.http.patch(`/mail/mailboxes/${id}`, data);
460
+ }
461
+ /**
462
+ * Delete a mailbox
463
+ */
464
+ async delete(id) {
465
+ return this.http.delete(`/mail/mailboxes/${id}`);
466
+ }
467
+ /**
468
+ * List inbound messages across mailboxes
469
+ */
470
+ async listMessages(request) {
471
+ const params = new URLSearchParams();
472
+ if (request?.mailboxId) params.set("mailboxId", request.mailboxId);
473
+ if (request?.limit) params.set("limit", String(request.limit));
474
+ if (request?.cursor) params.set("cursor", request.cursor);
475
+ const qs = params.toString();
476
+ return this.http.get(`/mail/mailboxes/messages${qs ? `?${qs}` : ""}`);
477
+ }
478
+ /**
479
+ * Get an inbound message by ID
480
+ */
481
+ async getMessage(id) {
482
+ return this.http.get(`/mail/mailboxes/messages/${id}`);
483
+ }
484
+ };
485
+
423
486
  // src/mail/sequences.ts
424
487
  var Sequences = class {
425
488
  constructor(http) {
@@ -702,6 +765,8 @@ var Mail = class {
702
765
  sequences;
703
766
  /** Track and manage custom events */
704
767
  events;
768
+ /** Manage agent mailboxes */
769
+ mailboxes;
705
770
  constructor(config) {
706
771
  this.http = new HttpClient(config);
707
772
  this.domains = new Domains(this.http);
@@ -711,6 +776,7 @@ var Mail = class {
711
776
  this.campaigns = new Campaigns(this.http);
712
777
  this.sequences = new Sequences(this.http);
713
778
  this.events = new Events(this.http);
779
+ this.mailboxes = new Mailboxes(this.http);
714
780
  }
715
781
  // ============================================================================
716
782
  // TRANSACTIONAL EMAILS
@@ -3826,18 +3892,104 @@ var Productivity = class {
3826
3892
  return this.http.delete(`/integrations/productivity/tables/${tableId}/rows/${rowId}?connectionId=${connectionId}`);
3827
3893
  }
3828
3894
  };
3895
+ var CalendarClient = class {
3896
+ http;
3897
+ constructor(http) {
3898
+ this.http = http;
3899
+ }
3900
+ async listCalendars(connectionId, options) {
3901
+ const params = new URLSearchParams({ connectionId });
3902
+ if (options?.cursor) params.set("cursor", options.cursor);
3903
+ if (options?.limit) params.set("limit", String(options.limit));
3904
+ return this.http.get(`/integrations/calendar/calendars?${params}`);
3905
+ }
3906
+ async listEvents(connectionId, calendarId, options) {
3907
+ const params = new URLSearchParams({ connectionId, calendarId });
3908
+ if (options?.cursor) params.set("cursor", options.cursor);
3909
+ if (options?.limit) params.set("limit", String(options.limit));
3910
+ if (options?.timeMin) params.set("timeMin", options.timeMin.toISOString());
3911
+ if (options?.timeMax) params.set("timeMax", options.timeMax.toISOString());
3912
+ if (options?.query) params.set("query", options.query);
3913
+ return this.http.get(`/integrations/calendar/events?${params}`);
3914
+ }
3915
+ async getEvent(connectionId, calendarId, eventId) {
3916
+ return this.http.get(
3917
+ `/integrations/calendar/events/${eventId}?connectionId=${connectionId}&calendarId=${calendarId}`
3918
+ );
3919
+ }
3920
+ async createEvent(connectionId, calendarId, data) {
3921
+ return this.http.post("/integrations/calendar/events", { connectionId, calendarId, data });
3922
+ }
3923
+ async updateEvent(connectionId, calendarId, eventId, data) {
3924
+ return this.http.patch(`/integrations/calendar/events/${eventId}`, { connectionId, calendarId, data });
3925
+ }
3926
+ async deleteEvent(connectionId, calendarId, eventId) {
3927
+ return this.http.delete(
3928
+ `/integrations/calendar/events/${eventId}?connectionId=${connectionId}&calendarId=${calendarId}`
3929
+ );
3930
+ }
3931
+ };
3932
+ var Mail2 = class {
3933
+ http;
3934
+ constructor(http) {
3935
+ this.http = http;
3936
+ }
3937
+ async listMessages(connectionId, options) {
3938
+ const params = new URLSearchParams({ connectionId });
3939
+ if (options?.cursor) params.set("cursor", options.cursor);
3940
+ if (options?.limit) params.set("limit", String(options.limit));
3941
+ if (options?.query) params.set("query", options.query);
3942
+ if (options?.labelIds) {
3943
+ for (const labelId of options.labelIds) {
3944
+ params.append("labelIds", labelId);
3945
+ }
3946
+ }
3947
+ return this.http.get(`/integrations/email/messages?${params}`);
3948
+ }
3949
+ async getMessage(connectionId, messageId) {
3950
+ return this.http.get(`/integrations/email/messages/${messageId}?connectionId=${connectionId}`);
3951
+ }
3952
+ async sendMessage(connectionId, data) {
3953
+ return this.http.post("/integrations/email/messages/send", { connectionId, data });
3954
+ }
3955
+ async listThreads(connectionId, options) {
3956
+ const params = new URLSearchParams({ connectionId });
3957
+ if (options?.cursor) params.set("cursor", options.cursor);
3958
+ if (options?.limit) params.set("limit", String(options.limit));
3959
+ if (options?.query) params.set("query", options.query);
3960
+ if (options?.labelIds) {
3961
+ for (const labelId of options.labelIds) {
3962
+ params.append("labelIds", labelId);
3963
+ }
3964
+ }
3965
+ return this.http.get(`/integrations/email/threads?${params}`);
3966
+ }
3967
+ async getThread(connectionId, threadId) {
3968
+ return this.http.get(`/integrations/email/threads/${threadId}?connectionId=${connectionId}`);
3969
+ }
3970
+ async listLabels(connectionId) {
3971
+ const result = await this.http.get(
3972
+ `/integrations/email/labels?connectionId=${connectionId}`
3973
+ );
3974
+ return result.labels;
3975
+ }
3976
+ };
3829
3977
  var Integrations = class {
3830
3978
  http;
3831
3979
  crm;
3832
3980
  storage;
3833
3981
  communication;
3834
3982
  productivity;
3983
+ calendar;
3984
+ mail;
3835
3985
  constructor(config) {
3836
3986
  this.http = new HttpClient(config);
3837
3987
  this.crm = new CRM(this.http);
3838
3988
  this.storage = new Storage(this.http);
3839
3989
  this.communication = new Communication(this.http);
3840
3990
  this.productivity = new Productivity(this.http);
3991
+ this.calendar = new CalendarClient(this.http);
3992
+ this.mail = new Mail2(this.http);
3841
3993
  }
3842
3994
  // ============================================================================
3843
3995
  // CONNECTORS
@@ -3875,6 +4027,7 @@ var Integrations = class {
3875
4027
  if (request?.environment) params.set("environment", request.environment);
3876
4028
  if (request?.connectorSlug) params.set("connectorSlug", request.connectorSlug);
3877
4029
  if (request?.status) params.set("status", request.status);
4030
+ if (request?.endUserId) params.set("endUserId", request.endUserId);
3878
4031
  if (request?.limit) params.set("limit", request.limit.toString());
3879
4032
  const queryString = params.toString();
3880
4033
  const response = await this.http.get(
@@ -3908,6 +4061,22 @@ var Integrations = class {
3908
4061
  async initiateOAuth(request) {
3909
4062
  return this.http.post("/integrations/connections/oauth/initiate", request);
3910
4063
  }
4064
+ /**
4065
+ * Create a connection session for an end user
4066
+ *
4067
+ * @example
4068
+ * ```typescript
4069
+ * const { authUrl, sessionId } = await integrations.createConnectionSession({
4070
+ * endUserId: 'user_123',
4071
+ * connectorSlug: 'google-calendar',
4072
+ * redirectUrl: 'https://yourapp.com/oauth/callback',
4073
+ * });
4074
+ * // Redirect user to authUrl
4075
+ * ```
4076
+ */
4077
+ async createConnectionSession(request) {
4078
+ return this.http.post("/integrations/connections/session", request);
4079
+ }
3911
4080
  /**
3912
4081
  * Complete OAuth flow with callback data
3913
4082
  *
@@ -5410,6 +5579,7 @@ exports.Events = Events;
5410
5579
  exports.Extraction = Extraction;
5411
5580
  exports.Integrations = Integrations;
5412
5581
  exports.Mail = Mail;
5582
+ exports.Mailboxes = Mailboxes;
5413
5583
  exports.Marketing = Marketing;
5414
5584
  exports.Memory = Memory;
5415
5585
  exports.MemoryAgents = MemoryAgents;