@rc-ex/ws 1.3.5 → 1.3.7

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.
Files changed (41) hide show
  1. package/dist/cjs/exceptions/ConnectionException.d.ts +1 -1
  2. package/dist/cjs/exceptions/ConnectionException.js +2 -2
  3. package/dist/cjs/exceptions/ConnectionException.js.map +1 -1
  4. package/dist/cjs/index.d.ts +3 -3
  5. package/dist/cjs/index.js +10 -10
  6. package/dist/cjs/index.js.map +1 -1
  7. package/dist/cjs/rest.d.ts +1 -1
  8. package/dist/cjs/rest.js +2 -2
  9. package/dist/cjs/rest.js.map +1 -1
  10. package/dist/cjs/subscription.d.ts +1 -1
  11. package/dist/cjs/subscription.js +2 -2
  12. package/dist/cjs/subscription.js.map +1 -1
  13. package/dist/cjs/utils.d.ts +1 -1
  14. package/dist/cjs/utils.js +4 -4
  15. package/dist/cjs/utils.js.map +1 -1
  16. package/dist/esm/exceptions/ConnectionException.d.ts +1 -1
  17. package/dist/esm/exceptions/ConnectionException.js +1 -1
  18. package/dist/esm/exceptions/ConnectionException.js.map +1 -1
  19. package/dist/esm/index.d.ts +3 -3
  20. package/dist/esm/index.js +4 -4
  21. package/dist/esm/index.js.map +1 -1
  22. package/dist/esm/rest.d.ts +1 -1
  23. package/dist/esm/rest.js +1 -1
  24. package/dist/esm/rest.js.map +1 -1
  25. package/dist/esm/subscription.d.ts +1 -1
  26. package/dist/esm/subscription.js +1 -1
  27. package/dist/esm/subscription.js.map +1 -1
  28. package/dist/esm/utils.d.ts +1 -1
  29. package/dist/esm/utils.js +2 -2
  30. package/dist/esm/utils.js.map +1 -1
  31. package/package.json +6 -2
  32. package/src/exceptions/ClosedException.ts +0 -7
  33. package/src/exceptions/ConnectionException.ts +0 -17
  34. package/src/exceptions/TimeoutException.ts +0 -7
  35. package/src/index.ts +0 -421
  36. package/src/rest.ts +0 -71
  37. package/src/subscription.ts +0 -131
  38. package/src/types.ts +0 -85
  39. package/src/utils.ts +0 -82
  40. package/tsconfig.cjs.json +0 -28
  41. package/tsconfig.esm.json +0 -28
