mezon-js 2.7.1

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts ADDED
@@ -0,0 +1,4351 @@
1
+ // tslint:disable
2
+ /* Code generated by openapi-gen/main.go. DO NOT EDIT. */
3
+
4
+ import { buildFetchOptions } from './utils';
5
+ import { encode } from 'js-base64';
6
+
7
+ /** A single user-role pair. */
8
+ export interface ChannelUserListChannelUser {
9
+ //
10
+ id?: string;
11
+ //Their relationship to the role.
12
+ role_id?: string;
13
+ //
14
+ thread_id?: string;
15
+ //User.
16
+ user?: ApiUser;
17
+ }
18
+
19
+ /** A single user-role pair. */
20
+ export interface ClanUserListClanUser {
21
+ //Their relationship to the role.
22
+ role_id?: string;
23
+ //User.
24
+ user?: ApiUser;
25
+ }
26
+
27
+ /** A single user-role pair. */
28
+ export interface RoleUserListRoleUser {
29
+ //A URL for an avatar image.
30
+ avatar_url?: string;
31
+ //The display name of the user.
32
+ display_name?: string;
33
+ //The id of the user's account.
34
+ id?: string;
35
+ //The language expected to be a tag which follows the BCP-47 spec.
36
+ lang_tag?: string;
37
+ //The location set by the user.
38
+ location?: string;
39
+ //The timezone set by the user.
40
+ online?: boolean;
41
+ //The username of the user's account.
42
+ username?: string;
43
+ }
44
+
45
+ /** A user with additional account details. Always the current user. */
46
+ export interface ApiAccount {
47
+ //The custom id in the user's account.
48
+ custom_id?: string;
49
+ //The devices which belong to the user's account.
50
+ devices?: Array<ApiAccountDevice>;
51
+ //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user's account was disabled/banned.
52
+ disable_time?: string;
53
+ //The email address of the user.
54
+ email?: string;
55
+ //The user object.
56
+ user?: ApiUser;
57
+ //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user's email was verified.
58
+ verify_time?: string;
59
+ //The user's wallet data.
60
+ wallet?: string;
61
+ }
62
+
63
+ /** Send a Apple Sign In token to the server. Used with authenticate/link/unlink. */
64
+ export interface ApiAccountApple {
65
+ //The ID token received from Apple to validate.
66
+ token?: string;
67
+ //Extra information that will be bundled in the session token.
68
+ vars?: Record<string, string>;
69
+ }
70
+
71
+ /** Send a custom ID to the server. Used with authenticate/link/unlink. */
72
+ export interface ApiAccountCustom {
73
+ //A custom identifier.
74
+ id?: string;
75
+ //Extra information that will be bundled in the session token.
76
+ vars?: Record<string, string>;
77
+ }
78
+
79
+ /** Send a device to the server. Used with authenticate/link/unlink and user. */
80
+ export interface ApiAccountDevice {
81
+ //A device identifier. Should be obtained by a platform-specific device API.
82
+ id?: string;
83
+ //Extra information that will be bundled in the session token.
84
+ vars?: Record<string, string>;
85
+ }
86
+
87
+ /** Send an email with password to the server. Used with authenticate/link/unlink. */
88
+ export interface ApiAccountEmail {
89
+ //A valid RFC-5322 email address.
90
+ email?: string;
91
+ //A password for the user account. Ignored with unlink operations.
92
+ password?: string;
93
+ //Extra information that will be bundled in the session token.
94
+ vars?: Record<string, string>;
95
+ }
96
+
97
+ /** Send a Facebook token to the server. Used with authenticate/link/unlink. */
98
+ export interface ApiAccountFacebook {
99
+ //The OAuth token received from Facebook to access their profile API.
100
+ token?: string;
101
+ //Extra information that will be bundled in the session token.
102
+ vars?: Record<string, string>;
103
+ }
104
+
105
+ /** Send a Facebook Instant Game token to the server. Used with authenticate/link/unlink. */
106
+ export interface ApiAccountFacebookInstantGame {
107
+ //
108
+ signed_player_info?: string;
109
+ //Extra information that will be bundled in the session token.
110
+ vars?: Record<string, string>;
111
+ }
112
+
113
+ /** Send Apple's Game Center account credentials to the server. Used with authenticate/link/unlink.
114
+
115
+ https://developer.apple.com/documentation/gamekit/gklocalplayer/1515407-generateidentityverificationsign */
116
+ export interface ApiAccountGameCenter {
117
+ //Bundle ID (generated by GameCenter).
118
+ bundle_id?: string;
119
+ //Player ID (generated by GameCenter).
120
+ player_id?: string;
121
+ //The URL for the public encryption key.
122
+ public_key_url?: string;
123
+ //A random "NSString" used to compute the hash and keep it randomized.
124
+ salt?: string;
125
+ //The verification signature data generated.
126
+ signature?: string;
127
+ //Time since UNIX epoch when the signature was created.
128
+ timestamp_seconds?: string;
129
+ //Extra information that will be bundled in the session token.
130
+ vars?: Record<string, string>;
131
+ }
132
+
133
+ /** Send a Google token to the server. Used with authenticate/link/unlink. */
134
+ export interface ApiAccountGoogle {
135
+ //The OAuth token received from Google to access their profile API.
136
+ token?: string;
137
+ //Extra information that will be bundled in the session token.
138
+ vars?: Record<string, string>;
139
+ }
140
+
141
+ /** Send a Steam token to the server. Used with authenticate/link/unlink. */
142
+ export interface ApiAccountSteam {
143
+ //The account token received from Steam to access their profile API.
144
+ token?: string;
145
+ //Extra information that will be bundled in the session token.
146
+ vars?: Record<string, string>;
147
+ }
148
+
149
+ /** Add a role for channel. */
150
+ export interface ApiAddRoleChannelDescRequest {
151
+ //
152
+ channel_id?: string;
153
+ //
154
+ role_ids?: Array<string>;
155
+ }
156
+
157
+ /** */
158
+ export interface ApiCategoryDesc {
159
+ //
160
+ category_id?: string;
161
+ //
162
+ category_name?: string;
163
+ //
164
+ clan_id?: string;
165
+ //
166
+ creator_id?: string;
167
+ }
168
+
169
+ /** */
170
+ export interface ApiCategoryDescList {
171
+ //A list of channel.
172
+ categorydesc?: Array<ApiCategoryDesc>;
173
+ }
174
+
175
+ /** A list of channel description, usually a result of a list operation. */
176
+ export interface ApiChannelDescList {
177
+ //Cacheable cursor to list newer channel description. Durable and designed to be stored, unlike next/prev cursors.
178
+ cacheable_cursor?: string;
179
+ //A list of channel.
180
+ channeldesc?: Array<ApiChannelDescription>;
181
+ //The cursor to send when retrieving the next page, if any.
182
+ next_cursor?: string;
183
+ //The cursor to send when retrieving the previous page, if any.
184
+ prev_cursor?: string;
185
+ }
186
+
187
+ /** */
188
+ export interface ApiChannelDescription {
189
+ //
190
+ category_id?: string;
191
+ //
192
+ category_name?: string;
193
+ //
194
+ channel_avatar?: string;
195
+ //The channel this message belongs to.
196
+ channel_id?: string;
197
+ //
198
+ channel_label?: string;
199
+ //
200
+ channel_private?: number;
201
+ //
202
+ clan_id?: string;
203
+ //creator ID.
204
+ creator_id?: string;
205
+ //
206
+ last_seen_message?: ApiChannelMessageHeader;
207
+ //
208
+ last_sent_message?: ApiChannelMessageHeader;
209
+ //The parrent channel this message belongs to.
210
+ parrent_id?: string;
211
+ //The channel type.
212
+ type?: number;
213
+ //
214
+ user_id?: string;
215
+ }
216
+
217
+ /** A message sent on a channel. */
218
+ export interface ApiChannelMessage {
219
+ //
220
+ attachments?: string;
221
+ //
222
+ avatar?: string;
223
+ //The channel this message belongs to.
224
+ channel_id: string;
225
+ //The name of the chat room, or an empty string if this message was not sent through a chat room.
226
+ channel_label: string;
227
+ //The clan this message belong to.
228
+ clan_id?: string;
229
+ //The code representing a message type or category.
230
+ code: number;
231
+ //The content payload.
232
+ content: string;
233
+ //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was created.
234
+ create_time?: string;
235
+ //
236
+ mentions?: string;
237
+ //The unique ID of this message.
238
+ message_id: string;
239
+ //
240
+ reactions?: string;
241
+ //
242
+ referenced_message?: string;
243
+ //
244
+ references?: string;
245
+ //Message sender, usually a user ID.
246
+ sender_id: string;
247
+ //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was last updated.
248
+ update_time?: string;
249
+ //The ID of the first DM user, or an empty string if this message was not sent through a DM chat.
250
+ user_id_one?: string;
251
+ //The ID of the second DM user, or an empty string if this message was not sent through a DM chat.
252
+ user_id_two?: string;
253
+ //The username of the message sender, if any.
254
+ username?: string;
255
+ }
256
+
257
+ /** */
258
+ export interface ApiChannelMessageHeader {
259
+ //
260
+ id?: string;
261
+ //
262
+ timestamp?: string;
263
+ // sender id
264
+ sender_id: string;
265
+ // content
266
+ content: string;
267
+ }
268
+
269
+ /** A list of channel messages, usually a result of a list operation. */
270
+ export interface ApiChannelMessageList {
271
+ //
272
+ last_seen_message?: ApiChannelMessageHeader;
273
+ //A list of messages.
274
+ messages?: Array<ApiChannelMessage>;
275
+ }
276
+
277
+ /** A list of users belonging to a channel, along with their role. */
278
+ export interface ApiChannelUserList {
279
+ //
280
+ channel_id?: string;
281
+ //User-role pairs for a channel.
282
+ channel_users?: Array<ChannelUserListChannelUser>;
283
+ //Cursor for the next page of results, if any.
284
+ cursor?: string;
285
+ }
286
+
287
+ /** */
288
+ export interface ApiClanDesc {
289
+ //
290
+ banner?: string;
291
+ //
292
+ clan_id?: string;
293
+ //
294
+ clan_name?: string;
295
+ //
296
+ creator_id?: string;
297
+ //
298
+ logo?: string;
299
+ //
300
+ status?: number;
301
+ }
302
+
303
+ /** */
304
+ export interface ApiClanDescList {
305
+ //A list of channel.
306
+ clandesc?: Array<ApiClanDesc>;
307
+ }
308
+
309
+ /** */
310
+ export interface ApiClanDescProfile {
311
+ //
312
+ avatar_url?: string;
313
+ //
314
+ clan_id?: string;
315
+ //
316
+ creator_id?: string;
317
+ //
318
+ nick_name?: string;
319
+ //
320
+ profile_banner?: string;
321
+ //
322
+ profile_theme?: string;
323
+ }
324
+
325
+ /** Get clan profile. */
326
+ export interface ApiClanProfile {
327
+ //
328
+ avartar?: string;
329
+ //
330
+ clan_id?: string;
331
+ //
332
+ nick_name?: string;
333
+ //
334
+ user_id?: string;
335
+ }
336
+
337
+ /** A list of users belonging to a clan, along with their role. */
338
+ export interface ApiClanUserList {
339
+ //
340
+ clan_id?: string;
341
+ //User-role pairs for a clan.
342
+ clan_users?: Array<ClanUserListClanUser>;
343
+ //Cursor for the next page of results, if any.
344
+ cursor?: string;
345
+ }
346
+
347
+ /** */
348
+ export interface ApiCreateCategoryDescRequest {
349
+ //
350
+ category_name?: string;
351
+ //
352
+ clan_id?: string;
353
+ }
354
+
355
+ /** Create a channel within clan. */
356
+ export interface ApiCreateChannelDescRequest {
357
+ //
358
+ category_id?: string;
359
+ //The channel this message belongs to.
360
+ channel_id?: string;
361
+ //
362
+ channel_label?: string;
363
+ //
364
+ channel_private?: number;
365
+ //
366
+ clan_id?: string;
367
+ //The parrent channel this message belongs to.
368
+ parrent_id?: string;
369
+ //The channel type.
370
+ type?: number;
371
+ //The users to add.
372
+ user_ids?: Array<string>;
373
+ }
374
+
375
+ /** */
376
+ export interface ApiCreateClanDescRequest {
377
+ //
378
+ banner?: string;
379
+ //
380
+ clan_name?: string;
381
+ //
382
+ creator_id?: string;
383
+ //
384
+ logo?: string;
385
+ }
386
+
387
+ /** Create a role within clan. */
388
+ export interface ApiCreateRoleRequest {
389
+ //The permissions to add.
390
+ active_permission_ids?: Array<string>;
391
+ //The users to add.
392
+ add_user_ids?: Array<string>;
393
+ //
394
+ allow_mention?: number;
395
+ //
396
+ clan_id?: string;
397
+ //
398
+ color?: string;
399
+ //
400
+ description?: string;
401
+ //
402
+ display_online?: number;
403
+ //
404
+ role_icon?: string;
405
+ //
406
+ title?: string;
407
+ }
408
+
409
+ /** Delete a role the user has access to. */
410
+ export interface ApiDeleteRoleRequest {
411
+ //
412
+ channel_id?: string;
413
+ //The id of a role.
414
+ role_id?: string;
415
+ }
416
+
417
+ /** Storage objects to delete. */
418
+ export interface ApiDeleteStorageObjectId {
419
+ //The collection which stores the object.
420
+ collection?: string;
421
+ //The key of the object within the collection.
422
+ key?: string;
423
+ //The version hash of the object.
424
+ version?: string;
425
+ }
426
+
427
+ /** Batch delete storage objects. */
428
+ export interface ApiDeleteStorageObjectsRequest {
429
+ //Batch of storage objects.
430
+ object_ids?: Array<ApiDeleteStorageObjectId>;
431
+ }
432
+
433
+ /** Represents an event to be passed through the server to registered event handlers. */
434
+ export interface ApiEvent {
435
+ //True if the event came directly from a client call, false otherwise.
436
+ external?: boolean;
437
+ //An event name, type, category, or identifier.
438
+ name?: string;
439
+ //Arbitrary event property values.
440
+ properties?: Record<string, string>;
441
+ //The time when the event was triggered.
442
+ timestamp?: string;
443
+ }
444
+
445
+ /** A friend of a user. */
446
+ export interface ApiFriend {
447
+ //The friend status. one of "Friend.State".
448
+ state?: number;
449
+ //Time of the latest relationship update.
450
+ update_time?: string;
451
+ //The user object.
452
+ user?: ApiUser;
453
+ }
454
+
455
+ /** A collection of zero or more friends of the user. */
456
+ export interface ApiFriendList {
457
+ //Cursor for the next page of results, if any.
458
+ cursor?: string;
459
+ //The Friend objects.
460
+ friends?: Array<ApiFriend>;
461
+ }
462
+
463
+ /** Add link invite users to. */
464
+ export interface ApiInviteUserRes {
465
+ //id channel to add link to.
466
+ channel_id?: string;
467
+ //
468
+ channel_label?: string;
469
+ //id clan to add link to .
470
+ clan_id?: string;
471
+ //
472
+ clan_name?: string;
473
+ //
474
+ user_joined?: boolean;
475
+ }
476
+
477
+ /** Add link invite users to. */
478
+ export interface ApiLinkInviteUser {
479
+ //
480
+ channel_id?: string;
481
+ //
482
+ clan_id?: string;
483
+ //
484
+ create_time?: string;
485
+ //The user to add.
486
+ creator_id?: string;
487
+ //
488
+ expiry_time?: string;
489
+ //
490
+ id?: string;
491
+ //
492
+ invite_link?: string;
493
+ }
494
+
495
+ /** Add link invite users to. */
496
+ export interface ApiLinkInviteUserRequest {
497
+ //id channel to add link to.
498
+ channel_id?: string;
499
+ //id clan to add link to .
500
+ clan_id?: string;
501
+ //
502
+ expiry_time?: number;
503
+ }
504
+
505
+ /** Link Steam to the current user's account. */
506
+ export interface ApiLinkSteamRequest {
507
+ //The Facebook account details.
508
+ account?: ApiAccountSteam;
509
+ //Import Steam friends for the user.
510
+ sync?: boolean;
511
+ }
512
+
513
+ /** */
514
+ export interface ApiMessageAttachment {
515
+ //
516
+ filename?: string;
517
+ //
518
+ filetype?: string;
519
+ //
520
+ height?: number;
521
+ //
522
+ size?: number;
523
+ //
524
+ url?: string;
525
+ //
526
+ width?: number;
527
+ }
528
+
529
+ /** */
530
+ export interface ApiMessageDeleted {
531
+ //
532
+ deletor?: string;
533
+ //
534
+ message_id?: string;
535
+ }
536
+
537
+ /** */
538
+ export interface ApiMessageMention {
539
+ //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was created.
540
+ create_time?: string;
541
+ //
542
+ id?: string;
543
+ //
544
+ user_id?: string;
545
+ //
546
+ username?: string;
547
+ }
548
+
549
+ /** */
550
+ export interface ApiMessageReaction {
551
+ //
552
+ action?: boolean;
553
+ //
554
+ emoji?: string;
555
+ //
556
+ id?: string;
557
+ //
558
+ sender_id?: string;
559
+ //
560
+ sender_name?: string;
561
+ //
562
+ sender_avatar?: string;
563
+ // count of emoji
564
+ count: number;
565
+ }
566
+
567
+ /** */
568
+ export interface ApiMessageRef {
569
+ //
570
+ message_id?: string;
571
+ //
572
+ message_ref_id?: string;
573
+ //
574
+ ref_type?: number;
575
+ //
576
+ message_sender_id?: string;
577
+ //
578
+ content?:string;
579
+ //
580
+ has_attachment: boolean;
581
+ }
582
+
583
+ /** A notification in the server. */
584
+ export interface ApiNotification {
585
+ //Category code for this notification.
586
+ code?: number;
587
+ //Content of the notification in JSON.
588
+ content?: string;
589
+ //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the notification was created.
590
+ create_time?: string;
591
+ //ID of the Notification.
592
+ id?: string;
593
+ //True if this notification was persisted to the database.
594
+ persistent?: boolean;
595
+ //ID of the sender, if a user. Otherwise 'null'.
596
+ sender_id?: string;
597
+ //Subject of the notification.
598
+ subject?: string;
599
+ }
600
+
601
+ /** A collection of zero or more notifications. */
602
+ export interface ApiNotificationList {
603
+ //Use this cursor to paginate notifications. Cache this to catch up to new notifications.
604
+ cacheable_cursor?: string;
605
+ //Collection of notifications.
606
+ notifications?: Array<ApiNotification>;
607
+ }
608
+
609
+ /** */
610
+ export interface ApiPermission {
611
+ //
612
+ active?: number;
613
+ //
614
+ description?: string;
615
+ //
616
+ id?: string;
617
+ //
618
+ slug?: string;
619
+ //
620
+ title?: string;
621
+ }
622
+
623
+ /** A list of permission description, usually a result of a list operation. */
624
+ export interface ApiPermissionList {
625
+ //A list of permission.
626
+ permissions?: Array<ApiPermission>;
627
+ }
628
+
629
+ /** Storage objects to get. */
630
+ export interface ApiReadStorageObjectId {
631
+ //The collection which stores the object.
632
+ collection?: string;
633
+ //The key of the object within the collection.
634
+ key?: string;
635
+ //The user owner of the object.
636
+ user_id?: string;
637
+ }
638
+
639
+ /** Batch get storage objects. */
640
+ export interface ApiReadStorageObjectsRequest {
641
+ //Batch of storage objects.
642
+ object_ids?: Array<ApiReadStorageObjectId>;
643
+ }
644
+
645
+ /** */
646
+ export interface ApiRole {
647
+ //
648
+ active?: number;
649
+ //
650
+ allow_mention?: number;
651
+ //
652
+ clan_id?: string;
653
+ //
654
+ color?: string;
655
+ //
656
+ creator_id?: string;
657
+ //
658
+ description?: string;
659
+ //
660
+ display_online?: number;
661
+ //
662
+ id?: string;
663
+ //
664
+ permission_list?: ApiPermissionList;
665
+ //
666
+ role_icon?: string;
667
+ //
668
+ role_user_list?: ApiRoleUserList;
669
+ //
670
+ slug?: string;
671
+ //
672
+ title?: string;
673
+ //
674
+ role_channel_active?: string;
675
+ //
676
+ channel_id?: string;
677
+ }
678
+
679
+ /** A list of role description, usually a result of a list operation. */
680
+ export interface ApiRoleList {
681
+ //Cacheable cursor to list newer role description. Durable and designed to be stored, unlike next/prev cursors.
682
+ cacheable_cursor?: string;
683
+ //The cursor to send when retrieving the next page, if any.
684
+ next_cursor?: string;
685
+ //The cursor to send when retrieving the previous page, if any.
686
+ prev_cursor?: string;
687
+ //A list of role.
688
+ roles?: Array<ApiRole>;
689
+ }
690
+
691
+ /** */
692
+ export interface ApiRoleUserList {
693
+ //Cursor for the next page of results, if any.
694
+ cursor?: string;
695
+ //role_users pairs for a clan.
696
+ role_users?: Array<RoleUserListRoleUser>;
697
+ }
698
+
699
+ /** Execute an Lua function on the server. */
700
+ export interface ApiRpc {
701
+ //The authentication key used when executed as a non-client HTTP request.
702
+ http_key?: string;
703
+ //The identifier of the function.
704
+ id?: string;
705
+ //The payload of the function which must be a JSON object.
706
+ payload?: string;
707
+ }
708
+
709
+ /** A user's session used to authenticate messages. */
710
+ export interface ApiSession {
711
+ //True if the corresponding account was just created, false otherwise.
712
+ created?: boolean;
713
+ //Refresh token that can be used for session token renewal.
714
+ refresh_token?: string;
715
+ //Authentication credentials.
716
+ token?: string;
717
+ }
718
+
719
+ /** Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user. */
720
+ export interface ApiSessionLogoutRequest {
721
+ //Refresh token to invalidate.
722
+ refresh_token?: string;
723
+ //Session token to log out.
724
+ token?: string;
725
+ }
726
+
727
+ /** Authenticate against the server with a refresh token. */
728
+ export interface ApiSessionRefreshRequest {
729
+ //Refresh token.
730
+ token?: string;
731
+ //Extra information that will be bundled in the session token.
732
+ vars?: Record<string, string>;
733
+ }
734
+
735
+ /** An object within the storage engine. */
736
+ export interface ApiStorageObject {
737
+ //The collection which stores the object.
738
+ collection?: string;
739
+ //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the object was created.
740
+ create_time?: string;
741
+ //The key of the object within the collection.
742
+ key?: string;
743
+ //The read access permissions for the object.
744
+ permission_read?: number;
745
+ //The write access permissions for the object.
746
+ permission_write?: number;
747
+ //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the object was last updated.
748
+ update_time?: string;
749
+ //The user owner of the object.
750
+ user_id?: string;
751
+ //The value of the object.
752
+ value?: string;
753
+ //The version hash of the object.
754
+ version?: string;
755
+ }
756
+
757
+ /** A storage acknowledgement. */
758
+ export interface ApiStorageObjectAck {
759
+ //The collection which stores the object.
760
+ collection?: string;
761
+ //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the object was created.
762
+ create_time?: string;
763
+ //The key of the object within the collection.
764
+ key?: string;
765
+ //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the object was last updated.
766
+ update_time?: string;
767
+ //The owner of the object.
768
+ user_id?: string;
769
+ //The version hash of the object.
770
+ version?: string;
771
+ }
772
+
773
+ /** Batch of acknowledgements for the storage object write. */
774
+ export interface ApiStorageObjectAcks {
775
+ //Batch of storage write acknowledgements.
776
+ acks?: Array<ApiStorageObjectAck>;
777
+ }
778
+
779
+ /** List of storage objects. */
780
+ export interface ApiStorageObjectList {
781
+ //The cursor for the next page of results, if any.
782
+ cursor?: string;
783
+ //The list of storage objects.
784
+ objects?: Array<ApiStorageObject>;
785
+ }
786
+
787
+ /** Batch of storage objects. */
788
+ export interface ApiStorageObjects {
789
+ //The batch of storage objects.
790
+ objects?: Array<ApiStorageObject>;
791
+ }
792
+
793
+ /** Update a user's account details. */
794
+ export interface ApiUpdateAccountRequest {
795
+ //A URL for an avatar image.
796
+ avatar_url?: string;
797
+ //The display name of the user.
798
+ display_name?: string;
799
+ //The language expected to be a tag which follows the BCP-47 spec.
800
+ lang_tag?: string;
801
+ //The location set by the user.
802
+ location?: string;
803
+ //The timezone set by the user.
804
+ timezone?: string;
805
+ //The username of the user's account.
806
+ username?: string;
807
+ }
808
+
809
+ /** */
810
+ export interface ApiUpdateCategoryDescRequest {
811
+ //The ID of the group to update.
812
+ category_id?: string;
813
+ //
814
+ category_name?: string;
815
+ }
816
+
817
+ /** Fetch a batch of zero or more users from the server. */
818
+ export interface ApiUpdateUsersRequest {
819
+ //The avarar_url of a user.
820
+ avatar_url?: string;
821
+ //The account username of a user.
822
+ display_name?: string;
823
+ }
824
+
825
+ /** */
826
+ export interface ApiUploadAttachment {
827
+ //
828
+ filename?: string;
829
+ //
830
+ url?: string;
831
+ }
832
+
833
+ /** */
834
+ export interface ApiUploadAttachmentRequest {
835
+ //
836
+ filename?: string;
837
+ //
838
+ filetype?: string;
839
+ //
840
+ height?: number;
841
+ //
842
+ size?: number;
843
+ //
844
+ width?: number;
845
+ }
846
+
847
+ /** A user in the server. */
848
+ export interface ApiUser {
849
+ //The Apple Sign In ID in the user's account.
850
+ apple_id?: string;
851
+ //A URL for an avatar image.
852
+ avatar_url?: string;
853
+ //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user was created.
854
+ create_time?: string;
855
+ //The display name of the user.
856
+ display_name?: string;
857
+ //Number of related edges to this user.
858
+ edge_count?: number;
859
+ //The Facebook id in the user's account.
860
+ facebook_id?: string;
861
+ //The Apple Game Center in of the user's account.
862
+ gamecenter_id?: string;
863
+ //The Google id in the user's account.
864
+ google_id?: string;
865
+ //The id of the user's account.
866
+ id?: string;
867
+ //The language expected to be a tag which follows the BCP-47 spec.
868
+ lang_tag?: string;
869
+ //The location set by the user.
870
+ location?: string;
871
+ //Additional information stored as a JSON object.
872
+ metadata?: string;
873
+ //Indicates whether the user is currently online.
874
+ online?: boolean;
875
+ //The Steam id in the user's account.
876
+ steam_id?: string;
877
+ //The timezone set by the user.
878
+ timezone?: string;
879
+ //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user was last updated.
880
+ update_time?: string;
881
+ //The username of the user's account.
882
+ username?: string;
883
+ }
884
+
885
+ /** A collection of zero or more users. */
886
+ export interface ApiUsers {
887
+ //The User objects.
888
+ users?: Array<ApiUser>;
889
+ }
890
+
891
+ /** A list of users belonging to a channel, along with their role. */
892
+ export interface ApiVoiceChannelUser {
893
+ //
894
+ channel_id?: string;
895
+ //Cursor for the next page of results, if any.
896
+ jid?: string;
897
+ //User for a channel.
898
+ user_id?: string;
899
+ }
900
+
901
+
902
+ /** A list of users belonging to a channel, along with their role. */
903
+ export interface ApiVoiceChannelUserList {
904
+ //
905
+ voice_channel_users?: Array<ApiVoiceChannelUser>;
906
+ }
907
+
908
+ /** The object to store. */
909
+ export interface ApiWriteStorageObject {
910
+ //The collection to store the object.
911
+ collection?: string;
912
+ //The key for the object within the collection.
913
+ key?: string;
914
+ //The read access permissions for the object.
915
+ permission_read?: number;
916
+ //The write access permissions for the object.
917
+ permission_write?: number;
918
+ //The value of the object.
919
+ value?: string;
920
+ //The version hash of the object to check. Possible values are: ["", "*", "#hash#"]. if-match and if-none-match
921
+ version?: string;
922
+ }
923
+
924
+ /** Write objects to the storage engine. */
925
+ export interface ApiWriteStorageObjectsRequest {
926
+ //The objects to store on the server.
927
+ objects?: Array<ApiWriteStorageObject>;
928
+ }
929
+
930
+ /** */
931
+ export interface ProtobufAny {
932
+ //
933
+ type_url?: string;
934
+ //
935
+ value?: string;
936
+ }
937
+
938
+ /** */
939
+ export interface RpcStatus {
940
+ //
941
+ code?: number;
942
+ //
943
+ details?: Array<ProtobufAny>;
944
+ //
945
+ message?: string;
946
+ }
947
+
948
+ export class MezonApi {
949
+
950
+ constructor(readonly serverKey: string, readonly basePath: string, readonly timeoutMs: number) {}
951
+
952
+ /** A healthcheck which load balancers can use to check the service. */
953
+ healthcheck(bearerToken: string,
954
+ options: any = {}): Promise<any> {
955
+
956
+ const urlPath = "/healthcheck";
957
+ const queryParams = new Map<string, any>();
958
+
959
+ let bodyJson : string = "";
960
+
961
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
962
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
963
+ if (bearerToken) {
964
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
965
+ }
966
+
967
+ return Promise.race([
968
+ fetch(fullUrl, fetchOptions).then((response) => {
969
+ if (response.status == 204) {
970
+ return response;
971
+ } else if (response.status >= 200 && response.status < 300) {
972
+ return response.json();
973
+ } else {
974
+ throw response;
975
+ }
976
+ }),
977
+ new Promise((_, reject) =>
978
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
979
+ ),
980
+ ]);
981
+ }
982
+
983
+ /** Delete the current user's account. */
984
+ deleteAccount(bearerToken: string,
985
+ options: any = {}): Promise<any> {
986
+
987
+ const urlPath = "/v2/account";
988
+ const queryParams = new Map<string, any>();
989
+
990
+ let bodyJson : string = "";
991
+
992
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
993
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
994
+ if (bearerToken) {
995
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
996
+ }
997
+
998
+ return Promise.race([
999
+ fetch(fullUrl, fetchOptions).then((response) => {
1000
+ if (response.status == 204) {
1001
+ return response;
1002
+ } else if (response.status >= 200 && response.status < 300) {
1003
+ return response.json();
1004
+ } else {
1005
+ throw response;
1006
+ }
1007
+ }),
1008
+ new Promise((_, reject) =>
1009
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1010
+ ),
1011
+ ]);
1012
+ }
1013
+
1014
+ /** Fetch the current user's account. */
1015
+ getAccount(bearerToken: string,
1016
+ options: any = {}): Promise<ApiAccount> {
1017
+
1018
+ const urlPath = "/v2/account";
1019
+ const queryParams = new Map<string, any>();
1020
+
1021
+ let bodyJson : string = "";
1022
+
1023
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1024
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
1025
+ if (bearerToken) {
1026
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1027
+ }
1028
+
1029
+ return Promise.race([
1030
+ fetch(fullUrl, fetchOptions).then((response) => {
1031
+ if (response.status == 204) {
1032
+ return response;
1033
+ } else if (response.status >= 200 && response.status < 300) {
1034
+ return response.json();
1035
+ } else {
1036
+ throw response;
1037
+ }
1038
+ }),
1039
+ new Promise((_, reject) =>
1040
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1041
+ ),
1042
+ ]);
1043
+ }
1044
+
1045
+ /** Update fields in the current user's account. */
1046
+ updateAccount(bearerToken: string,
1047
+ body:ApiUpdateAccountRequest,
1048
+ options: any = {}): Promise<any> {
1049
+
1050
+ if (body === null || body === undefined) {
1051
+ throw new Error("'body' is a required parameter but is null or undefined.");
1052
+ }
1053
+ const urlPath = "/v2/account";
1054
+ const queryParams = new Map<string, any>();
1055
+
1056
+ let bodyJson : string = "";
1057
+ bodyJson = JSON.stringify(body || {});
1058
+
1059
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1060
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
1061
+ if (bearerToken) {
1062
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1063
+ }
1064
+
1065
+ return Promise.race([
1066
+ fetch(fullUrl, fetchOptions).then((response) => {
1067
+ if (response.status == 204) {
1068
+ return response;
1069
+ } else if (response.status >= 200 && response.status < 300) {
1070
+ return response.json();
1071
+ } else {
1072
+ throw response;
1073
+ }
1074
+ }),
1075
+ new Promise((_, reject) =>
1076
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1077
+ ),
1078
+ ]);
1079
+ }
1080
+
1081
+ /** Authenticate a user with an Apple ID against the server. */
1082
+ authenticateApple(basicAuthUsername: string,
1083
+ basicAuthPassword: string,
1084
+ account:ApiAccountApple,
1085
+ create?:boolean,
1086
+ username?:string,
1087
+ options: any = {}): Promise<ApiSession> {
1088
+
1089
+ if (account === null || account === undefined) {
1090
+ throw new Error("'account' is a required parameter but is null or undefined.");
1091
+ }
1092
+ const urlPath = "/v2/account/authenticate/apple";
1093
+ const queryParams = new Map<string, any>();
1094
+ queryParams.set("create", create);
1095
+ queryParams.set("username", username);
1096
+
1097
+ let bodyJson : string = "";
1098
+ bodyJson = JSON.stringify(account || {});
1099
+
1100
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1101
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1102
+ if (basicAuthUsername) {
1103
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1104
+ }
1105
+
1106
+ return Promise.race([
1107
+ fetch(fullUrl, fetchOptions).then((response) => {
1108
+ if (response.status == 204) {
1109
+ return response;
1110
+ } else if (response.status >= 200 && response.status < 300) {
1111
+ return response.json();
1112
+ } else {
1113
+ throw response;
1114
+ }
1115
+ }),
1116
+ new Promise((_, reject) =>
1117
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1118
+ ),
1119
+ ]);
1120
+ }
1121
+
1122
+ /** Authenticate a user with a custom id against the server. */
1123
+ authenticateCustom(basicAuthUsername: string,
1124
+ basicAuthPassword: string,
1125
+ account:ApiAccountCustom,
1126
+ create?:boolean,
1127
+ username?:string,
1128
+ options: any = {}): Promise<ApiSession> {
1129
+
1130
+ if (account === null || account === undefined) {
1131
+ throw new Error("'account' is a required parameter but is null or undefined.");
1132
+ }
1133
+ const urlPath = "/v2/account/authenticate/custom";
1134
+ const queryParams = new Map<string, any>();
1135
+ queryParams.set("create", create);
1136
+ queryParams.set("username", username);
1137
+
1138
+ let bodyJson : string = "";
1139
+ bodyJson = JSON.stringify(account || {});
1140
+
1141
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1142
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1143
+ if (basicAuthUsername) {
1144
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1145
+ }
1146
+
1147
+ return Promise.race([
1148
+ fetch(fullUrl, fetchOptions).then((response) => {
1149
+ if (response.status == 204) {
1150
+ return response;
1151
+ } else if (response.status >= 200 && response.status < 300) {
1152
+ return response.json();
1153
+ } else {
1154
+ throw response;
1155
+ }
1156
+ }),
1157
+ new Promise((_, reject) =>
1158
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1159
+ ),
1160
+ ]);
1161
+ }
1162
+
1163
+ /** Authenticate a user with a device id against the server. */
1164
+ authenticateDevice(basicAuthUsername: string,
1165
+ basicAuthPassword: string,
1166
+ account:ApiAccountDevice,
1167
+ create?:boolean,
1168
+ username?:string,
1169
+ options: any = {}): Promise<ApiSession> {
1170
+
1171
+ if (account === null || account === undefined) {
1172
+ throw new Error("'account' is a required parameter but is null or undefined.");
1173
+ }
1174
+ const urlPath = "/v2/account/authenticate/device";
1175
+ const queryParams = new Map<string, any>();
1176
+ queryParams.set("create", create);
1177
+ queryParams.set("username", username);
1178
+
1179
+ let bodyJson : string = "";
1180
+ bodyJson = JSON.stringify(account || {});
1181
+
1182
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1183
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1184
+ if (basicAuthUsername) {
1185
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1186
+ }
1187
+
1188
+ return Promise.race([
1189
+ fetch(fullUrl, fetchOptions).then((response) => {
1190
+ if (response.status == 204) {
1191
+ return response;
1192
+ } else if (response.status >= 200 && response.status < 300) {
1193
+ return response.json();
1194
+ } else {
1195
+ throw response;
1196
+ }
1197
+ }),
1198
+ new Promise((_, reject) =>
1199
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1200
+ ),
1201
+ ]);
1202
+ }
1203
+
1204
+ /** Authenticate a user with an email+password against the server. */
1205
+ authenticateEmail(basicAuthUsername: string,
1206
+ basicAuthPassword: string,
1207
+ account:ApiAccountEmail,
1208
+ create?:boolean,
1209
+ username?:string,
1210
+ options: any = {}): Promise<ApiSession> {
1211
+
1212
+ if (account === null || account === undefined) {
1213
+ throw new Error("'account' is a required parameter but is null or undefined.");
1214
+ }
1215
+ const urlPath = "/v2/account/authenticate/email";
1216
+ const queryParams = new Map<string, any>();
1217
+ queryParams.set("create", create);
1218
+ queryParams.set("username", username);
1219
+
1220
+ let bodyJson : string = "";
1221
+ bodyJson = JSON.stringify(account || {});
1222
+
1223
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1224
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1225
+ if (basicAuthUsername) {
1226
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1227
+ }
1228
+
1229
+ return Promise.race([
1230
+ fetch(fullUrl, fetchOptions).then((response) => {
1231
+ if (response.status == 204) {
1232
+ return response;
1233
+ } else if (response.status >= 200 && response.status < 300) {
1234
+ return response.json();
1235
+ } else {
1236
+ throw response;
1237
+ }
1238
+ }),
1239
+ new Promise((_, reject) =>
1240
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1241
+ ),
1242
+ ]);
1243
+ }
1244
+
1245
+ /** Authenticate a user with a Facebook OAuth token against the server. */
1246
+ authenticateFacebook(basicAuthUsername: string,
1247
+ basicAuthPassword: string,
1248
+ account:ApiAccountFacebook,
1249
+ create?:boolean,
1250
+ username?:string,
1251
+ sync?:boolean,
1252
+ options: any = {}): Promise<ApiSession> {
1253
+
1254
+ if (account === null || account === undefined) {
1255
+ throw new Error("'account' is a required parameter but is null or undefined.");
1256
+ }
1257
+ const urlPath = "/v2/account/authenticate/facebook";
1258
+ const queryParams = new Map<string, any>();
1259
+ queryParams.set("create", create);
1260
+ queryParams.set("username", username);
1261
+ queryParams.set("sync", sync);
1262
+
1263
+ let bodyJson : string = "";
1264
+ bodyJson = JSON.stringify(account || {});
1265
+
1266
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1267
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1268
+ if (basicAuthUsername) {
1269
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1270
+ }
1271
+
1272
+ return Promise.race([
1273
+ fetch(fullUrl, fetchOptions).then((response) => {
1274
+ if (response.status == 204) {
1275
+ return response;
1276
+ } else if (response.status >= 200 && response.status < 300) {
1277
+ return response.json();
1278
+ } else {
1279
+ throw response;
1280
+ }
1281
+ }),
1282
+ new Promise((_, reject) =>
1283
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1284
+ ),
1285
+ ]);
1286
+ }
1287
+
1288
+ /** Authenticate a user with a Facebook Instant Game token against the server. */
1289
+ authenticateFacebookInstantGame(basicAuthUsername: string,
1290
+ basicAuthPassword: string,
1291
+ account:ApiAccountFacebookInstantGame,
1292
+ create?:boolean,
1293
+ username?:string,
1294
+ options: any = {}): Promise<ApiSession> {
1295
+
1296
+ if (account === null || account === undefined) {
1297
+ throw new Error("'account' is a required parameter but is null or undefined.");
1298
+ }
1299
+ const urlPath = "/v2/account/authenticate/facebookinstantgame";
1300
+ const queryParams = new Map<string, any>();
1301
+ queryParams.set("create", create);
1302
+ queryParams.set("username", username);
1303
+
1304
+ let bodyJson : string = "";
1305
+ bodyJson = JSON.stringify(account || {});
1306
+
1307
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1308
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1309
+ if (basicAuthUsername) {
1310
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1311
+ }
1312
+
1313
+ return Promise.race([
1314
+ fetch(fullUrl, fetchOptions).then((response) => {
1315
+ if (response.status == 204) {
1316
+ return response;
1317
+ } else if (response.status >= 200 && response.status < 300) {
1318
+ return response.json();
1319
+ } else {
1320
+ throw response;
1321
+ }
1322
+ }),
1323
+ new Promise((_, reject) =>
1324
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1325
+ ),
1326
+ ]);
1327
+ }
1328
+
1329
+ /** Authenticate a user with Apple's GameCenter against the server. */
1330
+ authenticateGameCenter(basicAuthUsername: string,
1331
+ basicAuthPassword: string,
1332
+ account:ApiAccountGameCenter,
1333
+ create?:boolean,
1334
+ username?:string,
1335
+ options: any = {}): Promise<ApiSession> {
1336
+
1337
+ if (account === null || account === undefined) {
1338
+ throw new Error("'account' is a required parameter but is null or undefined.");
1339
+ }
1340
+ const urlPath = "/v2/account/authenticate/gamecenter";
1341
+ const queryParams = new Map<string, any>();
1342
+ queryParams.set("create", create);
1343
+ queryParams.set("username", username);
1344
+
1345
+ let bodyJson : string = "";
1346
+ bodyJson = JSON.stringify(account || {});
1347
+
1348
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1349
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1350
+ if (basicAuthUsername) {
1351
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1352
+ }
1353
+
1354
+ return Promise.race([
1355
+ fetch(fullUrl, fetchOptions).then((response) => {
1356
+ if (response.status == 204) {
1357
+ return response;
1358
+ } else if (response.status >= 200 && response.status < 300) {
1359
+ return response.json();
1360
+ } else {
1361
+ throw response;
1362
+ }
1363
+ }),
1364
+ new Promise((_, reject) =>
1365
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1366
+ ),
1367
+ ]);
1368
+ }
1369
+
1370
+ /** Authenticate a user with Google against the server. */
1371
+ authenticateGoogle(basicAuthUsername: string,
1372
+ basicAuthPassword: string,
1373
+ account:ApiAccountGoogle,
1374
+ create?:boolean,
1375
+ username?:string,
1376
+ options: any = {}): Promise<ApiSession> {
1377
+
1378
+ if (account === null || account === undefined) {
1379
+ throw new Error("'account' is a required parameter but is null or undefined.");
1380
+ }
1381
+ const urlPath = "/v2/account/authenticate/google";
1382
+ const queryParams = new Map<string, any>();
1383
+ queryParams.set("create", create);
1384
+ queryParams.set("username", username);
1385
+
1386
+ let bodyJson : string = "";
1387
+ bodyJson = JSON.stringify(account || {});
1388
+
1389
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1390
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1391
+ if (basicAuthUsername) {
1392
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1393
+ }
1394
+
1395
+ return Promise.race([
1396
+ fetch(fullUrl, fetchOptions).then((response) => {
1397
+ if (response.status == 204) {
1398
+ return response;
1399
+ } else if (response.status >= 200 && response.status < 300) {
1400
+ return response.json();
1401
+ } else {
1402
+ throw response;
1403
+ }
1404
+ }),
1405
+ new Promise((_, reject) =>
1406
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1407
+ ),
1408
+ ]);
1409
+ }
1410
+
1411
+ /** Authenticate a user with Steam against the server. */
1412
+ authenticateSteam(basicAuthUsername: string,
1413
+ basicAuthPassword: string,
1414
+ account:ApiAccountSteam,
1415
+ create?:boolean,
1416
+ username?:string,
1417
+ sync?:boolean,
1418
+ options: any = {}): Promise<ApiSession> {
1419
+
1420
+ if (account === null || account === undefined) {
1421
+ throw new Error("'account' is a required parameter but is null or undefined.");
1422
+ }
1423
+ const urlPath = "/v2/account/authenticate/steam";
1424
+ const queryParams = new Map<string, any>();
1425
+ queryParams.set("create", create);
1426
+ queryParams.set("username", username);
1427
+ queryParams.set("sync", sync);
1428
+
1429
+ let bodyJson : string = "";
1430
+ bodyJson = JSON.stringify(account || {});
1431
+
1432
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1433
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1434
+ if (basicAuthUsername) {
1435
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1436
+ }
1437
+
1438
+ return Promise.race([
1439
+ fetch(fullUrl, fetchOptions).then((response) => {
1440
+ if (response.status == 204) {
1441
+ return response;
1442
+ } else if (response.status >= 200 && response.status < 300) {
1443
+ return response.json();
1444
+ } else {
1445
+ throw response;
1446
+ }
1447
+ }),
1448
+ new Promise((_, reject) =>
1449
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1450
+ ),
1451
+ ]);
1452
+ }
1453
+
1454
+ /** Add an Apple ID to the social profiles on the current user's account. */
1455
+ linkApple(bearerToken: string,
1456
+ body:ApiAccountApple,
1457
+ options: any = {}): Promise<any> {
1458
+
1459
+ if (body === null || body === undefined) {
1460
+ throw new Error("'body' is a required parameter but is null or undefined.");
1461
+ }
1462
+ const urlPath = "/v2/account/link/apple";
1463
+ const queryParams = new Map<string, any>();
1464
+
1465
+ let bodyJson : string = "";
1466
+ bodyJson = JSON.stringify(body || {});
1467
+
1468
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1469
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1470
+ if (bearerToken) {
1471
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1472
+ }
1473
+
1474
+ return Promise.race([
1475
+ fetch(fullUrl, fetchOptions).then((response) => {
1476
+ if (response.status == 204) {
1477
+ return response;
1478
+ } else if (response.status >= 200 && response.status < 300) {
1479
+ return response.json();
1480
+ } else {
1481
+ throw response;
1482
+ }
1483
+ }),
1484
+ new Promise((_, reject) =>
1485
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1486
+ ),
1487
+ ]);
1488
+ }
1489
+
1490
+ /** Add a custom ID to the social profiles on the current user's account. */
1491
+ linkCustom(bearerToken: string,
1492
+ body:ApiAccountCustom,
1493
+ options: any = {}): Promise<any> {
1494
+
1495
+ if (body === null || body === undefined) {
1496
+ throw new Error("'body' is a required parameter but is null or undefined.");
1497
+ }
1498
+ const urlPath = "/v2/account/link/custom";
1499
+ const queryParams = new Map<string, any>();
1500
+
1501
+ let bodyJson : string = "";
1502
+ bodyJson = JSON.stringify(body || {});
1503
+
1504
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1505
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1506
+ if (bearerToken) {
1507
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1508
+ }
1509
+
1510
+ return Promise.race([
1511
+ fetch(fullUrl, fetchOptions).then((response) => {
1512
+ if (response.status == 204) {
1513
+ return response;
1514
+ } else if (response.status >= 200 && response.status < 300) {
1515
+ return response.json();
1516
+ } else {
1517
+ throw response;
1518
+ }
1519
+ }),
1520
+ new Promise((_, reject) =>
1521
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1522
+ ),
1523
+ ]);
1524
+ }
1525
+
1526
+ /** Add a device ID to the social profiles on the current user's account. */
1527
+ linkDevice(bearerToken: string,
1528
+ body:ApiAccountDevice,
1529
+ options: any = {}): Promise<any> {
1530
+
1531
+ if (body === null || body === undefined) {
1532
+ throw new Error("'body' is a required parameter but is null or undefined.");
1533
+ }
1534
+ const urlPath = "/v2/account/link/device";
1535
+ const queryParams = new Map<string, any>();
1536
+
1537
+ let bodyJson : string = "";
1538
+ bodyJson = JSON.stringify(body || {});
1539
+
1540
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1541
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1542
+ if (bearerToken) {
1543
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1544
+ }
1545
+
1546
+ return Promise.race([
1547
+ fetch(fullUrl, fetchOptions).then((response) => {
1548
+ if (response.status == 204) {
1549
+ return response;
1550
+ } else if (response.status >= 200 && response.status < 300) {
1551
+ return response.json();
1552
+ } else {
1553
+ throw response;
1554
+ }
1555
+ }),
1556
+ new Promise((_, reject) =>
1557
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1558
+ ),
1559
+ ]);
1560
+ }
1561
+
1562
+ /** Add an email+password to the social profiles on the current user's account. */
1563
+ linkEmail(bearerToken: string,
1564
+ body:ApiAccountEmail,
1565
+ options: any = {}): Promise<any> {
1566
+
1567
+ if (body === null || body === undefined) {
1568
+ throw new Error("'body' is a required parameter but is null or undefined.");
1569
+ }
1570
+ const urlPath = "/v2/account/link/email";
1571
+ const queryParams = new Map<string, any>();
1572
+
1573
+ let bodyJson : string = "";
1574
+ bodyJson = JSON.stringify(body || {});
1575
+
1576
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1577
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1578
+ if (bearerToken) {
1579
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1580
+ }
1581
+
1582
+ return Promise.race([
1583
+ fetch(fullUrl, fetchOptions).then((response) => {
1584
+ if (response.status == 204) {
1585
+ return response;
1586
+ } else if (response.status >= 200 && response.status < 300) {
1587
+ return response.json();
1588
+ } else {
1589
+ throw response;
1590
+ }
1591
+ }),
1592
+ new Promise((_, reject) =>
1593
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1594
+ ),
1595
+ ]);
1596
+ }
1597
+
1598
+ /** Add Facebook to the social profiles on the current user's account. */
1599
+ linkFacebook(bearerToken: string,
1600
+ account:ApiAccountFacebook,
1601
+ sync?:boolean,
1602
+ options: any = {}): Promise<any> {
1603
+
1604
+ if (account === null || account === undefined) {
1605
+ throw new Error("'account' is a required parameter but is null or undefined.");
1606
+ }
1607
+ const urlPath = "/v2/account/link/facebook";
1608
+ const queryParams = new Map<string, any>();
1609
+ queryParams.set("sync", sync);
1610
+
1611
+ let bodyJson : string = "";
1612
+ bodyJson = JSON.stringify(account || {});
1613
+
1614
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1615
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1616
+ if (bearerToken) {
1617
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1618
+ }
1619
+
1620
+ return Promise.race([
1621
+ fetch(fullUrl, fetchOptions).then((response) => {
1622
+ if (response.status == 204) {
1623
+ return response;
1624
+ } else if (response.status >= 200 && response.status < 300) {
1625
+ return response.json();
1626
+ } else {
1627
+ throw response;
1628
+ }
1629
+ }),
1630
+ new Promise((_, reject) =>
1631
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1632
+ ),
1633
+ ]);
1634
+ }
1635
+
1636
+ /** Add Facebook Instant Game to the social profiles on the current user's account. */
1637
+ linkFacebookInstantGame(bearerToken: string,
1638
+ body:ApiAccountFacebookInstantGame,
1639
+ options: any = {}): Promise<any> {
1640
+
1641
+ if (body === null || body === undefined) {
1642
+ throw new Error("'body' is a required parameter but is null or undefined.");
1643
+ }
1644
+ const urlPath = "/v2/account/link/facebookinstantgame";
1645
+ const queryParams = new Map<string, any>();
1646
+
1647
+ let bodyJson : string = "";
1648
+ bodyJson = JSON.stringify(body || {});
1649
+
1650
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1651
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1652
+ if (bearerToken) {
1653
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1654
+ }
1655
+
1656
+ return Promise.race([
1657
+ fetch(fullUrl, fetchOptions).then((response) => {
1658
+ if (response.status == 204) {
1659
+ return response;
1660
+ } else if (response.status >= 200 && response.status < 300) {
1661
+ return response.json();
1662
+ } else {
1663
+ throw response;
1664
+ }
1665
+ }),
1666
+ new Promise((_, reject) =>
1667
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1668
+ ),
1669
+ ]);
1670
+ }
1671
+
1672
+ /** Add Apple's GameCenter to the social profiles on the current user's account. */
1673
+ linkGameCenter(bearerToken: string,
1674
+ body:ApiAccountGameCenter,
1675
+ options: any = {}): Promise<any> {
1676
+
1677
+ if (body === null || body === undefined) {
1678
+ throw new Error("'body' is a required parameter but is null or undefined.");
1679
+ }
1680
+ const urlPath = "/v2/account/link/gamecenter";
1681
+ const queryParams = new Map<string, any>();
1682
+
1683
+ let bodyJson : string = "";
1684
+ bodyJson = JSON.stringify(body || {});
1685
+
1686
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1687
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1688
+ if (bearerToken) {
1689
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1690
+ }
1691
+
1692
+ return Promise.race([
1693
+ fetch(fullUrl, fetchOptions).then((response) => {
1694
+ if (response.status == 204) {
1695
+ return response;
1696
+ } else if (response.status >= 200 && response.status < 300) {
1697
+ return response.json();
1698
+ } else {
1699
+ throw response;
1700
+ }
1701
+ }),
1702
+ new Promise((_, reject) =>
1703
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1704
+ ),
1705
+ ]);
1706
+ }
1707
+
1708
+ /** Add Google to the social profiles on the current user's account. */
1709
+ linkGoogle(bearerToken: string,
1710
+ body:ApiAccountGoogle,
1711
+ options: any = {}): Promise<any> {
1712
+
1713
+ if (body === null || body === undefined) {
1714
+ throw new Error("'body' is a required parameter but is null or undefined.");
1715
+ }
1716
+ const urlPath = "/v2/account/link/google";
1717
+ const queryParams = new Map<string, any>();
1718
+
1719
+ let bodyJson : string = "";
1720
+ bodyJson = JSON.stringify(body || {});
1721
+
1722
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1723
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1724
+ if (bearerToken) {
1725
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1726
+ }
1727
+
1728
+ return Promise.race([
1729
+ fetch(fullUrl, fetchOptions).then((response) => {
1730
+ if (response.status == 204) {
1731
+ return response;
1732
+ } else if (response.status >= 200 && response.status < 300) {
1733
+ return response.json();
1734
+ } else {
1735
+ throw response;
1736
+ }
1737
+ }),
1738
+ new Promise((_, reject) =>
1739
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1740
+ ),
1741
+ ]);
1742
+ }
1743
+
1744
+ /** Add Steam to the social profiles on the current user's account. */
1745
+ linkSteam(bearerToken: string,
1746
+ body:ApiLinkSteamRequest,
1747
+ options: any = {}): Promise<any> {
1748
+
1749
+ if (body === null || body === undefined) {
1750
+ throw new Error("'body' is a required parameter but is null or undefined.");
1751
+ }
1752
+ const urlPath = "/v2/account/link/steam";
1753
+ const queryParams = new Map<string, any>();
1754
+
1755
+ let bodyJson : string = "";
1756
+ bodyJson = JSON.stringify(body || {});
1757
+
1758
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1759
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1760
+ if (bearerToken) {
1761
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1762
+ }
1763
+
1764
+ return Promise.race([
1765
+ fetch(fullUrl, fetchOptions).then((response) => {
1766
+ if (response.status == 204) {
1767
+ return response;
1768
+ } else if (response.status >= 200 && response.status < 300) {
1769
+ return response.json();
1770
+ } else {
1771
+ throw response;
1772
+ }
1773
+ }),
1774
+ new Promise((_, reject) =>
1775
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1776
+ ),
1777
+ ]);
1778
+ }
1779
+
1780
+ /** Refresh a user's session using a refresh token retrieved from a previous authentication request. */
1781
+ sessionRefresh(basicAuthUsername: string,
1782
+ basicAuthPassword: string,
1783
+ body:ApiSessionRefreshRequest,
1784
+ options: any = {}): Promise<ApiSession> {
1785
+
1786
+ if (body === null || body === undefined) {
1787
+ throw new Error("'body' is a required parameter but is null or undefined.");
1788
+ }
1789
+ const urlPath = "/v2/account/session/refresh";
1790
+ const queryParams = new Map<string, any>();
1791
+
1792
+ let bodyJson : string = "";
1793
+ bodyJson = JSON.stringify(body || {});
1794
+
1795
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1796
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1797
+ if (basicAuthUsername) {
1798
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1799
+ }
1800
+
1801
+ return Promise.race([
1802
+ fetch(fullUrl, fetchOptions).then((response) => {
1803
+ if (response.status == 204) {
1804
+ return response;
1805
+ } else if (response.status >= 200 && response.status < 300) {
1806
+ return response.json();
1807
+ } else {
1808
+ throw response;
1809
+ }
1810
+ }),
1811
+ new Promise((_, reject) =>
1812
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1813
+ ),
1814
+ ]);
1815
+ }
1816
+
1817
+ /** Remove the Apple ID from the social profiles on the current user's account. */
1818
+ unlinkApple(bearerToken: string,
1819
+ body:ApiAccountApple,
1820
+ options: any = {}): Promise<any> {
1821
+
1822
+ if (body === null || body === undefined) {
1823
+ throw new Error("'body' is a required parameter but is null or undefined.");
1824
+ }
1825
+ const urlPath = "/v2/account/unlink/apple";
1826
+ const queryParams = new Map<string, any>();
1827
+
1828
+ let bodyJson : string = "";
1829
+ bodyJson = JSON.stringify(body || {});
1830
+
1831
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1832
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1833
+ if (bearerToken) {
1834
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1835
+ }
1836
+
1837
+ return Promise.race([
1838
+ fetch(fullUrl, fetchOptions).then((response) => {
1839
+ if (response.status == 204) {
1840
+ return response;
1841
+ } else if (response.status >= 200 && response.status < 300) {
1842
+ return response.json();
1843
+ } else {
1844
+ throw response;
1845
+ }
1846
+ }),
1847
+ new Promise((_, reject) =>
1848
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1849
+ ),
1850
+ ]);
1851
+ }
1852
+
1853
+ /** Remove the custom ID from the social profiles on the current user's account. */
1854
+ unlinkCustom(bearerToken: string,
1855
+ body:ApiAccountCustom,
1856
+ options: any = {}): Promise<any> {
1857
+
1858
+ if (body === null || body === undefined) {
1859
+ throw new Error("'body' is a required parameter but is null or undefined.");
1860
+ }
1861
+ const urlPath = "/v2/account/unlink/custom";
1862
+ const queryParams = new Map<string, any>();
1863
+
1864
+ let bodyJson : string = "";
1865
+ bodyJson = JSON.stringify(body || {});
1866
+
1867
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1868
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1869
+ if (bearerToken) {
1870
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1871
+ }
1872
+
1873
+ return Promise.race([
1874
+ fetch(fullUrl, fetchOptions).then((response) => {
1875
+ if (response.status == 204) {
1876
+ return response;
1877
+ } else if (response.status >= 200 && response.status < 300) {
1878
+ return response.json();
1879
+ } else {
1880
+ throw response;
1881
+ }
1882
+ }),
1883
+ new Promise((_, reject) =>
1884
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1885
+ ),
1886
+ ]);
1887
+ }
1888
+
1889
+ /** Remove the device ID from the social profiles on the current user's account. */
1890
+ unlinkDevice(bearerToken: string,
1891
+ body:ApiAccountDevice,
1892
+ options: any = {}): Promise<any> {
1893
+
1894
+ if (body === null || body === undefined) {
1895
+ throw new Error("'body' is a required parameter but is null or undefined.");
1896
+ }
1897
+ const urlPath = "/v2/account/unlink/device";
1898
+ const queryParams = new Map<string, any>();
1899
+
1900
+ let bodyJson : string = "";
1901
+ bodyJson = JSON.stringify(body || {});
1902
+
1903
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1904
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1905
+ if (bearerToken) {
1906
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1907
+ }
1908
+
1909
+ return Promise.race([
1910
+ fetch(fullUrl, fetchOptions).then((response) => {
1911
+ if (response.status == 204) {
1912
+ return response;
1913
+ } else if (response.status >= 200 && response.status < 300) {
1914
+ return response.json();
1915
+ } else {
1916
+ throw response;
1917
+ }
1918
+ }),
1919
+ new Promise((_, reject) =>
1920
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1921
+ ),
1922
+ ]);
1923
+ }
1924
+
1925
+ /** Remove the email+password from the social profiles on the current user's account. */
1926
+ unlinkEmail(bearerToken: string,
1927
+ body:ApiAccountEmail,
1928
+ options: any = {}): Promise<any> {
1929
+
1930
+ if (body === null || body === undefined) {
1931
+ throw new Error("'body' is a required parameter but is null or undefined.");
1932
+ }
1933
+ const urlPath = "/v2/account/unlink/email";
1934
+ const queryParams = new Map<string, any>();
1935
+
1936
+ let bodyJson : string = "";
1937
+ bodyJson = JSON.stringify(body || {});
1938
+
1939
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1940
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1941
+ if (bearerToken) {
1942
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1943
+ }
1944
+
1945
+ return Promise.race([
1946
+ fetch(fullUrl, fetchOptions).then((response) => {
1947
+ if (response.status == 204) {
1948
+ return response;
1949
+ } else if (response.status >= 200 && response.status < 300) {
1950
+ return response.json();
1951
+ } else {
1952
+ throw response;
1953
+ }
1954
+ }),
1955
+ new Promise((_, reject) =>
1956
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1957
+ ),
1958
+ ]);
1959
+ }
1960
+
1961
+ /** Remove Facebook from the social profiles on the current user's account. */
1962
+ unlinkFacebook(bearerToken: string,
1963
+ body:ApiAccountFacebook,
1964
+ options: any = {}): Promise<any> {
1965
+
1966
+ if (body === null || body === undefined) {
1967
+ throw new Error("'body' is a required parameter but is null or undefined.");
1968
+ }
1969
+ const urlPath = "/v2/account/unlink/facebook";
1970
+ const queryParams = new Map<string, any>();
1971
+
1972
+ let bodyJson : string = "";
1973
+ bodyJson = JSON.stringify(body || {});
1974
+
1975
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1976
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1977
+ if (bearerToken) {
1978
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1979
+ }
1980
+
1981
+ return Promise.race([
1982
+ fetch(fullUrl, fetchOptions).then((response) => {
1983
+ if (response.status == 204) {
1984
+ return response;
1985
+ } else if (response.status >= 200 && response.status < 300) {
1986
+ return response.json();
1987
+ } else {
1988
+ throw response;
1989
+ }
1990
+ }),
1991
+ new Promise((_, reject) =>
1992
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
1993
+ ),
1994
+ ]);
1995
+ }
1996
+
1997
+ /** Remove Facebook Instant Game profile from the social profiles on the current user's account. */
1998
+ unlinkFacebookInstantGame(bearerToken: string,
1999
+ body:ApiAccountFacebookInstantGame,
2000
+ options: any = {}): Promise<any> {
2001
+
2002
+ if (body === null || body === undefined) {
2003
+ throw new Error("'body' is a required parameter but is null or undefined.");
2004
+ }
2005
+ const urlPath = "/v2/account/unlink/facebookinstantgame";
2006
+ const queryParams = new Map<string, any>();
2007
+
2008
+ let bodyJson : string = "";
2009
+ bodyJson = JSON.stringify(body || {});
2010
+
2011
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2012
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2013
+ if (bearerToken) {
2014
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2015
+ }
2016
+
2017
+ return Promise.race([
2018
+ fetch(fullUrl, fetchOptions).then((response) => {
2019
+ if (response.status == 204) {
2020
+ return response;
2021
+ } else if (response.status >= 200 && response.status < 300) {
2022
+ return response.json();
2023
+ } else {
2024
+ throw response;
2025
+ }
2026
+ }),
2027
+ new Promise((_, reject) =>
2028
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2029
+ ),
2030
+ ]);
2031
+ }
2032
+
2033
+ /** Remove Apple's GameCenter from the social profiles on the current user's account. */
2034
+ unlinkGameCenter(bearerToken: string,
2035
+ body:ApiAccountGameCenter,
2036
+ options: any = {}): Promise<any> {
2037
+
2038
+ if (body === null || body === undefined) {
2039
+ throw new Error("'body' is a required parameter but is null or undefined.");
2040
+ }
2041
+ const urlPath = "/v2/account/unlink/gamecenter";
2042
+ const queryParams = new Map<string, any>();
2043
+
2044
+ let bodyJson : string = "";
2045
+ bodyJson = JSON.stringify(body || {});
2046
+
2047
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2048
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2049
+ if (bearerToken) {
2050
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2051
+ }
2052
+
2053
+ return Promise.race([
2054
+ fetch(fullUrl, fetchOptions).then((response) => {
2055
+ if (response.status == 204) {
2056
+ return response;
2057
+ } else if (response.status >= 200 && response.status < 300) {
2058
+ return response.json();
2059
+ } else {
2060
+ throw response;
2061
+ }
2062
+ }),
2063
+ new Promise((_, reject) =>
2064
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2065
+ ),
2066
+ ]);
2067
+ }
2068
+
2069
+ /** Remove Google from the social profiles on the current user's account. */
2070
+ unlinkGoogle(bearerToken: string,
2071
+ body:ApiAccountGoogle,
2072
+ options: any = {}): Promise<any> {
2073
+
2074
+ if (body === null || body === undefined) {
2075
+ throw new Error("'body' is a required parameter but is null or undefined.");
2076
+ }
2077
+ const urlPath = "/v2/account/unlink/google";
2078
+ const queryParams = new Map<string, any>();
2079
+
2080
+ let bodyJson : string = "";
2081
+ bodyJson = JSON.stringify(body || {});
2082
+
2083
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2084
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2085
+ if (bearerToken) {
2086
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2087
+ }
2088
+
2089
+ return Promise.race([
2090
+ fetch(fullUrl, fetchOptions).then((response) => {
2091
+ if (response.status == 204) {
2092
+ return response;
2093
+ } else if (response.status >= 200 && response.status < 300) {
2094
+ return response.json();
2095
+ } else {
2096
+ throw response;
2097
+ }
2098
+ }),
2099
+ new Promise((_, reject) =>
2100
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2101
+ ),
2102
+ ]);
2103
+ }
2104
+
2105
+ /** Remove Steam from the social profiles on the current user's account. */
2106
+ unlinkSteam(bearerToken: string,
2107
+ body:ApiAccountSteam,
2108
+ options: any = {}): Promise<any> {
2109
+
2110
+ if (body === null || body === undefined) {
2111
+ throw new Error("'body' is a required parameter but is null or undefined.");
2112
+ }
2113
+ const urlPath = "/v2/account/unlink/steam";
2114
+ const queryParams = new Map<string, any>();
2115
+
2116
+ let bodyJson : string = "";
2117
+ bodyJson = JSON.stringify(body || {});
2118
+
2119
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2120
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2121
+ if (bearerToken) {
2122
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2123
+ }
2124
+
2125
+ return Promise.race([
2126
+ fetch(fullUrl, fetchOptions).then((response) => {
2127
+ if (response.status == 204) {
2128
+ return response;
2129
+ } else if (response.status >= 200 && response.status < 300) {
2130
+ return response.json();
2131
+ } else {
2132
+ throw response;
2133
+ }
2134
+ }),
2135
+ new Promise((_, reject) =>
2136
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2137
+ ),
2138
+ ]);
2139
+ }
2140
+
2141
+ /** */
2142
+ listCategoryDescs(bearerToken: string,
2143
+ clanId:string,
2144
+ creatorId?:string,
2145
+ categoryName?:string,
2146
+ categoryId?:string,
2147
+ options: any = {}): Promise<ApiCategoryDescList> {
2148
+
2149
+ if (clanId === null || clanId === undefined) {
2150
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
2151
+ }
2152
+ const urlPath = "/v2/categorydesc/{clanId}"
2153
+ .replace("{clanId}", encodeURIComponent(String(clanId)));
2154
+ const queryParams = new Map<string, any>();
2155
+ queryParams.set("creator_id", creatorId);
2156
+ queryParams.set("category_name", categoryName);
2157
+ queryParams.set("category_id", categoryId);
2158
+
2159
+ let bodyJson : string = "";
2160
+
2161
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2162
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2163
+ if (bearerToken) {
2164
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2165
+ }
2166
+
2167
+ return Promise.race([
2168
+ fetch(fullUrl, fetchOptions).then((response) => {
2169
+ if (response.status == 204) {
2170
+ return response;
2171
+ } else if (response.status >= 200 && response.status < 300) {
2172
+ return response.json();
2173
+ } else {
2174
+ throw response;
2175
+ }
2176
+ }),
2177
+ new Promise((_, reject) =>
2178
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2179
+ ),
2180
+ ]);
2181
+ }
2182
+
2183
+ /** List a channel's message history. */
2184
+ listChannelMessages(bearerToken: string,
2185
+ channelId:string,
2186
+ messageId?:string,
2187
+ direction?:number,
2188
+ limit?:number,
2189
+ options: any = {}): Promise<ApiChannelMessageList> {
2190
+
2191
+ if (channelId === null || channelId === undefined) {
2192
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
2193
+ }
2194
+ const urlPath = "/v2/channel/{channelId}"
2195
+ .replace("{channelId}", encodeURIComponent(String(channelId)));
2196
+ const queryParams = new Map<string, any>();
2197
+ queryParams.set("message_id", messageId);
2198
+ queryParams.set("limit", limit);
2199
+ queryParams.set("direction", direction);
2200
+
2201
+ let bodyJson : string = "";
2202
+
2203
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2204
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2205
+ if (bearerToken) {
2206
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2207
+ }
2208
+
2209
+ return Promise.race([
2210
+ fetch(fullUrl, fetchOptions).then((response) => {
2211
+ if (response.status == 204) {
2212
+ return response;
2213
+ } else if (response.status >= 200 && response.status < 300) {
2214
+ return response.json();
2215
+ } else {
2216
+ throw response;
2217
+ }
2218
+ }),
2219
+ new Promise((_, reject) =>
2220
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2221
+ ),
2222
+ ]);
2223
+ }
2224
+
2225
+ /** List user channels */
2226
+ listChannelDescs(bearerToken: string,
2227
+ limit?:number,
2228
+ state?:number,
2229
+ cursor?:string,
2230
+ clanId?:string,
2231
+ channelType?:number,
2232
+ options: any = {}): Promise<ApiChannelDescList> {
2233
+
2234
+ const urlPath = "/v2/channeldesc";
2235
+ const queryParams = new Map<string, any>();
2236
+ queryParams.set("limit", limit);
2237
+ queryParams.set("state", state);
2238
+ queryParams.set("cursor", cursor);
2239
+ queryParams.set("clan_id", clanId);
2240
+ queryParams.set("channel_type", channelType);
2241
+
2242
+ let bodyJson : string = "";
2243
+
2244
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2245
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2246
+ if (bearerToken) {
2247
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2248
+ }
2249
+
2250
+ return Promise.race([
2251
+ fetch(fullUrl, fetchOptions).then((response) => {
2252
+ if (response.status == 204) {
2253
+ return response;
2254
+ } else if (response.status >= 200 && response.status < 300) {
2255
+ return response.json();
2256
+ } else {
2257
+ throw response;
2258
+ }
2259
+ }),
2260
+ new Promise((_, reject) =>
2261
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2262
+ ),
2263
+ ]);
2264
+ }
2265
+
2266
+ /** Create a new channel with the current user as the owner. */
2267
+ createChannelDesc(bearerToken: string,
2268
+ body:ApiCreateChannelDescRequest,
2269
+ options: any = {}): Promise<ApiChannelDescription> {
2270
+
2271
+ if (body === null || body === undefined) {
2272
+ throw new Error("'body' is a required parameter but is null or undefined.");
2273
+ }
2274
+ const urlPath = "/v2/channeldesc";
2275
+ const queryParams = new Map<string, any>();
2276
+
2277
+ let bodyJson : string = "";
2278
+ bodyJson = JSON.stringify(body || {});
2279
+
2280
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2281
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2282
+ if (bearerToken) {
2283
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2284
+ }
2285
+
2286
+ return Promise.race([
2287
+ fetch(fullUrl, fetchOptions).then((response) => {
2288
+ if (response.status == 204) {
2289
+ return response;
2290
+ } else if (response.status >= 200 && response.status < 300) {
2291
+ return response.json();
2292
+ } else {
2293
+ throw response;
2294
+ }
2295
+ }),
2296
+ new Promise((_, reject) =>
2297
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2298
+ ),
2299
+ ]);
2300
+ }
2301
+
2302
+
2303
+ /** Delete a channel by ID. */
2304
+ deleteChannelDesc(bearerToken: string,
2305
+ channelId:string,
2306
+ options: any = {}): Promise<any> {
2307
+
2308
+ if (channelId === null || channelId === undefined) {
2309
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
2310
+ }
2311
+ const urlPath = "/v2/channeldesc/{channelId}"
2312
+ .replace("{channelId}", encodeURIComponent(String(channelId)));
2313
+ const queryParams = new Map<string, any>();
2314
+
2315
+ let bodyJson : string = "";
2316
+
2317
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2318
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
2319
+ if (bearerToken) {
2320
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2321
+ }
2322
+
2323
+ return Promise.race([
2324
+ fetch(fullUrl, fetchOptions).then((response) => {
2325
+ if (response.status == 204) {
2326
+ return response;
2327
+ } else if (response.status >= 200 && response.status < 300) {
2328
+ return response.json();
2329
+ } else {
2330
+ throw response;
2331
+ }
2332
+ }),
2333
+ new Promise((_, reject) =>
2334
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2335
+ ),
2336
+ ]);
2337
+ }
2338
+
2339
+ /** Update fields in a given channel. */
2340
+ updateChannelDesc(bearerToken: string,
2341
+ channelId:string,
2342
+ body:{},
2343
+ options: any = {}): Promise<any> {
2344
+
2345
+ if (channelId === null || channelId === undefined) {
2346
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
2347
+ }
2348
+ if (body === null || body === undefined) {
2349
+ throw new Error("'body' is a required parameter but is null or undefined.");
2350
+ }
2351
+ const urlPath = "/v2/channeldesc/{channelId}"
2352
+ .replace("{channelId}", encodeURIComponent(String(channelId)));
2353
+ const queryParams = new Map<string, any>();
2354
+
2355
+ let bodyJson : string = "";
2356
+ bodyJson = JSON.stringify(body || {});
2357
+
2358
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2359
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
2360
+ if (bearerToken) {
2361
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2362
+ }
2363
+
2364
+ return Promise.race([
2365
+ fetch(fullUrl, fetchOptions).then((response) => {
2366
+ if (response.status == 204) {
2367
+ return response;
2368
+ } else if (response.status >= 200 && response.status < 300) {
2369
+ return response.json();
2370
+ } else {
2371
+ throw response;
2372
+ }
2373
+ }),
2374
+ new Promise((_, reject) =>
2375
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2376
+ ),
2377
+ ]);
2378
+ }
2379
+
2380
+ /** Add users to a channel. */
2381
+ addChannelUsers(bearerToken: string,
2382
+ channelId:string,
2383
+ userIds?:Array<string>,
2384
+ options: any = {}): Promise<any> {
2385
+
2386
+ if (channelId === null || channelId === undefined) {
2387
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
2388
+ }
2389
+ const urlPath = "/v2/channeldesc/{channelId}/add"
2390
+ .replace("{channelId}", encodeURIComponent(String(channelId)));
2391
+ const queryParams = new Map<string, any>();
2392
+ queryParams.set("user_ids", userIds);
2393
+
2394
+ let bodyJson : string = "";
2395
+
2396
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2397
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2398
+ if (bearerToken) {
2399
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2400
+ }
2401
+
2402
+ return Promise.race([
2403
+ fetch(fullUrl, fetchOptions).then((response) => {
2404
+ if (response.status == 204) {
2405
+ return response;
2406
+ } else if (response.status >= 200 && response.status < 300) {
2407
+ return response.json();
2408
+ } else {
2409
+ throw response;
2410
+ }
2411
+ }),
2412
+ new Promise((_, reject) =>
2413
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2414
+ ),
2415
+ ]);
2416
+ }
2417
+
2418
+ /** Leave a channel the user is a member of. */
2419
+ leaveChannel(bearerToken: string,
2420
+ channelId:string,
2421
+ options: any = {}): Promise<any> {
2422
+
2423
+ if (channelId === null || channelId === undefined) {
2424
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
2425
+ }
2426
+ const urlPath = "/v2/channeldesc/{channelId}/leave"
2427
+ .replace("{channelId}", encodeURIComponent(String(channelId)));
2428
+ const queryParams = new Map<string, any>();
2429
+
2430
+ let bodyJson : string = "";
2431
+
2432
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2433
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2434
+ if (bearerToken) {
2435
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2436
+ }
2437
+
2438
+ return Promise.race([
2439
+ fetch(fullUrl, fetchOptions).then((response) => {
2440
+ if (response.status == 204) {
2441
+ return response;
2442
+ } else if (response.status >= 200 && response.status < 300) {
2443
+ return response.json();
2444
+ } else {
2445
+ throw response;
2446
+ }
2447
+ }),
2448
+ new Promise((_, reject) =>
2449
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2450
+ ),
2451
+ ]);
2452
+ }
2453
+
2454
+ /** Kick a set of users from a channel. */
2455
+ removeChannelUsers(bearerToken: string,
2456
+ channelId:string,
2457
+ userIds?:Array<string>,
2458
+ options: any = {}): Promise<any> {
2459
+
2460
+ if (channelId === null || channelId === undefined) {
2461
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
2462
+ }
2463
+ const urlPath = "/v2/channeldesc/{channelId}/remove"
2464
+ .replace("{channelId}", encodeURIComponent(String(channelId)));
2465
+ const queryParams = new Map<string, any>();
2466
+ queryParams.set("user_ids", userIds);
2467
+
2468
+ let bodyJson : string = "";
2469
+
2470
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2471
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2472
+ if (bearerToken) {
2473
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2474
+ }
2475
+
2476
+ return Promise.race([
2477
+ fetch(fullUrl, fetchOptions).then((response) => {
2478
+ if (response.status == 204) {
2479
+ return response;
2480
+ } else if (response.status >= 200 && response.status < 300) {
2481
+ return response.json();
2482
+ } else {
2483
+ throw response;
2484
+ }
2485
+ }),
2486
+ new Promise((_, reject) =>
2487
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2488
+ ),
2489
+ ]);
2490
+ }
2491
+
2492
+ /** List all users that are part of a channel. */
2493
+ listChannelUsers(bearerToken: string,
2494
+ clanId:string,
2495
+ channelId:string,
2496
+ channelType?:number,
2497
+ limit?:number,
2498
+ state?:number,
2499
+ cursor?:string,
2500
+ options: any = {}): Promise<ApiChannelUserList> {
2501
+
2502
+ if (channelId === null || channelId === undefined) {
2503
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
2504
+ }
2505
+ const urlPath = "/v2/channeldesc/{channelId}/user"
2506
+ .replace("{channelId}", encodeURIComponent(String(channelId)));
2507
+ const queryParams = new Map<string, any>();
2508
+ queryParams.set("clan_id", clanId);
2509
+ queryParams.set("channel_type", channelType);
2510
+ queryParams.set("limit", limit);
2511
+ queryParams.set("state", state);
2512
+ queryParams.set("cursor", cursor);
2513
+
2514
+ let bodyJson : string = "";
2515
+
2516
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2517
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2518
+ if (bearerToken) {
2519
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2520
+ }
2521
+
2522
+ return Promise.race([
2523
+ fetch(fullUrl, fetchOptions).then((response) => {
2524
+ if (response.status == 204) {
2525
+ return response;
2526
+ } else if (response.status >= 200 && response.status < 300) {
2527
+ return response.json();
2528
+ } else {
2529
+ throw response;
2530
+ }
2531
+ }),
2532
+ new Promise((_, reject) =>
2533
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2534
+ ),
2535
+ ]);
2536
+ }
2537
+
2538
+ /** List all users that are part of a channel. */
2539
+ listChannelVoiceUsers(bearerToken: string,
2540
+ clanId?:string,
2541
+ channelId?:string,
2542
+ channelType?:number,
2543
+ limit?:number,
2544
+ state?:number,
2545
+ cursor?:string,
2546
+ options: any = {}): Promise<ApiVoiceChannelUserList> {
2547
+
2548
+ const urlPath = "/v2/channelvoice";
2549
+ const queryParams = new Map<string, any>();
2550
+ queryParams.set("clan_id", clanId);
2551
+ queryParams.set("channel_id", channelId);
2552
+ queryParams.set("channel_type", channelType);
2553
+ queryParams.set("limit", limit);
2554
+ queryParams.set("state", state);
2555
+ queryParams.set("cursor", cursor);
2556
+
2557
+ let bodyJson : string = "";
2558
+
2559
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2560
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2561
+ if (bearerToken) {
2562
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2563
+ }
2564
+
2565
+ return Promise.race([
2566
+ fetch(fullUrl, fetchOptions).then((response) => {
2567
+ if (response.status == 204) {
2568
+ return response;
2569
+ } else if (response.status >= 200 && response.status < 300) {
2570
+ return response.json();
2571
+ } else {
2572
+ throw response;
2573
+ }
2574
+ }),
2575
+ new Promise((_, reject) =>
2576
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2577
+ ),
2578
+ ]);
2579
+ }
2580
+
2581
+ /** List clans */
2582
+ listClanDescs(bearerToken: string,
2583
+ limit?:number,
2584
+ state?:number,
2585
+ cursor?:string,
2586
+ options: any = {}): Promise<ApiClanDescList> {
2587
+
2588
+ const urlPath = "/v2/clandesc";
2589
+ const queryParams = new Map<string, any>();
2590
+ queryParams.set("limit", limit);
2591
+ queryParams.set("state", state);
2592
+ queryParams.set("cursor", cursor);
2593
+
2594
+ let bodyJson : string = "";
2595
+
2596
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2597
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2598
+ if (bearerToken) {
2599
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2600
+ }
2601
+
2602
+ return Promise.race([
2603
+ fetch(fullUrl, fetchOptions).then((response) => {
2604
+ if (response.status == 204) {
2605
+ return response;
2606
+ } else if (response.status >= 200 && response.status < 300) {
2607
+ return response.json();
2608
+ } else {
2609
+ throw response;
2610
+ }
2611
+ }),
2612
+ new Promise((_, reject) =>
2613
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2614
+ ),
2615
+ ]);
2616
+ }
2617
+
2618
+ /** Create a clan */
2619
+ createClanDesc(bearerToken: string,
2620
+ body:ApiCreateClanDescRequest,
2621
+ options: any = {}): Promise<ApiClanDesc> {
2622
+
2623
+ if (body === null || body === undefined) {
2624
+ throw new Error("'body' is a required parameter but is null or undefined.");
2625
+ }
2626
+ const urlPath = "/v2/clandesc";
2627
+ const queryParams = new Map<string, any>();
2628
+
2629
+ let bodyJson : string = "";
2630
+ bodyJson = JSON.stringify(body || {});
2631
+
2632
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2633
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2634
+ if (bearerToken) {
2635
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2636
+ }
2637
+
2638
+ return Promise.race([
2639
+ fetch(fullUrl, fetchOptions).then((response) => {
2640
+ if (response.status == 204) {
2641
+ return response;
2642
+ } else if (response.status >= 200 && response.status < 300) {
2643
+ return response.json();
2644
+ } else {
2645
+ throw response;
2646
+ }
2647
+ }),
2648
+ new Promise((_, reject) =>
2649
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2650
+ ),
2651
+ ]);
2652
+ }
2653
+
2654
+ /** Delete a clan desc by ID. */
2655
+ deleteClanDesc(bearerToken: string,
2656
+ clanDescId:string,
2657
+ options: any = {}): Promise<any> {
2658
+
2659
+ if (clanDescId === null || clanDescId === undefined) {
2660
+ throw new Error("'clanDescId' is a required parameter but is null or undefined.");
2661
+ }
2662
+ const urlPath = "/v2/clandesc/{clanDescId}"
2663
+ .replace("{clanDescId}", encodeURIComponent(String(clanDescId)));
2664
+ const queryParams = new Map<string, any>();
2665
+
2666
+ let bodyJson : string = "";
2667
+
2668
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2669
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
2670
+ if (bearerToken) {
2671
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2672
+ }
2673
+
2674
+ return Promise.race([
2675
+ fetch(fullUrl, fetchOptions).then((response) => {
2676
+ if (response.status == 204) {
2677
+ return response;
2678
+ } else if (response.status >= 200 && response.status < 300) {
2679
+ return response.json();
2680
+ } else {
2681
+ throw response;
2682
+ }
2683
+ }),
2684
+ new Promise((_, reject) =>
2685
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2686
+ ),
2687
+ ]);
2688
+ }
2689
+
2690
+ /** Update fields in a given clan. */
2691
+ updateClanDesc(bearerToken: string,
2692
+ clanId:string,
2693
+ creatorId?:string,
2694
+ clanName?:string,
2695
+ logo?:string,
2696
+ banner?:string,
2697
+ options: any = {}): Promise<any> {
2698
+
2699
+ if (clanId === null || clanId === undefined) {
2700
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
2701
+ }
2702
+ const urlPath = "/v2/clandesc/{clanId}"
2703
+ .replace("{clanId}", encodeURIComponent(String(clanId)));
2704
+ const queryParams = new Map<string, any>();
2705
+ queryParams.set("creator_id", creatorId);
2706
+ queryParams.set("clan_name", clanName);
2707
+ queryParams.set("logo", logo);
2708
+ queryParams.set("banner", banner);
2709
+
2710
+ let bodyJson : string = "";
2711
+
2712
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2713
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
2714
+ if (bearerToken) {
2715
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2716
+ }
2717
+
2718
+ return Promise.race([
2719
+ fetch(fullUrl, fetchOptions).then((response) => {
2720
+ if (response.status == 204) {
2721
+ return response;
2722
+ } else if (response.status >= 200 && response.status < 300) {
2723
+ return response.json();
2724
+ } else {
2725
+ throw response;
2726
+ }
2727
+ }),
2728
+ new Promise((_, reject) =>
2729
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2730
+ ),
2731
+ ]);
2732
+ }
2733
+
2734
+ /** List all users that are part of a clan. */
2735
+ listClanUsers(bearerToken: string,
2736
+ clanId:string,
2737
+ options: any = {}): Promise<ApiClanUserList> {
2738
+
2739
+ if (clanId === null || clanId === undefined) {
2740
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
2741
+ }
2742
+ const urlPath = "/v2/clandesc/{clanId}/user"
2743
+ .replace("{clanId}", encodeURIComponent(String(clanId)));
2744
+ const queryParams = new Map<string, any>();
2745
+
2746
+ let bodyJson : string = "";
2747
+
2748
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2749
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2750
+ if (bearerToken) {
2751
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2752
+ }
2753
+
2754
+ return Promise.race([
2755
+ fetch(fullUrl, fetchOptions).then((response) => {
2756
+ if (response.status == 204) {
2757
+ return response;
2758
+ } else if (response.status >= 200 && response.status < 300) {
2759
+ return response.json();
2760
+ } else {
2761
+ throw response;
2762
+ }
2763
+ }),
2764
+ new Promise((_, reject) =>
2765
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2766
+ ),
2767
+ ]);
2768
+ }
2769
+
2770
+ /** Get a clan desc profile */
2771
+ getClanDescProfile(bearerToken: string,
2772
+ clanId:string,
2773
+ options: any = {}): Promise<ApiClanDescProfile> {
2774
+
2775
+ if (clanId === null || clanId === undefined) {
2776
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
2777
+ }
2778
+ const urlPath = "/v2/clandescprofile/{clanId}"
2779
+ .replace("{clanId}", encodeURIComponent(String(clanId)));
2780
+ const queryParams = new Map<string, any>();
2781
+
2782
+ let bodyJson : string = "";
2783
+
2784
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2785
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2786
+ if (bearerToken) {
2787
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2788
+ }
2789
+
2790
+ return Promise.race([
2791
+ fetch(fullUrl, fetchOptions).then((response) => {
2792
+ if (response.status == 204) {
2793
+ return response;
2794
+ } else if (response.status >= 200 && response.status < 300) {
2795
+ return response.json();
2796
+ } else {
2797
+ throw response;
2798
+ }
2799
+ }),
2800
+ new Promise((_, reject) =>
2801
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2802
+ ),
2803
+ ]);
2804
+ }
2805
+
2806
+ /** Update fields in a given clan profile. */
2807
+ updateClanDescProfile(bearerToken: string,
2808
+ clanId:string,
2809
+ body:{},
2810
+ options: any = {}): Promise<any> {
2811
+
2812
+ if (clanId === null || clanId === undefined) {
2813
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
2814
+ }
2815
+ if (body === null || body === undefined) {
2816
+ throw new Error("'body' is a required parameter but is null or undefined.");
2817
+ }
2818
+ const urlPath = "/v2/clandescprofile/{clanId}"
2819
+ .replace("{clanId}", encodeURIComponent(String(clanId)));
2820
+ const queryParams = new Map<string, any>();
2821
+
2822
+ let bodyJson : string = "";
2823
+ bodyJson = JSON.stringify(body || {});
2824
+
2825
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2826
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
2827
+ if (bearerToken) {
2828
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2829
+ }
2830
+
2831
+ return Promise.race([
2832
+ fetch(fullUrl, fetchOptions).then((response) => {
2833
+ if (response.status == 204) {
2834
+ return response;
2835
+ } else if (response.status >= 200 && response.status < 300) {
2836
+ return response.json();
2837
+ } else {
2838
+ throw response;
2839
+ }
2840
+ }),
2841
+ new Promise((_, reject) =>
2842
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2843
+ ),
2844
+ ]);
2845
+ }
2846
+
2847
+ /** */
2848
+ createCategoryDesc(bearerToken: string,
2849
+ body:ApiCreateCategoryDescRequest,
2850
+ options: any = {}): Promise<ApiCategoryDesc> {
2851
+
2852
+ if (body === null || body === undefined) {
2853
+ throw new Error("'body' is a required parameter but is null or undefined.");
2854
+ }
2855
+ const urlPath = "/v2/createcategory";
2856
+ const queryParams = new Map<string, any>();
2857
+
2858
+ let bodyJson : string = "";
2859
+ bodyJson = JSON.stringify(body || {});
2860
+
2861
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2862
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2863
+ if (bearerToken) {
2864
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2865
+ }
2866
+
2867
+ return Promise.race([
2868
+ fetch(fullUrl, fetchOptions).then((response) => {
2869
+ if (response.status == 204) {
2870
+ return response;
2871
+ } else if (response.status >= 200 && response.status < 300) {
2872
+ return response.json();
2873
+ } else {
2874
+ throw response;
2875
+ }
2876
+ }),
2877
+ new Promise((_, reject) =>
2878
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2879
+ ),
2880
+ ]);
2881
+ }
2882
+
2883
+ /** */
2884
+ deleteCategoryDesc(bearerToken: string,
2885
+ creatorId:string,
2886
+ options: any = {}): Promise<any> {
2887
+
2888
+ if (creatorId === null || creatorId === undefined) {
2889
+ throw new Error("'creatorId' is a required parameter but is null or undefined.");
2890
+ }
2891
+ const urlPath = "/v2/deletecategory/{creatorId}"
2892
+ .replace("{creatorId}", encodeURIComponent(String(creatorId)));
2893
+ const queryParams = new Map<string, any>();
2894
+
2895
+ let bodyJson : string = "";
2896
+
2897
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2898
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
2899
+ if (bearerToken) {
2900
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2901
+ }
2902
+
2903
+ return Promise.race([
2904
+ fetch(fullUrl, fetchOptions).then((response) => {
2905
+ if (response.status == 204) {
2906
+ return response;
2907
+ } else if (response.status >= 200 && response.status < 300) {
2908
+ return response.json();
2909
+ } else {
2910
+ throw response;
2911
+ }
2912
+ }),
2913
+ new Promise((_, reject) =>
2914
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2915
+ ),
2916
+ ]);
2917
+ }
2918
+
2919
+ /** Immediately join an open group, or request to join a closed one. */
2920
+ registFCMDeviceToken(bearerToken: string,
2921
+ token?:string,
2922
+ options: any = {}): Promise<any> {
2923
+
2924
+ const urlPath = "/v2/devicetoken";
2925
+ const queryParams = new Map<string, any>();
2926
+ queryParams.set("token", token);
2927
+
2928
+ let bodyJson : string = "";
2929
+
2930
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2931
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2932
+ if (bearerToken) {
2933
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2934
+ }
2935
+
2936
+ return Promise.race([
2937
+ fetch(fullUrl, fetchOptions).then((response) => {
2938
+ if (response.status == 204) {
2939
+ return response;
2940
+ } else if (response.status >= 200 && response.status < 300) {
2941
+ return response.json();
2942
+ } else {
2943
+ throw response;
2944
+ }
2945
+ }),
2946
+ new Promise((_, reject) =>
2947
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2948
+ ),
2949
+ ]);
2950
+ }
2951
+
2952
+ /** Submit an event for processing in the server's registered runtime custom events handler. */
2953
+ event(bearerToken: string,
2954
+ body:ApiEvent,
2955
+ options: any = {}): Promise<any> {
2956
+
2957
+ if (body === null || body === undefined) {
2958
+ throw new Error("'body' is a required parameter but is null or undefined.");
2959
+ }
2960
+ const urlPath = "/v2/event";
2961
+ const queryParams = new Map<string, any>();
2962
+
2963
+ let bodyJson : string = "";
2964
+ bodyJson = JSON.stringify(body || {});
2965
+
2966
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2967
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2968
+ if (bearerToken) {
2969
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2970
+ }
2971
+
2972
+ return Promise.race([
2973
+ fetch(fullUrl, fetchOptions).then((response) => {
2974
+ if (response.status == 204) {
2975
+ return response;
2976
+ } else if (response.status >= 200 && response.status < 300) {
2977
+ return response.json();
2978
+ } else {
2979
+ throw response;
2980
+ }
2981
+ }),
2982
+ new Promise((_, reject) =>
2983
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2984
+ ),
2985
+ ]);
2986
+ }
2987
+
2988
+ /** Delete one or more users by ID or username. */
2989
+ deleteFriends(bearerToken: string,
2990
+ ids?:Array<string>,
2991
+ usernames?:Array<string>,
2992
+ options: any = {}): Promise<any> {
2993
+
2994
+ const urlPath = "/v2/friend";
2995
+ const queryParams = new Map<string, any>();
2996
+ queryParams.set("ids", ids);
2997
+ queryParams.set("usernames", usernames);
2998
+
2999
+ let bodyJson : string = "";
3000
+
3001
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3002
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
3003
+ if (bearerToken) {
3004
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3005
+ }
3006
+
3007
+ return Promise.race([
3008
+ fetch(fullUrl, fetchOptions).then((response) => {
3009
+ if (response.status == 204) {
3010
+ return response;
3011
+ } else if (response.status >= 200 && response.status < 300) {
3012
+ return response.json();
3013
+ } else {
3014
+ throw response;
3015
+ }
3016
+ }),
3017
+ new Promise((_, reject) =>
3018
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3019
+ ),
3020
+ ]);
3021
+ }
3022
+
3023
+ /** List all friends for the current user. */
3024
+ listFriends(bearerToken: string,
3025
+ limit?:number,
3026
+ state?:number,
3027
+ cursor?:string,
3028
+ options: any = {}): Promise<ApiFriendList> {
3029
+
3030
+ const urlPath = "/v2/friend";
3031
+ const queryParams = new Map<string, any>();
3032
+ queryParams.set("limit", limit);
3033
+ queryParams.set("state", state);
3034
+ queryParams.set("cursor", cursor);
3035
+
3036
+ let bodyJson : string = "";
3037
+
3038
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3039
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3040
+ if (bearerToken) {
3041
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3042
+ }
3043
+
3044
+ return Promise.race([
3045
+ fetch(fullUrl, fetchOptions).then((response) => {
3046
+ if (response.status == 204) {
3047
+ return response;
3048
+ } else if (response.status >= 200 && response.status < 300) {
3049
+ return response.json();
3050
+ } else {
3051
+ throw response;
3052
+ }
3053
+ }),
3054
+ new Promise((_, reject) =>
3055
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3056
+ ),
3057
+ ]);
3058
+ }
3059
+
3060
+ /** Add friends by ID or username to a user's account. */
3061
+ addFriends(bearerToken: string,
3062
+ ids?:Array<string>,
3063
+ usernames?:Array<string>,
3064
+ options: any = {}): Promise<any> {
3065
+
3066
+ const urlPath = "/v2/friend";
3067
+ const queryParams = new Map<string, any>();
3068
+ queryParams.set("ids", ids);
3069
+ queryParams.set("usernames", usernames);
3070
+
3071
+ let bodyJson : string = "";
3072
+
3073
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3074
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3075
+ if (bearerToken) {
3076
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3077
+ }
3078
+
3079
+ return Promise.race([
3080
+ fetch(fullUrl, fetchOptions).then((response) => {
3081
+ if (response.status == 204) {
3082
+ return response;
3083
+ } else if (response.status >= 200 && response.status < 300) {
3084
+ return response.json();
3085
+ } else {
3086
+ throw response;
3087
+ }
3088
+ }),
3089
+ new Promise((_, reject) =>
3090
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3091
+ ),
3092
+ ]);
3093
+ }
3094
+
3095
+ /** Block one or more users by ID or username. */
3096
+ blockFriends(bearerToken: string,
3097
+ ids?:Array<string>,
3098
+ usernames?:Array<string>,
3099
+ options: any = {}): Promise<any> {
3100
+
3101
+ const urlPath = "/v2/friend/block";
3102
+ const queryParams = new Map<string, any>();
3103
+ queryParams.set("ids", ids);
3104
+ queryParams.set("usernames", usernames);
3105
+
3106
+ let bodyJson : string = "";
3107
+
3108
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3109
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3110
+ if (bearerToken) {
3111
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3112
+ }
3113
+
3114
+ return Promise.race([
3115
+ fetch(fullUrl, fetchOptions).then((response) => {
3116
+ if (response.status == 204) {
3117
+ return response;
3118
+ } else if (response.status >= 200 && response.status < 300) {
3119
+ return response.json();
3120
+ } else {
3121
+ throw response;
3122
+ }
3123
+ }),
3124
+ new Promise((_, reject) =>
3125
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3126
+ ),
3127
+ ]);
3128
+ }
3129
+
3130
+ /** Import Facebook friends and add them to a user's account. */
3131
+ importFacebookFriends(bearerToken: string,
3132
+ account:ApiAccountFacebook,
3133
+ reset?:boolean,
3134
+ options: any = {}): Promise<any> {
3135
+
3136
+ if (account === null || account === undefined) {
3137
+ throw new Error("'account' is a required parameter but is null or undefined.");
3138
+ }
3139
+ const urlPath = "/v2/friend/facebook";
3140
+ const queryParams = new Map<string, any>();
3141
+ queryParams.set("reset", reset);
3142
+
3143
+ let bodyJson : string = "";
3144
+ bodyJson = JSON.stringify(account || {});
3145
+
3146
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3147
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3148
+ if (bearerToken) {
3149
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3150
+ }
3151
+
3152
+ return Promise.race([
3153
+ fetch(fullUrl, fetchOptions).then((response) => {
3154
+ if (response.status == 204) {
3155
+ return response;
3156
+ } else if (response.status >= 200 && response.status < 300) {
3157
+ return response.json();
3158
+ } else {
3159
+ throw response;
3160
+ }
3161
+ }),
3162
+ new Promise((_, reject) =>
3163
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3164
+ ),
3165
+ ]);
3166
+ }
3167
+
3168
+ /** Import Steam friends and add them to a user's account. */
3169
+ importSteamFriends(bearerToken: string,
3170
+ account:ApiAccountSteam,
3171
+ reset?:boolean,
3172
+ options: any = {}): Promise<any> {
3173
+
3174
+ if (account === null || account === undefined) {
3175
+ throw new Error("'account' is a required parameter but is null or undefined.");
3176
+ }
3177
+ const urlPath = "/v2/friend/steam";
3178
+ const queryParams = new Map<string, any>();
3179
+ queryParams.set("reset", reset);
3180
+
3181
+ let bodyJson : string = "";
3182
+ bodyJson = JSON.stringify(account || {});
3183
+
3184
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3185
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3186
+ if (bearerToken) {
3187
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3188
+ }
3189
+
3190
+ return Promise.race([
3191
+ fetch(fullUrl, fetchOptions).then((response) => {
3192
+ if (response.status == 204) {
3193
+ return response;
3194
+ } else if (response.status >= 200 && response.status < 300) {
3195
+ return response.json();
3196
+ } else {
3197
+ throw response;
3198
+ }
3199
+ }),
3200
+ new Promise((_, reject) =>
3201
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3202
+ ),
3203
+ ]);
3204
+ }
3205
+
3206
+ /** */
3207
+ getUserProfileOnClan(bearerToken: string,
3208
+ clanId:string,
3209
+ options: any = {}): Promise<ApiClanProfile> {
3210
+
3211
+ if (clanId === null || clanId === undefined) {
3212
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
3213
+ }
3214
+ const urlPath = "/v2/getclanprofile/{clanId}"
3215
+ .replace("{clanId}", encodeURIComponent(String(clanId)));
3216
+ const queryParams = new Map<string, any>();
3217
+
3218
+ let bodyJson : string = "";
3219
+
3220
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3221
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3222
+ if (bearerToken) {
3223
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3224
+ }
3225
+
3226
+ return Promise.race([
3227
+ fetch(fullUrl, fetchOptions).then((response) => {
3228
+ if (response.status == 204) {
3229
+ return response;
3230
+ } else if (response.status >= 200 && response.status < 300) {
3231
+ return response.json();
3232
+ } else {
3233
+ throw response;
3234
+ }
3235
+ }),
3236
+ new Promise((_, reject) =>
3237
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3238
+ ),
3239
+ ]);
3240
+ }
3241
+
3242
+ /** Add users to a channel. */
3243
+ createLinkInviteUser(bearerToken: string,
3244
+ body:ApiLinkInviteUserRequest,
3245
+ options: any = {}): Promise<ApiLinkInviteUser> {
3246
+
3247
+ if (body === null || body === undefined) {
3248
+ throw new Error("'body' is a required parameter but is null or undefined.");
3249
+ }
3250
+ const urlPath = "/v2/invite";
3251
+ const queryParams = new Map<string, any>();
3252
+
3253
+ let bodyJson : string = "";
3254
+ bodyJson = JSON.stringify(body || {});
3255
+
3256
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3257
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3258
+ if (bearerToken) {
3259
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3260
+ }
3261
+
3262
+ return Promise.race([
3263
+ fetch(fullUrl, fetchOptions).then((response) => {
3264
+ if (response.status == 204) {
3265
+ return response;
3266
+ } else if (response.status >= 200 && response.status < 300) {
3267
+ return response.json();
3268
+ } else {
3269
+ throw response;
3270
+ }
3271
+ }),
3272
+ new Promise((_, reject) =>
3273
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3274
+ ),
3275
+ ]);
3276
+ }
3277
+
3278
+ /** Add users to a channel. */
3279
+ getLinkInvite(bearerToken: string,
3280
+ inviteId:string,
3281
+ options: any = {}): Promise<ApiInviteUserRes> {
3282
+
3283
+ if (inviteId === null || inviteId === undefined) {
3284
+ throw new Error("'inviteId' is a required parameter but is null or undefined.");
3285
+ }
3286
+ const urlPath = "/v2/invite/{inviteId}"
3287
+ .replace("{inviteId}", encodeURIComponent(String(inviteId)));
3288
+ const queryParams = new Map<string, any>();
3289
+
3290
+ let bodyJson : string = "";
3291
+
3292
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3293
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3294
+ if (bearerToken) {
3295
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3296
+ }
3297
+
3298
+ return Promise.race([
3299
+ fetch(fullUrl, fetchOptions).then((response) => {
3300
+ if (response.status == 204) {
3301
+ return response;
3302
+ } else if (response.status >= 200 && response.status < 300) {
3303
+ return response.json();
3304
+ } else {
3305
+ throw response;
3306
+ }
3307
+ }),
3308
+ new Promise((_, reject) =>
3309
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3310
+ ),
3311
+ ]);
3312
+ }
3313
+
3314
+ /** Add users to a channel. */
3315
+ inviteUser(bearerToken: string,
3316
+ inviteId:string,
3317
+ options: any = {}): Promise<ApiInviteUserRes> {
3318
+
3319
+ if (inviteId === null || inviteId === undefined) {
3320
+ throw new Error("'inviteId' is a required parameter but is null or undefined.");
3321
+ }
3322
+ const urlPath = "/v2/invite/{inviteId}"
3323
+ .replace("{inviteId}", encodeURIComponent(String(inviteId)));
3324
+ const queryParams = new Map<string, any>();
3325
+
3326
+ let bodyJson : string = "";
3327
+
3328
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3329
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3330
+ if (bearerToken) {
3331
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3332
+ }
3333
+
3334
+ return Promise.race([
3335
+ fetch(fullUrl, fetchOptions).then((response) => {
3336
+ if (response.status == 204) {
3337
+ return response;
3338
+ } else if (response.status >= 200 && response.status < 300) {
3339
+ return response.json();
3340
+ } else {
3341
+ throw response;
3342
+ }
3343
+ }),
3344
+ new Promise((_, reject) =>
3345
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3346
+ ),
3347
+ ]);
3348
+ }
3349
+
3350
+ /** */
3351
+ getListPermission(bearerToken: string,
3352
+ options: any = {}): Promise<ApiPermissionList> {
3353
+
3354
+ const urlPath = "/v2/listpermission";
3355
+ const queryParams = new Map<string, any>();
3356
+
3357
+ let bodyJson : string = "";
3358
+
3359
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3360
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3361
+ if (bearerToken) {
3362
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3363
+ }
3364
+
3365
+ return Promise.race([
3366
+ fetch(fullUrl, fetchOptions).then((response) => {
3367
+ if (response.status == 204) {
3368
+ return response;
3369
+ } else if (response.status >= 200 && response.status < 300) {
3370
+ return response.json();
3371
+ } else {
3372
+ throw response;
3373
+ }
3374
+ }),
3375
+ new Promise((_, reject) =>
3376
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3377
+ ),
3378
+ ]);
3379
+ }
3380
+
3381
+ /** Delete one or more notifications for the current user. */
3382
+ deleteNotifications(bearerToken: string,
3383
+ ids?:Array<string>,
3384
+ options: any = {}): Promise<any> {
3385
+
3386
+ const urlPath = "/v2/notification";
3387
+ const queryParams = new Map<string, any>();
3388
+ queryParams.set("ids", ids);
3389
+
3390
+ let bodyJson : string = "";
3391
+
3392
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3393
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
3394
+ if (bearerToken) {
3395
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3396
+ }
3397
+
3398
+ return Promise.race([
3399
+ fetch(fullUrl, fetchOptions).then((response) => {
3400
+ if (response.status == 204) {
3401
+ return response;
3402
+ } else if (response.status >= 200 && response.status < 300) {
3403
+ return response.json();
3404
+ } else {
3405
+ throw response;
3406
+ }
3407
+ }),
3408
+ new Promise((_, reject) =>
3409
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3410
+ ),
3411
+ ]);
3412
+ }
3413
+
3414
+ /** Fetch list of notifications. */
3415
+ listNotifications(bearerToken: string,
3416
+ limit?:number,
3417
+ cacheableCursor?:string,
3418
+ options: any = {}): Promise<ApiNotificationList> {
3419
+
3420
+ const urlPath = "/v2/notification";
3421
+ const queryParams = new Map<string, any>();
3422
+ queryParams.set("limit", limit);
3423
+ queryParams.set("cacheable_cursor", cacheableCursor);
3424
+
3425
+ let bodyJson : string = "";
3426
+
3427
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3428
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3429
+ if (bearerToken) {
3430
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3431
+ }
3432
+
3433
+ return Promise.race([
3434
+ fetch(fullUrl, fetchOptions).then((response) => {
3435
+ if (response.status == 204) {
3436
+ return response;
3437
+ } else if (response.status >= 200 && response.status < 300) {
3438
+ return response.json();
3439
+ } else {
3440
+ throw response;
3441
+ }
3442
+ }),
3443
+ new Promise((_, reject) =>
3444
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3445
+ ),
3446
+ ]);
3447
+ }
3448
+
3449
+ /** */
3450
+ GetPermissionOfUserInTheClan(bearerToken: string,
3451
+ clanId:string,
3452
+ options: any = {}): Promise<ApiPermissionList> {
3453
+
3454
+ if (clanId === null || clanId === undefined) {
3455
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
3456
+ }
3457
+ const urlPath = "/v2/permissionuserinclan/{clanId}"
3458
+ .replace("{clanId}", encodeURIComponent(String(clanId)));
3459
+ const queryParams = new Map<string, any>();
3460
+
3461
+ let bodyJson : string = "";
3462
+
3463
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3464
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3465
+ if (bearerToken) {
3466
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3467
+ }
3468
+
3469
+ return Promise.race([
3470
+ fetch(fullUrl, fetchOptions).then((response) => {
3471
+ if (response.status == 204) {
3472
+ return response;
3473
+ } else if (response.status >= 200 && response.status < 300) {
3474
+ return response.json();
3475
+ } else {
3476
+ throw response;
3477
+ }
3478
+ }),
3479
+ new Promise((_, reject) =>
3480
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3481
+ ),
3482
+ ]);
3483
+ }
3484
+
3485
+ /** */
3486
+ addRolesChannelDesc(bearerToken: string,
3487
+ body:ApiAddRoleChannelDescRequest,
3488
+ options: any = {}): Promise<any> {
3489
+
3490
+ if (body === null || body === undefined) {
3491
+ throw new Error("'body' is a required parameter but is null or undefined.");
3492
+ }
3493
+ const urlPath = "/v2/rolechannel/addrole";
3494
+ const queryParams = new Map<string, any>();
3495
+
3496
+ let bodyJson : string = "";
3497
+ bodyJson = JSON.stringify(body || {});
3498
+
3499
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3500
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3501
+ if (bearerToken) {
3502
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3503
+ }
3504
+
3505
+ return Promise.race([
3506
+ fetch(fullUrl, fetchOptions).then((response) => {
3507
+ if (response.status == 204) {
3508
+ return response;
3509
+ } else if (response.status >= 200 && response.status < 300) {
3510
+ return response.json();
3511
+ } else {
3512
+ throw response;
3513
+ }
3514
+ }),
3515
+ new Promise((_, reject) =>
3516
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3517
+ ),
3518
+ ]);
3519
+ }
3520
+
3521
+ /** Update a role when Delete a role by ID. */
3522
+ deleteRoleChannelDesc(bearerToken: string,
3523
+ body:ApiDeleteRoleRequest,
3524
+ options: any = {}): Promise<any> {
3525
+
3526
+ if (body === null || body === undefined) {
3527
+ throw new Error("'body' is a required parameter but is null or undefined.");
3528
+ }
3529
+ const urlPath = "/v2/rolechannel/delete";
3530
+ const queryParams = new Map<string, any>();
3531
+
3532
+ let bodyJson : string = "";
3533
+ bodyJson = JSON.stringify(body || {});
3534
+
3535
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3536
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
3537
+ if (bearerToken) {
3538
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3539
+ }
3540
+
3541
+ return Promise.race([
3542
+ fetch(fullUrl, fetchOptions).then((response) => {
3543
+ if (response.status == 204) {
3544
+ return response;
3545
+ } else if (response.status >= 200 && response.status < 300) {
3546
+ return response.json();
3547
+ } else {
3548
+ throw response;
3549
+ }
3550
+ }),
3551
+ new Promise((_, reject) =>
3552
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3553
+ ),
3554
+ ]);
3555
+ }
3556
+
3557
+ /** List user roles */
3558
+ listRoles(bearerToken: string,
3559
+ limit?:number,
3560
+ state?:number,
3561
+ cursor?:string,
3562
+ clanId?:string,
3563
+ options: any = {}): Promise<ApiRoleList> {
3564
+
3565
+ const urlPath = "/v2/roles";
3566
+ const queryParams = new Map<string, any>();
3567
+ queryParams.set("limit", limit);
3568
+ queryParams.set("state", state);
3569
+ queryParams.set("cursor", cursor);
3570
+ queryParams.set("clan_id", clanId);
3571
+
3572
+ let bodyJson : string = "";
3573
+
3574
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3575
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3576
+ if (bearerToken) {
3577
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3578
+ }
3579
+
3580
+ return Promise.race([
3581
+ fetch(fullUrl, fetchOptions).then((response) => {
3582
+ if (response.status == 204) {
3583
+ return response;
3584
+ } else if (response.status >= 200 && response.status < 300) {
3585
+ return response.json();
3586
+ } else {
3587
+ throw response;
3588
+ }
3589
+ }),
3590
+ new Promise((_, reject) =>
3591
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3592
+ ),
3593
+ ]);
3594
+ }
3595
+
3596
+ /** Create a new role for clan. */
3597
+ createRole(bearerToken: string,
3598
+ body:ApiCreateRoleRequest,
3599
+ options: any = {}): Promise<ApiRole> {
3600
+
3601
+ if (body === null || body === undefined) {
3602
+ throw new Error("'body' is a required parameter but is null or undefined.");
3603
+ }
3604
+ const urlPath = "/v2/roles";
3605
+ const queryParams = new Map<string, any>();
3606
+
3607
+ let bodyJson : string = "";
3608
+ bodyJson = JSON.stringify(body || {});
3609
+
3610
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3611
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3612
+ if (bearerToken) {
3613
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3614
+ }
3615
+
3616
+ return Promise.race([
3617
+ fetch(fullUrl, fetchOptions).then((response) => {
3618
+ if (response.status == 204) {
3619
+ return response;
3620
+ } else if (response.status >= 200 && response.status < 300) {
3621
+ return response.json();
3622
+ } else {
3623
+ throw response;
3624
+ }
3625
+ }),
3626
+ new Promise((_, reject) =>
3627
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3628
+ ),
3629
+ ]);
3630
+ }
3631
+
3632
+ /** Update a role when Delete a role by ID. */
3633
+ updateRoleDelete(bearerToken: string,
3634
+ roleId:string,
3635
+ body:{},
3636
+ options: any = {}): Promise<any> {
3637
+
3638
+ if (roleId === null || roleId === undefined) {
3639
+ throw new Error("'roleId' is a required parameter but is null or undefined.");
3640
+ }
3641
+ if (body === null || body === undefined) {
3642
+ throw new Error("'body' is a required parameter but is null or undefined.");
3643
+ }
3644
+ const urlPath = "/v2/roles/delete/{roleId}"
3645
+ .replace("{roleId}", encodeURIComponent(String(roleId)));
3646
+ const queryParams = new Map<string, any>();
3647
+
3648
+ let bodyJson : string = "";
3649
+ bodyJson = JSON.stringify(body || {});
3650
+
3651
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3652
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
3653
+ if (bearerToken) {
3654
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3655
+ }
3656
+
3657
+ return Promise.race([
3658
+ fetch(fullUrl, fetchOptions).then((response) => {
3659
+ if (response.status == 204) {
3660
+ return response;
3661
+ } else if (response.status >= 200 && response.status < 300) {
3662
+ return response.json();
3663
+ } else {
3664
+ throw response;
3665
+ }
3666
+ }),
3667
+ new Promise((_, reject) =>
3668
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3669
+ ),
3670
+ ]);
3671
+ }
3672
+
3673
+ /** Delete a role by ID. */
3674
+ deleteRole(bearerToken: string,
3675
+ roleId:string,
3676
+ options: any = {}): Promise<any> {
3677
+
3678
+ if (roleId === null || roleId === undefined) {
3679
+ throw new Error("'roleId' is a required parameter but is null or undefined.");
3680
+ }
3681
+ const urlPath = "/v2/roles/{roleId}"
3682
+ .replace("{roleId}", encodeURIComponent(String(roleId)));
3683
+ const queryParams = new Map<string, any>();
3684
+
3685
+ let bodyJson : string = "";
3686
+
3687
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3688
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
3689
+ if (bearerToken) {
3690
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3691
+ }
3692
+
3693
+ return Promise.race([
3694
+ fetch(fullUrl, fetchOptions).then((response) => {
3695
+ if (response.status == 204) {
3696
+ return response;
3697
+ } else if (response.status >= 200 && response.status < 300) {
3698
+ return response.json();
3699
+ } else {
3700
+ throw response;
3701
+ }
3702
+ }),
3703
+ new Promise((_, reject) =>
3704
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3705
+ ),
3706
+ ]);
3707
+ }
3708
+
3709
+ /** Update fields in a given role. */
3710
+ updateRole(bearerToken: string,
3711
+ roleId:string,
3712
+ body:{},
3713
+ options: any = {}): Promise<any> {
3714
+
3715
+ if (roleId === null || roleId === undefined) {
3716
+ throw new Error("'roleId' is a required parameter but is null or undefined.");
3717
+ }
3718
+ if (body === null || body === undefined) {
3719
+ throw new Error("'body' is a required parameter but is null or undefined.");
3720
+ }
3721
+ const urlPath = "/v2/roles/{roleId}"
3722
+ .replace("{roleId}", encodeURIComponent(String(roleId)));
3723
+ const queryParams = new Map<string, any>();
3724
+
3725
+ let bodyJson : string = "";
3726
+ bodyJson = JSON.stringify(body || {});
3727
+
3728
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3729
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
3730
+ if (bearerToken) {
3731
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3732
+ }
3733
+
3734
+ return Promise.race([
3735
+ fetch(fullUrl, fetchOptions).then((response) => {
3736
+ if (response.status == 204) {
3737
+ return response;
3738
+ } else if (response.status >= 200 && response.status < 300) {
3739
+ return response.json();
3740
+ } else {
3741
+ throw response;
3742
+ }
3743
+ }),
3744
+ new Promise((_, reject) =>
3745
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3746
+ ),
3747
+ ]);
3748
+ }
3749
+
3750
+ /** List role permissions */
3751
+ listRolePermissions(bearerToken: string,
3752
+ roleId:string,
3753
+ options: any = {}): Promise<ApiPermissionList> {
3754
+
3755
+ if (roleId === null || roleId === undefined) {
3756
+ throw new Error("'roleId' is a required parameter but is null or undefined.");
3757
+ }
3758
+ const urlPath = "/v2/roles/{roleId}/permissions"
3759
+ .replace("{roleId}", encodeURIComponent(String(roleId)));
3760
+ const queryParams = new Map<string, any>();
3761
+
3762
+ let bodyJson : string = "";
3763
+
3764
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3765
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3766
+ if (bearerToken) {
3767
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3768
+ }
3769
+
3770
+ return Promise.race([
3771
+ fetch(fullUrl, fetchOptions).then((response) => {
3772
+ if (response.status == 204) {
3773
+ return response;
3774
+ } else if (response.status >= 200 && response.status < 300) {
3775
+ return response.json();
3776
+ } else {
3777
+ throw response;
3778
+ }
3779
+ }),
3780
+ new Promise((_, reject) =>
3781
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3782
+ ),
3783
+ ]);
3784
+ }
3785
+
3786
+ /** List role permissions */
3787
+ listRoleUsers(bearerToken: string,
3788
+ roleId:string,
3789
+ limit?:number,
3790
+ cursor?:string,
3791
+ options: any = {}): Promise<ApiRoleUserList> {
3792
+
3793
+ if (roleId === null || roleId === undefined) {
3794
+ throw new Error("'roleId' is a required parameter but is null or undefined.");
3795
+ }
3796
+ const urlPath = "/v2/roles/{roleId}/users"
3797
+ .replace("{roleId}", encodeURIComponent(String(roleId)));
3798
+ const queryParams = new Map<string, any>();
3799
+ queryParams.set("limit", limit);
3800
+ queryParams.set("cursor", cursor);
3801
+
3802
+ let bodyJson : string = "";
3803
+
3804
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3805
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3806
+ if (bearerToken) {
3807
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3808
+ }
3809
+
3810
+ return Promise.race([
3811
+ fetch(fullUrl, fetchOptions).then((response) => {
3812
+ if (response.status == 204) {
3813
+ return response;
3814
+ } else if (response.status >= 200 && response.status < 300) {
3815
+ return response.json();
3816
+ } else {
3817
+ throw response;
3818
+ }
3819
+ }),
3820
+ new Promise((_, reject) =>
3821
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3822
+ ),
3823
+ ]);
3824
+ }
3825
+
3826
+ /** Execute a Lua function on the server. */
3827
+ rpcFunc2(bearerToken: string,basicAuthUsername: string,
3828
+ basicAuthPassword: string,
3829
+ id:string,
3830
+ payload?:string,
3831
+ httpKey?:string,
3832
+ options: any = {}): Promise<ApiRpc> {
3833
+
3834
+ if (id === null || id === undefined) {
3835
+ throw new Error("'id' is a required parameter but is null or undefined.");
3836
+ }
3837
+ const urlPath = "/v2/rpc/{id}"
3838
+ .replace("{id}", encodeURIComponent(String(id)));
3839
+ const queryParams = new Map<string, any>();
3840
+ queryParams.set("payload", payload);
3841
+ queryParams.set("http_key", httpKey);
3842
+
3843
+ let bodyJson : string = "";
3844
+
3845
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3846
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3847
+ if (bearerToken) {
3848
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3849
+ }
3850
+ if (basicAuthUsername) {
3851
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
3852
+ }
3853
+
3854
+ return Promise.race([
3855
+ fetch(fullUrl, fetchOptions).then((response) => {
3856
+ if (response.status == 204) {
3857
+ return response;
3858
+ } else if (response.status >= 200 && response.status < 300) {
3859
+ return response.json();
3860
+ } else {
3861
+ throw response;
3862
+ }
3863
+ }),
3864
+ new Promise((_, reject) =>
3865
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3866
+ ),
3867
+ ]);
3868
+ }
3869
+
3870
+ /** Execute a Lua function on the server. */
3871
+ rpcFunc(bearerToken: string,basicAuthUsername: string,
3872
+ basicAuthPassword: string,
3873
+ id:string,
3874
+ payload:string,
3875
+ httpKey?:string,
3876
+ options: any = {}): Promise<ApiRpc> {
3877
+
3878
+ if (id === null || id === undefined) {
3879
+ throw new Error("'id' is a required parameter but is null or undefined.");
3880
+ }
3881
+ if (payload === null || payload === undefined) {
3882
+ throw new Error("'payload' is a required parameter but is null or undefined.");
3883
+ }
3884
+ const urlPath = "/v2/rpc/{id}"
3885
+ .replace("{id}", encodeURIComponent(String(id)));
3886
+ const queryParams = new Map<string, any>();
3887
+ queryParams.set("http_key", httpKey);
3888
+
3889
+ let bodyJson : string = "";
3890
+ bodyJson = JSON.stringify(payload || {});
3891
+
3892
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3893
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3894
+ if (bearerToken) {
3895
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3896
+ }
3897
+ if (basicAuthUsername) {
3898
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
3899
+ }
3900
+
3901
+ return Promise.race([
3902
+ fetch(fullUrl, fetchOptions).then((response) => {
3903
+ if (response.status == 204) {
3904
+ return response;
3905
+ } else if (response.status >= 200 && response.status < 300) {
3906
+ return response.json();
3907
+ } else {
3908
+ throw response;
3909
+ }
3910
+ }),
3911
+ new Promise((_, reject) =>
3912
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3913
+ ),
3914
+ ]);
3915
+ }
3916
+
3917
+ /** Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user. */
3918
+ sessionLogout(bearerToken: string,
3919
+ body:ApiSessionLogoutRequest,
3920
+ options: any = {}): Promise<any> {
3921
+
3922
+ if (body === null || body === undefined) {
3923
+ throw new Error("'body' is a required parameter but is null or undefined.");
3924
+ }
3925
+ const urlPath = "/v2/session/logout";
3926
+ const queryParams = new Map<string, any>();
3927
+
3928
+ let bodyJson : string = "";
3929
+ bodyJson = JSON.stringify(body || {});
3930
+
3931
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3932
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3933
+ if (bearerToken) {
3934
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3935
+ }
3936
+
3937
+ return Promise.race([
3938
+ fetch(fullUrl, fetchOptions).then((response) => {
3939
+ if (response.status == 204) {
3940
+ return response;
3941
+ } else if (response.status >= 200 && response.status < 300) {
3942
+ return response.json();
3943
+ } else {
3944
+ throw response;
3945
+ }
3946
+ }),
3947
+ new Promise((_, reject) =>
3948
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3949
+ ),
3950
+ ]);
3951
+ }
3952
+
3953
+ /** Get storage objects. */
3954
+ readStorageObjects(bearerToken: string,
3955
+ body:ApiReadStorageObjectsRequest,
3956
+ options: any = {}): Promise<ApiStorageObjects> {
3957
+
3958
+ if (body === null || body === undefined) {
3959
+ throw new Error("'body' is a required parameter but is null or undefined.");
3960
+ }
3961
+ const urlPath = "/v2/storage";
3962
+ const queryParams = new Map<string, any>();
3963
+
3964
+ let bodyJson : string = "";
3965
+ bodyJson = JSON.stringify(body || {});
3966
+
3967
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3968
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3969
+ if (bearerToken) {
3970
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3971
+ }
3972
+
3973
+ return Promise.race([
3974
+ fetch(fullUrl, fetchOptions).then((response) => {
3975
+ if (response.status == 204) {
3976
+ return response;
3977
+ } else if (response.status >= 200 && response.status < 300) {
3978
+ return response.json();
3979
+ } else {
3980
+ throw response;
3981
+ }
3982
+ }),
3983
+ new Promise((_, reject) =>
3984
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3985
+ ),
3986
+ ]);
3987
+ }
3988
+
3989
+ /** Write objects into the storage engine. */
3990
+ writeStorageObjects(bearerToken: string,
3991
+ body:ApiWriteStorageObjectsRequest,
3992
+ options: any = {}): Promise<ApiStorageObjectAcks> {
3993
+
3994
+ if (body === null || body === undefined) {
3995
+ throw new Error("'body' is a required parameter but is null or undefined.");
3996
+ }
3997
+ const urlPath = "/v2/storage";
3998
+ const queryParams = new Map<string, any>();
3999
+
4000
+ let bodyJson : string = "";
4001
+ bodyJson = JSON.stringify(body || {});
4002
+
4003
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4004
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
4005
+ if (bearerToken) {
4006
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4007
+ }
4008
+
4009
+ return Promise.race([
4010
+ fetch(fullUrl, fetchOptions).then((response) => {
4011
+ if (response.status == 204) {
4012
+ return response;
4013
+ } else if (response.status >= 200 && response.status < 300) {
4014
+ return response.json();
4015
+ } else {
4016
+ throw response;
4017
+ }
4018
+ }),
4019
+ new Promise((_, reject) =>
4020
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4021
+ ),
4022
+ ]);
4023
+ }
4024
+
4025
+ /** Delete one or more objects by ID or username. */
4026
+ deleteStorageObjects(bearerToken: string,
4027
+ body:ApiDeleteStorageObjectsRequest,
4028
+ options: any = {}): Promise<any> {
4029
+
4030
+ if (body === null || body === undefined) {
4031
+ throw new Error("'body' is a required parameter but is null or undefined.");
4032
+ }
4033
+ const urlPath = "/v2/storage/delete";
4034
+ const queryParams = new Map<string, any>();
4035
+
4036
+ let bodyJson : string = "";
4037
+ bodyJson = JSON.stringify(body || {});
4038
+
4039
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4040
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
4041
+ if (bearerToken) {
4042
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4043
+ }
4044
+
4045
+ return Promise.race([
4046
+ fetch(fullUrl, fetchOptions).then((response) => {
4047
+ if (response.status == 204) {
4048
+ return response;
4049
+ } else if (response.status >= 200 && response.status < 300) {
4050
+ return response.json();
4051
+ } else {
4052
+ throw response;
4053
+ }
4054
+ }),
4055
+ new Promise((_, reject) =>
4056
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4057
+ ),
4058
+ ]);
4059
+ }
4060
+
4061
+ /** List publicly readable storage objects in a given collection. */
4062
+ listStorageObjects(bearerToken: string,
4063
+ collection:string,
4064
+ userId?:string,
4065
+ limit?:number,
4066
+ cursor?:string,
4067
+ options: any = {}): Promise<ApiStorageObjectList> {
4068
+
4069
+ if (collection === null || collection === undefined) {
4070
+ throw new Error("'collection' is a required parameter but is null or undefined.");
4071
+ }
4072
+ const urlPath = "/v2/storage/{collection}"
4073
+ .replace("{collection}", encodeURIComponent(String(collection)));
4074
+ const queryParams = new Map<string, any>();
4075
+ queryParams.set("user_id", userId);
4076
+ queryParams.set("limit", limit);
4077
+ queryParams.set("cursor", cursor);
4078
+
4079
+ let bodyJson : string = "";
4080
+
4081
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4082
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4083
+ if (bearerToken) {
4084
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4085
+ }
4086
+
4087
+ return Promise.race([
4088
+ fetch(fullUrl, fetchOptions).then((response) => {
4089
+ if (response.status == 204) {
4090
+ return response;
4091
+ } else if (response.status >= 200 && response.status < 300) {
4092
+ return response.json();
4093
+ } else {
4094
+ throw response;
4095
+ }
4096
+ }),
4097
+ new Promise((_, reject) =>
4098
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4099
+ ),
4100
+ ]);
4101
+ }
4102
+
4103
+ /** List publicly readable storage objects in a given collection. */
4104
+ listStorageObjects2(bearerToken: string,
4105
+ collection:string,
4106
+ userId:string,
4107
+ limit?:number,
4108
+ cursor?:string,
4109
+ options: any = {}): Promise<ApiStorageObjectList> {
4110
+
4111
+ if (collection === null || collection === undefined) {
4112
+ throw new Error("'collection' is a required parameter but is null or undefined.");
4113
+ }
4114
+ if (userId === null || userId === undefined) {
4115
+ throw new Error("'userId' is a required parameter but is null or undefined.");
4116
+ }
4117
+ const urlPath = "/v2/storage/{collection}/{userId}"
4118
+ .replace("{collection}", encodeURIComponent(String(collection)))
4119
+ .replace("{userId}", encodeURIComponent(String(userId)));
4120
+ const queryParams = new Map<string, any>();
4121
+ queryParams.set("limit", limit);
4122
+ queryParams.set("cursor", cursor);
4123
+
4124
+ let bodyJson : string = "";
4125
+
4126
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4127
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4128
+ if (bearerToken) {
4129
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4130
+ }
4131
+
4132
+ return Promise.race([
4133
+ fetch(fullUrl, fetchOptions).then((response) => {
4134
+ if (response.status == 204) {
4135
+ return response;
4136
+ } else if (response.status >= 200 && response.status < 300) {
4137
+ return response.json();
4138
+ } else {
4139
+ throw response;
4140
+ }
4141
+ }),
4142
+ new Promise((_, reject) =>
4143
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4144
+ ),
4145
+ ]);
4146
+ }
4147
+
4148
+ /** Update fields in a given category. */
4149
+ updateCategory(bearerToken: string,
4150
+ body:ApiUpdateCategoryDescRequest,
4151
+ options: any = {}): Promise<any> {
4152
+
4153
+ if (body === null || body === undefined) {
4154
+ throw new Error("'body' is a required parameter but is null or undefined.");
4155
+ }
4156
+ const urlPath = "/v2/updatecategory";
4157
+ const queryParams = new Map<string, any>();
4158
+
4159
+ let bodyJson : string = "";
4160
+ bodyJson = JSON.stringify(body || {});
4161
+
4162
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4163
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
4164
+ if (bearerToken) {
4165
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4166
+ }
4167
+
4168
+ return Promise.race([
4169
+ fetch(fullUrl, fetchOptions).then((response) => {
4170
+ if (response.status == 204) {
4171
+ return response;
4172
+ } else if (response.status >= 200 && response.status < 300) {
4173
+ return response.json();
4174
+ } else {
4175
+ throw response;
4176
+ }
4177
+ }),
4178
+ new Promise((_, reject) =>
4179
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4180
+ ),
4181
+ ]);
4182
+ }
4183
+
4184
+ /** */
4185
+ updateUserProfileByClan(bearerToken: string,
4186
+ clanId:string,
4187
+ body:{},
4188
+ options: any = {}): Promise<any> {
4189
+
4190
+ if (clanId === null || clanId === undefined) {
4191
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
4192
+ }
4193
+ if (body === null || body === undefined) {
4194
+ throw new Error("'body' is a required parameter but is null or undefined.");
4195
+ }
4196
+ const urlPath = "/v2/updateclanprofile/{clanId}"
4197
+ .replace("{clanId}", encodeURIComponent(String(clanId)));
4198
+ const queryParams = new Map<string, any>();
4199
+
4200
+ let bodyJson : string = "";
4201
+ bodyJson = JSON.stringify(body || {});
4202
+
4203
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4204
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
4205
+ if (bearerToken) {
4206
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4207
+ }
4208
+
4209
+ return Promise.race([
4210
+ fetch(fullUrl, fetchOptions).then((response) => {
4211
+ if (response.status == 204) {
4212
+ return response;
4213
+ } else if (response.status >= 200 && response.status < 300) {
4214
+ return response.json();
4215
+ } else {
4216
+ throw response;
4217
+ }
4218
+ }),
4219
+ new Promise((_, reject) =>
4220
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4221
+ ),
4222
+ ]);
4223
+ }
4224
+
4225
+ /** Create a new group with the current user as the owner. */
4226
+ uploadAttachmentFile(bearerToken: string,
4227
+ body:ApiUploadAttachmentRequest,
4228
+ options: any = {}): Promise<any> {
4229
+
4230
+ if (body === null || body === undefined) {
4231
+ throw new Error("'body' is a required parameter but is null or undefined.");
4232
+ }
4233
+ const urlPath = "/v2/uploadattachmentfile";
4234
+ const queryParams = new Map<string, any>();
4235
+
4236
+ let bodyJson : string = "";
4237
+ bodyJson = JSON.stringify(body || {});
4238
+
4239
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4240
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
4241
+ if (bearerToken) {
4242
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4243
+ }
4244
+
4245
+ return Promise.race([
4246
+ fetch(fullUrl, fetchOptions).then((response) => {
4247
+ if (response.status == 204) {
4248
+ return response;
4249
+ } else if (response.status >= 200 && response.status < 300) {
4250
+ return response.json();
4251
+ } else {
4252
+ throw response;
4253
+ }
4254
+ }),
4255
+ new Promise((_, reject) =>
4256
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4257
+ ),
4258
+ ]);
4259
+ }
4260
+
4261
+ /** Fetch zero or more users by ID and/or username. */
4262
+ getUsers(bearerToken: string,
4263
+ ids?:Array<string>,
4264
+ usernames?:Array<string>,
4265
+ facebookIds?:Array<string>,
4266
+ options: any = {}): Promise<ApiUsers> {
4267
+
4268
+ const urlPath = "/v2/user";
4269
+ const queryParams = new Map<string, any>();
4270
+ queryParams.set("ids", ids);
4271
+ queryParams.set("usernames", usernames);
4272
+ queryParams.set("facebook_ids", facebookIds);
4273
+
4274
+ let bodyJson : string = "";
4275
+
4276
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4277
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4278
+ if (bearerToken) {
4279
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4280
+ }
4281
+
4282
+ return Promise.race([
4283
+ fetch(fullUrl, fetchOptions).then((response) => {
4284
+ if (response.status == 204) {
4285
+ return response;
4286
+ } else if (response.status >= 200 && response.status < 300) {
4287
+ return response.json();
4288
+ } else {
4289
+ throw response;
4290
+ }
4291
+ }),
4292
+ new Promise((_, reject) =>
4293
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4294
+ ),
4295
+ ]);
4296
+ }
4297
+
4298
+ /** */
4299
+ updateUser(bearerToken: string,
4300
+ body:ApiUpdateUsersRequest,
4301
+ options: any = {}): Promise<any> {
4302
+
4303
+ if (body === null || body === undefined) {
4304
+ throw new Error("'body' is a required parameter but is null or undefined.");
4305
+ }
4306
+ const urlPath = "/v2/user/update";
4307
+ const queryParams = new Map<string, any>();
4308
+
4309
+ let bodyJson : string = "";
4310
+ bodyJson = JSON.stringify(body || {});
4311
+
4312
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4313
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
4314
+ if (bearerToken) {
4315
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4316
+ }
4317
+
4318
+ return Promise.race([
4319
+ fetch(fullUrl, fetchOptions).then((response) => {
4320
+ if (response.status == 204) {
4321
+ return response;
4322
+ } else if (response.status >= 200 && response.status < 300) {
4323
+ return response.json();
4324
+ } else {
4325
+ throw response;
4326
+ }
4327
+ }),
4328
+ new Promise((_, reject) =>
4329
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4330
+ ),
4331
+ ]);
4332
+ }
4333
+
4334
+ buildFullUrl(basePath: string, fragment: string, queryParams: Map<string, any>) {
4335
+ let fullPath = basePath + fragment + "?";
4336
+
4337
+ for (let [k, v] of queryParams) {
4338
+ if (v instanceof Array) {
4339
+ fullPath += v.reduce((prev: any, curr: any) => {
4340
+ return prev + encodeURIComponent(k) + "=" + encodeURIComponent(curr) + "&";
4341
+ }, "");
4342
+ } else {
4343
+ if (v != null) {
4344
+ fullPath += encodeURIComponent(k) + "=" + encodeURIComponent(v) + "&";
4345
+ }
4346
+ }
4347
+ }
4348
+
4349
+ return fullPath;
4350
+ }
4351
+ };