@heymantle/core-api-client 0.1.25 → 0.1.27

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
@@ -53,6 +53,7 @@ __export(index_exports, {
53
53
  MiddlewareManager: () => MiddlewareManager,
54
54
  OrganizationResource: () => OrganizationResource,
55
55
  SubscriptionsResource: () => SubscriptionsResource,
56
+ SyncedEmailsResource: () => SyncedEmailsResource,
56
57
  TasksResource: () => TasksResource,
57
58
  TicketsResource: () => TicketsResource,
58
59
  TransactionsResource: () => TransactionsResource,
@@ -2645,6 +2646,220 @@ var MeetingsResource = class extends BaseResource {
2645
2646
  `/meetings/${meetingId}/recording-url`
2646
2647
  );
2647
2648
  }
2649
+ /**
2650
+ * Accept an AI-generated task suggestion
2651
+ *
2652
+ * Creates a real Task from the suggestion. Optional overrides allow
2653
+ * modifying the title, description, priority, due date, or assignee
2654
+ * before creating the task.
2655
+ *
2656
+ * @param meetingId - The meeting ID
2657
+ * @param suggestionId - The task suggestion ID
2658
+ * @param overrides - Optional fields to override on the created task
2659
+ * @returns The created task and updated suggestion
2660
+ *
2661
+ * @example
2662
+ * ```typescript
2663
+ * // Accept a suggestion as-is
2664
+ * const { task, suggestion } = await client.meetings.acceptTaskSuggestion(
2665
+ * 'meeting_123',
2666
+ * 'suggestion_456'
2667
+ * );
2668
+ *
2669
+ * // Accept with overrides
2670
+ * const { task } = await client.meetings.acceptTaskSuggestion(
2671
+ * 'meeting_123',
2672
+ * 'suggestion_456',
2673
+ * { title: 'Custom title', priority: 'high' }
2674
+ * );
2675
+ * ```
2676
+ */
2677
+ async acceptTaskSuggestion(meetingId, suggestionId, overrides) {
2678
+ return this.post(
2679
+ `/meetings/${meetingId}/task-suggestions/${suggestionId}/accept`,
2680
+ overrides || {}
2681
+ );
2682
+ }
2683
+ /**
2684
+ * Dismiss an AI-generated task suggestion
2685
+ *
2686
+ * Marks the suggestion as dismissed so it no longer appears as pending.
2687
+ *
2688
+ * @param meetingId - The meeting ID
2689
+ * @param suggestionId - The task suggestion ID
2690
+ * @returns Success response
2691
+ *
2692
+ * @example
2693
+ * ```typescript
2694
+ * await client.meetings.dismissTaskSuggestion('meeting_123', 'suggestion_456');
2695
+ * ```
2696
+ */
2697
+ async dismissTaskSuggestion(meetingId, suggestionId) {
2698
+ return this.post(
2699
+ `/meetings/${meetingId}/task-suggestions/${suggestionId}/dismiss`
2700
+ );
2701
+ }
2702
+ };
2703
+
2704
+ // src/resources/synced-emails.ts
2705
+ var SyncedEmailsResource = class extends BaseResource {
2706
+ /**
2707
+ * List synced email threads with optional filters and pagination
2708
+ *
2709
+ * @param params - Filter and pagination parameters
2710
+ * @returns Paginated list of synced email threads
2711
+ *
2712
+ * @example
2713
+ * ```typescript
2714
+ * // List all synced emails
2715
+ * const { syncedEmails } = await client.syncedEmails.list();
2716
+ *
2717
+ * // List synced emails for a specific customer
2718
+ * const { syncedEmails } = await client.syncedEmails.list({ customerId: 'cust_123' });
2719
+ *
2720
+ * // List Gmail synced emails
2721
+ * const { syncedEmails } = await client.syncedEmails.list({ source: 'gmail' });
2722
+ * ```
2723
+ */
2724
+ async list(params) {
2725
+ const response = await this.get("/synced_emails", params);
2726
+ return {
2727
+ syncedEmails: response.syncedEmails || [],
2728
+ hasNextPage: response.hasNextPage || false,
2729
+ hasPreviousPage: response.hasPreviousPage || false,
2730
+ total: response.total,
2731
+ page: response.page,
2732
+ totalPages: response.totalPages
2733
+ };
2734
+ }
2735
+ /**
2736
+ * Retrieve a single synced email thread by ID with all messages
2737
+ *
2738
+ * @param syncedEmailId - The synced email thread ID
2739
+ * @returns The synced email with all messages
2740
+ *
2741
+ * @example
2742
+ * ```typescript
2743
+ * const syncedEmail = await client.syncedEmails.retrieve('se_123');
2744
+ * console.log(syncedEmail.messages?.length);
2745
+ * ```
2746
+ */
2747
+ async retrieve(syncedEmailId) {
2748
+ return this.get(`/synced_emails/${syncedEmailId}`);
2749
+ }
2750
+ /**
2751
+ * Create or sync a synced email thread
2752
+ *
2753
+ * If `emailData.externalId` is provided, performs an upsert: updates the
2754
+ * existing thread and adds new messages if a thread with that externalId
2755
+ * already exists. Otherwise creates a new thread.
2756
+ *
2757
+ * @param data - Email thread and messages data
2758
+ * @returns The created or updated synced email thread
2759
+ *
2760
+ * @example
2761
+ * ```typescript
2762
+ * // Create a new thread (or upsert if externalId matches)
2763
+ * const syncedEmail = await client.syncedEmails.create({
2764
+ * emailData: {
2765
+ * externalId: 'gmail-thread-123',
2766
+ * subject: 'Sales Discussion',
2767
+ * source: 'gmail',
2768
+ * },
2769
+ * messages: [
2770
+ * {
2771
+ * externalId: 'msg-1',
2772
+ * fromEmail: 'prospect@example.com',
2773
+ * subject: 'Sales Discussion',
2774
+ * bodyText: 'Interested in your product...',
2775
+ * date: new Date().toISOString(),
2776
+ * isInbound: true,
2777
+ * },
2778
+ * ],
2779
+ * });
2780
+ * ```
2781
+ */
2782
+ async create(data) {
2783
+ return this.post("/synced_emails", data);
2784
+ }
2785
+ /**
2786
+ * Update synced email thread metadata
2787
+ *
2788
+ * @param syncedEmailId - The synced email thread ID
2789
+ * @param data - Fields to update
2790
+ * @returns The updated synced email thread
2791
+ *
2792
+ * @example
2793
+ * ```typescript
2794
+ * // Link email to a deal
2795
+ * const syncedEmail = await client.syncedEmails.update('se_123', {
2796
+ * dealId: 'deal_456',
2797
+ * });
2798
+ * ```
2799
+ */
2800
+ async update(syncedEmailId, data) {
2801
+ return this.put(`/synced_emails/${syncedEmailId}`, data);
2802
+ }
2803
+ /**
2804
+ * Archive (soft delete) a synced email thread
2805
+ *
2806
+ * @param syncedEmailId - The synced email thread ID
2807
+ * @returns Success response
2808
+ *
2809
+ * @example
2810
+ * ```typescript
2811
+ * await client.syncedEmails.del('se_123');
2812
+ * ```
2813
+ */
2814
+ async del(syncedEmailId) {
2815
+ return this._delete(`/synced_emails/${syncedEmailId}`);
2816
+ }
2817
+ /**
2818
+ * Add messages to an existing synced email thread
2819
+ *
2820
+ * @param syncedEmailId - The synced email thread ID
2821
+ * @param data - Messages to add
2822
+ * @returns The synced email thread with all messages
2823
+ *
2824
+ * @example
2825
+ * ```typescript
2826
+ * const syncedEmail = await client.syncedEmails.addMessages('se_123', {
2827
+ * messages: [
2828
+ * {
2829
+ * externalId: 'msg-2',
2830
+ * fromEmail: 'you@company.com',
2831
+ * toEmails: ['prospect@example.com'],
2832
+ * subject: 'Re: Sales Discussion',
2833
+ * bodyText: 'Thanks for your interest...',
2834
+ * date: new Date().toISOString(),
2835
+ * isInbound: false,
2836
+ * },
2837
+ * ],
2838
+ * });
2839
+ * ```
2840
+ */
2841
+ async addMessages(syncedEmailId, data) {
2842
+ return this.post(
2843
+ `/synced_emails/${syncedEmailId}/messages`,
2844
+ data
2845
+ );
2846
+ }
2847
+ /**
2848
+ * Get messages for a synced email thread
2849
+ *
2850
+ * @param syncedEmailId - The synced email thread ID
2851
+ * @returns List of messages in the thread
2852
+ *
2853
+ * @example
2854
+ * ```typescript
2855
+ * const { messages } = await client.syncedEmails.getMessages('se_123');
2856
+ * ```
2857
+ */
2858
+ async getMessages(syncedEmailId) {
2859
+ return this.get(
2860
+ `/synced_emails/${syncedEmailId}/messages`
2861
+ );
2862
+ }
2648
2863
  };
