@azure/web-pubsub 1.1.0-alpha.20221107.1 → 1.1.0-alpha.20221121.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. package/README.md +31 -0
  2. package/dist/index.js +443 -294
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/generated/generatedClient.js +51 -3
  5. package/dist-esm/src/generated/generatedClient.js.map +1 -1
  6. package/dist-esm/src/generated/index.js +0 -1
  7. package/dist-esm/src/generated/index.js.map +1 -1
  8. package/dist-esm/src/generated/models/index.js +2 -0
  9. package/dist-esm/src/generated/models/index.js.map +1 -1
  10. package/dist-esm/src/generated/models/mappers.js +58 -44
  11. package/dist-esm/src/generated/models/mappers.js.map +1 -1
  12. package/dist-esm/src/generated/models/parameters.js +70 -31
  13. package/dist-esm/src/generated/models/parameters.js.map +1 -1
  14. package/dist-esm/src/generated/operations/healthApi.js.map +1 -1
  15. package/dist-esm/src/generated/operations/webPubSub.js +217 -185
  16. package/dist-esm/src/generated/operations/webPubSub.js.map +1 -1
  17. package/dist-esm/src/generated/operationsInterfaces/webPubSub.js.map +1 -1
  18. package/dist-esm/src/groupClient.js.map +1 -1
  19. package/dist-esm/src/hubClient.js +12 -2
  20. package/dist-esm/src/hubClient.js.map +1 -1
  21. package/dist-esm/src/index.js +1 -0
  22. package/dist-esm/src/index.js.map +1 -1
  23. package/dist-esm/src/utils.js +44 -0
  24. package/dist-esm/src/utils.js.map +1 -1
  25. package/dist-esm/test/groups.spec.js +23 -0
  26. package/dist-esm/test/groups.spec.js.map +1 -1
  27. package/dist-esm/test/hubs.spec.js +59 -7
  28. package/dist-esm/test/hubs.spec.js.map +1 -1
  29. package/dist-esm/test/integration.spec.js +99 -7
  30. package/dist-esm/test/integration.spec.js.map +1 -1
  31. package/dist-esm/test/odata.spec.js +15 -0
  32. package/dist-esm/test/odata.spec.js.map +1 -0
  33. package/package.json +3 -2
  34. package/types/web-pubsub.d.ts +56 -3
package/dist/index.js CHANGED
@@ -39,20 +39,6 @@ var jwt__default = /*#__PURE__*/_interopDefaultLegacy(jwt);
39
39
  * Code generated by Microsoft (R) AutoRest Code Generator.
40
40
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
41
41
  */
42
- const ClientTokenResponse = {
43
- type: {
44
- name: "Composite",
45
- className: "ClientTokenResponse",
46
- modelProperties: {
47
- token: {
48
- serializedName: "token",
49
- type: {
50
- name: "String"
51
- }
52
- }
53
- }
54
- }
55
- };
56
42
  const ErrorDetail = {
57
43
  type: {
58
44
  name: "Composite",
@@ -119,13 +105,13 @@ const InnerError = {
119
105
  }
120
106
  }
121
107
  };
