@azure/web-pubsub 1.0.0-beta.2 → 1.0.1-alpha.20211215.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +118 -31
  3. package/dist/index.js +1315 -567
  4. package/dist/index.js.map +1 -1
  5. package/dist-esm/samples-dev/broadcasting.js +16 -16
  6. package/dist-esm/samples-dev/broadcasting.js.map +1 -1
  7. package/dist-esm/samples-dev/directMessage.js +9 -9
  8. package/dist-esm/samples-dev/directMessage.js.map +1 -1
  9. package/dist-esm/samples-dev/managingGroups.js +11 -12
  10. package/dist-esm/samples-dev/managingGroups.js.map +1 -1
  11. package/dist-esm/src/generated/generatedClient.js +23 -0
  12. package/dist-esm/src/generated/generatedClient.js.map +1 -0
  13. package/dist-esm/src/generated/generatedClientContext.js +41 -0
  14. package/dist-esm/src/generated/generatedClientContext.js.map +1 -0
  15. package/dist-esm/src/generated/index.js +10 -2
  16. package/dist-esm/src/generated/index.js.map +1 -1
  17. package/dist-esm/src/generated/models/index.js +13 -1
  18. package/dist-esm/src/generated/models/index.js.map +1 -1
  19. package/dist-esm/src/generated/models/mappers.js +368 -0
  20. package/dist-esm/src/generated/models/mappers.js.map +1 -0
  21. package/dist-esm/src/generated/models/parameters.js +124 -43
  22. package/dist-esm/src/generated/models/parameters.js.map +1 -1
  23. package/dist-esm/src/generated/operations/healthApi.js +16 -11
  24. package/dist-esm/src/generated/operations/healthApi.js.map +1 -1
  25. package/dist-esm/src/generated/operations/index.js +7 -0
  26. package/dist-esm/src/generated/operations/index.js.map +1 -1
  27. package/dist-esm/src/generated/operations/webPubSub.js +341 -175
  28. package/dist-esm/src/generated/operations/webPubSub.js.map +1 -1
  29. package/dist-esm/src/generated/operationsInterfaces/healthApi.js +9 -0
  30. package/dist-esm/src/generated/operationsInterfaces/healthApi.js.map +1 -0
  31. package/dist-esm/src/generated/operationsInterfaces/index.js +10 -0
  32. package/dist-esm/src/generated/operationsInterfaces/index.js.map +1 -0
  33. package/dist-esm/src/generated/operationsInterfaces/webPubSub.js +9 -0
  34. package/dist-esm/src/generated/operationsInterfaces/webPubSub.js.map +1 -0
  35. package/dist-esm/src/groupClient.js +74 -92
  36. package/dist-esm/src/groupClient.js.map +1 -1
  37. package/dist-esm/src/hubClient.js +280 -196
  38. package/dist-esm/src/hubClient.js.map +1 -1
  39. package/dist-esm/src/index.js.map +1 -1
  40. package/dist-esm/src/logger.js +1 -1
  41. package/dist-esm/src/logger.js.map +1 -1
  42. package/dist-esm/src/parseConnectionString.js +3 -1
  43. package/dist-esm/src/parseConnectionString.js.map +1 -1
  44. package/dist-esm/src/reverseProxyPolicy.js +21 -0
  45. package/dist-esm/src/reverseProxyPolicy.js.map +1 -0
  46. package/dist-esm/src/utils.js +8 -6
  47. package/dist-esm/src/utils.js.map +1 -1
  48. package/dist-esm/src/webPubSubCredentialPolicy.js +18 -18
  49. package/dist-esm/src/webPubSubCredentialPolicy.js.map +1 -1
  50. package/dist-esm/test/conn.spec.js +7 -8
  51. package/dist-esm/test/conn.spec.js.map +1 -1
  52. package/dist-esm/test/groups.spec.js +39 -38
  53. package/dist-esm/test/groups.spec.js.map +1 -1
  54. package/dist-esm/test/hubs.spec.js +95 -49
  55. package/dist-esm/test/hubs.spec.js.map +1 -1
  56. package/dist-esm/test/integration.spec.js +128 -0
  57. package/dist-esm/test/integration.spec.js.map +1 -0
  58. package/dist-esm/test/testEnv.js +5 -1
  59. package/dist-esm/test/testEnv.js.map +1 -1
  60. package/package.json +37 -36
  61. package/types/web-pubsub.d.ts +186 -138
  62. package/dist-esm/src/generated/azureWebPubSubServiceRestAPI.js +0 -15
  63. package/dist-esm/src/generated/azureWebPubSubServiceRestAPI.js.map +0 -1
  64. package/dist-esm/src/generated/azureWebPubSubServiceRestAPIContext.js +0 -34
  65. package/dist-esm/src/generated/azureWebPubSubServiceRestAPIContext.js.map +0 -1
  66. package/dist-esm/src/normalizeOptions.js +0 -8
  67. package/dist-esm/src/normalizeOptions.js.map +0 -1
