@surgeapi/node 0.38.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.
@@ -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
  }
@@ -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.38.0'; // x-release-please-version
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.38.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.38.0";
1
+ export declare const VERSION = "0.39.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.38.0'; // x-release-please-version
4
+ exports.VERSION = '0.39.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.38.0'; // x-release-please-version
1
+ export const VERSION = '0.39.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map