@surgeapi/node 0.35.0 → 0.36.0

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 (53) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/client.d.mts +8 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +8 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js +12 -2
  7. package/client.js.map +1 -1
  8. package/client.mjs +12 -2
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/campaigns.d.mts +15 -0
  12. package/resources/campaigns.d.mts.map +1 -1
  13. package/resources/campaigns.d.ts +15 -0
  14. package/resources/campaigns.d.ts.map +1 -1
  15. package/resources/campaigns.js +13 -0
  16. package/resources/campaigns.js.map +1 -1
  17. package/resources/campaigns.mjs +13 -0
  18. package/resources/campaigns.mjs.map +1 -1
  19. package/resources/index.d.mts +2 -1
  20. package/resources/index.d.mts.map +1 -1
  21. package/resources/index.d.ts +2 -1
  22. package/resources/index.d.ts.map +1 -1
  23. package/resources/index.js +3 -1
  24. package/resources/index.js.map +1 -1
  25. package/resources/index.mjs +1 -0
  26. package/resources/index.mjs.map +1 -1
  27. package/resources/messages.d.mts +1 -1
  28. package/resources/messages.d.mts.map +1 -1
  29. package/resources/messages.d.ts +1 -1
  30. package/resources/messages.d.ts.map +1 -1
  31. package/resources/recordings.d.mts +31 -0
  32. package/resources/recordings.d.mts.map +1 -0
  33. package/resources/recordings.d.ts +31 -0
  34. package/resources/recordings.d.ts.map +1 -0
  35. package/resources/recordings.js +24 -0
  36. package/resources/recordings.js.map +1 -0
  37. package/resources/recordings.mjs +20 -0
  38. package/resources/recordings.mjs.map +1 -0
  39. package/resources/webhooks.d.mts +134 -2
  40. package/resources/webhooks.d.mts.map +1 -1
  41. package/resources/webhooks.d.ts +134 -2
  42. package/resources/webhooks.d.ts.map +1 -1
  43. package/src/client.ts +24 -4
  44. package/src/resources/campaigns.ts +19 -0
  45. package/src/resources/index.ts +3 -0
  46. package/src/resources/messages.ts +1 -1
  47. package/src/resources/recordings.ts +38 -0
  48. package/src/resources/webhooks.ts +180 -1
  49. package/src/version.ts +1 -1
  50. package/version.d.mts +1 -1
  51. package/version.d.ts +1 -1
  52. package/version.js +1 -1
  53. package/version.mjs +1 -1
@@ -553,8 +553,140 @@ export declare namespace MessageSentWebhookEvent {
553
553
  }
554
554
  }
555
555
  }
