@surgeapi/node 0.37.0 → 0.39.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 +42 -0
- package/client.d.mts +7 -7
- package/client.d.mts.map +1 -1
- package/client.d.ts +7 -7
- package/client.d.ts.map +1 -1
- package/client.js +8 -7
- package/client.js.map +1 -1
- package/client.mjs +9 -8
- package/client.mjs.map +1 -1
- package/internal/tslib.js +22 -22
- package/internal/utils/query.d.mts +2 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +2 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +10 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +6 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- package/package.json +7 -1
- package/resources/blasts.d.mts +3 -2
- package/resources/blasts.d.mts.map +1 -1
- package/resources/blasts.d.ts +3 -2
- package/resources/blasts.d.ts.map +1 -1
- package/resources/campaigns.d.mts +1 -1
- package/resources/campaigns.d.mts.map +1 -1
- package/resources/campaigns.d.ts +1 -1
- package/resources/campaigns.d.ts.map +1 -1
- package/resources/index.d.mts +3 -3
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/phone-numbers.d.mts +4 -0
- package/resources/phone-numbers.d.mts.map +1 -1
- package/resources/phone-numbers.d.ts +4 -0
- package/resources/phone-numbers.d.ts.map +1 -1
- package/resources/recordings.d.mts +118 -1
- package/resources/recordings.d.mts.map +1 -1
- package/resources/recordings.d.ts +118 -1
- package/resources/recordings.d.ts.map +1 -1
- package/resources/recordings.js +33 -0
- package/resources/recordings.js.map +1 -1
- package/resources/recordings.mjs +33 -0
- package/resources/recordings.mjs.map +1 -1
- package/resources/users.d.mts +19 -1
- package/resources/users.d.mts.map +1 -1
- package/resources/users.d.ts +19 -1
- package/resources/users.d.ts.map +1 -1
- package/resources/users.js +17 -0
- package/resources/users.js.map +1 -1
- package/resources/users.mjs +17 -0
- package/resources/users.mjs.map +1 -1
- package/resources/webhooks.d.mts +44 -2
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +44 -2
- package/resources/webhooks.d.ts.map +1 -1
- package/src/client.ts +30 -11
- package/src/internal/utils/query.ts +7 -0
- package/src/internal/utils.ts +1 -0
- package/src/resources/blasts.ts +3 -2
- package/src/resources/campaigns.ts +1 -1
- package/src/resources/index.ts +12 -1
- package/src/resources/phone-numbers.ts +5 -0
- package/src/resources/recordings.ts +169 -0
- package/src/resources/users.ts +28 -0
- package/src/resources/webhooks.ts +52 -0
- 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/resources/index.ts
CHANGED
|
@@ -40,14 +40,24 @@ export {
|
|
|
40
40
|
type PhoneNumberPurchaseParams,
|
|
41
41
|
type PhoneNumbersCursor,
|
|
42
42
|
} from './phone-numbers';
|
|
43
|
-
export {
|
|
43
|
+
export {
|
|
44
|
+
Recordings,
|
|
45
|
+
type RecordingRetrieveResponse,
|
|
46
|
+
type RecordingListResponse,
|
|
47
|
+
type RecordingDeleteResponse,
|
|
48
|
+
type RecordingGetFileResponse,
|
|
49
|
+
type RecordingListParams,
|
|
50
|
+
type RecordingListResponsesCursor,
|
|
51
|
+
} from './recordings';
|
|
44
52
|
export {
|
|
45
53
|
Users,
|
|
46
54
|
type User,
|
|
47
55
|
type UserTokenResponse,
|
|
48
56
|
type UserCreateParams,
|
|
49
57
|
type UserUpdateParams,
|
|
58
|
+
type UserListParams,
|
|
50
59
|
type UserCreateTokenParams,
|
|
60
|
+
type UsersCursor,
|
|
51
61
|
} from './users';
|
|
52
62
|
export {
|
|
53
63
|
Verifications,
|
|
@@ -68,6 +78,7 @@ export {
|
|
|
68
78
|
type MessageFailedWebhookEvent,
|
|
69
79
|
type MessageReceivedWebhookEvent,
|
|
70
80
|
type MessageSentWebhookEvent,
|
|
81
|
+
type PhoneNumberAttachedToCampaignWebhookEvent,
|
|
71
82
|
type RecordingCompletedWebhookEvent,
|
|
72
83
|
type VoicemailReceivedWebhookEvent,
|
|
73
84
|
type UnwrapWebhookEvent,
|
|
@@ -4,10 +4,49 @@ import { APIResource } from '../core/resource';
|
|
|
4
4
|
import * as ContactsAPI from './contacts';
|
|
5
5
|
import * as Shared from './shared';
|
|
6
6
|
import { APIPromise } from '../core/api-promise';
|
|
7
|
+
import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
|
|
7
8
|
import { RequestOptions } from '../internal/request-options';
|
|
8
9
|
import { path } from '../internal/utils/path';
|
|
9
10
|
|
|
10
11
|
export class Recordings extends APIResource {
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves a Recording object.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const recording = await client.recordings.retrieve(
|
|
18
|
+
* 'rec_01kfyc9dgdec1avkgs7tng8htg',
|
|
19
|
+
* );
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<RecordingRetrieveResponse> {
|
|
23
|
+
return this._client.get(path`/recordings/${id}`, options);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* List all recordings for an account with cursor-based pagination.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* // Automatically fetches more pages as needed.
|
|
32
|
+
* for await (const recordingListResponse of client.recordings.list(
|
|
33
|
+
* 'acct_01j9a43avnfqzbjfch6pygv1td',
|
|
34
|
+
* )) {
|
|
35
|
+
* // ...
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
list(
|
|
40
|
+
accountID: string,
|
|
41
|
+
query: RecordingListParams | null | undefined = {},
|
|
42
|
+
options?: RequestOptions,
|
|
43
|
+
): PagePromise<RecordingListResponsesCursor, RecordingListResponse> {
|
|
44
|
+
return this._client.getAPIList(path`/accounts/${accountID}/recordings`, Cursor<RecordingListResponse>, {
|
|
45
|
+
query,
|
|
46
|
+
...options,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
11
50
|
/**
|
|
12
51
|
* Deletes a recording. The recording file will be removed from storage
|
|
13
52
|
* asynchronously.
|
|
@@ -39,6 +78,130 @@ export class Recordings extends APIResource {
|
|
|
39
78
|
}
|
|
40
79
|
}
|
|
41
80
|
|
|
81
|
+
export type RecordingListResponsesCursor = Cursor<RecordingListResponse>;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* A call recording
|
|
85
|
+
*/
|
|
86
|
+
export interface RecordingRetrieveResponse {
|
|
87
|
+
/**
|
|
88
|
+
* The unique identifier for the recording
|
|
89
|
+
*/
|
|
90
|
+
id: string;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The call that produced this recording
|
|
94
|
+
*/
|
|
95
|
+
call: RecordingRetrieveResponse.Call;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The duration of the recording in seconds
|
|
99
|
+
*/
|
|
100
|
+
duration: number;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export namespace RecordingRetrieveResponse {
|
|
104
|
+
/**
|
|
105
|
+
* The call that produced this recording
|
|
106
|
+
*/
|
|
107
|
+
export interface Call {
|
|
108
|
+
/**
|
|
109
|
+
* The unique identifier for the call
|
|
110
|
+
*/
|
|
111
|
+
id: string;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* A contact who has consented to receive messages
|
|
115
|
+
*/
|
|
116
|
+
contact: ContactsAPI.Contact;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The duration of the call in seconds
|
|
120
|
+
*/
|
|
121
|
+
duration: number;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* When the call was initiated
|
|
125
|
+
*/
|
|
126
|
+
initiated_at: string;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The status of the call
|
|
130
|
+
*/
|
|
131
|
+
status:
|
|
132
|
+
| 'busy'
|
|
133
|
+
| 'canceled'
|
|
134
|
+
| 'completed'
|
|
135
|
+
| 'failed'
|
|
136
|
+
| 'in_progress'
|
|
137
|
+
| 'missed'
|
|
138
|
+
| 'no_answer'
|
|
139
|
+
| 'queued'
|
|
140
|
+
| 'ringing';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* A call recording
|
|
146
|
+
*/
|
|
147
|
+
export interface RecordingListResponse {
|
|
148
|
+
/**
|
|
149
|
+
* The unique identifier for the recording
|
|
150
|
+
*/
|
|
151
|
+
id: string;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* The call that produced this recording
|
|
155
|
+
*/
|
|
156
|
+
call: RecordingListResponse.Call;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The duration of the recording in seconds
|
|
160
|
+
*/
|
|
161
|
+
duration: number;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export namespace RecordingListResponse {
|
|
165
|
+
/**
|
|
166
|
+
* The call that produced this recording
|
|
167
|
+
*/
|
|
168
|
+
export interface Call {
|
|
169
|
+
/**
|
|
170
|
+
* The unique identifier for the call
|
|
171
|
+
*/
|
|
172
|
+
id: string;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* A contact who has consented to receive messages
|
|
176
|
+
*/
|
|
177
|
+
contact: ContactsAPI.Contact;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The duration of the call in seconds
|
|
181
|
+
*/
|
|
182
|
+
duration: number;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* When the call was initiated
|
|
186
|
+
*/
|
|
187
|
+
initiated_at: string;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* The status of the call
|
|
191
|
+
*/
|
|
192
|
+
status:
|
|
193
|
+
| 'busy'
|
|
194
|
+
| 'canceled'
|
|
195
|
+
| 'completed'
|
|
196
|
+
| 'failed'
|
|
197
|
+
| 'in_progress'
|
|
198
|
+
| 'missed'
|
|
199
|
+
| 'no_answer'
|
|
200
|
+
| 'queued'
|
|
201
|
+
| 'ringing';
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
42
205
|
/**
|
|
43
206
|
* A call recording
|
|
44
207
|
*/
|
|
@@ -110,9 +273,15 @@ export interface RecordingGetFileResponse {
|
|
|
110
273
|
error: Shared.Error;
|
|
111
274
|
}
|
|
112
275
|
|
|
276
|
+
export interface RecordingListParams extends CursorParams {}
|
|
277
|
+
|
|
113
278
|
export declare namespace Recordings {
|
|
114
279
|
export {
|
|
280
|
+
type RecordingRetrieveResponse as RecordingRetrieveResponse,
|
|
281
|
+
type RecordingListResponse as RecordingListResponse,
|
|
115
282
|
type RecordingDeleteResponse as RecordingDeleteResponse,
|
|
116
283
|
type RecordingGetFileResponse as RecordingGetFileResponse,
|
|
284
|
+
type RecordingListResponsesCursor as RecordingListResponsesCursor,
|
|
285
|
+
type RecordingListParams as RecordingListParams,
|
|
117
286
|
};
|
|
118
287
|
}
|
package/src/resources/users.ts
CHANGED
|
@@ -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
|
|
|
@@ -50,6 +51,27 @@ export class Users extends APIResource {
|
|
|
50
51
|
return this._client.patch(path`/users/${id}`, { body, ...options });
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
/**
|
|
55
|
+
* List all users for an account with cursor-based pagination.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* // Automatically fetches more pages as needed.
|
|
60
|
+
* for await (const user of client.users.list(
|
|
61
|
+
* 'acct_01j9a43avnfqzbjfch6pygv1td',
|
|
62
|
+
* )) {
|
|
63
|
+
* // ...
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
list(
|
|
68
|
+
accountID: string,
|
|
69
|
+
query: UserListParams | null | undefined = {},
|
|
70
|
+
options?: RequestOptions,
|
|
71
|
+
): PagePromise<UsersCursor, User> {
|
|
72
|
+
return this._client.getAPIList(path`/accounts/${accountID}/users`, Cursor<User>, { query, ...options });
|
|
73
|
+
}
|
|
74
|
+
|
|
53
75
|
/**
|
|
54
76
|
* Deletes a user.
|
|
55
77
|
*
|
|
@@ -88,6 +110,8 @@ export class Users extends APIResource {
|
|
|
88
110
|
}
|
|
89
111
|
}
|
|
90
112
|
|
|
113
|
+
export type UsersCursor = Cursor<User>;
|
|
114
|
+
|
|
91
115
|
/**
|
|
92
116
|
* A user of the app
|
|
93
117
|
*/
|
|
@@ -172,6 +196,8 @@ export interface UserUpdateParams {
|
|
|
172
196
|
photo_url?: string;
|
|
173
197
|
}
|
|
174
198
|
|
|
199
|
+
export interface UserListParams extends CursorParams {}
|
|
200
|
+
|
|
175
201
|
export interface UserCreateTokenParams {
|
|
176
202
|
/**
|
|
177
203
|
* For how many seconds the token should be accepted. Defaults to 15 minutes.
|
|
@@ -183,8 +209,10 @@ export declare namespace Users {
|
|
|
183
209
|
export {
|
|
184
210
|
type User as User,
|
|
185
211
|
type UserTokenResponse as UserTokenResponse,
|
|
212
|
+
type UsersCursor as UsersCursor,
|
|
186
213
|
type UserCreateParams as UserCreateParams,
|
|
187
214
|
type UserUpdateParams as UserUpdateParams,
|
|
215
|
+
type UserListParams as UserListParams,
|
|
188
216
|
type UserCreateTokenParams as UserCreateTokenParams,
|
|
189
217
|
};
|
|
190
218
|
}
|
|
@@ -699,6 +699,56 @@ export namespace MessageSentWebhookEvent {
|
|
|
699
699
|
}
|
|
700
700
|
}
|
|
701
701
|
|
|
702
|
+
export interface PhoneNumberAttachedToCampaignWebhookEvent {
|
|
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: PhoneNumberAttachedToCampaignWebhookEvent.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 `phone_number.attached_to_campaign` for this
|
|
720
|
+
* event.
|
|
721
|
+
*/
|
|
722
|
+
type: 'phone_number.attached_to_campaign';
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
export namespace PhoneNumberAttachedToCampaignWebhookEvent {
|
|
726
|
+
/**
|
|
727
|
+
* The data associated with the event
|
|
728
|
+
*/
|
|
729
|
+
export interface Data {
|
|
730
|
+
/**
|
|
731
|
+
* The unique identifier for the phone number
|
|
732
|
+
*/
|
|
733
|
+
id: string;
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* The unique identifier of the campaign this phone number is attached to
|
|
737
|
+
*/
|
|
738
|
+
campaign_id: string;
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* The phone number in E.164 format
|
|
742
|
+
*/
|
|
743
|
+
number: string;
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Whether the phone number is local, toll-free, or short code
|
|
747
|
+
*/
|
|
748
|
+
type: 'local' | 'short_code' | 'toll_free';
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
|
|
702
752
|
export interface RecordingCompletedWebhookEvent {
|
|
703
753
|
/**
|
|
704
754
|
* The ID of the account in which this event occurred
|
|
@@ -885,6 +935,7 @@ export type UnwrapWebhookEvent =
|
|
|
885
935
|
| MessageFailedWebhookEvent
|
|
886
936
|
| MessageReceivedWebhookEvent
|
|
887
937
|
| MessageSentWebhookEvent
|
|
938
|
+
| PhoneNumberAttachedToCampaignWebhookEvent
|
|
888
939
|
| RecordingCompletedWebhookEvent
|
|
889
940
|
| VoicemailReceivedWebhookEvent;
|
|
890
941
|
|
|
@@ -900,6 +951,7 @@ export declare namespace Webhooks {
|
|
|
900
951
|
type MessageFailedWebhookEvent as MessageFailedWebhookEvent,
|
|
901
952
|
type MessageReceivedWebhookEvent as MessageReceivedWebhookEvent,
|
|
902
953
|
type MessageSentWebhookEvent as MessageSentWebhookEvent,
|
|
954
|
+
type PhoneNumberAttachedToCampaignWebhookEvent as PhoneNumberAttachedToCampaignWebhookEvent,
|
|
903
955
|
type RecordingCompletedWebhookEvent as RecordingCompletedWebhookEvent,
|
|
904
956
|
type VoicemailReceivedWebhookEvent as VoicemailReceivedWebhookEvent,
|
|
905
957
|
type UnwrapWebhookEvent as UnwrapWebhookEvent,
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.39.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.39.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.39.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.39.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|