122
- const WebPubSubGenerateClientTokenExceptionHeaders = {
108
+ const ClientTokenResponse = {
123
109
  type: {
124
110
  name: "Composite",
125
- className: "WebPubSubGenerateClientTokenExceptionHeaders",
111
+ className: "ClientTokenResponse",
126
112
  modelProperties: {
127
- errorCode: {
128
- serializedName: "x-ms-error-code",
113
+ token: {
114
+ serializedName: "token",
129
115
  type: {
130
116
  name: "String"
131
117
  }
@@ -147,10 +133,10 @@ const WebPubSubCloseAllConnectionsExceptionHeaders = {
147
133
  }
148
134
  }
149
135
  };
150
- const WebPubSubSendToAllExceptionHeaders = {
136
+ const WebPubSubGenerateClientTokenExceptionHeaders = {
151
137
  type: {
152
138
  name: "Composite",
153
- className: "WebPubSubSendToAllExceptionHeaders",
139
+ className: "WebPubSubGenerateClientTokenExceptionHeaders",
154
140
  modelProperties: {
155
141
  errorCode: {
156
142
  serializedName: "x-ms-error-code",
@@ -161,10 +147,10 @@ const WebPubSubSendToAllExceptionHeaders = {
161
147
  }
162
148
  }
163
149
  };
164
- const WebPubSubConnectionExistsExceptionHeaders = {
150
+ const WebPubSubSendToAllExceptionHeaders = {
165
151
  type: {
166
152
  name: "Composite",
167
- className: "WebPubSubConnectionExistsExceptionHeaders",
153
+ className: "WebPubSubSendToAllExceptionHeaders",
168
154
  modelProperties: {
169
155
  errorCode: {
170
156
  serializedName: "x-ms-error-code",
@@ -189,6 +175,20 @@ const WebPubSubCloseConnectionExceptionHeaders = {
189
175
  }
190
176
  }
191
177
  };
178
+ const WebPubSubConnectionExistsExceptionHeaders = {
179
+ type: {
180
+ name: "Composite",
181
+ className: "WebPubSubConnectionExistsExceptionHeaders",
182
+ modelProperties: {
183
+ errorCode: {
184
+ serializedName: "x-ms-error-code",
185
+ type: {
186
+ name: "String"
187
+ }
188
+ }
189
+ }
190
+ }
191
+ };
192
192
  const WebPubSubSendToConnectionExceptionHeaders = {
193
193
  type: {
194
194
  name: "Composite",
@@ -203,6 +203,20 @@ const WebPubSubSendToConnectionExceptionHeaders = {
203
203
  }
204
204
  }
205
205
  };
206
+ const WebPubSubRemoveConnectionFromAllGroupsExceptionHeaders = {
207
+ type: {
208
+ name: "Composite",
209
+ className: "WebPubSubRemoveConnectionFromAllGroupsExceptionHeaders",
210
+ modelProperties: {
211
+ errorCode: {
212
+ serializedName: "x-ms-error-code",
213
+ type: {
214
+ name: "String"
215
+ }
216
+ }
217
+ }
218
+ }
219
+ };
206
220
  const WebPubSubGroupExistsExceptionHeaders = {
207
221
  type: {
208
222
  name: "Composite",
@@ -245,10 +259,10 @@ const WebPubSubSendToGroupExceptionHeaders = {
245
259
  }
246
260
  }
247
261
  };
248
- const WebPubSubAddConnectionToGroupExceptionHeaders = {
262
+ const WebPubSubRemoveConnectionFromGroupExceptionHeaders = {
249
263
  type: {
250
264
  name: "Composite",
251
- className: "WebPubSubAddConnectionToGroupExceptionHeaders",
265
+ className: "WebPubSubRemoveConnectionFromGroupExceptionHeaders",
252
266
  modelProperties: {
253
267
  errorCode: {
254
268
  serializedName: "x-ms-error-code",
@@ -259,10 +273,10 @@ const WebPubSubAddConnectionToGroupExceptionHeaders = {
259
273
  }
260
274
  }
261
275
  };
262
- const WebPubSubRemoveConnectionFromGroupExceptionHeaders = {
276
+ const WebPubSubAddConnectionToGroupExceptionHeaders = {
263
277
  type: {
264
278
  name: "Composite",
265
- className: "WebPubSubRemoveConnectionFromGroupExceptionHeaders",
279
+ className: "WebPubSubAddConnectionToGroupExceptionHeaders",
266
280
  modelProperties: {
267
281
  errorCode: {
268
282
  serializedName: "x-ms-error-code",
@@ -273,10 +287,10 @@ const WebPubSubRemoveConnectionFromGroupExceptionHeaders = {
273
287
  }
274
288
  }
275
289
  };
276
- const WebPubSubUserExistsExceptionHeaders = {
290
+ const WebPubSubRevokePermissionExceptionHeaders = {
277
291
  type: {
278
292
  name: "Composite",
279
- className: "WebPubSubUserExistsExceptionHeaders",
293
+ className: "WebPubSubRevokePermissionExceptionHeaders",
280
294
  modelProperties: {
281
295
  errorCode: {
282
296
  serializedName: "x-ms-error-code",
@@ -287,10 +301,10 @@ const WebPubSubUserExistsExceptionHeaders = {
287
301
  }
288
302
  }
289
303
  };
290
- const WebPubSubCloseUserConnectionsExceptionHeaders = {
304
+ const WebPubSubCheckPermissionExceptionHeaders = {
291
305
  type: {
292
306
  name: "Composite",
293
- className: "WebPubSubCloseUserConnectionsExceptionHeaders",
307
+ className: "WebPubSubCheckPermissionExceptionHeaders",
294
308
  modelProperties: {
295
309
  errorCode: {
296
310
  serializedName: "x-ms-error-code",
@@ -301,10 +315,10 @@ const WebPubSubCloseUserConnectionsExceptionHeaders = {
301
315
  }
302
316
  }
303
317
  };
304
- const WebPubSubSendToUserExceptionHeaders = {
318
+ const WebPubSubGrantPermissionExceptionHeaders = {
305
319
  type: {
306
320
  name: "Composite",
307
- className: "WebPubSubSendToUserExceptionHeaders",
321
+ className: "WebPubSubGrantPermissionExceptionHeaders",
308
322
  modelProperties: {
309
323
  errorCode: {
310
324
  serializedName: "x-ms-error-code",
@@ -315,10 +329,10 @@ const WebPubSubSendToUserExceptionHeaders = {
315
329
  }
316
330
  }
317
331
  };
318
- const WebPubSubAddUserToGroupExceptionHeaders = {
332
+ const WebPubSubUserExistsExceptionHeaders = {
319
333
  type: {
320
334
  name: "Composite",
321
- className: "WebPubSubAddUserToGroupExceptionHeaders",
335
+ className: "WebPubSubUserExistsExceptionHeaders",
322
336
  modelProperties: {
323
337
  errorCode: {
324
338
  serializedName: "x-ms-error-code",
@@ -329,10 +343,10 @@ const WebPubSubAddUserToGroupExceptionHeaders = {
329
343
  }
330
344
  }
331
345
  };
332
- const WebPubSubRemoveUserFromGroupExceptionHeaders = {
346
+ const WebPubSubCloseUserConnectionsExceptionHeaders = {
333
347
  type: {
334
348
  name: "Composite",
335
- className: "WebPubSubRemoveUserFromGroupExceptionHeaders",
349
+ className: "WebPubSubCloseUserConnectionsExceptionHeaders",
336
350
  modelProperties: {
337
351
  errorCode: {
338
352
  serializedName: "x-ms-error-code",
@@ -343,10 +357,10 @@ const WebPubSubRemoveUserFromGroupExceptionHeaders = {
343
357
  }
344
358
  }
345
359
  };
346
- const WebPubSubRemoveUserFromAllGroupsExceptionHeaders = {
360
+ const WebPubSubSendToUserExceptionHeaders = {
347
361
  type: {
348
362
  name: "Composite",
349
- className: "WebPubSubRemoveUserFromAllGroupsExceptionHeaders",
363
+ className: "WebPubSubSendToUserExceptionHeaders",
350
364
  modelProperties: {
351
365
  errorCode: {
352
366
  serializedName: "x-ms-error-code",
@@ -357,10 +371,10 @@ const WebPubSubRemoveUserFromAllGroupsExceptionHeaders = {
357
371
  }
358
372
  }
359
373
  };
360
- const WebPubSubGrantPermissionExceptionHeaders = {
374
+ const WebPubSubRemoveUserFromAllGroupsExceptionHeaders = {
361
375
  type: {
362
376
  name: "Composite",
363
- className: "WebPubSubGrantPermissionExceptionHeaders",
377
+ className: "WebPubSubRemoveUserFromAllGroupsExceptionHeaders",
364
378
  modelProperties: {
365
379
  errorCode: {
366
380
  serializedName: "x-ms-error-code",
@@ -371,10 +385,10 @@ const WebPubSubGrantPermissionExceptionHeaders = {
371
385
  }
372
386
  }
373
387
  };
374
- const WebPubSubRevokePermissionExceptionHeaders = {
388
+ const WebPubSubRemoveUserFromGroupExceptionHeaders = {
375
389
  type: {
376
390
  name: "Composite",
377
- className: "WebPubSubRevokePermissionExceptionHeaders",
391
+ className: "WebPubSubRemoveUserFromGroupExceptionHeaders",
378
392
  modelProperties: {
379
393
  errorCode: {
380
394
  serializedName: "x-ms-error-code",
@@ -385,10 +399,10 @@ const WebPubSubRevokePermissionExceptionHeaders = {
385
399
  }
386
400
  }
387
401
  };
388
- const WebPubSubCheckPermissionExceptionHeaders = {
402
+ const WebPubSubAddUserToGroupExceptionHeaders = {
389
403
  type: {
390
404
  name: "Composite",
391
- className: "WebPubSubCheckPermissionExceptionHeaders",
405
+ className: "WebPubSubAddUserToGroupExceptionHeaders",
392
406
  modelProperties: {
393
407
  errorCode: {
394
408
  serializedName: "x-ms-error-code",
@@ -402,29 +416,30 @@ const WebPubSubCheckPermissionExceptionHeaders = {
402
416
 
403
417
  var Mappers = /*#__PURE__*/Object.freeze({
404
418
  __proto__: null,
405
- ClientTokenResponse: ClientTokenResponse,
406
419
  ErrorDetail: ErrorDetail,
407
420
  InnerError: InnerError,
408
- WebPubSubGenerateClientTokenExceptionHeaders: WebPubSubGenerateClientTokenExceptionHeaders,
421
+ ClientTokenResponse: ClientTokenResponse,
409
422
  WebPubSubCloseAllConnectionsExceptionHeaders: WebPubSubCloseAllConnectionsExceptionHeaders,
423
+ WebPubSubGenerateClientTokenExceptionHeaders: WebPubSubGenerateClientTokenExceptionHeaders,
410
424
  WebPubSubSendToAllExceptionHeaders: WebPubSubSendToAllExceptionHeaders,
411
- WebPubSubConnectionExistsExceptionHeaders: WebPubSubConnectionExistsExceptionHeaders,
412
425
  WebPubSubCloseConnectionExceptionHeaders: WebPubSubCloseConnectionExceptionHeaders,
426
+ WebPubSubConnectionExistsExceptionHeaders: WebPubSubConnectionExistsExceptionHeaders,
413
427
  WebPubSubSendToConnectionExceptionHeaders: WebPubSubSendToConnectionExceptionHeaders,
428
+ WebPubSubRemoveConnectionFromAllGroupsExceptionHeaders: WebPubSubRemoveConnectionFromAllGroupsExceptionHeaders,
414
429
  WebPubSubGroupExistsExceptionHeaders: WebPubSubGroupExistsExceptionHeaders,
415
430
  WebPubSubCloseGroupConnectionsExceptionHeaders: WebPubSubCloseGroupConnectionsExceptionHeaders,
416
431
  WebPubSubSendToGroupExceptionHeaders: WebPubSubSendToGroupExceptionHeaders,
417
- WebPubSubAddConnectionToGroupExceptionHeaders: WebPubSubAddConnectionToGroupExceptionHeaders,
418
432
  WebPubSubRemoveConnectionFromGroupExceptionHeaders: WebPubSubRemoveConnectionFromGroupExceptionHeaders,
433
+ WebPubSubAddConnectionToGroupExceptionHeaders: WebPubSubAddConnectionToGroupExceptionHeaders,
434
+ WebPubSubRevokePermissionExceptionHeaders: WebPubSubRevokePermissionExceptionHeaders,
435
+ WebPubSubCheckPermissionExceptionHeaders: WebPubSubCheckPermissionExceptionHeaders,
436
+ WebPubSubGrantPermissionExceptionHeaders: WebPubSubGrantPermissionExceptionHeaders,
419
437
  WebPubSubUserExistsExceptionHeaders: WebPubSubUserExistsExceptionHeaders,
420
438
  WebPubSubCloseUserConnectionsExceptionHeaders: WebPubSubCloseUserConnectionsExceptionHeaders,
421
439
  WebPubSubSendToUserExceptionHeaders: WebPubSubSendToUserExceptionHeaders,
422
- WebPubSubAddUserToGroupExceptionHeaders: WebPubSubAddUserToGroupExceptionHeaders,
423
- WebPubSubRemoveUserFromGroupExceptionHeaders: WebPubSubRemoveUserFromGroupExceptionHeaders,
424
440
  WebPubSubRemoveUserFromAllGroupsExceptionHeaders: WebPubSubRemoveUserFromAllGroupsExceptionHeaders,
425
- WebPubSubGrantPermissionExceptionHeaders: WebPubSubGrantPermissionExceptionHeaders,
426
- WebPubSubRevokePermissionExceptionHeaders: WebPubSubRevokePermissionExceptionHeaders,
427
- WebPubSubCheckPermissionExceptionHeaders: WebPubSubCheckPermissionExceptionHeaders
441
+ WebPubSubRemoveUserFromGroupExceptionHeaders: WebPubSubRemoveUserFromGroupExceptionHeaders,
442
+ WebPubSubAddUserToGroupExceptionHeaders: WebPubSubAddUserToGroupExceptionHeaders
428
443
  });
429
444
 
430
445
  /*
@@ -448,7 +463,7 @@ const endpoint = {
448
463
  const apiVersion = {
449
464
  parameterPath: "apiVersion",
450
465
  mapper: {
451
- defaultValue: "2021-10-01",
466
+ defaultValue: "2022-11-01",
452
467
  isConstant: true,
453
468
  serializedName: "api-version",
454
469
  type: {
@@ -459,7 +474,7 @@ const apiVersion = {
459
474
  const accept = {
460
475
  parameterPath: "accept",
461
476
  mapper: {
462
- defaultValue: "application/json, text/json",
477
+ defaultValue: "application/json",
463
478
  isConstant: true,
464
479
  serializedName: "Accept",
465
480
  type: {
@@ -480,6 +495,41 @@ const hub = {
480
495
  }
481
496
  }
482
497
  };
498
+ const excluded = {
499
+ parameterPath: ["options", "excluded"],
500
+ mapper: {
501
+ serializedName: "excluded",
502
+ type: {
503
+ name: "Sequence",
504
+ element: {
505
+ type: {
506
+ name: "String"
507
+ }
508
+ }
509
+ }
510
+ },
511
+ collectionFormat: "Multi"
512
+ };
513
+ const reason = {
514
+ parameterPath: ["options", "reason"],
515
+ mapper: {
516
+ serializedName: "reason",
517
+ type: {
518
+ name: "String"
519
+ }
520
+ }
521
+ };
522
+ const accept1 = {
523
+ parameterPath: "accept",
524
+ mapper: {
525
+ defaultValue: "application/json, text/json",
526
+ isConstant: true,
527
+ serializedName: "Accept",
528
+ type: {
529
+ name: "String"
530
+ }
531
+ }
532
+ };
483
533
  const userId = {
484
534
  parameterPath: ["options", "userId"],
485
535
  mapper: {
@@ -508,16 +558,19 @@ const expirationTimeInMinutes = {
508
558
  parameterPath: ["options", "expirationTimeInMinutes"],
509
559
  mapper: {
510
560
  defaultValue: 60,
561
+ constraints: {
562
+ InclusiveMinimum: 1
563
+ },
511
564
  serializedName: "minutesToExpire",
512
565
  type: {
513
566
  name: "Number"
514
567
  }
515
568
  }
516
569
  };
517
- const excluded = {
518
- parameterPath: ["options", "excluded"],
570
+ const groups = {
571
+ parameterPath: ["options", "groups"],
519
572
  mapper: {
520
- serializedName: "excluded",
573
+ serializedName: "group",
521
574
  type: {
522
575
  name: "Sequence",
523
576
  element: {
@@ -529,15 +582,6 @@ const excluded = {
529
582
  },
530
583
  collectionFormat: "Multi"
531
584
  };
532
- const reason = {
533
- parameterPath: ["options", "reason"],
534
- mapper: {
535
- serializedName: "reason",
536
- type: {
537
- name: "String"
538
- }
539
- }
540
- };
541
585
  const contentType = {
542
586
  parameterPath: "contentType",
543
587
  mapper: {
@@ -559,10 +603,10 @@ const message = {
559
603
  }
560
604
  }
561
605
  };
562
- const accept1 = {
606
+ const accept2 = {
563
607
  parameterPath: "accept",
564
608
  mapper: {
565
- defaultValue: "application/json, text/json",
609
+ defaultValue: "application/json",
566
610
  isConstant: true,
567
611
  serializedName: "Accept",
568
612
  type: {
@@ -591,10 +635,10 @@ const message1 = {
591
635
  }
592
636
  }
593
637
  };
594
- const accept2 = {
638
+ const accept3 = {
595
639
  parameterPath: "accept",
596
640
  mapper: {
597
- defaultValue: "application/json, text/json",
641
+ defaultValue: "application/json",
598
642
  isConstant: true,
599
643
  serializedName: "Accept",
600
644
  type: {
@@ -617,6 +661,15 @@ const excludedConnections = {
617
661
  },
618
662
  collectionFormat: "Multi"
619
663
  };
664
+ const filter = {
665
+ parameterPath: ["options", "filter"],
666
+ mapper: {
667
+ serializedName: "filter",
668
+ type: {
669
+ name: "String"
670
+ }
671
+ }
672
+ };
620
673
  const connectionId = {
621
674
  parameterPath: "connectionId",
622
675
  mapper: {
@@ -634,6 +687,7 @@ const group = {
634
687
  parameterPath: "group",
635
688
  mapper: {
636
689
  constraints: {
690
+ Pattern: new RegExp("^(?!\\s+$).+$"),
637
691
  MaxLength: 1024,
638
692
  MinLength: 1
639
693
  },
@@ -644,19 +698,6 @@ const group = {
644
698
  }
645
699
  }
646
700
  };
647
- const userId1 = {
648
- parameterPath: "userId",
649
- mapper: {
650
- constraints: {
651
- MinLength: 1
652
- },
653
- serializedName: "userId",
654
- required: true,
655
- type: {
656
- name: "String"
657
- }
658
- }
659
- };
660
701
  const permission = {
661
702
  parameterPath: "permission",
662
703
  mapper: {
@@ -676,6 +717,19 @@ const targetName = {
676
717
  }
677
718
  }
678
719
  };
720
+ const userId1 = {
721
+ parameterPath: "userId",
722
+ mapper: {
723
+ constraints: {
724
+ MinLength: 1
725
+ },
726
+ serializedName: "userId",
727
+ required: true,
728
+ type: {
729
+ name: "String"
730
+ }
731
+ }
732
+ };
679
733
 
680
734
  /*
681
735
  * Copyright (c) Microsoft Corporation.
@@ -729,22 +783,22 @@ class WebPubSubImpl {
729
783
  this.client = client;
730
784
  }
731
785
  /**
732
- * Generate token for the client to connect Azure Web PubSub service.
786
+ * Close the connections in the hub.
733
787
  * @param hub Target hub name, which should start with alphabetic characters and only contain
734
788
  * alpha-numeric characters or underscore.
735
789
  * @param options The options parameters.
736
790
  */
737
- generateClientToken(hub, options) {
738
- return this.client.sendOperationRequest({ hub, options }, generateClientTokenOperationSpec);
791
+ closeAllConnections(hub, options) {
792
+ return this.client.sendOperationRequest({ hub, options }, closeAllConnectionsOperationSpec);
739
793
  }
740
794
  /**
741
- * Close the connections in the hub.
795
+ * Generate token for the client to connect Azure Web PubSub service.
742
796
  * @param hub Target hub name, which should start with alphabetic characters and only contain
743
797
  * alpha-numeric characters or underscore.
744
798
  * @param options The options parameters.
745
799
  */
746
- closeAllConnections(hub, options) {
747
- return this.client.sendOperationRequest({ hub, options }, closeAllConnectionsOperationSpec);
800
+ generateClientToken(hub, options) {
801
+ return this.client.sendOperationRequest({ hub, options }, generateClientTokenOperationSpec);
748
802
  }
749
803
  /**
750
804
  * Broadcast content inside request body to all the connected client connections.
@@ -782,24 +836,24 @@ class WebPubSubImpl {
782
836
  return this.client.sendOperationRequest(operationArguments, operationSpec);
783
837
  }
784
838
  /**
785
- * Check if the connection with the given connectionId exists.
839
+ * Close the client connection.
786
840
  * @param hub Target hub name, which should start with alphabetic characters and only contain
787
841
  * alpha-numeric characters or underscore.
788
- * @param connectionId The connection Id.
842
+ * @param connectionId Target connection Id.
789
843
  * @param options The options parameters.
790
844
  */
791
- connectionExists(hub, connectionId, options) {
792
- return this.client.sendOperationRequest({ hub, connectionId, options }, connectionExistsOperationSpec);
845
+ closeConnection(hub, connectionId, options) {
846
+ return this.client.sendOperationRequest({ hub, connectionId, options }, closeConnectionOperationSpec);
793
847
  }
794
848
  /**
795
- * Close the client connection.
849
+ * Check if the connection with the given connectionId exists.
796
850
  * @param hub Target hub name, which should start with alphabetic characters and only contain
797
851
  * alpha-numeric characters or underscore.
798
- * @param connectionId Target connection Id.
852
+ * @param connectionId The connection Id.
799
853
  * @param options The options parameters.
800
854
  */
801
- closeConnection(hub, connectionId, options) {
802
- return this.client.sendOperationRequest({ hub, connectionId, options }, closeConnectionOperationSpec);
855
+ connectionExists(hub, connectionId, options) {
856
+ return this.client.sendOperationRequest({ hub, connectionId, options }, connectionExistsOperationSpec);
803
857
  }
804
858
  /**
805
859
  * Send content inside request body to the specific connection.
@@ -838,6 +892,16 @@ class WebPubSubImpl {
838
892
  operationArguments.options = options || {};
839
893
  return this.client.sendOperationRequest(operationArguments, operationSpec);
840
894
  }
895
+ /**
896
+ * Remove a connection from all groups.
897
+ * @param hub Target hub name, which should start with alphabetic characters and only contain
898
+ * alpha-numeric characters or underscore.
899
+ * @param connectionId Target connection Id.
900
+ * @param options The options parameters.
901
+ */
902
+ removeConnectionFromAllGroups(hub, connectionId, options) {
903
+ return this.client.sendOperationRequest({ hub, connectionId, options }, removeConnectionFromAllGroupsOperationSpec);
904
+ }
841
905
  /**
842
906
  * Check if there are any client connections inside the given group
843
907
  * @param hub Target hub name, which should start with alphabetic characters and only contain
@@ -895,6 +959,17 @@ class WebPubSubImpl {
895
959
  operationArguments.options = options || {};
896
960
  return this.client.sendOperationRequest(operationArguments, operationSpec);
897
961
  }
962
+ /**
963
+ * Remove a connection from the target group.
964
+ * @param hub Target hub name, which should start with alphabetic characters and only contain
965
+ * alpha-numeric characters or underscore.
966
+ * @param group Target group name, which length should be greater than 0 and less than 1025.
967
+ * @param connectionId Target connection Id.
968
+ * @param options The options parameters.
969
+ */
970
+ removeConnectionFromGroup(hub, group, connectionId, options) {
971
+ return this.client.sendOperationRequest({ hub, group, connectionId, options }, removeConnectionFromGroupOperationSpec);
972
+ }
898
973
  /**
899
974
  * Add a connection to the target group.
900
975
  * @param hub Target hub name, which should start with alphabetic characters and only contain
@@ -907,15 +982,37 @@ class WebPubSubImpl {
907
982
  return this.client.sendOperationRequest({ hub, group, connectionId, options }, addConnectionToGroupOperationSpec);
908
983
  }
909
984
  /**
910
- * Remove a connection from the target group.
985
+ * Revoke permission for the connection.
911
986
  * @param hub Target hub name, which should start with alphabetic characters and only contain
912
987
  * alpha-numeric characters or underscore.
913
- * @param group Target group name, which length should be greater than 0 and less than 1025.
988
+ * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup.
914
989
  * @param connectionId Target connection Id.
915
990
  * @param options The options parameters.
916
991
  */
917
- removeConnectionFromGroup(hub, group, connectionId, options) {
918
- return this.client.sendOperationRequest({ hub, group, connectionId, options }, removeConnectionFromGroupOperationSpec);
992
+ revokePermission(hub, permission, connectionId, options) {
993
+ return this.client.sendOperationRequest({ hub, permission, connectionId, options }, revokePermissionOperationSpec);
994
+ }
995
+ /**
996
+ * Check if a connection has permission to the specified action.
997
+ * @param hub Target hub name, which should start with alphabetic characters and only contain
998
+ * alpha-numeric characters or underscore.
999
+ * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup.
1000
+ * @param connectionId Target connection Id.
1001
+ * @param options The options parameters.
1002
+ */
1003
+ checkPermission(hub, permission, connectionId, options) {
1004
+ return this.client.sendOperationRequest({ hub, permission, connectionId, options }, checkPermissionOperationSpec);
1005
+ }
1006
+ /**
1007
+ * Grant permission to the connection.
1008
+ * @param hub Target hub name, which should start with alphabetic characters and only contain
1009
+ * alpha-numeric characters or underscore.
1010
+ * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup.
1011
+ * @param connectionId Target connection Id.
1012
+ * @param options The options parameters.
1013
+ */
1014
+ grantPermission(hub, permission, connectionId, options) {
1015
+ return this.client.sendOperationRequest({ hub, permission, connectionId, options }, grantPermissionOperationSpec);
919
1016
  }
920
1017
  /**
921
1018
  * Check if there are any client connections connected for the given user.
@@ -975,15 +1072,14 @@ class WebPubSubImpl {
975
1072
  return this.client.sendOperationRequest(operationArguments, operationSpec);
976
1073
  }
977
1074
  /**
978
- * Add a user to the target group.
1075
+ * Remove a user from all groups.
979
1076
  * @param hub Target hub name, which should start with alphabetic characters and only contain
980
1077
  * alpha-numeric characters or underscore.
981
- * @param group Target group name, which length should be greater than 0 and less than 1025.
982
1078
  * @param userId Target user Id.
983
1079
  * @param options The options parameters.
984
1080
  */
985
- addUserToGroup(hub, group, userId, options) {
986
- return this.client.sendOperationRequest({ hub, group, userId, options }, addUserToGroupOperationSpec);
1081
+ removeUserFromAllGroups(hub, userId, options) {
1082
+ return this.client.sendOperationRequest({ hub, userId, options }, removeUserFromAllGroupsOperationSpec);
987
1083
  }
988
1084
  /**
989
1085
  * Remove a user from the target group.
@@ -997,90 +1093,59 @@ class WebPubSubImpl {
997
1093
  return this.client.sendOperationRequest({ hub, group, userId, options }, removeUserFromGroupOperationSpec);
998
1094
  }
999
1095
  /**
1000
- * Remove a user from all groups.
1096
+ * Add a user to the target group.
1001
1097
  * @param hub Target hub name, which should start with alphabetic characters and only contain
1002
1098
  * alpha-numeric characters or underscore.
1099
+ * @param group Target group name, which length should be greater than 0 and less than 1025.
1003
1100
  * @param userId Target user Id.
1004
1101
  * @param options The options parameters.
1005
1102
  */
1006
- removeUserFromAllGroups(hub, userId, options) {
1007
- return this.client.sendOperationRequest({ hub, userId, options }, removeUserFromAllGroupsOperationSpec);
1008
- }
1009
- /**
1010
- * Grant permission to the connection.
1011
- * @param hub Target hub name, which should start with alphabetic characters and only contain
1012
- * alpha-numeric characters or underscore.
1013
- * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup.
1014
- * @param connectionId Target connection Id.
1015
- * @param options The options parameters.
1016
- */
1017
- grantPermission(hub, permission, connectionId, options) {
1018
- return this.client.sendOperationRequest({ hub, permission, connectionId, options }, grantPermissionOperationSpec);
1019
- }
1020
- /**
1021
- * Revoke permission for the connection.
1022
- * @param hub Target hub name, which should start with alphabetic characters and only contain
1023
- * alpha-numeric characters or underscore.
1024
- * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup.
1025
- * @param connectionId Target connection Id.
1026
- * @param options The options parameters.
1027
- */
1028
- revokePermission(hub, permission, connectionId, options) {
1029
- return this.client.sendOperationRequest({ hub, permission, connectionId, options }, revokePermissionOperationSpec);
1030
- }
1031
- /**
1032
- * Check if a connection has permission to the specified action.
1033
- * @param hub Target hub name, which should start with alphabetic characters and only contain
1034
- * alpha-numeric characters or underscore.
1035
- * @param permission The permission: current supported actions are joinLeaveGroup and sendToGroup.
1036
- * @param connectionId Target connection Id.
1037
- * @param options The options parameters.
1038
- */
1039
- checkPermission(hub, permission, connectionId, options) {
1040
- return this.client.sendOperationRequest({ hub, permission, connectionId, options }, checkPermissionOperationSpec);
1103
+ addUserToGroup(hub, group, userId, options) {
1104
+ return this.client.sendOperationRequest({ hub, group, userId, options }, addUserToGroupOperationSpec);
1041
1105
  }
1042
1106
  }
1043
1107
  // Operation Specifications
1044
1108
  const serializer = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
1045
- const generateClientTokenOperationSpec = {
1046
- path: "/api/hubs/{hub}/:generateToken",
1109
+ const closeAllConnectionsOperationSpec = {
1110
+ path: "/api/hubs/{hub}/:closeConnections",
1047
1111
  httpMethod: "POST",
1048
1112
  responses: {
1049
- 200: {
1050
- bodyMapper: ClientTokenResponse
1051
- },
1113
+ 204: {},
1052
1114
  default: {
1053
1115
  bodyMapper: ErrorDetail,
1054
- headersMapper: WebPubSubGenerateClientTokenExceptionHeaders
1116
+ headersMapper: WebPubSubCloseAllConnectionsExceptionHeaders
1055
1117
  }
1056
1118
  },
1057
1119
  queryParameters: [
1058
1120
  apiVersion,
1059
- userId,
1060
- roles,
1061
- expirationTimeInMinutes
1121
+ excluded,
1122
+ reason
1062
1123
  ],
1063
1124
  urlParameters: [endpoint, hub],
1064
1125
  headerParameters: [accept],
1065
1126
  serializer
1066
1127
  };
1067
- const closeAllConnectionsOperationSpec = {
1068
- path: "/api/hubs/{hub}/:closeConnections",
1128
+ const generateClientTokenOperationSpec = {
1129
+ path: "/api/hubs/{hub}/:generateToken",
1069
1130
  httpMethod: "POST",
1070
1131
  responses: {
1071
- 204: {},
1132
+ 200: {
1133
+ bodyMapper: ClientTokenResponse
1134
+ },
1072
1135
  default: {
1073
1136
  bodyMapper: ErrorDetail,
1074
- headersMapper: WebPubSubCloseAllConnectionsExceptionHeaders
1137
+ headersMapper: WebPubSubGenerateClientTokenExceptionHeaders
1075
1138
  }
1076
1139
  },
1077
1140
  queryParameters: [
1078
1141
  apiVersion,
1079
- excluded,
1080
- reason
1142
+ userId,
1143
+ roles,
1144
+ expirationTimeInMinutes,
1145
+ groups
1081
1146
  ],
1082
1147
  urlParameters: [endpoint, hub],
1083
- headerParameters: [accept],
1148
+ headerParameters: [accept1],
1084
1149
  serializer
1085
1150
  };
1086
1151
  const sendToAll$binaryOperationSpec = {
@@ -1094,9 +1159,13 @@ const sendToAll$binaryOperationSpec = {
1094
1159
  }
1095
1160
  },
1096
1161
  requestBody: message,
1097
- queryParameters: [apiVersion, excludedConnections],
1162
+ queryParameters: [
1163
+ apiVersion,
1164
+ excludedConnections,
1165
+ filter
1166
+ ],
1098
1167
  urlParameters: [endpoint, hub],
1099
- headerParameters: [contentType, accept1],
1168
+ headerParameters: [contentType, accept2],
1100
1169
  mediaType: "binary",
1101
1170
  serializer
1102
1171
  };
@@ -1111,41 +1180,43 @@ const sendToAll$textOperationSpec = {
1111
1180
  }
1112
1181
  },
1113
1182
  requestBody: message1,
1114
- queryParameters: [apiVersion, excludedConnections],
1183
+ queryParameters: [
1184
+ apiVersion,
1185
+ excludedConnections,
1186
+ filter
1187
+ ],
1115
1188
  urlParameters: [endpoint, hub],
1116
- headerParameters: [contentType1, accept2],
1189
+ headerParameters: [contentType1, accept3],
1117
1190
  mediaType: "text",
1118
1191
  serializer
1119
1192
  };
1120
- const connectionExistsOperationSpec = {
1193
+ const closeConnectionOperationSpec = {
1121
1194
  path: "/api/hubs/{hub}/connections/{connectionId}",
1122
- httpMethod: "HEAD",
1195
+ httpMethod: "DELETE",
1123
1196
  responses: {
1124
- 200: {},
1125
- 404: {},
1197
+ 204: {},
1126
1198
  default: {
1127
1199
  bodyMapper: ErrorDetail,
1128
- headersMapper: WebPubSubConnectionExistsExceptionHeaders
1200
+ headersMapper: WebPubSubCloseConnectionExceptionHeaders
1129
1201
  }
1130
1202
  },
1131
- queryParameters: [apiVersion],
1203
+ queryParameters: [apiVersion, reason],
1132
1204
  urlParameters: [endpoint, hub, connectionId],
1133
1205
  headerParameters: [accept],
1134
1206
  serializer
1135
1207
  };
1136
- const closeConnectionOperationSpec = {
1208
+ const connectionExistsOperationSpec = {
1137
1209
  path: "/api/hubs/{hub}/connections/{connectionId}",
1138
- httpMethod: "DELETE",
1210
+ httpMethod: "HEAD",
1139
1211
  responses: {
1140
- 204: {},
1212
+ 200: {},
1213
+ 404: {},
1141
1214
  default: {
1142
- bodyMapper: ErrorDetail,
1143
- headersMapper: WebPubSubCloseConnectionExceptionHeaders
1215
+ headersMapper: WebPubSubConnectionExistsExceptionHeaders
1144
1216
  }
1145
1217
  },
1146
- queryParameters: [apiVersion, reason],
1218
+ queryParameters: [apiVersion],
1147
1219
  urlParameters: [endpoint, hub, connectionId],
1148
- headerParameters: [accept],
1149
1220
  serializer
1150
1221
  };
1151
1222
  const sendToConnection$binaryOperationSpec = {
@@ -1161,7 +1232,7 @@ const sendToConnection$binaryOperationSpec = {
1161
1232
  requestBody: message,
1162
1233
  queryParameters: [apiVersion],
1163
1234
  urlParameters: [endpoint, hub, connectionId],
1164
- headerParameters: [contentType, accept1],
1235
+ headerParameters: [contentType, accept2],
1165
1236
  mediaType: "binary",
1166
1237
  serializer
1167
1238
  };
@@ -1178,10 +1249,25 @@ const sendToConnection$textOperationSpec = {
1178
1249
  requestBody: message1,
1179
1250
  queryParameters: [apiVersion],
1180
1251
  urlParameters: [endpoint, hub, connectionId],
1181
- headerParameters: [contentType1, accept2],
1252
+ headerParameters: [contentType1, accept3],
1182
1253
  mediaType: "text",
1183
1254
  serializer
1184
1255
  };
1256
+ const removeConnectionFromAllGroupsOperationSpec = {
1257
+ path: "/api/hubs/{hub}/connections/{connectionId}/groups",
1258
+ httpMethod: "DELETE",
1259
+ responses: {
1260
+ 204: {},
1261
+ default: {
1262
+ bodyMapper: ErrorDetail,
1263
+ headersMapper: WebPubSubRemoveConnectionFromAllGroupsExceptionHeaders
1264
+ }
1265
+ },
1266
+ queryParameters: [apiVersion],
1267
+ urlParameters: [endpoint, hub, connectionId],
1268
+ headerParameters: [accept],
1269
+ serializer
1270
+ };
1185
1271
  const groupExistsOperationSpec = {
1186
1272
  path: "/api/hubs/{hub}/groups/{group}",
1187
1273
  httpMethod: "HEAD",
@@ -1189,13 +1275,11 @@ const groupExistsOperationSpec = {
1189
1275
  200: {},
1190
1276
  404: {},
1191
1277
  default: {
1192
- bodyMapper: ErrorDetail,
1193
1278
  headersMapper: WebPubSubGroupExistsExceptionHeaders
1194
1279
  }
1195
1280
  },
1196
1281
  queryParameters: [apiVersion],
1197
1282
  urlParameters: [endpoint, hub, group],
1198
- headerParameters: [accept],
1199
1283
  serializer
1200
1284
  };
1201
1285
  const closeGroupConnectionsOperationSpec = {
@@ -1228,9 +1312,13 @@ const sendToGroup$binaryOperationSpec = {
1228
1312
  }
1229
1313
  },
1230
1314
  requestBody: message,
1231
- queryParameters: [apiVersion, excludedConnections],
1315
+ queryParameters: [
1316
+ apiVersion,
1317
+ excludedConnections,
1318
+ filter
1319
+ ],
1232
1320
  urlParameters: [endpoint, hub, group],
1233
- headerParameters: [contentType, accept1],
1321
+ headerParameters: [contentType, accept2],
1234
1322
  mediaType: "binary",
1235
1323
  serializer
1236
1324
  };
@@ -1245,18 +1333,41 @@ const sendToGroup$textOperationSpec = {
1245
1333
  }
1246
1334
  },
1247
1335
  requestBody: message1,
1248
- queryParameters: [apiVersion, excludedConnections],
1336
+ queryParameters: [
1337
+ apiVersion,
1338
+ excludedConnections,
1339
+ filter
1340
+ ],
1249
1341
  urlParameters: [endpoint, hub, group],
1250
- headerParameters: [contentType1, accept2],
1342
+ headerParameters: [contentType1, accept3],
1251
1343
  mediaType: "text",
1252
1344
  serializer
1253
1345
  };
1346
+ const removeConnectionFromGroupOperationSpec = {
1347
+ path: "/api/hubs/{hub}/groups/{group}/connections/{connectionId}",
1348
+ httpMethod: "DELETE",
1349
+ responses: {
1350
+ 204: {},
1351
+ default: {
1352
+ bodyMapper: ErrorDetail,
1353
+ headersMapper: WebPubSubRemoveConnectionFromGroupExceptionHeaders
1354
+ }
1355
+ },
1356
+ queryParameters: [apiVersion],
1357
+ urlParameters: [
1358
+ endpoint,
1359
+ hub,
1360
+ connectionId,
1361
+ group
1362
+ ],
1363
+ headerParameters: [accept],
1364
+ serializer
1365
+ };
1254
1366
  const addConnectionToGroupOperationSpec = {
1255
1367
  path: "/api/hubs/{hub}/groups/{group}/connections/{connectionId}",
1256
1368
  httpMethod: "PUT",
1257
1369
  responses: {
1258
1370
  200: {},
1259
- 404: {},
1260
1371
  default: {
1261
1372
  bodyMapper: ErrorDetail,
1262
1373
  headersMapper: WebPubSubAddConnectionToGroupExceptionHeaders
@@ -1272,22 +1383,61 @@ const addConnectionToGroupOperationSpec = {
1272
1383
  headerParameters: [accept],
1273
1384
  serializer
1274
1385
  };
1275
- const removeConnectionFromGroupOperationSpec = {
1276
- path: "/api/hubs/{hub}/groups/{group}/connections/{connectionId}",
1386
+ const revokePermissionOperationSpec = {
1387
+ path: "/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}",
1277
1388
  httpMethod: "DELETE",
1278
1389
  responses: {
1279
1390
  204: {},
1280
1391
  default: {
1281
1392
  bodyMapper: ErrorDetail,
1282
- headersMapper: WebPubSubRemoveConnectionFromGroupExceptionHeaders
1393
+ headersMapper: WebPubSubRevokePermissionExceptionHeaders
1283
1394
  }
1284
1395
  },
1285
- queryParameters: [apiVersion],
1396
+ queryParameters: [apiVersion, targetName],
1286
1397
  urlParameters: [
1287
1398
  endpoint,
1288
1399
  hub,
1289
1400
  connectionId,
1290
- group
1401
+ permission
1402
+ ],
1403
+ headerParameters: [accept],
1404
+ serializer
1405
+ };
1406
+ const checkPermissionOperationSpec = {
1407
+ path: "/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}",
1408
+ httpMethod: "HEAD",
1409
+ responses: {
1410
+ 200: {},
1411
+ 404: {},
1412
+ default: {
1413
+ headersMapper: WebPubSubCheckPermissionExceptionHeaders
1414
+ }
1415
+ },
1416
+ queryParameters: [apiVersion, targetName],
1417
+ urlParameters: [
1418
+ endpoint,
1419
+ hub,
1420
+ connectionId,
1421
+ permission
1422
+ ],
1423
+ serializer
1424
+ };
1425
+ const grantPermissionOperationSpec = {
1426
+ path: "/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}",
1427
+ httpMethod: "PUT",
1428
+ responses: {
1429
+ 200: {},
1430
+ default: {
1431
+ bodyMapper: ErrorDetail,
1432
+ headersMapper: WebPubSubGrantPermissionExceptionHeaders
1433
+ }
1434
+ },
1435
+ queryParameters: [apiVersion, targetName],
1436
+ urlParameters: [
1437
+ endpoint,
1438
+ hub,
1439
+ connectionId,
1440
+ permission
1291
1441
  ],
1292
1442
  headerParameters: [accept],
1293
1443
  serializer
@@ -1299,13 +1449,11 @@ const userExistsOperationSpec = {
1299
1449
  200: {},
1300
1450
  404: {},
1301
1451
  default: {
1302
- bodyMapper: ErrorDetail,
1303
1452
  headersMapper: WebPubSubUserExistsExceptionHeaders
1304
1453
  }
1305
1454
  },
1306
1455
  queryParameters: [apiVersion],
1307
1456
  urlParameters: [endpoint, hub, userId1],
1308
- headerParameters: [accept],
1309
1457
  serializer
1310
1458
  };
1311
1459
  const closeUserConnectionsOperationSpec = {
@@ -1338,9 +1486,9 @@ const sendToUser$binaryOperationSpec = {
1338
1486
  }
1339
1487
  },
1340
1488
  requestBody: message,
1341
- queryParameters: [apiVersion],
1489
+ queryParameters: [apiVersion, filter],
1342
1490
  urlParameters: [endpoint, hub, userId1],
1343
- headerParameters: [contentType, accept1],
1491
+ headerParameters: [contentType, accept2],
1344
1492
  mediaType: "binary",
1345
1493
  serializer
1346
1494
  };
@@ -1355,30 +1503,24 @@ const sendToUser$textOperationSpec = {
1355
1503
  }
1356
1504
  },
1357
1505
  requestBody: message1,
1358
- queryParameters: [apiVersion],
1506
+ queryParameters: [apiVersion, filter],
1359
1507
  urlParameters: [endpoint, hub, userId1],
1360
- headerParameters: [contentType1, accept2],
1508
+ headerParameters: [contentType1, accept3],
1361
1509
  mediaType: "text",
1362
1510
  serializer
1363
1511
  };
1364
- const addUserToGroupOperationSpec = {
1365
- path: "/api/hubs/{hub}/users/{userId}/groups/{group}",
1366
- httpMethod: "PUT",
1512
+ const removeUserFromAllGroupsOperationSpec = {
1513
+ path: "/api/hubs/{hub}/users/{userId}/groups",
1514
+ httpMethod: "DELETE",
1367
1515
  responses: {
1368
- 200: {},
1369
- 404: {},
1516
+ 204: {},
1370
1517
  default: {
1371
1518
  bodyMapper: ErrorDetail,
1372
- headersMapper: WebPubSubAddUserToGroupExceptionHeaders
1519
+ headersMapper: WebPubSubRemoveUserFromAllGroupsExceptionHeaders
1373
1520
  }
1374
1521
  },
1375
1522
  queryParameters: [apiVersion],
1376
- urlParameters: [
1377
- endpoint,
1378
- hub,
1379
- group,
1380
- userId1
1381
- ],
1523
+ urlParameters: [endpoint, hub, userId1],
1382
1524
  headerParameters: [accept],
1383
1525
  serializer
1384
1526
  };
@@ -1402,78 +1544,22 @@ const removeUserFromGroupOperationSpec = {
1402
1544
  headerParameters: [accept],
1403
1545
  serializer
1404
1546
  };
1405
- const removeUserFromAllGroupsOperationSpec = {
1406
- path: "/api/hubs/{hub}/users/{userId}/groups",
1407
- httpMethod: "DELETE",
1408
- responses: {
1409
- 204: {},
1410
- default: {
1411
- bodyMapper: ErrorDetail,
1412
- headersMapper: WebPubSubRemoveUserFromAllGroupsExceptionHeaders
1413
- }
1414
- },
1415
- queryParameters: [apiVersion],
1416
- urlParameters: [endpoint, hub, userId1],
1417
- headerParameters: [accept],
1418
- serializer
1419
- };
1420
- const grantPermissionOperationSpec = {
1421
- path: "/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}",
1547
+ const addUserToGroupOperationSpec = {
1548
+ path: "/api/hubs/{hub}/users/{userId}/groups/{group}",
1422
1549
  httpMethod: "PUT",
1423
1550
  responses: {
1424
1551
  200: {},
1425
1552
  default: {
1426
1553
  bodyMapper: ErrorDetail,
1427
- headersMapper: WebPubSubGrantPermissionExceptionHeaders
1428
- }
1429
- },
1430
- queryParameters: [apiVersion, targetName],
1431
- urlParameters: [
1432
- endpoint,
1433
- hub,
1434
- connectionId,
1435
- permission
1436
- ],
1437
- headerParameters: [accept],
1438
- serializer
1439
- };
1440
- const revokePermissionOperationSpec = {
1441
- path: "/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}",
1442
- httpMethod: "DELETE",
1443
- responses: {
1444
- 204: {},
1445
- default: {
1446
- bodyMapper: ErrorDetail,
1447
- headersMapper: WebPubSubRevokePermissionExceptionHeaders
1448
- }
1449
- },
1450
- queryParameters: [apiVersion, targetName],
1451
- urlParameters: [
1452
- endpoint,
1453
- hub,
1454
- connectionId,
1455
- permission
1456
- ],
1457
- headerParameters: [accept],
1458
- serializer
1459
- };
1460
- const checkPermissionOperationSpec = {
1461
- path: "/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}",
1462
- httpMethod: "HEAD",
1463
- responses: {
1464
- 200: {},
1465
- 404: {},
1466
- default: {
1467
- bodyMapper: ErrorDetail,
1468
- headersMapper: WebPubSubCheckPermissionExceptionHeaders
1554
+ headersMapper: WebPubSubAddUserToGroupExceptionHeaders
1469
1555
  }
1470
1556
  },
1471
- queryParameters: [apiVersion, targetName],
1557
+ queryParameters: [apiVersion],
1472
1558
  urlParameters: [
1473
1559
  endpoint,
1474
1560
  hub,
1475
- connectionId,
1476
- permission
1561
+ group,
1562
+ userId1
1477
1563
  ],
1478
1564
  headerParameters: [accept],
1479
1565
  serializer
@@ -1487,13 +1573,14 @@ const checkPermissionOperationSpec = {
1487
1573
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
1488
1574
  */
1489
1575
  /** @internal */
1490
- class GeneratedClientContext extends coreClient__namespace.ServiceClient {
1576
+ class GeneratedClient extends coreClient__namespace.ServiceClient {
1491
1577
  /**
1492
- * Initializes a new instance of the GeneratedClientContext class.
1578
+ * Initializes a new instance of the GeneratedClient class.
1493
1579
  * @param endpoint HTTP or HTTPS endpoint for the Web PubSub service instance.
1494
1580
  * @param options The parameter options
1495
1581
  */
1496
1582
  constructor(endpoint, options) {
1583
+ var _a, _b;
1497
1584
  if (endpoint === undefined) {
1498
1585
  throw new Error("'endpoint' cannot be null");
1499
1586
  }
@@ -1510,33 +1597,40 @@ class GeneratedClientContext extends coreClient__namespace.ServiceClient {
1510
1597
  : `${packageDetails}`;
1511
1598
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
1512
1599
  userAgentPrefix
1513
- }, baseUri: options.endpoint || "{Endpoint}" });
1600
+ }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{Endpoint}" });
1514
1601
  super(optionsWithDefaults);
1515
1602
  // Parameter assignments
1516
1603
  this.endpoint = endpoint;
1517
1604
  // Assigning values to Constant parameters
1518
- this.apiVersion = options.apiVersion || "2021-10-01";
1519
- }
1520
- }
1521
-
1522
- /*
1523
- * Copyright (c) Microsoft Corporation.
1524
- * Licensed under the MIT License.
1525
- *
1526
- * Code generated by Microsoft (R) AutoRest Code Generator.
1527
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
1528
- */
1529
- /** @internal */
1530
- class GeneratedClient extends GeneratedClientContext {
1531
- /**
1532
- * Initializes a new instance of the GeneratedClient class.
1533
- * @param endpoint HTTP or HTTPS endpoint for the Web PubSub service instance.
1534
- * @param options The parameter options
1535
- */
1536
- constructor(endpoint, options) {
1537
- super(endpoint, options);
1605
+ this.apiVersion = options.apiVersion || "2022-11-01";
1538
1606
  this.healthApi = new HealthApiImpl(this);
1539
1607
  this.webPubSub = new WebPubSubImpl(this);
1608
+ this.addCustomApiVersionPolicy(options.apiVersion);
1609
+ }
1610
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
1611
+ addCustomApiVersionPolicy(apiVersion) {
1612
+ if (!apiVersion) {
1613
+ return;
1614
+ }
1615
+ const apiVersionPolicy = {
1616
+ name: "CustomApiVersionPolicy",
1617
+ async sendRequest(request, next) {
1618
+ const param = request.url.split("?");
1619
+ if (param.length > 1) {
1620
+ const newParams = param[1].split("&").map((item) => {
1621
+ if (item.indexOf("api-version") > -1) {
1622
+ return "api-version=" + apiVersion;
1623
+ }
1624
+ else {
1625
+ return item;
1626
+ }
1627
+ });
1628
+ request.url = param[0] + "?" + newParams.join("&");
1629
+ }
1630
+ return next(request);
1631
+ }
1632
+ };
1633
+ this.pipeline.addPolicy(apiVersionPolicy);
1540
1634
  }
1541
1635
  }
1542
1636
 
@@ -1571,6 +1665,50 @@ function getPayloadForMessage(message, options) {
1571
1665
  return { contentType: "application/json", payload: JSON.stringify(message) };
1572
1666
  }
1573
1667
  }
1668
+ function formatNullAndUndefined(input) {
1669
+ if (input === null || input === undefined) {
1670
+ return "null";
1671
+ }
1672
+ return input;
1673
+ }
1674
+ function escapeQuotesIfString(input, previous) {
1675
+ let result = input;
1676
+ if (typeof input === "string") {
1677
+ result = input.replace(/'/g, "''");
1678
+ // check if we need to escape this literal
1679
+ if (!previous.trim().endsWith("'")) {
1680
+ result = `'${result}'`;
1681
+ }
1682
+ }
1683
+ return result;
1684
+ }
1685
+ /**
1686
+ * Escapes an odata filter expression to avoid errors with quoting string literals.
1687
+ * Example usage:
1688
+ * ```ts
1689
+ * const userId = "vic's";
1690
+ * const anonymous = null;
1691
+ * const length = 3
1692
+ * const filter = odata`userId eq ${anonymous} or userId eq ${userId} or length(userId) > ${length}`;
1693
+ * ```
1694
+ * @param strings - Array of strings for the expression
1695
+ * @param values - Array of values for the expression
1696
+ */
1697
+ function odata(strings, ...values) {
1698
+ const results = [];
1699
+ for (let i = 0; i < strings.length; i++) {
1700
+ results.push(strings[i]);
1701
+ if (i < values.length) {
1702
+ if (values[i] === null || values[i] === undefined) {
1703
+ results.push(formatNullAndUndefined(values[i]));
1704
+ }
1705
+ else {
1706
+ results.push(escapeQuotesIfString(values[i], strings[i]));
1707
+ }
1708
+ }
1709
+ }
1710
+ return results.join("");
1711
+ }
1574
1712
 
1575
1713
  // Copyright (c) Microsoft Corporation.
1576
1714
  /**
@@ -1756,7 +1894,7 @@ class WebPubSubServiceClient {
1756
1894
  /**
1757
1895
  * The Web PubSub API version being used by this client
1758
1896
  */
1759
- this.apiVersion = "2021-10-01";
1897
+ this.apiVersion = "2022-11-01";
1760
1898
  // unpack constructor arguments
1761
1899
  if (typeof credsOrHubName === "object") {
1762
1900
  this.endpoint = endpointOrConnectionString;
@@ -1891,6 +2029,16 @@ class WebPubSubServiceClient {
1891
2029
  return this.client.webPubSub.removeUserFromAllGroups(this.hubName, userId, updatedOptions);
1892
2030
  });
1893
2031
  }
2032
+ /**
2033
+ * Remove a specific connection from all groups they are joined to
2034
+ * @param connectionId - The connection id to remove from all groups
2035
+ * @param options - Additional options
2036
+ */
2037
+ async removeConnectionFromAllGroups(connectionId, options = {}) {
2038
+ return tracingClient.withSpan("WebPubSubServiceClient.removeConnectionFromAllGroups", options, (updatedOptions) => {
2039
+ return this.client.webPubSub.removeConnectionFromAllGroups(this.hubName, connectionId, updatedOptions);
2040
+ });
2041
+ }
1894
2042
  /**
1895
2043
  * Check if a particular group exists (i.e. has active connections).
1896
2044
  *
@@ -2029,7 +2177,7 @@ class WebPubSubServiceClient {
2029
2177
  else {
2030
2178
  const key = this.credential.key;
2031
2179
  const audience = `${endpoint}client/hubs/${this.hubName}`;
2032
- const payload = { role: options === null || options === void 0 ? void 0 : options.roles };
2180
+ const payload = { role: options === null || options === void 0 ? void 0 : options.roles, "webpubsub.group": options === null || options === void 0 ? void 0 : options.groups };
2033
2181
  const signOptions = {
2034
2182
  audience: audience,
2035
2183
  expiresIn: (options === null || options === void 0 ? void 0 : options.expirationTimeInMinutes) === undefined
@@ -2056,4 +2204,5 @@ Object.defineProperty(exports, 'AzureKeyCredential', {
2056
2204
  get: function () { return coreAuth.AzureKeyCredential; }
2057
2205
  });
2058
2206
  exports.WebPubSubServiceClient = WebPubSubServiceClient;
2207
+ exports.odata = odata;
2059
2208
  //# sourceMappingURL=index.js.map