556
- export type UnwrapWebhookEvent = CallEndedWebhookEvent | CampaignApprovedWebhookEvent | ContactOptedInWebhookEvent | ContactOptedOutWebhookEvent | ConversationCreatedWebhookEvent | LinkFollowedWebhookEvent | MessageDeliveredWebhookEvent | MessageFailedWebhookEvent | MessageReceivedWebhookEvent | MessageSentWebhookEvent;
556
+ export interface RecordingCompletedWebhookEvent {
557
+ /**
558
+ * The ID of the account in which this event occurred
559
+ */
560
+ account_id: string;
561
+ /**
562
+ * The data associated with the event
563
+ */
564
+ data: RecordingCompletedWebhookEvent.Data;
565
+ /**
566
+ * The timestamp when this event occurred, in ISO8601 format
567
+ */
568
+ timestamp: string;
569
+ /**
570
+ * The type of the event. Always `recording.completed` for this event.
571
+ */
572
+ type: 'recording.completed';
573
+ }
574
+ export declare namespace RecordingCompletedWebhookEvent {
575
+ /**
576
+ * The data associated with the event
577
+ */
578
+ interface Data {
579
+ /**
580
+ * The unique identifier for the recording
581
+ */
582
+ id: string;
583
+ /**
584
+ * The call that produced this recording
585
+ */
586
+ call: Data.Call;
587
+ /**
588
+ * The duration of the recording in seconds
589
+ */
590
+ duration: number;
591
+ }
592
+ namespace Data {
593
+ /**
594
+ * The call that produced this recording
595
+ */
596
+ interface Call {
597
+ /**
598
+ * The unique identifier for the call
599
+ */
600
+ id: string;
601
+ /**
602
+ * A contact who has consented to receive messages
603
+ */
604
+ contact: ContactsAPI.Contact;
605
+ /**
606
+ * The duration of the call in seconds
607
+ */
608
+ duration: number;
609
+ /**
610
+ * When the call was initiated
611
+ */
612
+ initiated_at: string;
613
+ /**
614
+ * The status of the call
615
+ */
616
+ status: 'busy' | 'canceled' | 'completed' | 'failed' | 'in_progress' | 'missed' | 'no_answer' | 'queued' | 'ringing';
617
+ }
618
+ }
619
+ }
620
+ export interface VoicemailReceivedWebhookEvent {
621
+ /**
622
+ * The ID of the account in which this event occurred
623
+ */
624
+ account_id: string;
625
+ /**
626
+ * The data associated with the event
627
+ */
628
+ data: VoicemailReceivedWebhookEvent.Data;
629
+ /**
630
+ * The timestamp when this event occurred, in ISO8601 format
631
+ */
632
+ timestamp: string;
633
+ /**
634
+ * The type of the event. Always `voicemail.received` for this event.
635
+ */
636
+ type: 'voicemail.received';
637
+ }
638
+ export declare namespace VoicemailReceivedWebhookEvent {
639
+ /**
640
+ * The data associated with the event
641
+ */
642
+ interface Data {
643
+ /**
644
+ * The unique identifier for the voicemail
645
+ */
646
+ id: string;
647
+ /**
648
+ * The call that resulted in this voicemail
649
+ */
650
+ call: Data.Call;
651
+ /**
652
+ * The duration of the voicemail in seconds
653
+ */
654
+ duration: number;
655
+ /**
656
+ * The unique identifier for the recording
657
+ */
658
+ recording_id: string;
659
+ }
660
+ namespace Data {
661
+ /**
662
+ * The call that resulted in this voicemail
663
+ */
664
+ interface Call {
665
+ /**
666
+ * The unique identifier for the call
667
+ */
668
+ id: string;
669
+ /**
670
+ * A contact who has consented to receive messages
671
+ */
672
+ contact: ContactsAPI.Contact;
673
+ /**
674
+ * The duration of the call in seconds
675
+ */
676
+ duration: number;
677
+ /**
678
+ * When the call was initiated
679
+ */
680
+ initiated_at: string;
681
+ /**
682
+ * The status of the call
683
+ */
684
+ status: 'busy' | 'canceled' | 'completed' | 'failed' | 'in_progress' | 'missed' | 'no_answer' | 'queued' | 'ringing';
685
+ }
686
+ }
687
+ }
688
+ export type UnwrapWebhookEvent = CallEndedWebhookEvent | CampaignApprovedWebhookEvent | ContactOptedInWebhookEvent | ContactOptedOutWebhookEvent | ConversationCreatedWebhookEvent | LinkFollowedWebhookEvent | MessageDeliveredWebhookEvent | MessageFailedWebhookEvent | MessageReceivedWebhookEvent | MessageSentWebhookEvent | RecordingCompletedWebhookEvent | VoicemailReceivedWebhookEvent;
557
689
  export declare namespace Webhooks {
558
- export { type CallEndedWebhookEvent as CallEndedWebhookEvent, type CampaignApprovedWebhookEvent as CampaignApprovedWebhookEvent, type ContactOptedInWebhookEvent as ContactOptedInWebhookEvent, type ContactOptedOutWebhookEvent as ContactOptedOutWebhookEvent, type ConversationCreatedWebhookEvent as ConversationCreatedWebhookEvent, type LinkFollowedWebhookEvent as LinkFollowedWebhookEvent, type MessageDeliveredWebhookEvent as MessageDeliveredWebhookEvent, type MessageFailedWebhookEvent as MessageFailedWebhookEvent, type MessageReceivedWebhookEvent as MessageReceivedWebhookEvent, type MessageSentWebhookEvent as MessageSentWebhookEvent, type UnwrapWebhookEvent as UnwrapWebhookEvent, };
690
+ export { type CallEndedWebhookEvent as CallEndedWebhookEvent, type CampaignApprovedWebhookEvent as CampaignApprovedWebhookEvent, type ContactOptedInWebhookEvent as ContactOptedInWebhookEvent, type ContactOptedOutWebhookEvent as ContactOptedOutWebhookEvent, type ConversationCreatedWebhookEvent as ConversationCreatedWebhookEvent, type LinkFollowedWebhookEvent as LinkFollowedWebhookEvent, type MessageDeliveredWebhookEvent as MessageDeliveredWebhookEvent, type MessageFailedWebhookEvent as MessageFailedWebhookEvent, type MessageReceivedWebhookEvent as MessageReceivedWebhookEvent, type MessageSentWebhookEvent as MessageSentWebhookEvent, type RecordingCompletedWebhookEvent as RecordingCompletedWebhookEvent, type VoicemailReceivedWebhookEvent as VoicemailReceivedWebhookEvent, type UnwrapWebhookEvent as UnwrapWebhookEvent, };
559
691
  }
