@surgeapi/node 0.38.0 → 0.40.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 +40 -0
- package/README.md +8 -8
- package/client.d.mts +7 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +7 -4
- package/client.d.ts.map +1 -1
- package/client.js +3 -0
- package/client.js.map +1 -1
- package/client.mjs +4 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/accounts.d.mts +21 -21
- package/resources/accounts.d.mts.map +1 -1
- package/resources/accounts.d.ts +21 -21
- package/resources/accounts.d.ts.map +1 -1
- package/resources/audiences.d.mts +49 -0
- package/resources/audiences.d.mts.map +1 -0
- package/resources/audiences.d.ts +49 -0
- package/resources/audiences.d.ts.map +1 -0
- package/resources/audiences.js +45 -0
- package/resources/audiences.js.map +1 -0
- package/resources/audiences.mjs +41 -0
- package/resources/audiences.mjs.map +1 -0
- 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/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/src/client.ts +26 -1
- package/src/resources/accounts.ts +21 -21
- package/src/resources/audiences.ts +74 -0
- package/src/resources/index.ts +12 -1
- package/src/resources/recordings.ts +169 -0
- package/src/resources/users.ts +28 -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
|
@@ -0,0 +1,74 @@
|
|
|
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 { ContactsCursor } from './contacts';
|
|
6
|
+
import { APIPromise } from '../core/api-promise';
|
|
7
|
+
import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
|
|
8
|
+
import { RequestOptions } from '../internal/request-options';
|
|
9
|
+
import { path } from '../internal/utils/path';
|
|
10
|
+
|
|
11
|
+
export class Audiences extends APIResource {
|
|
12
|
+
/**
|
|
13
|
+
* Adds an existing contact to a manual audience.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const contact = await client.audiences.addContact(
|
|
18
|
+
* 'aud_01j9a43avnfqzbjfch6pygv1td',
|
|
19
|
+
* { id: 'ctc_01j9dy8mdzfn3r0e8x1tbdrdrf' },
|
|
20
|
+
* );
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
addContact(
|
|
24
|
+
audienceID: string,
|
|
25
|
+
body: AudienceAddContactParams,
|
|
26
|
+
options?: RequestOptions,
|
|
27
|
+
): APIPromise<ContactsAPI.Contact> {
|
|
28
|
+
return this._client.post(path`/audiences/${audienceID}/contacts`, { body, ...options });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* List all contacts in an audience with cursor-based pagination. The account is
|
|
33
|
+
* inferred from the audience.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* // Automatically fetches more pages as needed.
|
|
38
|
+
* for await (const contact of client.audiences.listContacts(
|
|
39
|
+
* 'aud_01j9a43avnfqzbjfch6pygv1td',
|
|
40
|
+
* )) {
|
|
41
|
+
* // ...
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
listContacts(
|
|
46
|
+
audienceID: string,
|
|
47
|
+
query: AudienceListContactsParams | null | undefined = {},
|
|
48
|
+
options?: RequestOptions,
|
|
49
|
+
): PagePromise<ContactsCursor, ContactsAPI.Contact> {
|
|
50
|
+
return this._client.getAPIList(path`/audiences/${audienceID}/contacts`, Cursor<ContactsAPI.Contact>, {
|
|
51
|
+
query,
|
|
52
|
+
...options,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface AudienceAddContactParams {
|
|
58
|
+
/**
|
|
59
|
+
* The ID of the contact to add. The contact must belong to the same account as the
|
|
60
|
+
* audience.
|
|
61
|
+
*/
|
|
62
|
+
id: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface AudienceListContactsParams extends CursorParams {}
|
|
66
|
+
|
|
67
|
+
export declare namespace Audiences {
|
|
68
|
+
export {
|
|
69
|
+
type AudienceAddContactParams as AudienceAddContactParams,
|
|
70
|
+
type AudienceListContactsParams as AudienceListContactsParams,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { type ContactsCursor };
|
package/src/resources/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ export {
|
|
|
10
10
|
type AccountUpdateParams,
|
|
11
11
|
type AccountRetrieveStatusParams,
|
|
12
12
|
} from './accounts';
|
|
13
|
+
export { Audiences, type AudienceAddContactParams, type AudienceListContactsParams } from './audiences';
|
|
13
14
|
export { Blasts, type Blast, type BlastCreateParams } from './blasts';
|
|
14
15
|
export {
|
|
15
16
|
Campaigns,
|
|
@@ -40,14 +41,24 @@ export {
|
|
|
40
41
|
type PhoneNumberPurchaseParams,
|
|
41
42
|
type PhoneNumbersCursor,
|
|
42
43
|
} from './phone-numbers';
|
|
43
|
-
export {
|
|
44
|
+
export {
|
|
45
|
+
Recordings,
|
|
46
|
+
type RecordingRetrieveResponse,
|
|
47
|
+
type RecordingListResponse,
|
|
48
|
+
type RecordingDeleteResponse,
|
|
49
|
+
type RecordingGetFileResponse,
|
|
50
|
+
type RecordingListParams,
|
|
51
|
+
type RecordingListResponsesCursor,
|
|
52
|
+
} from './recordings';
|
|
44
53
|
export {
|
|
45
54
|
Users,
|
|
46
55
|
type User,
|
|
47
56
|
type UserTokenResponse,
|
|
48
57
|
type UserCreateParams,
|
|
49
58
|
type UserUpdateParams,
|
|
59
|
+
type UserListParams,
|
|
50
60
|
type UserCreateTokenParams,
|
|
61
|
+
type UsersCursor,
|
|
51
62
|
} from './users';
|
|
52
63
|
export {
|
|
53
64
|
Verifications,
|
|
@@ -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
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.40.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.40.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.40.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.40.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|