package/src/index.ts DELETED
@@ -1,421 +0,0 @@
1
- import type RingCentral from "@rc-ex/core/index";
2
- import type {
3
- RestMethod,
4
- RestRequestConfig,
5
- RestResponse,
6
- } from "@rc-ex/core/types";
7
- import SdkExtension from "@rc-ex/core/SdkExtension";
8
- import type { MessageEvent } from "isomorphic-ws";
9
- import WS from "isomorphic-ws";
10
- import hyperid from "hyperid";
11
- import { EventEmitter } from "events";
12
- import waitFor from "wait-for-async";
13
- import RestException from "@rc-ex/core/RestException";
14
- import type SubscriptionInfo from "@rc-ex/core/definitions/SubscriptionInfo";
15
-
16
- import { request } from "./rest";
17
- import type {
18
- ConnectionDetails,
19
- WebSocketExtensionInterface,
20
- WebSocketOptions,
21
- Wsc,
22
- WsgEvent,
23
- WsToken,
24
- } from "./types";
25
- import Subscription from "./subscription";
26
- import ConnectionException from "./exceptions/ConnectionException";
27
- import Utils from "./utils";
28
-
29
- const CONNECTING = 0;
30
- const OPEN = 1;
31
-
32
- const uuid = hyperid();
33
-
34
- export enum Events {
35
- autoRecoverSuccess = "autoRecoverSuccess",
36
- autoRecoverFailed = "autoRecoverFailed",
37
- autoRecoverError = "autoRecoverError",
38
- newWebSocketObject = "newWebSocketObject",
39
- newWsc = "newWsc",
40
- connectionReady = "connectionReady",
41
- }
42
-
43
- class WebSocketExtension extends SdkExtension {
44
- public eventEmitter = new EventEmitter();
45
-
46
- public options: WebSocketOptions;
47
-
48
- public rc!: RingCentral;
49
-
50
- public wsToken?: WsToken;
51
-
52
- public wsTokenExpiresAt = 0;
53
-
54
- public ws!: WS;
55
-
56
- public connectionDetails!: ConnectionDetails;
57
-
58
- public wsc?: Wsc;
59
-
60
- public subscription?: Subscription;
61
-
62
- // for auto recover
63
- public intervalHandle?: NodeJS.Timeout;
64
-
65
- public recoverTimestamp?: number;
66
-
67
- public pingServerHandle?: NodeJS.Timeout;
68
-
69
- public _recoverPromise?: Promise<void>;
70
-
71
- public _connectPromise?: Promise<void>;
72
-
73
- public request = request; // request method was moved to another file to keep this file short
74
-
75
- public constructor(options: WebSocketOptions = {}) {
76
- super();
77
- this.options = options;
78
- this.options.restOverWebSocket ??= false;
79
- this.options.debugMode ??= false;
80
- this.options.autoRecover ??= {
81
- enabled: true,
82
- };
83
- this.options.autoRecover.checkInterval ??= (retriesAttempted) => {
84
- const interval = 2000 + 2000 * retriesAttempted;
85
- return Math.min(8000, interval);
86
- };
87
- this.options.autoRecover.pingServerInterval ??= 60000;
88
- }
89
-
90
- public disable() {
91
- super.disable();
92
- if (this.subscription) {
93
- this.subscription.enabled = false;
94
- }
95
- }
96
-
97
- public async install(rc: RingCentral) {
98
- this.rc = rc;
99
- if (this.options.restOverWebSocket) {
100
- const request = rc.request.bind(rc);
101
- rc.request = async <T>(
102
- method: RestMethod,
103
- endpoint: string,
104
- content?: {},
105
- queryParams?: {},
106
- config?: RestRequestConfig,
107
- ): Promise<RestResponse<T>> => {
108
- if (!this.enabled || !this.options.restOverWebSocket) {
109
- return request(method, endpoint, content, queryParams, config);
110
- }
111
- if (
112
- // the following cannot be done with WebSocket
113
- config?.headers?.getContentType?.toString()?.includes(
114
- "multipart/form-data",
115
- ) ||
116
- config?.responseType === "arraybuffer" ||
117
- endpoint.startsWith("/restapi/oauth/") // token, revoke, wstoken
118
- ) {
119
- return request(method, endpoint, content, queryParams, config);
120
- }
121
- return this.request<T>(method, endpoint, content, queryParams, config);
122
- };
123
- }
124
-
125
- // should recover if this.options.wscToken
126
- let connectMethod = this.connect.bind(this);
127
- if (this.options.wscToken) {
128
- this.wsc = {
129
- token: this.options.wscToken,
130
- sequence: 0,
131
- };
132
- connectMethod = this.recover.bind(this);
133
- }
134
-
135
- if (!this.options.autoRecover!.enabled) {
136
- await connectMethod();
137
- return;
138
- }
139
-
140
- // code after is for auto recover
141
- try {
142
- await connectMethod();
143
- } catch (e) {
144
- if (e instanceof RestException) {
145
- throw e; // such as InsufficientPermissions
146
- }
147
- if (this.options.debugMode) {
148
- console.debug("Initial connect failed:", e);
149
- }
150
- }
151
- let retriesAttempted = 0;
152
- let checking = false;
153
- const check = async () => {
154
- if (!this.enabled) {
155
- return;
156
- }
157
- if (this.options.autoRecover?.enabled !== true) {
158
- return;
159
- }
160
- if (checking) {
161
- return;
162
- }
163
- checking = true;
164
- if (this.ws?.readyState !== OPEN && this.ws?.readyState !== CONNECTING) {
165
- clearInterval(this.intervalHandle!);
166
- try {
167
- await this.recover();
168
- retriesAttempted = 0;
169
- if (this.options.debugMode) {
170
- console.debug(
171
- `Auto recover done, recoveryState: ${this.connectionDetails.recoveryState}`,
172
- );
173
- }
174
- this.eventEmitter.emit(
175
- this.connectionDetails.recoveryState === "Successful"
176
- ? Events.autoRecoverSuccess
177
- : Events.autoRecoverFailed,
178
- this.ws,
179
- );
180
- } catch (e) {
181
- if (e instanceof RestException) {
182
- throw e; // such as InsufficientPermissions
183
- }
184
- retriesAttempted += 1;
185
- if (this.options.debugMode) {
186
- console.debug("Auto recover error:", e);
187
- }
188
- this.eventEmitter.emit(Events.autoRecoverError, e);
189
- }
190
- this.intervalHandle = setInterval(
191
- check,
192
- this.options.autoRecover!.checkInterval!(retriesAttempted),
193
- );
194
- }
195
- checking = false;
196
- };
197
- this.intervalHandle = setInterval(
198
- check,
199
- this.options.autoRecover!.checkInterval!(retriesAttempted),
200
- );
201
-
202
- // browser only code start
203
- if (
204
- typeof globalThis.window !== "undefined" &&
205
- globalThis.window.addEventListener
206
- ) {
207
- globalThis.window.addEventListener("offline", () => {
208
- if (this.pingServerHandle) {
209
- clearTimeout(this.pingServerHandle);
210
- }
211
- this.ws?.close();
212
- });
213
- globalThis.window.addEventListener("online", () => {
214
- check();
215
- });
216
- }
217
- // browser only code end
218
- }
219
-
220
- public async recover() {
221
- if (this._recoverPromise) {
222
- return this._recoverPromise;
223
- }
224
- this._recoverPromise = this._recover();
225
- try {
226
- await this._recoverPromise;
227
- } finally {
228
- this._recoverPromise = undefined;
229
- }
230
- return undefined;
231
- }
232
-
233
- public async _recover() {
234
- if (this.ws?.readyState === OPEN || this.ws?.readyState === CONNECTING) {
235
- return;
236
- }
237
- if (!this.wsc || !this.wsc.token) {
238
- await this.connect(false); // connect to WSG but do not recover
239
- return;
240
- }
241
- if (this.recoverTimestamp === undefined) {
242
- this.recoverTimestamp = Date.now();
243
- }
244
- if (
245
- this.connectionDetails !== undefined &&
246
- Date.now() - this.recoverTimestamp >
247
- this.connectionDetails.recoveryTimeout * 1000
248
- ) {
249
- if (this.options.debugMode) {
250
- console.debug("connect to WSG but do not recover");
251
- }
252
- await this.connect(false); // connect to WSG but do not recover
253
- } else {
254
- if (this.options.debugMode) {
255
- console.debug("connect to WSG and recover");
256
- }
257
- await this.connect(true); // connect to WSG and recover
258
- }
259
- this.recoverTimestamp = undefined;
260
- this.enable();
261
- }
262
-
263
- public async pingServer() {
264
- if (this.options.autoRecover?.enabled !== true) {
265
- return;
266
- }
267
- if (this.ws?.readyState !== OPEN) {
268
- return;
269
- }
270
- try {
271
- await this.ws.send(
272
- JSON.stringify([
273
- {
274
- type: "Heartbeat",
275
- messageId: uuid(),
276
- },
277
- ]),
278
- );
279
- } catch (e) {
280
- this.ws.close(); // Explicitly mark WS as closed
281
- }
282
- }
283
-
284
- public async connect(recoverSession?: boolean) {
285
- if (this._connectPromise) {
286
- return this._connectPromise;
287
- }
288
- this._connectPromise = this._connect(recoverSession);
289
- try {
290
- await this._connectPromise;
291
- } finally {
292
- this._connectPromise = undefined;
293
- }
294
- return undefined;
295
- }
296
-
297
- public async _connect(recoverSession = false) {
298
- if (!this.wsToken || Date.now() > this.wsTokenExpiresAt) {
299
- const r = await this.rc.post("/restapi/oauth/wstoken");
300
- this.wsToken = r.data as WsToken;
301
- // `expires_in` default value is 600 seconds. That's why we `* 0.8`
302
- this.wsTokenExpiresAt = Date.now() + this.wsToken.expires_in * 0.8 * 1000;
303
- }
304
- let wsUri = `${this.wsToken!.uri}?access_token=${
305
- this.wsToken!.ws_access_token
306
- }`;
307
- if (recoverSession && this.wsc) {
308
- wsUri += `&wsc=${this.wsc.token}`;
309
- }
310
- this.ws = new WS(wsUri);
311
- this.eventEmitter.emit(Events.newWebSocketObject, this.ws);
312
-
313
- // override send method to wait for connecting
314
- const send = this.ws.send.bind(this.ws);
315
- this.ws.send = async (s: string) => {
316
- if (this.ws.readyState === CONNECTING) {
317
- await waitFor({
318
- interval: 100,
319
- condition: () => this.ws.readyState !== CONNECTING,
320
- });
321
- }
322
- await send(s);
323
- };
324
-
325
- if (this.options.autoRecover?.enabled) {
326
- this.ws.addEventListener("message", () => {
327
- if (this.pingServerHandle) {
328
- clearTimeout(this.pingServerHandle);
329
- }
330
- this.pingServerHandle = setTimeout(
331
- () => this.pingServer(),
332
- this.options.autoRecover!.pingServerInterval,
333
- );
334
- });
335
- }
336
-
337
- // debug mode to print all WebSocket traffic
338
- if (this.options.debugMode) {
339
- Utils.debugWebSocket(this.ws);
340
- }
341
-
342
- // listen for new wsc data
343
- this.ws.addEventListener("message", (mEvent: MessageEvent) => {
344
- const event = mEvent as WsgEvent;
345
- const [meta, body] = Utils.splitWsgData(event.data);
346
- if (
347
- meta.wsc &&
348
- (!this.wsc ||
349
- (meta.type === "ConnectionDetails" && body.recoveryState) ||
350
- this.wsc.sequence < meta.wsc.sequence)
351
- ) {
352
- this.wsc = meta.wsc;
353
- this.eventEmitter.emit(Events.newWsc, this.wsc);
354
- }
355
- });
356
-
357
- // get initial ConnectionDetails data
358
- const [meta, body, event] = await Utils.waitForWebSocketMessage(
359
- this.ws,
360
- (meta) => meta.type === "ConnectionDetails" || meta.type === "Error",
361
- );
362
- if (meta.type === "Error") {
363
- throw new ConnectionException(event);
364
- }
365
- this.connectionDetails = body;
366
-
367
- // fired when ws connection is ready for creating subscription
368
- this.eventEmitter.emit(Events.connectionReady, this.ws);
369
-
370
- // recover the subscription, if it exists and enabled
371
- if (this.subscription && this.subscription.enabled) {
372
- // because we have a new ws object
373
- this.subscription.setupWsEventListener();
374
- if (
375
- !recoverSession || this.connectionDetails.recoveryState === "Failed"
376
- ) {
377
- // create new subscription if don't recover existing one
378
- await this.subscription.subscribe();
379
- }
380
- }
381
- }
382
-
383
- // keepInterval means we do not clear the interval
384
- public async revoke(keepInterval = false) {
385
- await this.subscription?.revoke();
386
- this.subscription = undefined;
387
- if (!keepInterval && this.intervalHandle) {
388
- clearInterval(this.intervalHandle);
389
- }
390
- if (this.pingServerHandle) {
391
- clearTimeout(this.pingServerHandle);
392
- }
393
- this.ws?.close();
394
- this.wsc = undefined;
395
- this.wsToken = undefined;
396
- this.wsTokenExpiresAt = 0;
397
- this.disable();
398
- }
399
-
400
- public async subscribe(
401
- eventFilters: string[],
402
- callback: (event: {}) => void,
403
- cache: SubscriptionInfo | undefined | null = undefined,
404
- ) {
405
- const subscription = new Subscription(
406
- this as WebSocketExtensionInterface,
407
- eventFilters,
408
- callback,
409
- );
410
- if (cache === undefined || cache === null) {
411
- await subscription.subscribe();
412
- } else {
413
- subscription.subscriptionInfo = cache;
414
- await subscription.refresh();
415
- }
416
- this.subscription = subscription;
417
- return subscription;
418
- }
419
- }
420
-
421
- export default WebSocketExtension;
package/src/rest.ts DELETED
@@ -1,71 +0,0 @@
1
- import type {
2
- RestMethod,
3
- RestRequestConfig,
4
- RestResponse,
5
- } from "@rc-ex/core/types";
6
- import RestException from "@rc-ex/core/RestException";
7
- import hyperid from "hyperid";
8
- import { getReasonPhrase } from "http-status-codes";
9
-
10
- import Utils from "./utils";
11
- import type { WebSocketExtensionInterface } from "./types";
12
-
13
- const version = "0.16";
14
-
15
- const uuid = hyperid();
16
-
17
- export async function request<T>(
18
- this: WebSocketExtensionInterface,
19
- method: RestMethod,
20
- endpoint: string,
21
- content?: {},
22
- queryParams?: {},
23
- config?: RestRequestConfig,
24
- ): Promise<RestResponse<T>> {
25
- const newConfig: RestRequestConfig = {
26
- method,
27
- baseURL: this.wsToken?.uri,
28
- url: endpoint,
29
- data: content,
30
- params: queryParams,
31
- ...config,
32
- };
33
- newConfig.headers = {
34
- ...newConfig.headers,
35
- "X-User-Agent": `${this.rc.rest!.appName}/${
36
- this.rc.rest!.appVersion
37
- } ringcentral-extensible/ws/${version}`,
38
- } as any;
39
- const messageId = uuid();
40
- const requestBody = [
41
- {
42
- type: "ClientRequest",
43
- messageId,
44
- method: newConfig.method,
45
- path: newConfig.url,
46
- headers: newConfig.headers,
47
- query: newConfig.params,
48
- },
49
- ];
50
- if (newConfig.data) {
51
- requestBody.push(newConfig.data);
52
- }
53
- await this.ws.send(JSON.stringify(requestBody));
54
- const [meta, body] = await Utils.waitForWebSocketMessage(
55
- this.ws,
56
- (_meta) => _meta.messageId === messageId,
57
- );
58
- const response: RestResponse = {
59
- data: body as T,
60
- status: meta.status,
61
- statusText: getReasonPhrase(meta.status),
62
- headers: meta.headers,
63
- config: newConfig as any,
64
- };
65
- if (
66
- meta.type === "ClientRequest" && meta.status >= 200 && meta.status < 300
67
- ) {
68
- return response;
69
- }
70
- throw new RestException(response);
71
- }
@@ -1,131 +0,0 @@
1
- import type CreateSubscriptionRequest from "@rc-ex/core/definitions/CreateSubscriptionRequest";
2
- import type SubscriptionInfo from "@rc-ex/core/definitions/SubscriptionInfo";
3
- import type { RestResponse } from "@rc-ex/core/types";
4
- import type { MessageEvent } from "ws";
5
-
6
- import type { WebSocketExtensionInterface, WsgEvent, WsgMeta } from "./types";
7
- import Utils from "./utils";
8
-
9
- class Subscription {
10
- public subscriptionInfo?: SubscriptionInfo;
11
-
12
- public wse: WebSocketExtensionInterface;
13
-
14
- public eventFilters: string[];
15
-
16
- public eventListener: (event: MessageEvent) => void;
17
-
18
- public timeout?: NodeJS.Timeout;
19
-
20
- public enabled = true;
21
-
22
- public constructor(
23
- wse: WebSocketExtensionInterface,
24
- eventFilters: string[],
25
- callback: (event: {}) => void,
26
- ) {
27
- this.wse = wse;
28
- this.eventFilters = eventFilters;
29
- this.eventListener = (mEvent: MessageEvent) => {
30
- const event = mEvent as WsgEvent;
31
- const [meta, body]: [WsgMeta, { subscriptionId: string }] = Utils
32
- .splitWsgData(event.data);
33
- if (
34
- this.enabled && meta.type === "ServerNotification" &&
35
- body.subscriptionId === this.subscriptionInfo!.id
36
- ) {
37
- callback(body);
38
- }
39
- };
40
- this.setupWsEventListener();
41
- }
42
-
43
- public setupWsEventListener() {
44
- this.wse.ws.addEventListener("message", this.eventListener);
45
- }
46
-
47
- public get requestBody(): CreateSubscriptionRequest {
48
- return {
49
- deliveryMode: { transportType: "WebSocket" as any }, // because WebSocket is not in spec
50
- eventFilters: this.eventFilters,
51
- };
52
- }
53
-
54
- public async subscribe() {
55
- this.subscriptionInfo = (
56
- await this.wse.request<SubscriptionInfo>(
57
- "POST",
58
- "/restapi/v1.0/subscription",
59
- this.requestBody,
60
- )
61
- ).data;
62
- }
63
-
64
- public async refresh() {
65
- if (!this.subscriptionInfo) {
66
- return;
67
- }
68
- try {
69
- this.subscriptionInfo = (
70
- await this.wse.request<SubscriptionInfo>(
71
- "PUT",
72
- `/restapi/v1.0/subscription/${this.subscriptionInfo!.id}`,
73
- this.requestBody,
74
- )
75
- ).data;
76
- } catch (e) {
77
- const re = e as { response: RestResponse };
78
- if (re.response && re.response.status === 404) {
79
- // subscription expired
80
- await this.subscribe();
81
- }
82
- }
83
- }
84
-
85
- public async revoke() {
86
- if (!this.subscriptionInfo) {
87
- return;
88
- }
89
- try {
90
- await this.wse.request<SubscriptionInfo>(
91
- "DELETE",
92
- `/restapi/v1.0/subscription/${this.subscriptionInfo!.id}`,
93
- );
94
- } catch (e) {
95
- const re = e as { response: RestResponse };
96
- if (re.response && re.response.status === 404) {
97
- // ignore
98
- if (this.wse.options.debugMode) {
99
- console.debug(
100
- `Subscription ${
101
- this.subscriptionInfo!.id
102
- } doesn't exist on server side`,
103
- );
104
- }
105
- } else if (re.response && re.response.status === 401) {
106
- // ignore
107
- if (this.wse.options.debugMode) {
108
- console.debug("Token invalid when trying to revoke subscription");
109
- }
110
- } else {
111
- throw e;
112
- }
113
- }
114
- this.remove();
115
- }
116
-
117
- public remove() {
118
- if (this.timeout) {
119
- global.clearTimeout(this.timeout);
120
- this.timeout = undefined;
121
- }
122
- this.enabled = false;
123
- this.subscriptionInfo = undefined;
124
- if (this.wse.ws) {
125
- this.wse.ws.removeEventListener("message", this.eventListener);
126
- }
127
- this.wse.subscription = undefined;
128
- }
129
- }
130
-
131
- export default Subscription;
package/src/types.ts DELETED
@@ -1,85 +0,0 @@
1
- import type RingCentral from "@rc-ex/core/index";
2
- import type {
3
- RestMethod,
4
- RestRequestConfig,
5
- RestResponse,
6
- } from "@rc-ex/core/types";
7
- import type WS from "isomorphic-ws";
8
-
9
- export interface WsToken {
10
- uri: string;
11
- ws_access_token: string;
12
- expires_in: number;
13
- }
14
-
15
- export type CheckInterval = (retriesAttempted: number) => number;
16
- export interface WebSocketOptions {
17
- restOverWebSocket?: boolean;
18
- debugMode?: boolean;
19
- autoRecover?: {
20
- enabled: boolean;
21
- checkInterval?: CheckInterval;
22
- pingServerInterval?: number;
23
- };
24
- wscToken?: string;
25
- }
26
-
27
- export interface WsgEvent {
28
- data: string;
29
- }
30
-
31
- export interface Wsc {
32
- token: string;
33
- sequence: number;
34
- }
35
-
36
- export interface WsgMeta {
37
- type:
38
- | "ClientRequest"
39
- | "ServerNotification"
40
- | "Error"
41
- | "ConnectionDetails"
42
- | "Heartbeat";
43
- messageId: string;
44
- status: number;
45
- headers: {
46
- [key: string]: string;
47
- };
48
- wsc?: Wsc;
49
- }
50
-
51
- export interface WsgError {
52
- errorCode: string;
53
- message: string;
54
- }
55
-
56
- export interface ConnectionDetails {
57
- creationTime: string;
58
- maxConnectionsPerSession: number;
59
- recoveryBufferSize: number;
60
- recoveryTimeout: number;
61
- idleTimeout: number;
62
- absoluteTimeout: number;
63
- maxActiveRequests: number;
64
- recoveryState?: "Successful" | "Failed";
65
- recoveryErrorCode?: string;
66
- }
67
-
68
- export interface WebSocketExtensionInterface {
69
- options: WebSocketOptions;
70
- subscription?: SubscriptionInterface;
71
- ws: WS;
72
- wsToken?: WsToken;
73
- rc: RingCentral;
74
- request: <T>(
75
- method: RestMethod,
76
- endpoint: string,
77
- content?: {},
78
- queryParams?: {},
79
- config?: RestRequestConfig,
80
- ) => Promise<RestResponse<T>>;
81
- }
82
-
83
- export interface SubscriptionInterface {
84
- eventFilters: string[];
85
- }