2649
2864
 
2650
2865
  // src/client.ts
@@ -2706,6 +2921,7 @@ var MantleCoreClient = class {
2706
2921
  this.flowExtensions = new FlowExtensionsResource(this);
2707
2922
  this.aiAgentRuns = new AiAgentRunsResource(this);
2708
2923
  this.meetings = new MeetingsResource(this);
2924
+ this.syncedEmails = new SyncedEmailsResource(this);
2709
2925
  }
2710
2926
  /**
2711
2927
  * Register a middleware function
@@ -3147,6 +3363,7 @@ function createRateLimitMiddleware(options = {}) {
3147
3363
  MiddlewareManager,
3148
3364
  OrganizationResource,
3149
3365
  SubscriptionsResource,
3366
+ SyncedEmailsResource,
3150
3367
  TasksResource,
3151
3368
  TicketsResource,
3152
3369
  TransactionsResource,
package/dist/index.mjs CHANGED
@@ -2579,6 +2579,220 @@ var MeetingsResource = class extends BaseResource {
2579
2579
  `/meetings/${meetingId}/recording-url`
2580
2580
  );
2581
2581
  }
2582
+ /**
2583
+ * Accept an AI-generated task suggestion
2584
+ *
2585
+ * Creates a real Task from the suggestion. Optional overrides allow
2586
+ * modifying the title, description, priority, due date, or assignee
2587
+ * before creating the task.
2588
+ *
2589
+ * @param meetingId - The meeting ID
2590
+ * @param suggestionId - The task suggestion ID
2591
+ * @param overrides - Optional fields to override on the created task
2592
+ * @returns The created task and updated suggestion
2593
+ *
2594
+ * @example
2595
+ * ```typescript
2596
+ * // Accept a suggestion as-is
2597
+ * const { task, suggestion } = await client.meetings.acceptTaskSuggestion(
2598
+ * 'meeting_123',
2599
+ * 'suggestion_456'
2600
+ * );
2601
+ *
2602
+ * // Accept with overrides
2603
+ * const { task } = await client.meetings.acceptTaskSuggestion(
2604
+ * 'meeting_123',
2605
+ * 'suggestion_456',
2606
+ * { title: 'Custom title', priority: 'high' }
2607
+ * );
2608
+ * ```
2609
+ */
2610
+ async acceptTaskSuggestion(meetingId, suggestionId, overrides) {
2611
+ return this.post(
2612
+ `/meetings/${meetingId}/task-suggestions/${suggestionId}/accept`,
2613
+ overrides || {}
2614
+ );
2615
+ }
2616
+ /**
2617
+ * Dismiss an AI-generated task suggestion
2618
+ *
2619
+ * Marks the suggestion as dismissed so it no longer appears as pending.
2620
+ *
2621
+ * @param meetingId - The meeting ID
2622
+ * @param suggestionId - The task suggestion ID
2623
+ * @returns Success response
2624
+ *
2625
+ * @example
2626
+ * ```typescript
2627
+ * await client.meetings.dismissTaskSuggestion('meeting_123', 'suggestion_456');
2628
+ * ```
2629
+ */
2630
+ async dismissTaskSuggestion(meetingId, suggestionId) {
2631
+ return this.post(
2632
+ `/meetings/${meetingId}/task-suggestions/${suggestionId}/dismiss`
2633
+ );
2634
+ }
2635
+ };
2636
+
2637
+ // src/resources/synced-emails.ts
2638
+ var SyncedEmailsResource = class extends BaseResource {
2639
+ /**
2640
+ * List synced email threads with optional filters and pagination
2641
+ *
2642
+ * @param params - Filter and pagination parameters
2643
+ * @returns Paginated list of synced email threads
2644
+ *
2645
+ * @example
2646
+ * ```typescript
2647
+ * // List all synced emails
2648
+ * const { syncedEmails } = await client.syncedEmails.list();
2649
+ *
2650
+ * // List synced emails for a specific customer
2651
+ * const { syncedEmails } = await client.syncedEmails.list({ customerId: 'cust_123' });
2652
+ *
2653
+ * // List Gmail synced emails
2654
+ * const { syncedEmails } = await client.syncedEmails.list({ source: 'gmail' });
2655
+ * ```
2656
+ */
2657
+ async list(params) {
2658
+ const response = await this.get("/synced_emails", params);
2659
+ return {
2660
+ syncedEmails: response.syncedEmails || [],
2661
+ hasNextPage: response.hasNextPage || false,
2662
+ hasPreviousPage: response.hasPreviousPage || false,
2663
+ total: response.total,
2664
+ page: response.page,
2665
+ totalPages: response.totalPages
2666
+ };
2667
+ }
2668
+ /**
2669
+ * Retrieve a single synced email thread by ID with all messages
2670
+ *
2671
+ * @param syncedEmailId - The synced email thread ID
2672
+ * @returns The synced email with all messages
2673
+ *
2674
+ * @example
2675
+ * ```typescript
2676
+ * const syncedEmail = await client.syncedEmails.retrieve('se_123');
2677
+ * console.log(syncedEmail.messages?.length);
2678
+ * ```
2679
+ */
2680
+ async retrieve(syncedEmailId) {
2681
+ return this.get(`/synced_emails/${syncedEmailId}`);
2682
+ }
2683
+ /**
2684
+ * Create or sync a synced email thread
2685
+ *
2686
+ * If `emailData.externalId` is provided, performs an upsert: updates the
2687
+ * existing thread and adds new messages if a thread with that externalId
2688
+ * already exists. Otherwise creates a new thread.
2689
+ *
2690
+ * @param data - Email thread and messages data
2691
+ * @returns The created or updated synced email thread
2692
+ *
2693
+ * @example
2694
+ * ```typescript
2695
+ * // Create a new thread (or upsert if externalId matches)
2696
+ * const syncedEmail = await client.syncedEmails.create({
2697
+ * emailData: {
2698
+ * externalId: 'gmail-thread-123',
2699
+ * subject: 'Sales Discussion',
2700
+ * source: 'gmail',
2701
+ * },
2702
+ * messages: [
2703
+ * {
2704
+ * externalId: 'msg-1',
2705
+ * fromEmail: 'prospect@example.com',
2706
+ * subject: 'Sales Discussion',
2707
+ * bodyText: 'Interested in your product...',
2708
+ * date: new Date().toISOString(),
2709
+ * isInbound: true,
2710
+ * },
2711
+ * ],
2712
+ * });
2713
+ * ```
2714
+ */
2715
+ async create(data) {
2716
+ return this.post("/synced_emails", data);
2717
+ }
2718
+ /**
2719
+ * Update synced email thread metadata
2720
+ *
2721
+ * @param syncedEmailId - The synced email thread ID
2722
+ * @param data - Fields to update
2723
+ * @returns The updated synced email thread
2724
+ *
2725
+ * @example
2726
+ * ```typescript
2727
+ * // Link email to a deal
2728
+ * const syncedEmail = await client.syncedEmails.update('se_123', {
2729
+ * dealId: 'deal_456',
2730
+ * });
2731
+ * ```
2732
+ */
2733
+ async update(syncedEmailId, data) {
2734
+ return this.put(`/synced_emails/${syncedEmailId}`, data);
2735
+ }
2736
+ /**
2737
+ * Archive (soft delete) a synced email thread
2738
+ *
2739
+ * @param syncedEmailId - The synced email thread ID
2740
+ * @returns Success response
2741
+ *
2742
+ * @example
2743
+ * ```typescript
2744
+ * await client.syncedEmails.del('se_123');
2745
+ * ```
2746
+ */
2747
+ async del(syncedEmailId) {
2748
+ return this._delete(`/synced_emails/${syncedEmailId}`);
2749
+ }
2750
+ /**
2751
+ * Add messages to an existing synced email thread
2752
+ *
2753
+ * @param syncedEmailId - The synced email thread ID
2754
+ * @param data - Messages to add
2755
+ * @returns The synced email thread with all messages
2756
+ *
2757
+ * @example
2758
+ * ```typescript
2759
+ * const syncedEmail = await client.syncedEmails.addMessages('se_123', {
2760
+ * messages: [
2761
+ * {
2762
+ * externalId: 'msg-2',
2763
+ * fromEmail: 'you@company.com',
2764
+ * toEmails: ['prospect@example.com'],
2765
+ * subject: 'Re: Sales Discussion',
2766
+ * bodyText: 'Thanks for your interest...',
2767
+ * date: new Date().toISOString(),
2768
+ * isInbound: false,
2769
+ * },
2770
+ * ],
2771
+ * });
2772
+ * ```
2773
+ */
2774
+ async addMessages(syncedEmailId, data) {
2775
+ return this.post(
2776
+ `/synced_emails/${syncedEmailId}/messages`,
2777
+ data
2778
+ );
2779
+ }
2780
+ /**
2781
+ * Get messages for a synced email thread
2782
+ *
2783
+ * @param syncedEmailId - The synced email thread ID
2784
+ * @returns List of messages in the thread
2785
+ *
2786
+ * @example
2787
+ * ```typescript
2788
+ * const { messages } = await client.syncedEmails.getMessages('se_123');
2789
+ * ```
2790
+ */
2791
+ async getMessages(syncedEmailId) {
2792
+ return this.get(
2793
+ `/synced_emails/${syncedEmailId}/messages`
2794
+ );
2795
+ }
2582
2796
  };
2583
2797
 
2584
2798
  // src/client.ts
@@ -2640,6 +2854,7 @@ var MantleCoreClient = class {
2640
2854
  this.flowExtensions = new FlowExtensionsResource(this);
2641
2855
  this.aiAgentRuns = new AiAgentRunsResource(this);
2642
2856
  this.meetings = new MeetingsResource(this);
2857
+ this.syncedEmails = new SyncedEmailsResource(this);
2643
2858
  }
2644
2859
  /**
2645
2860
  * Register a middleware function
@@ -3080,6 +3295,7 @@ export {
3080
3295
  MiddlewareManager,
3081
3296
  OrganizationResource,
3082
3297
  SubscriptionsResource,
3298
+ SyncedEmailsResource,
3083
3299
  TasksResource,
3084
3300
  TicketsResource,
3085
3301
  TransactionsResource,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heymantle/core-api-client",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "description": "TypeScript SDK for the Mantle Core API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",