@surgeapi/node 0.35.0 → 0.37.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.
- package/CHANGELOG.md +45 -0
- package/README.md +8 -8
- package/client.d.mts +10 -6
- package/client.d.mts.map +1 -1
- package/client.d.ts +10 -6
- package/client.d.ts.map +1 -1
- package/client.js +19 -2
- package/client.js.map +1 -1
- package/client.mjs +20 -3
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/campaigns.d.mts +34 -1
- package/resources/campaigns.d.mts.map +1 -1
- package/resources/campaigns.d.ts +34 -1
- package/resources/campaigns.d.ts.map +1 -1
- package/resources/campaigns.js +33 -0
- package/resources/campaigns.js.map +1 -1
- package/resources/campaigns.mjs +33 -0
- package/resources/campaigns.mjs.map +1 -1
- package/resources/index.d.mts +3 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -1
- package/resources/index.mjs.map +1 -1
- package/resources/messages.d.mts +2 -2
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +2 -2
- package/resources/messages.d.ts.map +1 -1
- package/resources/recordings.d.mts +88 -0
- package/resources/recordings.d.mts.map +1 -0
- package/resources/recordings.d.ts +88 -0
- package/resources/recordings.d.ts.map +1 -0
- package/resources/recordings.js +38 -0
- package/resources/recordings.js.map +1 -0
- package/resources/recordings.mjs +34 -0
- package/resources/recordings.mjs.map +1 -0
- package/resources/webhooks.d.mts +158 -2
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +158 -2
- package/resources/webhooks.d.ts.map +1 -1
- package/src/client.ts +46 -6
- package/src/resources/campaigns.ts +54 -1
- package/src/resources/index.ts +10 -1
- package/src/resources/messages.ts +2 -2
- package/src/resources/recordings.ts +118 -0
- package/src/resources/webhooks.ts +200 -1
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/client.ts
CHANGED
|
@@ -29,7 +29,13 @@ import {
|
|
|
29
29
|
Organization,
|
|
30
30
|
} from './resources/accounts';
|
|
31
31
|
import { Blast, BlastCreateParams, Blasts } from './resources/blasts';
|
|
32
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
Campaign,
|
|
34
|
+
CampaignCreateParams,
|
|
35
|
+
CampaignListParams,
|
|
36
|
+
Campaigns,
|
|
37
|
+
CampaignsCursor,
|
|
38
|
+
} from './resources/campaigns';
|
|
33
39
|
import {
|
|
34
40
|
Contact,
|
|
35
41
|
ContactCreateParams,
|
|
@@ -52,6 +58,7 @@ import {
|
|
|
52
58
|
PhoneNumbers,
|
|
53
59
|
PhoneNumbersCursor,
|
|
54
60
|
} from './resources/phone-numbers';
|
|
61
|
+
import { RecordingDeleteResponse, RecordingGetFileResponse, Recordings } from './resources/recordings';
|
|
55
62
|
import {
|
|
56
63
|
User,
|
|
57
64
|
UserCreateParams,
|
|
@@ -78,7 +85,9 @@ import {
|
|
|
78
85
|
MessageFailedWebhookEvent,
|
|
79
86
|
MessageReceivedWebhookEvent,
|
|
80
87
|
MessageSentWebhookEvent,
|
|
88
|
+
RecordingCompletedWebhookEvent,
|
|
81
89
|
UnwrapWebhookEvent,
|
|
90
|
+
VoicemailReceivedWebhookEvent,
|
|
82
91
|
Webhooks,
|
|
83
92
|
} from './resources/webhooks';
|
|
84
93
|
import { type Fetch } from './internal/builtin-types';
|
|
@@ -507,7 +516,7 @@ export class Surge {
|
|
|
507
516
|
loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
|
|
508
517
|
|
|
509
518
|
const errText = await response.text().catch((err: any) => castToError(err).message);
|
|
510
|
-
const errJSON = safeJSON(errText);
|
|
519
|
+
const errJSON = safeJSON(errText) as any;
|
|
511
520
|
const errMessage = errJSON ? undefined : errText;
|
|
512
521
|
|
|
513
522
|
loggerFor(this).debug(
|
|
@@ -544,9 +553,14 @@ export class Surge {
|
|
|
544
553
|
getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(
|
|
545
554
|
path: string,
|
|
546
555
|
Page: new (...args: any[]) => PageClass,
|
|
547
|
-
opts?: RequestOptions
|
|
556
|
+
opts?: PromiseOrValue<RequestOptions>,
|
|
548
557
|
): Pagination.PagePromise<PageClass, Item> {
|
|
549
|
-
return this.requestAPIList(
|
|
558
|
+
return this.requestAPIList(
|
|
559
|
+
Page,
|
|
560
|
+
opts && 'then' in opts ?
|
|
561
|
+
opts.then((opts) => ({ method: 'get', path, ...opts }))
|
|
562
|
+
: { method: 'get', path, ...opts },
|
|
563
|
+
);
|
|
550
564
|
}
|
|
551
565
|
|
|
552
566
|
requestAPIList<
|
|
@@ -554,7 +568,7 @@ export class Surge {
|
|
|
554
568
|
PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>,
|
|
555
569
|
>(
|
|
556
570
|
Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass,
|
|
557
|
-
options: FinalRequestOptions
|
|
571
|
+
options: PromiseOrValue<FinalRequestOptions>,
|
|
558
572
|
): Pagination.PagePromise<PageClass, Item> {
|
|
559
573
|
const request = this.makeRequest(options, null, undefined);
|
|
560
574
|
return new Pagination.PagePromise<PageClass, Item>(this as any as Surge, request, Page);
|
|
@@ -567,7 +581,7 @@ export class Surge {
|
|
|
567
581
|
controller: AbortController,
|
|
568
582
|
): Promise<Response> {
|
|
569
583
|
const { signal, method, ...options } = init || {};
|
|
570
|
-
const abort =
|
|
584
|
+
const abort = this._makeAbort(controller);
|
|
571
585
|
if (signal) signal.addEventListener('abort', abort, { once: true });
|
|
572
586
|
|
|
573
587
|
const timeout = setTimeout(abort, ms);
|
|
@@ -737,6 +751,12 @@ export class Surge {
|
|
|
737
751
|
return headers.values;
|
|
738
752
|
}
|
|
739
753
|
|
|
754
|
+
private _makeAbort(controller: AbortController) {
|
|
755
|
+
// note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
|
|
756
|
+
// would capture all request options, and cause a memory leak.
|
|
757
|
+
return () => controller.abort();
|
|
758
|
+
}
|
|
759
|
+
|
|
740
760
|
private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
|
|
741
761
|
bodyHeaders: HeadersLike;
|
|
742
762
|
body: BodyInit | undefined;
|
|
@@ -769,6 +789,14 @@ export class Surge {
|
|
|
769
789
|
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
|
|
770
790
|
) {
|
|
771
791
|
return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
|
|
792
|
+
} else if (
|
|
793
|
+
typeof body === 'object' &&
|
|
794
|
+
headers.values.get('content-type') === 'application/x-www-form-urlencoded'
|
|
795
|
+
) {
|
|
796
|
+
return {
|
|
797
|
+
bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
798
|
+
body: this.stringifyQuery(body as Record<string, unknown>),
|
|
799
|
+
};
|
|
772
800
|
} else {
|
|
773
801
|
return this.#encoder({ body, headers });
|
|
774
802
|
}
|
|
@@ -799,6 +827,7 @@ export class Surge {
|
|
|
799
827
|
contacts: API.Contacts = new API.Contacts(this);
|
|
800
828
|
messages: API.Messages = new API.Messages(this);
|
|
801
829
|
phoneNumbers: API.PhoneNumbers = new API.PhoneNumbers(this);
|
|
830
|
+
recordings: API.Recordings = new API.Recordings(this);
|
|
802
831
|
users: API.Users = new API.Users(this);
|
|
803
832
|
verifications: API.Verifications = new API.Verifications(this);
|
|
804
833
|
webhooks: API.Webhooks = new API.Webhooks(this);
|
|
@@ -810,6 +839,7 @@ Surge.Campaigns = Campaigns;
|
|
|
810
839
|
Surge.Contacts = Contacts;
|
|
811
840
|
Surge.Messages = Messages;
|
|
812
841
|
Surge.PhoneNumbers = PhoneNumbers;
|
|
842
|
+
Surge.Recordings = Recordings;
|
|
813
843
|
Surge.Users = Users;
|
|
814
844
|
Surge.Verifications = Verifications;
|
|
815
845
|
Surge.Webhooks = Webhooks;
|
|
@@ -835,7 +865,9 @@ export declare namespace Surge {
|
|
|
835
865
|
export {
|
|
836
866
|
Campaigns as Campaigns,
|
|
837
867
|
type Campaign as Campaign,
|
|
868
|
+
type CampaignsCursor as CampaignsCursor,
|
|
838
869
|
type CampaignCreateParams as CampaignCreateParams,
|
|
870
|
+
type CampaignListParams as CampaignListParams,
|
|
839
871
|
};
|
|
840
872
|
|
|
841
873
|
export {
|
|
@@ -863,6 +895,12 @@ export declare namespace Surge {
|
|
|
863
895
|
type PhoneNumberPurchaseParams as PhoneNumberPurchaseParams,
|
|
864
896
|
};
|
|
865
897
|
|
|
898
|
+
export {
|
|
899
|
+
Recordings as Recordings,
|
|
900
|
+
type RecordingDeleteResponse as RecordingDeleteResponse,
|
|
901
|
+
type RecordingGetFileResponse as RecordingGetFileResponse,
|
|
902
|
+
};
|
|
903
|
+
|
|
866
904
|
export {
|
|
867
905
|
Users as Users,
|
|
868
906
|
type User as User,
|
|
@@ -892,6 +930,8 @@ export declare namespace Surge {
|
|
|
892
930
|
type MessageFailedWebhookEvent as MessageFailedWebhookEvent,
|
|
893
931
|
type MessageReceivedWebhookEvent as MessageReceivedWebhookEvent,
|
|
894
932
|
type MessageSentWebhookEvent as MessageSentWebhookEvent,
|
|
933
|
+
type RecordingCompletedWebhookEvent as RecordingCompletedWebhookEvent,
|
|
934
|
+
type VoicemailReceivedWebhookEvent as VoicemailReceivedWebhookEvent,
|
|
895
935
|
type UnwrapWebhookEvent as UnwrapWebhookEvent,
|
|
896
936
|
};
|
|
897
937
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../core/resource';
|
|
4
4
|
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
|
|
5
6
|
import { RequestOptions } from '../internal/request-options';
|
|
6
7
|
import { path } from '../internal/utils/path';
|
|
7
8
|
|
|
@@ -37,8 +38,48 @@ export class Campaigns extends APIResource {
|
|
|
37
38
|
create(accountID: string, body: CampaignCreateParams, options?: RequestOptions): APIPromise<Campaign> {
|
|
38
39
|
return this._client.post(path`/accounts/${accountID}/campaigns`, { body, ...options });
|
|
39
40
|
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Retrieves a Campaign object.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const campaign = await client.campaigns.retrieve(
|
|
48
|
+
* 'cpn_01k0qczvhbet4azgn5xm2ccfst',
|
|
49
|
+
* );
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<Campaign> {
|
|
53
|
+
return this._client.get(path`/campaigns/${id}`, options);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* List all campaigns for an account with cursor-based pagination.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* // Automatically fetches more pages as needed.
|
|
62
|
+
* for await (const campaign of client.campaigns.list(
|
|
63
|
+
* 'acct_01j9a43avnfqzbjfch6pygv1td',
|
|
64
|
+
* )) {
|
|
65
|
+
* // ...
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
list(
|
|
70
|
+
accountID: string,
|
|
71
|
+
query: CampaignListParams | null | undefined = {},
|
|
72
|
+
options?: RequestOptions,
|
|
73
|
+
): PagePromise<CampaignsCursor, Campaign> {
|
|
74
|
+
return this._client.getAPIList(path`/accounts/${accountID}/campaigns`, Cursor<Campaign>, {
|
|
75
|
+
query,
|
|
76
|
+
...options,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
40
79
|
}
|
|
41
80
|
|
|
81
|
+
export type CampaignsCursor = Cursor<Campaign>;
|
|
82
|
+
|
|
42
83
|
/**
|
|
43
84
|
* A campaign represents the context in which one or more of your phone numbers
|
|
44
85
|
* communicates with your contacts. Consent and opt-outs are tied to the campaign.
|
|
@@ -94,6 +135,11 @@ export interface Campaign {
|
|
|
94
135
|
*/
|
|
95
136
|
privacy_policy_url: string;
|
|
96
137
|
|
|
138
|
+
/**
|
|
139
|
+
* The current status of the campaign.
|
|
140
|
+
*/
|
|
141
|
+
status: 'active' | 'canceled' | 'created' | 'deactivated' | 'in_review' | 'pending' | 'rejected';
|
|
142
|
+
|
|
97
143
|
/**
|
|
98
144
|
* A list containing 1-5 types of messages that will be sent with this campaign.
|
|
99
145
|
*
|
|
@@ -299,6 +345,13 @@ export declare namespace CampaignCreateParams {
|
|
|
299
345
|
}
|
|
300
346
|
}
|
|
301
347
|
|
|
348
|
+
export interface CampaignListParams extends CursorParams {}
|
|
349
|
+
|
|
302
350
|
export declare namespace Campaigns {
|
|
303
|
-
export {
|
|
351
|
+
export {
|
|
352
|
+
type Campaign as Campaign,
|
|
353
|
+
type CampaignsCursor as CampaignsCursor,
|
|
354
|
+
type CampaignCreateParams as CampaignCreateParams,
|
|
355
|
+
type CampaignListParams as CampaignListParams,
|
|
356
|
+
};
|
|
304
357
|
}
|
package/src/resources/index.ts
CHANGED
|
@@ -11,7 +11,13 @@ export {
|
|
|
11
11
|
type AccountRetrieveStatusParams,
|
|
12
12
|
} from './accounts';
|
|
13
13
|
export { Blasts, type Blast, type BlastCreateParams } from './blasts';
|
|
14
|
-
export {
|
|
14
|
+
export {
|
|
15
|
+
Campaigns,
|
|
16
|
+
type Campaign,
|
|
17
|
+
type CampaignCreateParams,
|
|
18
|
+
type CampaignListParams,
|
|
19
|
+
type CampaignsCursor,
|
|
20
|
+
} from './campaigns';
|
|
15
21
|
export {
|
|
16
22
|
Contacts,
|
|
17
23
|
type Contact,
|
|
@@ -34,6 +40,7 @@ export {
|
|
|
34
40
|
type PhoneNumberPurchaseParams,
|
|
35
41
|
type PhoneNumbersCursor,
|
|
36
42
|
} from './phone-numbers';
|
|
43
|
+
export { Recordings, type RecordingDeleteResponse, type RecordingGetFileResponse } from './recordings';
|
|
37
44
|
export {
|
|
38
45
|
Users,
|
|
39
46
|
type User,
|
|
@@ -61,5 +68,7 @@ export {
|
|
|
61
68
|
type MessageFailedWebhookEvent,
|
|
62
69
|
type MessageReceivedWebhookEvent,
|
|
63
70
|
type MessageSentWebhookEvent,
|
|
71
|
+
type RecordingCompletedWebhookEvent,
|
|
72
|
+
type VoicemailReceivedWebhookEvent,
|
|
64
73
|
type UnwrapWebhookEvent,
|
|
65
74
|
} 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.
|
|
@@ -138,7 +138,7 @@ export namespace Message {
|
|
|
138
138
|
/**
|
|
139
139
|
* The type of attachment.
|
|
140
140
|
*/
|
|
141
|
-
type?:
|
|
141
|
+
type?: 'file' | 'image' | 'link' | 'video';
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
144
|
* The URL of the attachment.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import * as ContactsAPI from './contacts';
|
|
5
|
+
import * as Shared from './shared';
|
|
6
|
+
import { APIPromise } from '../core/api-promise';
|
|
7
|
+
import { RequestOptions } from '../internal/request-options';
|
|
8
|
+
import { path } from '../internal/utils/path';
|
|
9
|
+
|
|
10
|
+
export class Recordings extends APIResource {
|
|
11
|
+
/**
|
|
12
|
+
* Deletes a recording. The recording file will be removed from storage
|
|
13
|
+
* asynchronously.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const recording = await client.recordings.delete(
|
|
18
|
+
* 'rec_01kfyc9dgdec1avkgs7tng8htg',
|
|
19
|
+
* );
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
delete(id: string, options?: RequestOptions): APIPromise<RecordingDeleteResponse> {
|
|
23
|
+
return this._client.delete(path`/recordings/${id}`, options);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Redirects to a signed URL where the recording audio file can be downloaded. URL
|
|
28
|
+
* is short-lived, so redirect should be followed immediately.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const response = await client.recordings.getFile(
|
|
33
|
+
* 'rec_01kfyc9dgdec1avkgs7tng8htg',
|
|
34
|
+
* );
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
getFile(recordingID: string, options?: RequestOptions): APIPromise<RecordingGetFileResponse> {
|
|
38
|
+
return this._client.get(path`/recordings/${recordingID}/file`, options);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A call recording
|
|
44
|
+
*/
|
|
45
|
+
export interface RecordingDeleteResponse {
|
|
46
|
+
/**
|
|
47
|
+
* The unique identifier for the recording
|
|
48
|
+
*/
|
|
49
|
+
id: string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The call that produced this recording
|
|
53
|
+
*/
|
|
54
|
+
call: RecordingDeleteResponse.Call;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The duration of the recording in seconds
|
|
58
|
+
*/
|
|
59
|
+
duration: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export namespace RecordingDeleteResponse {
|
|
63
|
+
/**
|
|
64
|
+
* The call that produced this recording
|
|
65
|
+
*/
|
|
66
|
+
export interface Call {
|
|
67
|
+
/**
|
|
68
|
+
* The unique identifier for the call
|
|
69
|
+
*/
|
|
70
|
+
id: string;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* A contact who has consented to receive messages
|
|
74
|
+
*/
|
|
75
|
+
contact: ContactsAPI.Contact;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The duration of the call in seconds
|
|
79
|
+
*/
|
|
80
|
+
duration: number;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* When the call was initiated
|
|
84
|
+
*/
|
|
85
|
+
initiated_at: string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The status of the call
|
|
89
|
+
*/
|
|
90
|
+
status:
|
|
91
|
+
| 'busy'
|
|
92
|
+
| 'canceled'
|
|
93
|
+
| 'completed'
|
|
94
|
+
| 'failed'
|
|
95
|
+
| 'in_progress'
|
|
96
|
+
| 'missed'
|
|
97
|
+
| 'no_answer'
|
|
98
|
+
| 'queued'
|
|
99
|
+
| 'ringing';
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* An error response
|
|
105
|
+
*/
|
|
106
|
+
export interface RecordingGetFileResponse {
|
|
107
|
+
/**
|
|
108
|
+
* An error response
|
|
109
|
+
*/
|
|
110
|
+
error: Shared.Error;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export declare namespace Recordings {
|
|
114
|
+
export {
|
|
115
|
+
type RecordingDeleteResponse as RecordingDeleteResponse,
|
|
116
|
+
type RecordingGetFileResponse as RecordingGetFileResponse,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
@@ -325,6 +325,11 @@ export namespace MessageDeliveredWebhookEvent {
|
|
|
325
325
|
*/
|
|
326
326
|
delivered_at: string;
|
|
327
327
|
|
|
328
|
+
/**
|
|
329
|
+
* Set of key-value pairs that will be stored with the object.
|
|
330
|
+
*/
|
|
331
|
+
metadata: { [key: string]: string };
|
|
332
|
+
|
|
328
333
|
/**
|
|
329
334
|
* Attachments included with the message
|
|
330
335
|
*/
|
|
@@ -429,6 +434,11 @@ export namespace MessageFailedWebhookEvent {
|
|
|
429
434
|
*/
|
|
430
435
|
failure_reason: string;
|
|
431
436
|
|
|
437
|
+
/**
|
|
438
|
+
* Set of key-value pairs that will be stored with the object.
|
|
439
|
+
*/
|
|
440
|
+
metadata: { [key: string]: string };
|
|
441
|
+
|
|
432
442
|
/**
|
|
433
443
|
* Attachments included with the message
|
|
434
444
|
*/
|
|
@@ -523,6 +533,11 @@ export namespace MessageReceivedWebhookEvent {
|
|
|
523
533
|
*/
|
|
524
534
|
conversation: Data.Conversation;
|
|
525
535
|
|
|
536
|
+
/**
|
|
537
|
+
* Set of key-value pairs that will be stored with the object.
|
|
538
|
+
*/
|
|
539
|
+
metadata: { [key: string]: string };
|
|
540
|
+
|
|
526
541
|
/**
|
|
527
542
|
* When the message was received
|
|
528
543
|
*/
|
|
@@ -622,6 +637,11 @@ export namespace MessageSentWebhookEvent {
|
|
|
622
637
|
*/
|
|
623
638
|
conversation: Data.Conversation;
|
|
624
639
|
|
|
640
|
+
/**
|
|
641
|
+
* Set of key-value pairs that will be stored with the object.
|
|
642
|
+
*/
|
|
643
|
+
metadata: { [key: string]: string };
|
|
644
|
+
|
|
625
645
|
/**
|
|
626
646
|
* When the message was sent
|
|
627
647
|
*/
|
|
@@ -679,6 +699,181 @@ export namespace MessageSentWebhookEvent {
|
|
|
679
699
|
}
|
|
680
700
|
}
|
|
681
701
|
|
|
702
|
+
export interface RecordingCompletedWebhookEvent {
|
|
703
|
+
/**
|
|
704
|
+
* The ID of the account in which this event occurred
|
|
705
|
+
*/
|
|
706
|
+
account_id: string;
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* The data associated with the event
|
|
710
|
+
*/
|
|
711
|
+
data: RecordingCompletedWebhookEvent.Data;
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* The timestamp when this event occurred, in ISO8601 format
|
|
715
|
+
*/
|
|
716
|
+
timestamp: string;
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* The type of the event. Always `recording.completed` for this event.
|
|
720
|
+
*/
|
|
721
|
+
type: 'recording.completed';
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
export namespace RecordingCompletedWebhookEvent {
|
|
725
|
+
/**
|
|
726
|
+
* The data associated with the event
|
|
727
|
+
*/
|
|
728
|
+
export interface Data {
|
|
729
|
+
/**
|
|
730
|
+
* The unique identifier for the recording
|
|
731
|
+
*/
|
|
732
|
+
id: string;
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* The call that produced this recording
|
|
736
|
+
*/
|
|
737
|
+
call: Data.Call;
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* The duration of the recording in seconds
|
|
741
|
+
*/
|
|
742
|
+
duration: number;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
export namespace Data {
|
|
746
|
+
/**
|
|
747
|
+
* The call that produced this recording
|
|
748
|
+
*/
|
|
749
|
+
export interface Call {
|
|
750
|
+
/**
|
|
751
|
+
* The unique identifier for the call
|
|
752
|
+
*/
|
|
753
|
+
id: string;
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* A contact who has consented to receive messages
|
|
757
|
+
*/
|
|
758
|
+
contact: ContactsAPI.Contact;
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* The duration of the call in seconds
|
|
762
|
+
*/
|
|
763
|
+
duration: number;
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* When the call was initiated
|
|
767
|
+
*/
|
|
768
|
+
initiated_at: string;
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* The status of the call
|
|
772
|
+
*/
|
|
773
|
+
status:
|
|
774
|
+
| 'busy'
|
|
775
|
+
| 'canceled'
|
|
776
|
+
| 'completed'
|
|
777
|
+
| 'failed'
|
|
778
|
+
| 'in_progress'
|
|
779
|
+
| 'missed'
|
|
780
|
+
| 'no_answer'
|
|
781
|
+
| 'queued'
|
|
782
|
+
| 'ringing';
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
export interface VoicemailReceivedWebhookEvent {
|
|
788
|
+
/**
|
|
789
|
+
* The ID of the account in which this event occurred
|
|
790
|
+
*/
|
|
791
|
+
account_id: string;
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* The data associated with the event
|
|
795
|
+
*/
|
|
796
|
+
data: VoicemailReceivedWebhookEvent.Data;
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* The timestamp when this event occurred, in ISO8601 format
|
|
800
|
+
*/
|
|
801
|
+
timestamp: string;
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* The type of the event. Always `voicemail.received` for this event.
|
|
805
|
+
*/
|
|
806
|
+
type: 'voicemail.received';
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
export namespace VoicemailReceivedWebhookEvent {
|
|
810
|
+
/**
|
|
811
|
+
* The data associated with the event
|
|
812
|
+
*/
|
|
813
|
+
export interface Data {
|
|
814
|
+
/**
|
|
815
|
+
* The unique identifier for the voicemail
|
|
816
|
+
*/
|
|
817
|
+
id: string;
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* The call that resulted in this voicemail
|
|
821
|
+
*/
|
|
822
|
+
call: Data.Call;
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* The duration of the voicemail in seconds
|
|
826
|
+
*/
|
|
827
|
+
duration: number;
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* The unique identifier for the recording
|
|
831
|
+
*/
|
|
832
|
+
recording_id: string;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
export namespace Data {
|
|
836
|
+
/**
|
|
837
|
+
* The call that resulted in this voicemail
|
|
838
|
+
*/
|
|
839
|
+
export interface Call {
|
|
840
|
+
/**
|
|
841
|
+
* The unique identifier for the call
|
|
842
|
+
*/
|
|
843
|
+
id: string;
|
|
844
|
+
|
|
845
|
+
/**
|
|
846
|
+
* A contact who has consented to receive messages
|
|
847
|
+
*/
|
|
848
|
+
contact: ContactsAPI.Contact;
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* The duration of the call in seconds
|
|
852
|
+
*/
|
|
853
|
+
duration: number;
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* When the call was initiated
|
|
857
|
+
*/
|
|
858
|
+
initiated_at: string;
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* The status of the call
|
|
862
|
+
*/
|
|
863
|
+
status:
|
|
864
|
+
| 'busy'
|
|
865
|
+
| 'canceled'
|
|
866
|
+
| 'completed'
|
|
867
|
+
| 'failed'
|
|
868
|
+
| 'in_progress'
|
|
869
|
+
| 'missed'
|
|
870
|
+
| 'no_answer'
|
|
871
|
+
| 'queued'
|
|
872
|
+
| 'ringing';
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
|
|
682
877
|
export type UnwrapWebhookEvent =
|
|
683
878
|
| CallEndedWebhookEvent
|
|
684
879
|
| CampaignApprovedWebhookEvent
|
|
@@ -689,7 +884,9 @@ export type UnwrapWebhookEvent =
|
|
|
689
884
|
| MessageDeliveredWebhookEvent
|
|
690
885
|
| MessageFailedWebhookEvent
|
|
691
886
|
| MessageReceivedWebhookEvent
|
|
692
|
-
| MessageSentWebhookEvent
|
|
887
|
+
| MessageSentWebhookEvent
|
|
888
|
+
| RecordingCompletedWebhookEvent
|
|
889
|
+
| VoicemailReceivedWebhookEvent;
|
|
693
890
|
|
|
694
891
|
export declare namespace Webhooks {
|
|
695
892
|
export {
|
|
@@ -703,6 +900,8 @@ export declare namespace Webhooks {
|
|
|
703
900
|
type MessageFailedWebhookEvent as MessageFailedWebhookEvent,
|
|
704
901
|
type MessageReceivedWebhookEvent as MessageReceivedWebhookEvent,
|
|
705
902
|
type MessageSentWebhookEvent as MessageSentWebhookEvent,
|
|
903
|
+
type RecordingCompletedWebhookEvent as RecordingCompletedWebhookEvent,
|
|
904
|
+
type VoicemailReceivedWebhookEvent as VoicemailReceivedWebhookEvent,
|
|
706
905
|
type UnwrapWebhookEvent as UnwrapWebhookEvent,
|
|
707
906
|
};
|
|
708
907
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.37.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.37.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.37.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.37.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|