@dereekb/zoom 12.1.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/LICENSE +21 -0
- package/README.md +6 -0
- package/index.cjs.d.ts +1 -0
- package/index.cjs.js +4346 -0
- package/index.esm.d.ts +1 -0
- package/index.esm.js +4293 -0
- package/nestjs/CHANGELOG.md +183 -0
- package/nestjs/README.md +11 -0
- package/nestjs/package.json +7 -0
- package/nestjs/src/index.d.ts +1 -0
- package/nestjs/src/index.js +5 -0
- package/nestjs/src/index.js.map +1 -0
- package/nestjs/src/lib/index.d.ts +2 -0
- package/nestjs/src/lib/index.js +6 -0
- package/nestjs/src/lib/index.js.map +1 -0
- package/nestjs/src/lib/oauth/index.d.ts +3 -0
- package/nestjs/src/lib/oauth/index.js +7 -0
- package/nestjs/src/lib/oauth/index.js.map +1 -0
- package/nestjs/src/lib/oauth/oauth.api.d.ts +12 -0
- package/nestjs/src/lib/oauth/oauth.api.js +41 -0
- package/nestjs/src/lib/oauth/oauth.api.js.map +1 -0
- package/nestjs/src/lib/oauth/oauth.config.d.ts +14 -0
- package/nestjs/src/lib/oauth/oauth.config.js +50 -0
- package/nestjs/src/lib/oauth/oauth.config.js.map +1 -0
- package/nestjs/src/lib/oauth/oauth.module.d.ts +29 -0
- package/nestjs/src/lib/oauth/oauth.module.js +36 -0
- package/nestjs/src/lib/oauth/oauth.module.js.map +1 -0
- package/nestjs/src/lib/oauth/oauth.service.d.ts +55 -0
- package/nestjs/src/lib/oauth/oauth.service.js +226 -0
- package/nestjs/src/lib/oauth/oauth.service.js.map +1 -0
- package/nestjs/src/lib/zoom/index.d.ts +3 -0
- package/nestjs/src/lib/zoom/index.js +7 -0
- package/nestjs/src/lib/zoom/index.js.map +1 -0
- package/nestjs/src/lib/zoom/zoom.api.d.ts +21 -0
- package/nestjs/src/lib/zoom/zoom.api.js +65 -0
- package/nestjs/src/lib/zoom/zoom.api.js.map +1 -0
- package/nestjs/src/lib/zoom/zoom.config.d.ts +10 -0
- package/nestjs/src/lib/zoom/zoom.config.js +15 -0
- package/nestjs/src/lib/zoom/zoom.config.js.map +1 -0
- package/nestjs/src/lib/zoom/zoom.module.d.ts +22 -0
- package/nestjs/src/lib/zoom/zoom.module.js +40 -0
- package/nestjs/src/lib/zoom/zoom.module.js.map +1 -0
- package/package.json +31 -0
- package/src/index.d.ts +1 -0
- package/src/lib/index.d.ts +7 -0
- package/src/lib/oauth/index.d.ts +5 -0
- package/src/lib/oauth/oauth.api.d.ts +39 -0
- package/src/lib/oauth/oauth.config.d.ts +44 -0
- package/src/lib/oauth/oauth.d.ts +71 -0
- package/src/lib/oauth/oauth.error.api.d.ts +30 -0
- package/src/lib/oauth/oauth.factory.d.ts +34 -0
- package/src/lib/zoom/index.d.ts +7 -0
- package/src/lib/zoom/zoom.api.meeting.d.ts +144 -0
- package/src/lib/zoom/zoom.api.meeting.type.d.ts +297 -0
- package/src/lib/zoom/zoom.api.user.d.ts +32 -0
- package/src/lib/zoom/zoom.api.user.type.d.ts +287 -0
- package/src/lib/zoom/zoom.config.d.ts +69 -0
- package/src/lib/zoom/zoom.error.api.d.ts +6 -0
- package/src/lib/zoom/zoom.factory.d.ts +23 -0
- package/src/lib/zoom.api.page.d.ts +73 -0
- package/src/lib/zoom.config.d.ts +39 -0
- package/src/lib/zoom.error.api.d.ts +145 -0
- package/src/lib/zoom.limit.d.ts +37 -0
- package/src/lib/zoom.type.d.ts +12 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { EmailAddress, ISO8601DateStringUTCFull, TimezoneString } from '@dereekb/util';
|
|
2
|
+
import { ZoomClientVersion, ZoomUserId } from '../zoom.type';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a Zoom user, as returned by the Zoom API.
|
|
5
|
+
*/
|
|
6
|
+
export interface ZoomUser {
|
|
7
|
+
/**
|
|
8
|
+
* The user's ID. Not returned for users with 'pending' status.
|
|
9
|
+
*
|
|
10
|
+
* @example "KDcuGIm1QgePTO8WbOqwIQ"
|
|
11
|
+
*/
|
|
12
|
+
readonly id: ZoomUserId;
|
|
13
|
+
/**
|
|
14
|
+
* The date and time when this user's latest login type was created.
|
|
15
|
+
*
|
|
16
|
+
* @example "2018-10-31T04:32:37Z"
|
|
17
|
+
*/
|
|
18
|
+
readonly created_at: ISO8601DateStringUTCFull;
|
|
19
|
+
/**
|
|
20
|
+
* The date and time when this user was created.
|
|
21
|
+
*
|
|
22
|
+
* @example "2019-06-01T07:58:03Z"
|
|
23
|
+
*/
|
|
24
|
+
readonly user_created_at: ISO8601DateStringUTCFull;
|
|
25
|
+
/**
|
|
26
|
+
* The user's department.
|
|
27
|
+
*
|
|
28
|
+
* @example "Developers"
|
|
29
|
+
*/
|
|
30
|
+
readonly dept?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The user's first name.
|
|
33
|
+
*
|
|
34
|
+
* @example "Jill"
|
|
35
|
+
*/
|
|
36
|
+
readonly first_name: string;
|
|
37
|
+
/**
|
|
38
|
+
* The user's last name.
|
|
39
|
+
*
|
|
40
|
+
* @example "Chill"
|
|
41
|
+
*/
|
|
42
|
+
readonly last_name: string;
|
|
43
|
+
/**
|
|
44
|
+
* The user's email address.
|
|
45
|
+
*
|
|
46
|
+
* @example "jchill@example.com"
|
|
47
|
+
*/
|
|
48
|
+
readonly email: EmailAddress;
|
|
49
|
+
/**
|
|
50
|
+
* The employee's unique ID. Only returned when SAML SSO is enabled and login_type is 101 (SSO).
|
|
51
|
+
*
|
|
52
|
+
* @example "HqDyI037Qjili1kNsSIrIg"
|
|
53
|
+
*/
|
|
54
|
+
readonly employee_unique_id?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The IDs of groups where the user is a member.
|
|
57
|
+
*/
|
|
58
|
+
readonly group_ids: string[];
|
|
59
|
+
/**
|
|
60
|
+
* The user's host key. Only returned if assigned and requested via include_fields.
|
|
61
|
+
*/
|
|
62
|
+
readonly host_key?: string;
|
|
63
|
+
/**
|
|
64
|
+
* The IDs of IM directory groups where the user is a member.
|
|
65
|
+
*/
|
|
66
|
+
readonly im_group_ids: string[];
|
|
67
|
+
/**
|
|
68
|
+
* The last client version that user used to log in.
|
|
69
|
+
*
|
|
70
|
+
* @example "5.2.45120.0906(win)"
|
|
71
|
+
*/
|
|
72
|
+
readonly last_client_version: ZoomClientVersion;
|
|
73
|
+
/**
|
|
74
|
+
* The user's last login time. Has a three-day buffer period.
|
|
75
|
+
*
|
|
76
|
+
* @example "2022-03-25T05:40:55Z"
|
|
77
|
+
*/
|
|
78
|
+
readonly last_login_time: ISO8601DateStringUTCFull;
|
|
79
|
+
/**
|
|
80
|
+
* Returned if the user is enrolled in the Zoom United plan. See docs for enum values.
|
|
81
|
+
* @example "1"
|
|
82
|
+
*/
|
|
83
|
+
readonly plan_united_type?: ZoomUserPlanUnitedType;
|
|
84
|
+
/**
|
|
85
|
+
* The user's personal meeting ID (PMI).
|
|
86
|
+
* @example 6589310093
|
|
87
|
+
*/
|
|
88
|
+
readonly pmi: ZoomUserPersonalMeetingId;
|
|
89
|
+
/**
|
|
90
|
+
* The unique ID of the user's assigned role.
|
|
91
|
+
* @example "0"
|
|
92
|
+
*/
|
|
93
|
+
readonly role_id: ZoomUserRoleId;
|
|
94
|
+
/**
|
|
95
|
+
* The user's status: 'active', 'inactive', or 'pending'.
|
|
96
|
+
* @example "active"
|
|
97
|
+
*/
|
|
98
|
+
readonly status: ZoomUserStatus;
|
|
99
|
+
/**
|
|
100
|
+
* The user's timezone.
|
|
101
|
+
* @example "Asia/Shanghai"
|
|
102
|
+
*/
|
|
103
|
+
readonly timezone: TimezoneString;
|
|
104
|
+
/**
|
|
105
|
+
* The user's assigned plan type. 1 - Basic, 2 - Licensed, 4 - Unassigned, 99 - None (ssoCreate only).
|
|
106
|
+
*
|
|
107
|
+
* @example 1
|
|
108
|
+
*/
|
|
109
|
+
readonly type: ZoomUserType;
|
|
110
|
+
/**
|
|
111
|
+
* Whether the user's email address is verified.
|
|
112
|
+
*/
|
|
113
|
+
readonly verified: ZoomUserVerified;
|
|
114
|
+
/**
|
|
115
|
+
* The information about the user's custom attributes.
|
|
116
|
+
* This field is only returned if users are assigned custom attributes and you provided the `custom_attributes` value for the `include_fields` query parameter in the API request.
|
|
117
|
+
*/
|
|
118
|
+
readonly custom_attributes?: ZoomUserCustomAttribute[];
|
|
119
|
+
/**
|
|
120
|
+
* The user's display name.
|
|
121
|
+
*/
|
|
122
|
+
readonly display_name: string;
|
|
123
|
+
/**
|
|
124
|
+
* The user's role name (e.g., 'Owner').
|
|
125
|
+
*/
|
|
126
|
+
readonly role_name: string;
|
|
127
|
+
/**
|
|
128
|
+
* Whether to use PMI for instant meetings.
|
|
129
|
+
*/
|
|
130
|
+
readonly use_pmi: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* The user's personal meeting URL.
|
|
133
|
+
*/
|
|
134
|
+
readonly personal_meeting_url: string;
|
|
135
|
+
/**
|
|
136
|
+
* The user's profile picture URL.
|
|
137
|
+
*/
|
|
138
|
+
readonly pic_url: string;
|
|
139
|
+
/**
|
|
140
|
+
* The user's CMS user ID (may be empty).
|
|
141
|
+
*/
|
|
142
|
+
readonly cms_user_id?: string;
|
|
143
|
+
/**
|
|
144
|
+
* The user's XMPP JID (may be empty).
|
|
145
|
+
*/
|
|
146
|
+
readonly jid?: string;
|
|
147
|
+
/**
|
|
148
|
+
* The user's account ID.
|
|
149
|
+
*/
|
|
150
|
+
readonly account_id: string;
|
|
151
|
+
/**
|
|
152
|
+
* The user's language (e.g., 'en-US').
|
|
153
|
+
*/
|
|
154
|
+
readonly language: string;
|
|
155
|
+
/**
|
|
156
|
+
* The user's phone country code (may be empty).
|
|
157
|
+
*/
|
|
158
|
+
readonly phone_country?: string;
|
|
159
|
+
/**
|
|
160
|
+
* The user's phone number (may be empty).
|
|
161
|
+
*/
|
|
162
|
+
readonly phone_number?: string;
|
|
163
|
+
/**
|
|
164
|
+
* The user's job title (may be empty).
|
|
165
|
+
*/
|
|
166
|
+
readonly job_title?: string;
|
|
167
|
+
/**
|
|
168
|
+
* The user's cost center (may be empty).
|
|
169
|
+
*/
|
|
170
|
+
readonly cost_center?: string;
|
|
171
|
+
/**
|
|
172
|
+
* The user's location (may be empty).
|
|
173
|
+
*/
|
|
174
|
+
readonly location?: string;
|
|
175
|
+
/**
|
|
176
|
+
* The user's login types (array of numbers).
|
|
177
|
+
*/
|
|
178
|
+
readonly login_types: number[];
|
|
179
|
+
/**
|
|
180
|
+
* The user's cluster (e.g., 'us05').
|
|
181
|
+
*/
|
|
182
|
+
readonly cluster: string;
|
|
183
|
+
/**
|
|
184
|
+
* The user's manager (email address).
|
|
185
|
+
*/
|
|
186
|
+
readonly manager?: string;
|
|
187
|
+
/**
|
|
188
|
+
* The user's phone numbers (new format, array of objects).
|
|
189
|
+
*/
|
|
190
|
+
readonly phone_numbers?: ZoomUserPhoneNumber[];
|
|
191
|
+
/**
|
|
192
|
+
* The user's pronouns.
|
|
193
|
+
*/
|
|
194
|
+
readonly pronouns?: string;
|
|
195
|
+
/**
|
|
196
|
+
* The user's display pronouns setting.
|
|
197
|
+
*/
|
|
198
|
+
readonly pronouns_option?: number;
|
|
199
|
+
/**
|
|
200
|
+
* The user's vanity URL (personal meeting room URL).
|
|
201
|
+
*/
|
|
202
|
+
readonly vanity_url?: string;
|
|
203
|
+
/**
|
|
204
|
+
* The user's account number.
|
|
205
|
+
*/
|
|
206
|
+
readonly account_number?: number;
|
|
207
|
+
/**
|
|
208
|
+
* The user's company.
|
|
209
|
+
*/
|
|
210
|
+
readonly company?: string;
|
|
211
|
+
/**
|
|
212
|
+
* The user's Zoom Workplace/Zoom One plan option.
|
|
213
|
+
*/
|
|
214
|
+
readonly zoom_one_type?: number;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Represents a user's phone number object in the new phone_numbers format.
|
|
218
|
+
*/
|
|
219
|
+
export interface ZoomUserPhoneNumber {
|
|
220
|
+
/**
|
|
221
|
+
* The phone number's ISO country code.
|
|
222
|
+
*
|
|
223
|
+
* @example "US"
|
|
224
|
+
*/
|
|
225
|
+
readonly code: string;
|
|
226
|
+
/**
|
|
227
|
+
* The phone number's country ID (e.g., 'US').
|
|
228
|
+
*
|
|
229
|
+
* @example "US"
|
|
230
|
+
*/
|
|
231
|
+
readonly country: string;
|
|
232
|
+
/**
|
|
233
|
+
* The phone number's label (Mobile, Office, Home, Fax).
|
|
234
|
+
*
|
|
235
|
+
* @example "Mobile"
|
|
236
|
+
*/
|
|
237
|
+
readonly label: 'Mobile' | 'Office' | 'Home' | 'Fax' | string;
|
|
238
|
+
/**
|
|
239
|
+
* The user's phone number.
|
|
240
|
+
*
|
|
241
|
+
* @example "5550100"
|
|
242
|
+
*/
|
|
243
|
+
readonly number: string;
|
|
244
|
+
/**
|
|
245
|
+
* Whether Zoom has verified the phone number.
|
|
246
|
+
*
|
|
247
|
+
* @example true
|
|
248
|
+
*/
|
|
249
|
+
readonly verified: boolean;
|
|
250
|
+
}
|
|
251
|
+
export type ZoomUserPersonalMeetingId = number;
|
|
252
|
+
export type ZoomUserRoleId = string;
|
|
253
|
+
export type ZoomUserStatus = 'active' | 'inactive' | 'pending';
|
|
254
|
+
export declare enum ZoomUserType {
|
|
255
|
+
Basic = 1,
|
|
256
|
+
Licensed = 2,
|
|
257
|
+
Unassigned = 4,
|
|
258
|
+
None = 99
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Whether the user's email address is verified.
|
|
262
|
+
*
|
|
263
|
+
* 1 - verified, 0 - not verified.
|
|
264
|
+
*/
|
|
265
|
+
export type ZoomUserVerified = 1 | 0;
|
|
266
|
+
/**
|
|
267
|
+
* Custom attribute for a Zoom user.
|
|
268
|
+
*/
|
|
269
|
+
export interface ZoomUserCustomAttribute {
|
|
270
|
+
/**
|
|
271
|
+
* The custom attribute's unique ID.
|
|
272
|
+
*/
|
|
273
|
+
readonly key: string;
|
|
274
|
+
/**
|
|
275
|
+
* The custom attribute's name.
|
|
276
|
+
*/
|
|
277
|
+
readonly name: string;
|
|
278
|
+
/**
|
|
279
|
+
* The custom attribute's value.
|
|
280
|
+
*/
|
|
281
|
+
readonly value: string;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Enum for plan_united_type field.
|
|
285
|
+
* See Zoom API documentation for details.
|
|
286
|
+
*/
|
|
287
|
+
export type ZoomUserPlanUnitedType = '1' | '2' | '4' | '8' | '16' | '32' | '64' | '128' | '256' | '512' | '1024' | '2048' | '4096' | '8192' | '16384' | '32768' | '65536' | '131072';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { FactoryWithInput, FactoryWithRequiredInput, Maybe } from '@dereekb/util';
|
|
2
|
+
import { ConfiguredFetch, FetchJsonFunction } from '@dereekb/util/fetch';
|
|
3
|
+
import { ZoomConfig, ZoomRefreshToken } from '../zoom.config';
|
|
4
|
+
import { ZoomRateLimiterRef } from '../zoom.limit';
|
|
5
|
+
import { ZoomAccessTokenCache, ZoomAccessTokenStringFactory } from '../oauth/oauth';
|
|
6
|
+
export type ZoomApiKey = ZoomRefreshToken;
|
|
7
|
+
export interface ZoomFetchFactoryInput {
|
|
8
|
+
readonly zoomAccessTokenStringFactory: ZoomAccessTokenStringFactory;
|
|
9
|
+
}
|
|
10
|
+
export type ZoomFetchFactory = FactoryWithInput<ConfiguredFetch, ZoomFetchFactoryInput>;
|
|
11
|
+
/**
|
|
12
|
+
* Denotes the type of authorization used by the ZoomContext.
|
|
13
|
+
*
|
|
14
|
+
* - 'server': Uses Server to Server authorization
|
|
15
|
+
* - 'user': Uses User to Server authorization
|
|
16
|
+
*/
|
|
17
|
+
export type ZoomContextType = 'server' | 'user';
|
|
18
|
+
/**
|
|
19
|
+
* A zoom context that can send requests to the Zoom API.
|
|
20
|
+
*/
|
|
21
|
+
export interface ZoomContext extends ZoomRateLimiterRef {
|
|
22
|
+
/**
|
|
23
|
+
* Type of context this is.
|
|
24
|
+
*/
|
|
25
|
+
readonly type: ZoomContextType;
|
|
26
|
+
/**
|
|
27
|
+
* Performs a fetch as the server.
|
|
28
|
+
*/
|
|
29
|
+
readonly fetch: ConfiguredFetch;
|
|
30
|
+
/**
|
|
31
|
+
* Performs a json fetch as the server.
|
|
32
|
+
*/
|
|
33
|
+
readonly fetchJson: FetchJsonFunction;
|
|
34
|
+
}
|
|
35
|
+
export interface ZoomServerContext extends ZoomContext {
|
|
36
|
+
readonly type: 'server';
|
|
37
|
+
readonly serverFetch: ConfiguredFetch;
|
|
38
|
+
readonly serverFetchJson: FetchJsonFunction;
|
|
39
|
+
readonly makeUserContext: ZoomUserContextFactory;
|
|
40
|
+
readonly config: ZoomConfig;
|
|
41
|
+
}
|
|
42
|
+
export interface ZoomUserContextFactoryInput {
|
|
43
|
+
/**
|
|
44
|
+
* The user's refresh token.
|
|
45
|
+
*/
|
|
46
|
+
readonly refreshToken: ZoomRefreshToken;
|
|
47
|
+
/**
|
|
48
|
+
* Optional cache to use for the user's access token.
|
|
49
|
+
*
|
|
50
|
+
* The cache should only be configured for the user that owns the refresh token.
|
|
51
|
+
*/
|
|
52
|
+
readonly accessTokenCache?: Maybe<ZoomAccessTokenCache>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Creates a ZoomUserContext from the input.
|
|
56
|
+
*/
|
|
57
|
+
export type ZoomUserContextFactory = FactoryWithRequiredInput<ZoomUserContext, ZoomUserContextFactoryInput>;
|
|
58
|
+
/**
|
|
59
|
+
* Context used for performing fetch requests for a specific user.
|
|
60
|
+
*/
|
|
61
|
+
export interface ZoomUserContext extends ZoomContext {
|
|
62
|
+
readonly type: 'user';
|
|
63
|
+
readonly zoomServerContext: ZoomServerContext;
|
|
64
|
+
readonly userFetch: ConfiguredFetch;
|
|
65
|
+
readonly userFetchJson: FetchJsonFunction;
|
|
66
|
+
}
|
|
67
|
+
export interface ZoomServerContextRef {
|
|
68
|
+
readonly zoomServerContext: ZoomServerContext;
|
|
69
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FetchResponseError } from '@dereekb/util/fetch';
|
|
2
|
+
import { ZoomServerErrorData, ParsedZoomServerError } from '../zoom.error.api';
|
|
3
|
+
export declare const logZoomErrorToConsole: import("../zoom.error.api").LogZoomServerErrorFunction;
|
|
4
|
+
export declare function parseZoomApiError(responseError: FetchResponseError): Promise<ParsedZoomServerError>;
|
|
5
|
+
export declare function parseZoomApiServerErrorResponseData(zoomServerError: ZoomServerErrorData, responseError: FetchResponseError): ParsedZoomServerError;
|
|
6
|
+
export declare const handleZoomErrorFetch: import("../zoom.error.api").HandleZoomErrorFetchFactory;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ZoomServerContextRef, ZoomFetchFactory } from './zoom.config';
|
|
2
|
+
import { LogZoomServerErrorFunction } from '../zoom.error.api';
|
|
3
|
+
import { ZoomOAuthContextRef } from '../oauth/oauth.config';
|
|
4
|
+
import { ZoomRateLimitedFetchHandlerConfig } from '../zoom.limit';
|
|
5
|
+
import { type Maybe } from '@dereekb/util';
|
|
6
|
+
import { ZoomConfig } from '../zoom.config';
|
|
7
|
+
export type Zoom = ZoomServerContextRef;
|
|
8
|
+
export interface ZoomFactoryConfig extends ZoomOAuthContextRef {
|
|
9
|
+
/**
|
|
10
|
+
* Custom ZoomRateLimitedFetchHandlerConfig
|
|
11
|
+
*/
|
|
12
|
+
readonly rateLimiterConfig?: Maybe<ZoomRateLimitedFetchHandlerConfig>;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new fetch instance to use when making calls.
|
|
15
|
+
*/
|
|
16
|
+
readonly fetchFactory?: ZoomFetchFactory;
|
|
17
|
+
/**
|
|
18
|
+
* Custom log error function.
|
|
19
|
+
*/
|
|
20
|
+
readonly logZoomServerErrorFunction?: LogZoomServerErrorFunction;
|
|
21
|
+
}
|
|
22
|
+
export type ZoomFactory = (config: ZoomConfig) => Zoom;
|
|
23
|
+
export declare function zoomFactory(factoryConfig: ZoomFactoryConfig): ZoomFactory;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Maybe, PageNumber } from '@dereekb/util';
|
|
2
|
+
import { FetchPageFactoryConfigDefaults } from '@dereekb/util/fetch';
|
|
3
|
+
/**
|
|
4
|
+
* Base page filter
|
|
5
|
+
*/
|
|
6
|
+
export interface ZoomPageFilter {
|
|
7
|
+
readonly page_number?: number;
|
|
8
|
+
readonly page_size?: number;
|
|
9
|
+
readonly next_page_token?: string;
|
|
10
|
+
}
|
|
11
|
+
export type MapToZoomPageResultFunction<T> = (data: any) => ZoomPageResult<T>;
|
|
12
|
+
/**
|
|
13
|
+
* The Zoom API returns the data for a page for a specific key.
|
|
14
|
+
*
|
|
15
|
+
* This function maps the data under that key to a ZoomPageResult with the data on the "data" variable.
|
|
16
|
+
|
|
17
|
+
* @param dataTypeKey
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare function mapToZoomPageResult<T>(dataTypeKey: string): MapToZoomPageResultFunction<T>;
|
|
21
|
+
export interface ZoomDataArrayResultRef<T> {
|
|
22
|
+
/**
|
|
23
|
+
* Array of data returned.
|
|
24
|
+
*/
|
|
25
|
+
readonly data: T[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Page result that contains an array of data and page information.
|
|
29
|
+
*/
|
|
30
|
+
export interface ZoomPageResult<T> extends ZoomDataArrayResultRef<T>, ZoomPageResultInfo {
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Cursor for pagination.
|
|
34
|
+
*/
|
|
35
|
+
export type ZoomPageResultToken = string;
|
|
36
|
+
/**
|
|
37
|
+
* Page information within a ZoomPageResult
|
|
38
|
+
*/
|
|
39
|
+
export interface ZoomPageResultInfo {
|
|
40
|
+
/**
|
|
41
|
+
* Use the next page token to paginate through large result sets. A next page token will be returned whenever the set of available results exceeds the current page size. This token's expiration period is 15 minutes.
|
|
42
|
+
*/
|
|
43
|
+
readonly next_page_token: ZoomPageResultToken;
|
|
44
|
+
/**
|
|
45
|
+
* The number of pages returned for the request made.
|
|
46
|
+
*
|
|
47
|
+
* Possibly undefined for some calls.
|
|
48
|
+
*/
|
|
49
|
+
readonly page_count?: number | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* The page number of the current results.
|
|
52
|
+
*
|
|
53
|
+
* Possibly undefined for some calls.
|
|
54
|
+
*/
|
|
55
|
+
readonly page_number?: PageNumber | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* The number of records returned with a single API call.
|
|
58
|
+
*/
|
|
59
|
+
readonly page_size: number;
|
|
60
|
+
/**
|
|
61
|
+
* The total number of all the records available across pages.
|
|
62
|
+
*/
|
|
63
|
+
readonly total_records: number;
|
|
64
|
+
}
|
|
65
|
+
export type ZoomFetchPageFetchFunction<I extends ZoomPageFilter, R extends ZoomPageResult<any>> = (input: I) => Promise<R>;
|
|
66
|
+
/**
|
|
67
|
+
* Creates a FetchPageFactory using the input ZoomFetchPageFetchFunction.
|
|
68
|
+
*
|
|
69
|
+
* @param fetch
|
|
70
|
+
* @param defaults
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
73
|
+
export declare function zoomFetchPageFactory<I extends ZoomPageFilter, R extends ZoomPageResult<any>>(fetch: ZoomFetchPageFetchFunction<I, R>, defaults?: Maybe<FetchPageFactoryConfigDefaults>): import("@dereekb/util/fetch").FetchPageFactory<I, R>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Zoom API URL for the US datacenter.
|
|
3
|
+
*/
|
|
4
|
+
export declare const ZOOM_API_URL = "https://api.zoom.us/v2";
|
|
5
|
+
/**
|
|
6
|
+
* Url for the Zoom API.
|
|
7
|
+
*/
|
|
8
|
+
export type ZoomApiUrl = typeof ZOOM_API_URL;
|
|
9
|
+
/**
|
|
10
|
+
* Zoom Server Account ID used to identify a specific Zoom account.
|
|
11
|
+
*
|
|
12
|
+
* Can be found on the Server to Server app build page.
|
|
13
|
+
*/
|
|
14
|
+
export type ZoomAccountId = string;
|
|
15
|
+
/**
|
|
16
|
+
* Non-expiring refresh token used to retrieve access tokens for performing API calls.
|
|
17
|
+
*
|
|
18
|
+
* https://www.zoom.com/recruit/developer-guide/apiv2/oauth-overview.html
|
|
19
|
+
*
|
|
20
|
+
* Is in the format of "1000.abc.123"
|
|
21
|
+
*/
|
|
22
|
+
export type ZoomRefreshToken = string;
|
|
23
|
+
/**
|
|
24
|
+
* OAuth Client Id
|
|
25
|
+
*/
|
|
26
|
+
export type ZoomOAuthClientId = string;
|
|
27
|
+
/**
|
|
28
|
+
* OAuth Client Secret
|
|
29
|
+
*/
|
|
30
|
+
export type ZoomOAuthClientSecret = string;
|
|
31
|
+
export interface ZoomAccountIdRef {
|
|
32
|
+
readonly accountId: ZoomAccountId;
|
|
33
|
+
}
|
|
34
|
+
export interface ZoomAuthClientIdAndSecretPair {
|
|
35
|
+
readonly clientId: ZoomOAuthClientId;
|
|
36
|
+
readonly clientSecret: ZoomOAuthClientSecret;
|
|
37
|
+
}
|
|
38
|
+
export interface ZoomConfig {
|
|
39
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { ArrayOrValue, Maybe, UnixDateTimeNumber } from '@dereekb/util';
|
|
2
|
+
import { ConfiguredFetch, FetchRequestFactoryError, FetchResponseError, MakeUrlSearchParamsOptions } from '@dereekb/util/fetch';
|
|
3
|
+
import { BaseError } from 'make-error';
|
|
4
|
+
/**
|
|
5
|
+
* A code used in some cases to denote success.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ZOOM_SUCCESS_CODE = "SUCCESS";
|
|
8
|
+
export type ZoomServerSuccessCode = typeof ZOOM_SUCCESS_CODE;
|
|
9
|
+
export type ZoomServerSuccessStatus = 'success';
|
|
10
|
+
export type ZoomServerErrorStatus = 'error';
|
|
11
|
+
/**
|
|
12
|
+
* Zoom server error codes are numbers or strings.
|
|
13
|
+
*
|
|
14
|
+
* Check the API docs for specific functions to see what codes are used for what error.
|
|
15
|
+
*/
|
|
16
|
+
export type ZoomServerErrorCode = string | number;
|
|
17
|
+
/**
|
|
18
|
+
* Zoom Server Error Data
|
|
19
|
+
*
|
|
20
|
+
* Always contains a code and message. Details and status are optional.
|
|
21
|
+
*/
|
|
22
|
+
export interface ZoomServerErrorData<T = unknown> {
|
|
23
|
+
readonly code: ZoomServerErrorCode;
|
|
24
|
+
readonly message: string;
|
|
25
|
+
readonly errors?: T;
|
|
26
|
+
/**
|
|
27
|
+
* Is sometimes present on some error responses.
|
|
28
|
+
*/
|
|
29
|
+
readonly status?: ZoomServerErrorStatus;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Contains details and a status
|
|
33
|
+
*/
|
|
34
|
+
export type ZoomServerErrorDataWithDetails<T = unknown> = Required<ZoomServerErrorData<T>>;
|
|
35
|
+
/**
|
|
36
|
+
* Zoom Server Error
|
|
37
|
+
*/
|
|
38
|
+
export declare class ZoomServerError<D extends ZoomServerErrorData = ZoomServerErrorData> extends BaseError {
|
|
39
|
+
readonly error: D;
|
|
40
|
+
get code(): ZoomServerErrorCode;
|
|
41
|
+
constructor(error: D);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Zoom Server Error that includes the FetchResponseError
|
|
45
|
+
*/
|
|
46
|
+
export declare class ZoomServerFetchResponseError<D extends ZoomServerErrorData = ZoomServerErrorData> extends ZoomServerError<D> {
|
|
47
|
+
readonly data: D;
|
|
48
|
+
readonly responseError: FetchResponseError;
|
|
49
|
+
constructor(data: D, responseError: FetchResponseError);
|
|
50
|
+
}
|
|
51
|
+
export type LogZoomServerErrorFunction = (error: FetchRequestFactoryError | ZoomServerError | ZoomServerFetchResponseError) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Creates a logZoomServerErrorFunction that logs the error to console.
|
|
54
|
+
*
|
|
55
|
+
* @param zoomApiNamePrefix Prefix to use when logging. I.E. ZoomError, etc.
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
export declare function logZoomServerErrorFunction(zoomApiNamePrefix: string): LogZoomServerErrorFunction;
|
|
59
|
+
/**
|
|
60
|
+
* Wraps a ConfiguredFetch to support handling errors returned by fetch.
|
|
61
|
+
*
|
|
62
|
+
* @param fetch
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
export type HandleZoomErrorFetchFactory = (fetch: ConfiguredFetch, logError?: LogZoomServerErrorFunction) => ConfiguredFetch;
|
|
66
|
+
export type ParsedZoomServerError = FetchRequestFactoryError | ZoomServerError | undefined;
|
|
67
|
+
export type ParseZoomFetchResponseErrorFunction = (responseError: FetchResponseError) => Promise<ParsedZoomServerError>;
|
|
68
|
+
/**
|
|
69
|
+
* Wraps a ConfiguredFetch to support handling errors returned by fetch.
|
|
70
|
+
*
|
|
71
|
+
* @param fetch
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
export declare function handleZoomErrorFetchFactory(parseZoomError: ParseZoomFetchResponseErrorFunction, defaultLogError: LogZoomServerErrorFunction): HandleZoomErrorFetchFactory;
|
|
75
|
+
/**
|
|
76
|
+
* The status code that Zoom uses to indicates that too many requests have been made in a short period of time.
|
|
77
|
+
*/
|
|
78
|
+
export declare const ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE = 429;
|
|
79
|
+
export type ZoomRateLimitCategory = 'Light' | 'Medium' | 'Heavy';
|
|
80
|
+
export type ZoomRateLimitType = 'Per-second-limit' | 'Daily-limit';
|
|
81
|
+
export declare const ZOOM_RATE_LIMIT_CATEGORY_HEADER = "X-RateLimit-Category";
|
|
82
|
+
export declare const ZOOM_RATE_LIMIT_TYPE_HEADER = "X-RateLimit-Type";
|
|
83
|
+
export declare const ZOOM_RATE_LIMIT_LIMIT_HEADER = "X-RateLimit-Limit";
|
|
84
|
+
export declare const ZOOM_RATE_LIMIT_REMAINING_HEADER = "X-RateLimit-Remaining";
|
|
85
|
+
export declare const ZOOM_RATE_LIMIT_RETRY_AFTER_HEADER = "Retry-After";
|
|
86
|
+
export declare const DEFAULT_ZOOM_API_RATE_LIMIT = 100;
|
|
87
|
+
export declare const DEFAULT_ZOOM_API_RATE_LIMIT_RESET_PERIOD: number;
|
|
88
|
+
export interface ZoomRateLimitHeaderDetails {
|
|
89
|
+
/**
|
|
90
|
+
* Total limit in a given period.
|
|
91
|
+
*/
|
|
92
|
+
readonly limit: number;
|
|
93
|
+
/**
|
|
94
|
+
* Total number of remaining allowed requests.
|
|
95
|
+
*/
|
|
96
|
+
readonly remaining: number;
|
|
97
|
+
/**
|
|
98
|
+
* The category of the rate limit.
|
|
99
|
+
*/
|
|
100
|
+
readonly category: ZoomRateLimitCategory;
|
|
101
|
+
/**
|
|
102
|
+
* The type of the rate limit.
|
|
103
|
+
*/
|
|
104
|
+
readonly type: ZoomRateLimitType;
|
|
105
|
+
/**
|
|
106
|
+
* The time at which the rate limit will reset.
|
|
107
|
+
*/
|
|
108
|
+
readonly retryAfter: UnixDateTimeNumber;
|
|
109
|
+
/**
|
|
110
|
+
* The time at which the rate limit will reset.
|
|
111
|
+
*/
|
|
112
|
+
readonly retryAfterAt: Date;
|
|
113
|
+
}
|
|
114
|
+
export declare function zoomRateLimitHeaderDetails(headers: Headers): Maybe<ZoomRateLimitHeaderDetails>;
|
|
115
|
+
export declare class ZoomTooManyRequestsError extends ZoomServerFetchResponseError {
|
|
116
|
+
get headerDetails(): Maybe<ZoomRateLimitHeaderDetails>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Function that parses/transforms a ZoomServerErrorData into a general ZoomServerError or other known error type.
|
|
120
|
+
*
|
|
121
|
+
* @param errorResponseData
|
|
122
|
+
* @param responseError
|
|
123
|
+
* @returns
|
|
124
|
+
*/
|
|
125
|
+
export declare function parseZoomServerErrorData(zoomServerError: ZoomServerErrorData, responseError: FetchResponseError): ZoomServerFetchResponseError | undefined;
|
|
126
|
+
export interface SilenceZoomErrorConfig {
|
|
127
|
+
/**
|
|
128
|
+
* If true an error will be thrown if the meeting does not exist.
|
|
129
|
+
*/
|
|
130
|
+
readonly silenceError?: boolean;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Returns a pre-configured MakeUrlSearchParamsOptions that omits the silenceError key.
|
|
134
|
+
*
|
|
135
|
+
* If other options are input, it merges those two options together and adds silenceError to the omitted keys.
|
|
136
|
+
*/
|
|
137
|
+
export declare function omitSilenceZoomErrorKeys(options?: MakeUrlSearchParamsOptions): MakeUrlSearchParamsOptions;
|
|
138
|
+
export type SilenceZoomErrorWithCodesFunction<T> = (silence?: boolean) => (reason: unknown) => T;
|
|
139
|
+
/**
|
|
140
|
+
* Used with catch() to silence Zoom errors with the specified codes.
|
|
141
|
+
*
|
|
142
|
+
* For example, when deleting a meeting that does not exist, the error code is 3001. This function can be used to silence that error.
|
|
143
|
+
*/
|
|
144
|
+
export declare function silenceZoomErrorWithCodesFunction<T>(codes: ArrayOrValue<ZoomServerErrorCode>): SilenceZoomErrorWithCodesFunction<void>;
|
|
145
|
+
export declare function silenceZoomErrorWithCodesFunction<T>(codes: ArrayOrValue<ZoomServerErrorCode>, returnFn: (error: ZoomServerFetchResponseError) => T): SilenceZoomErrorWithCodesFunction<T>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Maybe, Milliseconds, PromiseOrValue, ResetPeriodPromiseRateLimiter } from '@dereekb/util';
|
|
2
|
+
import { FetchResponseError, RateLimitedFetchHandler } from '@dereekb/util/fetch';
|
|
3
|
+
import { ZoomRateLimitHeaderDetails } from './zoom.error.api';
|
|
4
|
+
export interface ZoomRateLimiterRef {
|
|
5
|
+
readonly zoomRateLimiter: ResetPeriodPromiseRateLimiter;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Function to execute when too many requests is reached.
|
|
9
|
+
*
|
|
10
|
+
* Typically used for logging of some sort. Thrown errors are ignored.
|
|
11
|
+
*/
|
|
12
|
+
export type ZoomRateLimitedTooManyRequestsLogFunction = (headers: ZoomRateLimitHeaderDetails, response: Response, fetchResponseError?: FetchResponseError) => PromiseOrValue<void>;
|
|
13
|
+
export declare const DEFAULT_ZOOM_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION: (headers: ZoomRateLimitHeaderDetails) => void;
|
|
14
|
+
export interface ZoomRateLimitedFetchHandlerConfig {
|
|
15
|
+
/**
|
|
16
|
+
* Custom max rate limit.
|
|
17
|
+
*
|
|
18
|
+
* Rate limits are different between account types and are described here:
|
|
19
|
+
*
|
|
20
|
+
* https://help.zoom.com/portal/en/community/topic/key-changes-in-api-limits-26-9-2018#:~:text=X%2DRATELIMIT%2DREMAINING%20%2D%20Represents,time%20of%20the%20current%20window.&text=Please%20note%20that%20these%20Rate,API%20limit%20changes%20are%20implemented.
|
|
21
|
+
*/
|
|
22
|
+
readonly maxRateLimit?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Custom reset period for the rate limiter.
|
|
25
|
+
*
|
|
26
|
+
* Defaults to 1 minute in milliseconds.
|
|
27
|
+
*/
|
|
28
|
+
readonly resetPeriod?: Milliseconds;
|
|
29
|
+
/**
|
|
30
|
+
* Optional function to execute when too many requests is reached.t
|
|
31
|
+
*
|
|
32
|
+
* Defaults to the default logging function, unless false is passed.
|
|
33
|
+
*/
|
|
34
|
+
readonly onTooManyRequests?: ZoomRateLimitedTooManyRequestsLogFunction | false;
|
|
35
|
+
}
|
|
36
|
+
export type ZoomRateLimitedFetchHandler = RateLimitedFetchHandler<ResetPeriodPromiseRateLimiter>;
|
|
37
|
+
export declare function zoomRateLimitedFetchHandler(config?: Maybe<ZoomRateLimitedFetchHandlerConfig>): ZoomRateLimitedFetchHandler;
|