@@ -1,30 +1,39 @@
1
1
  import { AzureKeyCredential } from '@azure/core-auth';
2
- import { HttpRequestBody } from '@azure/core-http';
3
- import { OperationOptions } from '@azure/core-http';
4
- import { PipelineOptions } from '@azure/core-http';
5
- import { RestResponse } from '@azure/core-http';
2
+ import { CommonClientOptions } from '@azure/core-client';
3
+ import { OperationOptions } from '@azure/core-client';
4
+ import { RequestBodyType } from '@azure/core-rest-pipeline';
5
+ import { TokenCredential } from '@azure/core-auth';
6
+
6
7
  export { AzureKeyCredential }
7
8
 
8
9
  /**
9
- * Options for closing a connection to a hub.
10
+ * A response containing the client token.
10
11
  */
11
- export declare interface CloseConnectionOptions extends OperationOptions {
12
+ export declare interface ClientTokenResponse {
12
13
  /**
13
- * Reason the connection is being closed.
14
+ * The client token.
14
15
  */
15
- reason?: string;
16
+ token: string;
17
+ /**
18
+ * The URL client connects to
19
+ */
20
+ baseUrl: string;
21
+ /**
22
+ * The URL client connects to with access_token query string
23
+ */
24
+ url: string;
16
25
  }
17
26
 
18
27
  /**
19
- * Options for auth a client
28
+ * Options for generating a token to connect a client to the Azure Web Pubsub service.
20
29
  */
21
- export declare interface GetAuthenticationTokenOptions {
30
+ export declare interface GenerateClientTokenOptions extends OperationOptions {
22
31
  /**
23
- * The userId for the client
32
+ * The userId for the client.
24
33
  */
25
34
  userId?: string;
26
35
  /**
27
- * The roles the client have.
36
+ * The roles that the connection with the generated token will have.
28
37
  * Roles give the client initial permissions to leave, join, or publish to groups when using PubSub subprotocol
29
38
  * * `webpubsub.joinLeaveGroup`: the client can join or leave any group
30
39
  * * `webpubsub.sendToGroup`: the client can send messages to any group
@@ -35,27 +44,9 @@ export declare interface GetAuthenticationTokenOptions {
35
44
  */
36
45
  roles?: string[];
37
46
  /**
38
- * The time-to-live minutes for the access token. If not set, the default value is 60 minutes.
47
+ * Minutes until the token expires.
39
48
  */
40
- ttl?: number;
41
- }
42
-
43
- /**
44
- * Response for the authed client, including the url and the jwt token
45
- */
46
- export declare interface GetAuthenticationTokenResponse {
47
- /**
48
- * The URL client connects to
49
- */
50
- baseUrl: string;
51
- /**
52
- * The JWT token the client uses to connect
53
- */
54
- token: string;
55
- /**
56
- * The URL client connects to with access_token query string
57
- */
58
- url: string;
49
+ expirationTimeInMinutes?: number;
59
50
  }
60
51
 
61
52
  /**
@@ -73,7 +64,17 @@ export declare interface GroupAddUserOptions extends OperationOptions {
73
64
  /**
74
65
  * Options for constructing a GroupAdmin client.
75
66
  */
76
- export declare interface GroupAdminClientOptions extends PipelineOptions {
67
+ export declare interface GroupAdminClientOptions extends CommonClientOptions {
68
+ }
69
+
70
+ /**
71
+ * Options for closing all connections to a group.
72
+ */
73
+ export declare interface GroupCloseAllConnectionsOptions extends OperationOptions {
74
+ /**
75
+ * Reason the connection is being closed.
76
+ */
77
+ reason?: string;
77
78
  }
78
79
 
79
80
  /**
@@ -122,9 +123,33 @@ export declare interface HasConnectionOptions extends OperationOptions {
122
123
  }
123
124
 
124
125
  /**
125
- * Options for constructing a HubAdmin client.
126
+ * Options for closing all connections to a hub.
127
+ */
128
+ export declare interface HubCloseAllConnectionsOptions extends OperationOptions {
129
+ /**
130
+ * Reason the connection is being closed.
131
+ */
132
+ reason?: string;
133
+ }
134
+
135
+ /**
136
+ * Options for closing a connection to a hub.
137
+ */
138
+ export declare interface HubCloseConnectionOptions extends OperationOptions {
139
+ /**
140
+ * Reason the connection is being closed.
141
+ */
142
+ reason?: string;
143
+ }
144
+
145
+ /**
146
+ * Options for closing all of a user's connections to a hub.
126
147
  */
127
- export declare interface HubAdminClientOptions extends PipelineOptions {
148
+ export declare interface HubCloseUserConnectionsOptions extends OperationOptions {
149
+ /**
150
+ * Reason the connection is being closed.
151
+ */
152
+ reason?: string;
128
153
  }
129
154
 
130
155
  /**
@@ -145,7 +170,7 @@ export declare interface HubHasGroupOptions extends OperationOptions {
145
170
  }
146
171
 
147
172
  /**
148
- * Options for check if a connection has the specified permission
173
+ * Options for checking if a connection has the specified permission
149
174
  */
150
175
  export declare interface HubHasPermissionOptions extends OperationOptions {
151
176
  /**
@@ -164,7 +189,7 @@ export declare interface HubHasUserOptions extends OperationOptions {
164
189
  /**
165
190
  * Options for removing a user from all groups.
166
191
  */
167
- export declare interface HubRemoveUserFromAllGroupsOptions extends CloseConnectionOptions {
192
+ export declare interface HubRemoveUserFromAllGroupsOptions extends HubCloseConnectionOptions {
168
193
  }
169
194
 
170
195
  /**
@@ -248,59 +273,58 @@ export declare interface WebPubSubGroup {
248
273
  /**
249
274
  * Add a specific connection to this group
250
275
  *
251
- * @param connectionId The connection id to add to this group
252
- * @param options Additional options
276
+ * @param connectionId - The connection id to add to this group
277
+ * @param options - Additional options
253
278
  */
254
- addConnection(connectionId: string, options?: GroupAddConnectionOptions): Promise<RestResponse>;
279
+ addConnection(connectionId: string, options?: GroupAddConnectionOptions): Promise<void>;
255
280
  /**
256
281
  * Remove a specific connection from this group
257
282
  *
258
- * @param connectionId The connection id to remove from this group
259
- * @param options Additional options
283
+ * @param connectionId - The connection id to remove from this group
284
+ * @param options - Additional options
260
285
  */
261
- removeConnection(connectionId: string, options?: GroupRemoveConnectionOptions): Promise<RestResponse>;
286
+ removeConnection(connectionId: string, options?: GroupRemoveConnectionOptions): Promise<void>;
262
287
  /**
263
- * Add a user to this group
288
+ * Close all connections to the group
264
289
  *
265
- * @param username The user name to add
266
- * @param options Additional options
290
+ * @param options - Additional options
267
291
  */
268
- addUser(username: string, options?: GroupAddUserOptions): Promise<RestResponse>;
292
+ closeAllConnections(options?: GroupCloseAllConnectionsOptions): Promise<void>;
269
293
  /**
270
- * Check if a user is in this group
294
+ * Add a user to this group
271
295
  *
272
- * @param username The user name to check for
273
- * @param options Additional options
296
+ * @param username - The user name to add
297
+ * @param options - Additional options
274
298
  */
275
- hasUser(username: string, options?: GroupHasUserOptions): Promise<boolean>;
299
+ addUser(username: string, options?: GroupAddUserOptions): Promise<void>;
276
300
  /**
277
301
  * Remove a user from this group
278
302
  *
279
- * @param username The user name to remove
280
- * @param options Additional options
303
+ * @param username - The user name to remove
304
+ * @param options - Additional options
281
305
  */
282
- removeUser(username: string, options?: GroupRemoveUserOptions): Promise<RestResponse>;
306
+ removeUser(username: string, options?: GroupRemoveUserOptions): Promise<void>;
283
307
  /**
284
308
  * Send a text message to every connection in this group
285
309
  *
286
- * @param message The message to send
287
- * @param options Additional options
310
+ * @param message - The message to send
311
+ * @param options - Additional options
288
312
  */
289
- sendToAll(message: string, options: GroupSendTextToAllOptions): Promise<RestResponse>;
313
+ sendToAll(message: string, options: GroupSendTextToAllOptions): Promise<void>;
290
314
  /**
291
315
  * Send a json message to every connection in this group
292
316
  *
293
- * @param message The message to send
294
- * @param options Additional options
317
+ * @param message - The message to send
318
+ * @param options - Additional options
295
319
  */
296
- sendToAll(message: JSONTypes, options?: GroupSendToAllOptions): Promise<RestResponse>;
320
+ sendToAll(message: JSONTypes, options?: GroupSendToAllOptions): Promise<void>;
297
321
  /**
298
322
  * Send a binary message to every connection in this group
299
323
  *
300
- * @param message The binary message to send
301
- * @param options Additional options
324
+ * @param message - The binary message to send
325
+ * @param options - Additional options
302
326
  */
303
- sendToAll(message: HttpRequestBody, options?: GroupSendToAllOptions): Promise<RestResponse>;
327
+ sendToAll(message: RequestBodyType, options?: GroupSendToAllOptions): Promise<void>;
304
328
  }
305
329
 
306
330
  /**
@@ -332,11 +356,11 @@ export declare class WebPubSubServiceClient {
332
356
  * const client = new WebPubSubServiceClient(connectionString, 'chat');
333
357
  * ```
334
358
  *
335
- * @param connectionString The connection string
336
- * @param hubName The name of the hub to connect to. If omitted, '_default' is used.
337
- * @param options Options to configure the http pipeline
359
+ * @param connectionString - The connection string
360
+ * @param hubName - The name of the hub to connect to. If omitted, '_default' is used.
361
+ * @param options - Options to configure the http pipeline
338
362
  */
339
- constructor(connectionString: string, hubName: string, options?: HubAdminClientOptions);
363
+ constructor(connectionString: string, hubName: string, options?: WebPubSubServiceClientOptions);
340
364
  /**
341
365
  * Creates an instance of a WebPubSubServiceClient for sending messages and managing groups, connections, and users.
342
366
  *
@@ -348,149 +372,173 @@ export declare class WebPubSubServiceClient {
348
372
  * const client = new WebPubSubServiceClient(endpoint, cred, 'chat');
349
373
  * ```
350
374
  *
351
- * @param endpoint The endpoint to connect to
352
- * @param credential An AzureKeyCredential holding your service key
353
- * @param hubName The name of the hub to connect to.
354
- * @param options Options to configure the http pipeline
355
- */
356
- constructor(endpoint: string, credential: AzureKeyCredential, hubName: string, options?: HubAdminClientOptions);
357
- /**
358
- * Auth the client connection with userId and custom claims if any
359
- * @param options The options that the client has
375
+ * @param endpoint - The endpoint to connect to
376
+ * @param credential - An AzureKeyCredential holding your service key
377
+ * @param hubName - The name of the hub to connect to.
378
+ * @param options - Options to configure the http pipeline
360
379
  */
361
- getAuthenticationToken(options?: GetAuthenticationTokenOptions): Promise<GetAuthenticationTokenResponse>;
380
+ constructor(endpoint: string, credential: AzureKeyCredential | TokenCredential, hubName: string, options?: WebPubSubServiceClientOptions);
362
381
  /**
363
382
  * Get a client for a group
364
- * @param groupName The name of the group to connect to.
383
+ * @param groupName - The name of the group to connect to.
365
384
  */
366
385
  group(groupName: string): WebPubSubGroup;
367
386
  /**
368
387
  * Broadcast a text message to all connections on this hub.
369
388
  *
370
- * @param message The text message to send
371
- * @param options Additional options
389
+ * @param message - The text message to send
390
+ * @param options - Additional options
372
391
  */
373
- sendToAll(message: string, options: HubSendTextToAllOptions): Promise<RestResponse>;
392
+ sendToAll(message: string, options: HubSendTextToAllOptions): Promise<void>;
374
393
  /**
375
394
  * Broadcast a JSON message to all connections on this hub.
376
395
  *
377
- * @param message The JSON message to send
378
- * @param options Additional options
396
+ * @param message - The JSON message to send
397
+ * @param options - Additional options
379
398
  */
380
- sendToAll(message: JSONTypes, options?: HubSendToAllOptions): Promise<RestResponse>;
399
+ sendToAll(message: JSONTypes, options?: HubSendToAllOptions): Promise<void>;
381
400
  /**
382
401
  * Broadcast a binary message to all connections on this hub.
383
402
  *
384
- * @param message The message to send
385
- * @param options Additional options
403
+ * @param message - The message to send
404
+ * @param options - Additional options
386
405
  */
387
- sendToAll(message: HttpRequestBody, options?: HubSendToAllOptions): Promise<RestResponse>;
406
+ sendToAll(message: RequestBodyType, options?: HubSendToAllOptions): Promise<void>;
388
407
  /**
389
408
  * Send a text message to a specific user
390
409
  *
391
- * @param username User name to send to
392
- * @param message The text message to send
393
- * @param options Additional options
410
+ * @param username - User name to send to
411
+ * @param message - The text message to send
412
+ * @param options - Additional options
394
413
  */
395
- sendToUser(username: string, message: string, options: HubSendTextToUserOptions): Promise<RestResponse>;
414
+ sendToUser(username: string, message: string, options: HubSendTextToUserOptions): Promise<void>;
396
415
  /**
397
416
  * Send a JSON message to a specific user
398
417
  *
399
- * @param username User name to send to
400
- * @param message The josn message to send
401
- * @param options Additional options
418
+ * @param username - User name to send to
419
+ * @param message - The josn message to send
420
+ * @param options - Additional options
402
421
  */
403
- sendToUser(username: string, message: JSONTypes, options?: HubSendToUserOptions): Promise<RestResponse>;
422
+ sendToUser(username: string, message: JSONTypes, options?: HubSendToUserOptions): Promise<void>;
404
423
  /**
405
424
  * Send a binary message to a specific user
406
425
  *
407
- * @param username The user name to send to
408
- * @param message The binary message to send
409
- * @param options Additional options
426
+ * @param username - The user name to send to
427
+ * @param message - The binary message to send
428
+ * @param options - Additional options
410
429
  */
411
- sendToUser(username: string, message: HttpRequestBody, options?: HubSendToUserOptions | HubSendTextToUserOptions): Promise<RestResponse>;
430
+ sendToUser(username: string, message: RequestBodyType, options?: HubSendToUserOptions | HubSendTextToUserOptions): Promise<void>;
412
431
  /**
413
432
  * Send a text message to a specific connection
414
433
  *
415
- * @param connectionId Connection id to send to
416
- * @param message The text message
417
- * @param options Additional options
434
+ * @param connectionId - Connection id to send to
435
+ * @param message - The text message
436
+ * @param options - Additional options
418
437
  */
419
- sendToConnection(connectionId: string, message: string, options: HubSendTextToConnectionOptions): Promise<RestResponse>;
438
+ sendToConnection(connectionId: string, message: string, options: HubSendTextToConnectionOptions): Promise<void>;
420
439
  /**
421
440
  * Send a binary message to a specific connection
422
441
  *
423
- * @param connectionId Connection id to send to
424
- * @param message The JSON message
425
- * @param options Additional options
442
+ * @param connectionId - Connection id to send to
443
+ * @param message - The JSON message
444
+ * @param options - Additional options
426
445
  */
427
- sendToConnection(connectionId: string, message: JSONTypes, options?: HubSendToConnectionOptions): Promise<RestResponse>;
446
+ sendToConnection(connectionId: string, message: JSONTypes, options?: HubSendToConnectionOptions): Promise<void>;
428
447
  /**
429
448
  * Send a binary message to a specific connection
430
449
  *
431
- * @param connectionId Connection id to send to
432
- * @param message The binary message
433
- * @param options Additional options
450
+ * @param connectionId - Connection id to send to
451
+ * @param message - The binary message
452
+ * @param options - Additional options
434
453
  */
435
- sendToConnection(connectionId: string, message: HttpRequestBody | JSONTypes, options?: HubSendToConnectionOptions | HubSendTextToConnectionOptions): Promise<RestResponse>;
454
+ sendToConnection(connectionId: string, message: RequestBodyType, options?: HubSendToConnectionOptions | HubSendTextToConnectionOptions): Promise<void>;
436
455
  /**
437
456
  * Check if a specific connection is connected to this hub
438
457
  *
439
- * @param connectionId Connection id to check
440
- * @param options Additional options
458
+ * @param connectionId - Connection id to check
459
+ * @param options - Additional options
441
460
  */
442
- hasConnection(connectionId: string, options?: HasConnectionOptions): Promise<boolean>;
461
+ connectionExists(connectionId: string, options?: HasConnectionOptions): Promise<boolean>;
443
462
  /**
444
463
  * Close a specific connection to this hub
445
464
  *
446
- * @param connectionId Connection id to close
447
- * @param options Additional options
465
+ * @param connectionId - Connection id to close
466
+ * @param options - Additional options
467
+ */
468
+ closeConnection(connectionId: string, options?: HubCloseConnectionOptions): Promise<void>;
469
+ /**
470
+ * Close all connections to this hub
471
+ *
472
+ * @param options - Additional options
448
473
  */
449
- closeConnection(connectionId: string, options?: CloseConnectionOptions): Promise<RestResponse>;
474
+ closeAllConnections(options?: HubCloseAllConnectionsOptions): Promise<void>;
475
+ /**
476
+ * Close all connections with the given user id
477
+ *
478
+ * @param user - User id to close
479
+ * @param options - Additional options
480
+ */
481
+ closeUserConnections(userId: string, options?: HubCloseUserConnectionsOptions): Promise<void>;
450
482
  /**
451
483
  * Remove a specific user from all groups they are joined to
452
- * @param userId The user id to remove from all groups
453
- * @param options Additional options
484
+ * @param userId - The user id to remove from all groups
485
+ * @param options - Additional options
454
486
  */
455
- removeUserFromAllGroups(userId: string, options?: CloseConnectionOptions): Promise<RestResponse>;
487
+ removeUserFromAllGroups(userId: string, options?: HubCloseConnectionOptions): Promise<void>;
456
488
  /**
457
489
  * Check if a particular group exists (i.e. has active connections).
458
490
  *
459
- * @param groupName The group name to check for
460
- * @param options Additional options
491
+ * @param groupName - The group name to check for
492
+ * @param options - Additional options
461
493
  */
462
- hasGroup(groupName: string, options?: HubHasGroupOptions): Promise<boolean>;
494
+ groupExists(groupName: string, options?: HubHasGroupOptions): Promise<boolean>;
463
495
  /**
464
496
  * Check if a particular user is connected to this hub.
465
497
  *
466
- * @param username The user name to check for
467
- * @param options Additional options
498
+ * @param username - The user name to check for
499
+ * @param options - Additional options
468
500
  */
469
- hasUser(username: string, options?: HubHasUserOptions): Promise<boolean>;
501
+ userExists(username: string, options?: HubHasUserOptions): Promise<boolean>;
470
502
  /**
471
503
  * Grant permissions to a connection
472
504
  *
473
- * @param connectionId The connection id to grant permissions to
474
- * @param Permission The permission to grant
475
- * @param options Additional options
505
+ * @param connectionId - The connection id to grant permissions to
506
+ * @param Permission - The permission to grant
507
+ * @param options - Additional options
476
508
  */
477
- grantPermission(connectionId: string, permission: Permission, options?: HubGrantPermissionOptions): Promise<RestResponse>;
509
+ grantPermission(connectionId: string, permission: Permission, options?: HubGrantPermissionOptions): Promise<void>;
478
510
  /**
479
511
  * Revoke permissions from a connection
480
512
  *
481
- * @param connectionId The connection id to revoke permissions from
482
- * @param Permission The permission to revoke
483
- * @param options Additional options
513
+ * @param connectionId - The connection id to revoke permissions from
514
+ * @param Permission - The permission to revoke
515
+ * @param options - Additional options
484
516
  */
485
- revokePermission(connectionId: string, permission: Permission, options?: HubRevokePermissionOptions): Promise<RestResponse>;
517
+ revokePermission(connectionId: string, permission: Permission, options?: HubRevokePermissionOptions): Promise<void>;
486
518
  /**
487
519
  * Check if the connection has the specified permission
488
520
  *
489
- * @param connectionId The connection id to check permission
490
- * @param Permission The permission to check
491
- * @param options Additional options
521
+ * @param connectionId - The connection id to check permission
522
+ * @param Permission - The permission to check
523
+ * @param options - Additional options
524
+ */
525
+ hasPermission(connectionId: string, permission: Permission, options?: HubHasPermissionOptions): Promise<boolean>;
526
+ /**
527
+ * Generate a token for a client to connect to the Azure Web PubSub service.
528
+ *
529
+ * @param options - Additional options
530
+ */
531
+ getClientAccessToken(options?: GenerateClientTokenOptions): Promise<ClientTokenResponse>;
532
+ }
533
+
534
+ /**
535
+ * Options for constructing a HubAdmin client.
536
+ */
537
+ export declare interface WebPubSubServiceClientOptions extends CommonClientOptions {
538
+ /**
539
+ * Reverse proxy endpoint (for example, your Azure API management endpoint)
492
540
  */
493
- hasPermission(connectionId: string, permission: Permission, options?: HubHasPermissionOptions): Promise<RestResponse>;
541
+ reverseProxyEndpoint?: string;
494
542
  }
495
543
 
496
544
  export { }
@@ -1,15 +0,0 @@
1
- import { HealthApi, WebPubSub } from "./operations";
2
- import { AzureWebPubSubServiceRestAPIContext } from "./azureWebPubSubServiceRestAPIContext";
3
- export class AzureWebPubSubServiceRestAPI extends AzureWebPubSubServiceRestAPIContext {
4
- /**
5
- * Initializes a new instance of the AzureWebPubSubServiceRestAPI class.
6
- * @param $host server parameter
7
- * @param options The parameter options
8
- */
9
- constructor($host, options) {
10
- super($host, options);
11
- this.healthApi = new HealthApi(this);
12
- this.webPubSub = new WebPubSub(this);
13
- }
14
- }
15
- //# sourceMappingURL=azureWebPubSubServiceRestAPI.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"azureWebPubSubServiceRestAPI.js","sourceRoot":"","sources":["../../../src/generated/azureWebPubSubServiceRestAPI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AAG5F,MAAM,OAAO,4BAA6B,SAAQ,mCAAmC;IACnF;;;;OAIG;IACH,YACE,KAAa,EACb,OAAoD;QAEpD,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;CAIF","sourcesContent":["import { HealthApi, WebPubSub } from \"./operations\";\nimport { AzureWebPubSubServiceRestAPIContext } from \"./azureWebPubSubServiceRestAPIContext\";\nimport { AzureWebPubSubServiceRestAPIOptionalParams } from \"./models\";\n\nexport class AzureWebPubSubServiceRestAPI extends AzureWebPubSubServiceRestAPIContext {\n /**\n * Initializes a new instance of the AzureWebPubSubServiceRestAPI class.\n * @param $host server parameter\n * @param options The parameter options\n */\n constructor(\n $host: string,\n options?: AzureWebPubSubServiceRestAPIOptionalParams\n ) {\n super($host, options);\n this.healthApi = new HealthApi(this);\n this.webPubSub = new WebPubSub(this);\n }\n\n healthApi: HealthApi;\n webPubSub: WebPubSub;\n}\n"]}
@@ -1,34 +0,0 @@
1
- import * as coreHttp from "@azure/core-http";
2
- const packageName = "WebPubSub";
3
- const packageVersion = "1.0.0";
4
- /**
5
- * @hidden
6
- */
7
- export class AzureWebPubSubServiceRestAPIContext extends coreHttp.ServiceClient {
8
- /**
9
- * Initializes a new instance of the AzureWebPubSubServiceRestAPIContext class.
10
- * @param $host server parameter
11
- * @param options The parameter options
12
- */
13
- constructor($host, options) {
14
- if ($host === undefined) {
15
- throw new Error("'$host' cannot be null");
16
- }
17
- // Initializing default values for options
18
- if (!options) {
19
- options = {};
20
- }
21
- if (!options.userAgent) {
22
- const defaultUserAgent = coreHttp.getDefaultUserAgentValue();
23
- options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;
24
- }
25
- super(undefined, options);
26
- this.requestContentType = "application/json; charset=utf-8";
27
- this.baseUri = options.endpoint || "{$host}";
28
- // Parameter assignments
29
- this.$host = $host;
30
- // Assigning values to Constant parameters
31
- this.apiVersion = options.apiVersion || "2020-10-01";
32
- }
33
- }
34
- //# sourceMappingURL=azureWebPubSubServiceRestAPIContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"azureWebPubSubServiceRestAPIContext.js","sourceRoot":"","sources":["../../../src/generated/azureWebPubSubServiceRestAPIContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAG7C,MAAM,WAAW,GAAG,WAAW,CAAC;AAChC,MAAM,cAAc,GAAG,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,OAAO,mCAAoC,SAAQ,QAAQ,CAAC,aAAa;IAI7E;;;;OAIG;IACH,YACE,KAAa,EACb,OAAoD;QAEpD,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAC3C;QAED,0CAA0C;QAC1C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,EAAE,CAAC;SACd;QAED,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YACtB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,wBAAwB,EAAE,CAAC;YAC7D,OAAO,CAAC,SAAS,GAAG,GAAG,WAAW,IAAI,cAAc,IAAI,gBAAgB,EAAE,CAAC;SAC5E;QAED,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE1B,IAAI,CAAC,kBAAkB,GAAG,iCAAiC,CAAC;QAE5D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,QAAQ,IAAI,SAAS,CAAC;QAE7C,wBAAwB;QACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,0CAA0C;QAC1C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,YAAY,CAAC;IACvD,CAAC;CACF","sourcesContent":["import * as coreHttp from \"@azure/core-http\";\nimport { AzureWebPubSubServiceRestAPIOptionalParams } from \"./models\";\n\nconst packageName = \"WebPubSub\";\nconst packageVersion = \"1.0.0\";\n\n/**\n * @hidden\n */\nexport class AzureWebPubSubServiceRestAPIContext extends coreHttp.ServiceClient {\n $host: string;\n apiVersion?: string;\n\n /**\n * Initializes a new instance of the AzureWebPubSubServiceRestAPIContext class.\n * @param $host server parameter\n * @param options The parameter options\n */\n constructor(\n $host: string,\n options?: AzureWebPubSubServiceRestAPIOptionalParams\n ) {\n if ($host === undefined) {\n throw new Error(\"'$host' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n\n if (!options.userAgent) {\n const defaultUserAgent = coreHttp.getDefaultUserAgentValue();\n options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;\n }\n\n super(undefined, options);\n\n this.requestContentType = \"application/json; charset=utf-8\";\n\n this.baseUri = options.endpoint || \"{$host}\";\n\n // Parameter assignments\n this.$host = $host;\n\n // Assigning values to Constant parameters\n this.apiVersion = options.apiVersion || \"2020-10-01\";\n }\n}\n"]}
@@ -1,8 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { __rest } from "tslib";
4
- export default function normalizeSendToAllOptions(options) {
5
- const { excludedConnections } = options, otherOptions = __rest(options, ["excludedConnections"]);
6
- return Object.assign(Object.assign({}, otherOptions), { excluded: excludedConnections });
7
- }
8
- //# sourceMappingURL=normalizeOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeOptions.js","sourceRoot":"","sources":["../../src/normalizeOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,OAAU;IAEV,MAAM,EAAE,mBAAmB,KAAsB,OAAO,EAAxB,YAAY,UAAK,OAAO,EAAlD,uBAAwC,CAAU,CAAC;IACzD,uCACK,YAAY,KACf,QAAQ,EAAE,mBAAmB,IAC7B;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport default function normalizeSendToAllOptions<T extends { excludedConnections?: string[] }>(\n options: T\n) {\n const { excludedConnections, ...otherOptions } = options;\n return {\n ...otherOptions,\n excluded: excludedConnections\n };\n}\n"]}