560
692
  //# sourceMappingURL=webhooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,WAAW;OAChB,KAAK,eAAe;AAG3B,qBAAa,QAAS,SAAQ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;YACH,MAAM,EACF,MAAM,GACN,UAAU,GACV,WAAW,GACX,QAAQ,GACR,aAAa,GACb,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,SAAS,CAAC;SACf;KACF;CACF;AAED,MAAM,MAAM,kBAAkB,GAC1B,qBAAqB,GACrB,4BAA4B,GAC5B,0BAA0B,GAC1B,2BAA2B,GAC3B,+BAA+B,GAC/B,wBAAwB,GACxB,4BAA4B,GAC5B,yBAAyB,GACzB,2BAA2B,GAC3B,uBAAuB,GACvB,8BAA8B,GAC9B,6BAA6B,CAAC;AAElC,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,kBAAkB,IAAI,kBAAkB,GAC9C,CAAC;CACH"}
package/src/client.ts CHANGED
@@ -52,6 +52,7 @@ import {
52
52
  PhoneNumbers,
53
53
  PhoneNumbersCursor,
54
54
  } from './resources/phone-numbers';
55
+ import { RecordingGetFileResponse, Recordings } from './resources/recordings';
55
56
  import {
56
57
  User,
57
58
  UserCreateParams,
@@ -78,7 +79,9 @@ import {
78
79
  MessageFailedWebhookEvent,
79
80
  MessageReceivedWebhookEvent,
80
81
  MessageSentWebhookEvent,
82
+ RecordingCompletedWebhookEvent,
81
83
  UnwrapWebhookEvent,
84
+ VoicemailReceivedWebhookEvent,
82
85
  Webhooks,
83
86
  } from './resources/webhooks';
84
87
  import { type Fetch } from './internal/builtin-types';
@@ -544,9 +547,14 @@ export class Surge {
544
547
  getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(
545
548
  path: string,
546
549
  Page: new (...args: any[]) => PageClass,
547
- opts?: RequestOptions,
550
+ opts?: PromiseOrValue<RequestOptions>,
548
551
  ): Pagination.PagePromise<PageClass, Item> {
549
- return this.requestAPIList(Page, { method: 'get', path, ...opts });
552
+ return this.requestAPIList(
553
+ Page,
554
+ opts && 'then' in opts ?
555
+ opts.then((opts) => ({ method: 'get', path, ...opts }))
556
+ : { method: 'get', path, ...opts },
557
+ );
550
558
  }
551
559
 
552
560
  requestAPIList<
@@ -554,7 +562,7 @@ export class Surge {
554
562
  PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>,
555
563
  >(
556
564
  Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass,
557
- options: FinalRequestOptions,
565
+ options: PromiseOrValue<FinalRequestOptions>,
558
566
  ): Pagination.PagePromise<PageClass, Item> {
559
567
  const request = this.makeRequest(options, null, undefined);
560
568
  return new Pagination.PagePromise<PageClass, Item>(this as any as Surge, request, Page);
@@ -567,7 +575,7 @@ export class Surge {
567
575
  controller: AbortController,
568
576
  ): Promise<Response> {
569
577
  const { signal, method, ...options } = init || {};
570
- const abort = controller.abort.bind(controller);
578
+ const abort = this._makeAbort(controller);
571
579
  if (signal) signal.addEventListener('abort', abort, { once: true });
572
580
 
573
581
  const timeout = setTimeout(abort, ms);
@@ -737,6 +745,12 @@ export class Surge {
737
745
  return headers.values;
738
746
  }
739
747
 
748
+ private _makeAbort(controller: AbortController) {
749
+ // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
750
+ // would capture all request options, and cause a memory leak.
751
+ return () => controller.abort();
752
+ }
753
+
740
754
  private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
741
755
  bodyHeaders: HeadersLike;
742
756
  body: BodyInit | undefined;
@@ -799,6 +813,7 @@ export class Surge {
799
813
  contacts: API.Contacts = new API.Contacts(this);
800
814
  messages: API.Messages = new API.Messages(this);
801
815
  phoneNumbers: API.PhoneNumbers = new API.PhoneNumbers(this);
816
+ recordings: API.Recordings = new API.Recordings(this);
802
817
  users: API.Users = new API.Users(this);
803
818
  verifications: API.Verifications = new API.Verifications(this);
804
819
  webhooks: API.Webhooks = new API.Webhooks(this);
@@ -810,6 +825,7 @@ Surge.Campaigns = Campaigns;
810
825
  Surge.Contacts = Contacts;
811
826
  Surge.Messages = Messages;
812
827
  Surge.PhoneNumbers = PhoneNumbers;
828
+ Surge.Recordings = Recordings;
813
829
  Surge.Users = Users;
814
830
  Surge.Verifications = Verifications;
815
831
  Surge.Webhooks = Webhooks;
@@ -863,6 +879,8 @@ export declare namespace Surge {
863
879
  type PhoneNumberPurchaseParams as PhoneNumberPurchaseParams,
864
880
  };
865
881
 
882
+ export { Recordings as Recordings, type RecordingGetFileResponse as RecordingGetFileResponse };
883
+
866
884
  export {
867
885
  Users as Users,
868
886
  type User as User,
@@ -892,6 +910,8 @@ export declare namespace Surge {
892
910
  type MessageFailedWebhookEvent as MessageFailedWebhookEvent,
893
911
  type MessageReceivedWebhookEvent as MessageReceivedWebhookEvent,
894
912
  type MessageSentWebhookEvent as MessageSentWebhookEvent,
913
+ type RecordingCompletedWebhookEvent as RecordingCompletedWebhookEvent,
914
+ type VoicemailReceivedWebhookEvent as VoicemailReceivedWebhookEvent,
895
915
  type UnwrapWebhookEvent as UnwrapWebhookEvent,
896
916
  };
897
917
 
@@ -37,6 +37,20 @@ export class Campaigns extends APIResource {
37
37
  create(accountID: string, body: CampaignCreateParams, options?: RequestOptions): APIPromise<Campaign> {
38
38
  return this._client.post(path`/accounts/${accountID}/campaigns`, { body, ...options });
39
39
  }
40
+
41
+ /**
42
+ * Retrieves a Campaign object.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const campaign = await client.campaigns.retrieve(
47
+ * 'cpn_01k0qczvhbet4azgn5xm2ccfst',
48
+ * );
49
+ * ```
50
+ */
51
+ retrieve(id: string, options?: RequestOptions): APIPromise<Campaign> {
52
+ return this._client.get(path`/campaigns/${id}`, options);
53
+ }
40
54
  }
41
55
 
42
56
  /**
@@ -94,6 +108,11 @@ export interface Campaign {
94
108
  */
95
109
  privacy_policy_url: string;
96
110
 
111
+ /**
112
+ * The current status of the campaign.
113
+ */
114
+ status: 'active' | 'canceled' | 'created' | 'deactivated' | 'in_review' | 'pending' | 'rejected';
115
+
97
116
  /**
98
117
  * A list containing 1-5 types of messages that will be sent with this campaign.
99
118
  *
@@ -34,6 +34,7 @@ export {
34
34
  type PhoneNumberPurchaseParams,
35
35
  type PhoneNumbersCursor,
36
36
  } from './phone-numbers';
37
+ export { Recordings, type RecordingGetFileResponse } from './recordings';
37
38
  export {
38
39
  Users,
39
40
  type User,
@@ -61,5 +62,7 @@ export {
61
62
  type MessageFailedWebhookEvent,
62
63
  type MessageReceivedWebhookEvent,
63
64
  type MessageSentWebhookEvent,
65
+ type RecordingCompletedWebhookEvent,
66
+ type VoicemailReceivedWebhookEvent,
64
67
  type UnwrapWebhookEvent,
65
68
  } from './webhooks';
@@ -107,7 +107,7 @@ export interface Message {
107
107
  * The ID of the blast this message belongs to, if any. This can be used to
108
108
  * attribute messages back to a specific blast.
109
109
  */
110
- blast_id?: string;
110
+ blast_id?: string | null;
111
111
 
112
112
  /**
113
113
  * The message body.
@@ -0,0 +1,38 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import * as Shared from './shared';
5
+ import { APIPromise } from '../core/api-promise';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { path } from '../internal/utils/path';
8
+
9
+ export class Recordings extends APIResource {
10
+ /**
11
+ * Redirects to a signed URL where the recording audio file can be downloaded. URL
12
+ * is short-lived, so redirect should be followed immediately.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const response = await client.recordings.getFile(
17
+ * 'rec_01kfyc9dgdec1avkgs7tng8htg',
18
+ * );
19
+ * ```
20
+ */
21
+ getFile(recordingID: string, options?: RequestOptions): APIPromise<RecordingGetFileResponse> {
22
+ return this._client.get(path`/recordings/${recordingID}/file`, options);
23
+ }
24
+ }
25
+
26
+ /**
27
+ * An error response
28
+ */
29
+ export interface RecordingGetFileResponse {
30
+ /**
31
+ * An error response
32
+ */
33
+ error: Shared.Error;
34
+ }
35
+
36
+ export declare namespace Recordings {
37
+ export { type RecordingGetFileResponse as RecordingGetFileResponse };
38
+ }
@@ -679,6 +679,181 @@ export namespace MessageSentWebhookEvent {
679
679
  }
680
680
  }
681
681
 
682
+ export interface RecordingCompletedWebhookEvent {
683
+ /**
684
+ * The ID of the account in which this event occurred
685
+ */
686
+ account_id: string;
687
+
688
+ /**
689
+ * The data associated with the event
690
+ */
691
+ data: RecordingCompletedWebhookEvent.Data;
692
+
693
+ /**
694
+ * The timestamp when this event occurred, in ISO8601 format
695
+ */
696
+ timestamp: string;
697
+
698
+ /**
699
+ * The type of the event. Always `recording.completed` for this event.
700
+ */
701
+ type: 'recording.completed';
702
+ }
703
+
704
+ export namespace RecordingCompletedWebhookEvent {
705
+ /**
706
+ * The data associated with the event
707
+ */
708
+ export interface Data {
709
+ /**
710
+ * The unique identifier for the recording
711
+ */
712
+ id: string;
713
+
714
+ /**
715
+ * The call that produced this recording
716
+ */
717
+ call: Data.Call;
718
+
719
+ /**
720
+ * The duration of the recording in seconds
721
+ */
722
+ duration: number;
723
+ }
724
+
725
+ export namespace Data {
726
+ /**
727
+ * The call that produced this recording
728
+ */
729
+ export interface Call {
730
+ /**
731
+ * The unique identifier for the call
732
+ */
733
+ id: string;
734
+
735
+ /**
736
+ * A contact who has consented to receive messages
737
+ */
738
+ contact: ContactsAPI.Contact;
739
+
740
+ /**
741
+ * The duration of the call in seconds
742
+ */
743
+ duration: number;
744
+
745
+ /**
746
+ * When the call was initiated
747
+ */
748
+ initiated_at: string;
749
+
750
+ /**
751
+ * The status of the call
752
+ */
753
+ status:
754
+ | 'busy'
755
+ | 'canceled'
756
+ | 'completed'
757
+ | 'failed'
758
+ | 'in_progress'
759
+ | 'missed'
760
+ | 'no_answer'
761
+ | 'queued'
762
+ | 'ringing';
763
+ }
764
+ }
765
+ }
766
+
767
+ export interface VoicemailReceivedWebhookEvent {
768
+ /**
769
+ * The ID of the account in which this event occurred
770
+ */
771
+ account_id: string;
772
+
773
+ /**
774
+ * The data associated with the event
775
+ */
776
+ data: VoicemailReceivedWebhookEvent.Data;
777
+
778
+ /**
779
+ * The timestamp when this event occurred, in ISO8601 format
780
+ */
781
+ timestamp: string;
782
+
783
+ /**
784
+ * The type of the event. Always `voicemail.received` for this event.
785
+ */
786
+ type: 'voicemail.received';
787
+ }
788
+
789
+ export namespace VoicemailReceivedWebhookEvent {
790
+ /**
791
+ * The data associated with the event
792
+ */
793
+ export interface Data {
794
+ /**
795
+ * The unique identifier for the voicemail
796
+ */
797
+ id: string;
798
+
799
+ /**
800
+ * The call that resulted in this voicemail
801
+ */
802
+ call: Data.Call;
803
+
804
+ /**
805
+ * The duration of the voicemail in seconds
806
+ */
807
+ duration: number;
808
+
809
+ /**
810
+ * The unique identifier for the recording
811
+ */
812
+ recording_id: string;
813
+ }
814
+
815
+ export namespace Data {
816
+ /**
817
+ * The call that resulted in this voicemail
818
+ */
819
+ export interface Call {
820
+ /**
821
+ * The unique identifier for the call
822
+ */
823
+ id: string;
824
+
825
+ /**
826
+ * A contact who has consented to receive messages
827
+ */
828
+ contact: ContactsAPI.Contact;
829
+
830
+ /**
831
+ * The duration of the call in seconds
832
+ */
833
+ duration: number;
834
+
835
+ /**
836
+ * When the call was initiated
837
+ */
838
+ initiated_at: string;
839
+
840
+ /**
841
+ * The status of the call
842
+ */
843
+ status:
844
+ | 'busy'
845
+ | 'canceled'
846
+ | 'completed'
847
+ | 'failed'
848
+ | 'in_progress'
849
+ | 'missed'
850
+ | 'no_answer'
851
+ | 'queued'
852
+ | 'ringing';
853
+ }
854
+ }
855
+ }
856
+
682
857
  export type UnwrapWebhookEvent =
683
858
  | CallEndedWebhookEvent
684
859
  | CampaignApprovedWebhookEvent
@@ -689,7 +864,9 @@ export type UnwrapWebhookEvent =
689
864
  | MessageDeliveredWebhookEvent
690
865
  | MessageFailedWebhookEvent
691
866
  | MessageReceivedWebhookEvent
692
- | MessageSentWebhookEvent;
867
+ | MessageSentWebhookEvent
868
+ | RecordingCompletedWebhookEvent
869
+ | VoicemailReceivedWebhookEvent;
693
870
 
694
871
  export declare namespace Webhooks {
695
872
  export {
@@ -703,6 +880,8 @@ export declare namespace Webhooks {
703
880
  type MessageFailedWebhookEvent as MessageFailedWebhookEvent,
704
881
  type MessageReceivedWebhookEvent as MessageReceivedWebhookEvent,
705
882
  type MessageSentWebhookEvent as MessageSentWebhookEvent,
883
+ type RecordingCompletedWebhookEvent as RecordingCompletedWebhookEvent,
884
+ type VoicemailReceivedWebhookEvent as VoicemailReceivedWebhookEvent,
706
885
  type UnwrapWebhookEvent as UnwrapWebhookEvent,
707
886
  };
708
887
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.35.0'; // x-release-please-version
1
+ export const VERSION = '0.36.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.35.0";
1
+ export declare const VERSION = "0.36.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.35.0";
1
+ export declare const VERSION = "0.36.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.35.0'; // x-release-please-version
4
+ exports.VERSION = '0.36.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.35.0'; // x-release-please-version
1
+ export const VERSION = '0.36.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map