@appwrite.io/console 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/iife/sdk.js CHANGED
@@ -281,7 +281,7 @@
281
281
  'x-sdk-name': 'Console',
282
282
  'x-sdk-platform': 'console',
283
283
  'x-sdk-language': 'web',
284
- 'x-sdk-version': '1.0.0',
284
+ 'x-sdk-version': '1.0.1',
285
285
  'X-Appwrite-Response-Format': '1.6.0',
286
286
  };
287
287
  this.realtime = {
@@ -625,16 +625,6 @@
625
625
  return response;
626
626
  });
627
627
  }
628
- redirect(method, url, headers = {}, params = {}) {
629
- return __awaiter(this, void 0, void 0, function* () {
630
- const { uri, options } = this.prepareRequest(method, url, headers, params);
631
- const response = yield fetch(uri, Object.assign(Object.assign({}, options), { redirect: 'manual' }));
632
- if (response.status !== 301 && response.status !== 302) {
633
- throw new AppwriteException('Invalid redirect', response.status);
634
- }
635
- return response.headers.get('location') || '';
636
- });
637
- }
638
628
  call(method, url, headers = {}, params = {}, responseType = 'json') {
639
629
  var _a;
640
630
  return __awaiter(this, void 0, void 0, function* () {
@@ -683,6 +673,29 @@
683
673
  }
684
674
  Client.CHUNK_SIZE = 1024 * 1024 * 5;
685
675
 
676
+ class Service {
677
+ constructor(client) {
678
+ this.client = client;
679
+ }
680
+ static flatten(data, prefix = '') {
681
+ let output = {};
682
+ for (const [key, value] of Object.entries(data)) {
683
+ let finalKey = prefix ? prefix + '[' + key + ']' : key;
684
+ if (Array.isArray(value)) {
685
+ output = Object.assign(Object.assign({}, output), Service.flatten(value, finalKey));
686
+ }
687
+ else {
688
+ output[finalKey] = value;
689
+ }
690
+ }
691
+ return output;
692
+ }
693
+ }
694
+ /**
695
+ * The size for chunked uploads in bytes.
696
+ */
697
+ Service.CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
698
+
686
699
  class Account {
687
700
  constructor(client) {
688
701
  this.client = client;
@@ -1497,14 +1510,17 @@
1497
1510
  payload['scopes'] = scopes;
1498
1511
  }
1499
1512
  const uri = new URL(this.client.config.endpoint + apiPath);
1500
- const apiHeaders = {
1501
- 'content-type': 'application/json',
1502
- };
1503
- const location = yield this.client.redirect('get', uri, apiHeaders, payload);
1504
- if (typeof window !== 'undefined') {
1505
- window.location.href = location;
1513
+ payload['project'] = this.client.config.project;
1514
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
1515
+ uri.searchParams.append(key, value);
1516
+ }
1517
+ if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.location)) {
1518
+ window.location.href = uri.toString();
1519
+ return;
1520
+ }
1521
+ else {
1522
+ return uri.toString();
1506
1523
  }
1507
- return location.toString();
1508
1524
  });
1509
1525
  }
1510
1526
  /**
@@ -1864,14 +1880,17 @@
1864
1880
  payload['scopes'] = scopes;
1865
1881
  }
1866
1882
  const uri = new URL(this.client.config.endpoint + apiPath);
1867
- const apiHeaders = {
1868
- 'content-type': 'application/json',
1869
- };
1870
- const location = yield this.client.redirect('get', uri, apiHeaders, payload);
1871
- if (typeof window !== 'undefined') {
1872
- window.location.href = location;
1883
+ payload['project'] = this.client.config.project;
1884
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
1885
+ uri.searchParams.append(key, value);
1886
+ }
1887
+ if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.location)) {
1888
+ window.location.href = uri.toString();
1889
+ return;
1890
+ }
1891
+ else {
1892
+ return uri.toString();
1873
1893
  }
1874
- return location.toString();
1875
1894
  });
1876
1895
  }
1877
1896
  /**
@@ -2060,6 +2079,10 @@
2060
2079
  }
2061
2080
  const uri = new URL(this.client.config.endpoint + apiPath);
2062
2081
  payload['project'] = this.client.config.project;
2082
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
2083
+ uri.searchParams.append(key, value);
2084
+ }
2085
+ payload['project'] = this.client.config.project;
2063
2086
  for (const [key, value] of Object.entries(Client.flatten(payload))) {
2064
2087
  uri.searchParams.append(key, value);
2065
2088
  }
@@ -2097,6 +2120,10 @@
2097
2120
  }
2098
2121
  const uri = new URL(this.client.config.endpoint + apiPath);
2099
2122
  payload['project'] = this.client.config.project;
2123
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
2124
+ uri.searchParams.append(key, value);
2125
+ }
2126
+ payload['project'] = this.client.config.project;
2100
2127
  for (const [key, value] of Object.entries(Client.flatten(payload))) {
2101
2128
  uri.searchParams.append(key, value);
2102
2129
  }
@@ -2124,6 +2151,10 @@
2124
2151
  }
2125
2152
  const uri = new URL(this.client.config.endpoint + apiPath);
2126
2153
  payload['project'] = this.client.config.project;
2154
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
2155
+ uri.searchParams.append(key, value);
2156
+ }
2157
+ payload['project'] = this.client.config.project;
2127
2158
  for (const [key, value] of Object.entries(Client.flatten(payload))) {
2128
2159
  uri.searchParams.append(key, value);
2129
2160
  }
@@ -2161,6 +2192,10 @@
2161
2192
  }
2162
2193
  const uri = new URL(this.client.config.endpoint + apiPath);
2163
2194
  payload['project'] = this.client.config.project;
2195
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
2196
+ uri.searchParams.append(key, value);
2197
+ }
2198
+ payload['project'] = this.client.config.project;
2164
2199
  for (const [key, value] of Object.entries(Client.flatten(payload))) {
2165
2200
  uri.searchParams.append(key, value);
2166
2201
  }
@@ -2198,6 +2233,10 @@
2198
2233
  }
2199
2234
  const uri = new URL(this.client.config.endpoint + apiPath);
2200
2235
  payload['project'] = this.client.config.project;
2236
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
2237
+ uri.searchParams.append(key, value);
2238
+ }
2239
+ payload['project'] = this.client.config.project;
2201
2240
  for (const [key, value] of Object.entries(Client.flatten(payload))) {
2202
2241
  uri.searchParams.append(key, value);
2203
2242
  }
@@ -2237,6 +2276,10 @@
2237
2276
  }
2238
2277
  const uri = new URL(this.client.config.endpoint + apiPath);
2239
2278
  payload['project'] = this.client.config.project;
2279
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
2280
+ uri.searchParams.append(key, value);
2281
+ }
2282
+ payload['project'] = this.client.config.project;
2240
2283
  for (const [key, value] of Object.entries(Client.flatten(payload))) {
2241
2284
  uri.searchParams.append(key, value);
2242
2285
  }
@@ -2275,6 +2318,10 @@
2275
2318
  }
2276
2319
  const uri = new URL(this.client.config.endpoint + apiPath);
2277
2320
  payload['project'] = this.client.config.project;
2321
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
2322
+ uri.searchParams.append(key, value);
2323
+ }
2324
+ payload['project'] = this.client.config.project;
2278
2325
  for (const [key, value] of Object.entries(Client.flatten(payload))) {
2279
2326
  uri.searchParams.append(key, value);
2280
2327
  }
@@ -4928,6 +4975,10 @@
4928
4975
  const payload = {};
4929
4976
  const uri = new URL(this.client.config.endpoint + apiPath);
4930
4977
  payload['project'] = this.client.config.project;
4978
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
4979
+ uri.searchParams.append(key, value);
4980
+ }
4981
+ payload['project'] = this.client.config.project;
4931
4982
  for (const [key, value] of Object.entries(Client.flatten(payload))) {
4932
4983
  uri.searchParams.append(key, value);
4933
4984
  }
@@ -10929,6 +10980,10 @@
10929
10980
  const payload = {};
10930
10981
  const uri = new URL(this.client.config.endpoint + apiPath);
10931
10982
  payload['project'] = this.client.config.project;
10983
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
10984
+ uri.searchParams.append(key, value);
10985
+ }
10986
+ payload['project'] = this.client.config.project;
10932
10987
  for (const [key, value] of Object.entries(Client.flatten(payload))) {
10933
10988
  uri.searchParams.append(key, value);
10934
10989
  }
@@ -10999,6 +11054,10 @@
10999
11054
  }
11000
11055
  const uri = new URL(this.client.config.endpoint + apiPath);
11001
11056
  payload['project'] = this.client.config.project;
11057
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
11058
+ uri.searchParams.append(key, value);
11059
+ }
11060
+ payload['project'] = this.client.config.project;
11002
11061
  for (const [key, value] of Object.entries(Client.flatten(payload))) {
11003
11062
  uri.searchParams.append(key, value);
11004
11063
  }
@@ -11025,6 +11084,10 @@
11025
11084
  const payload = {};
11026
11085
  const uri = new URL(this.client.config.endpoint + apiPath);
11027
11086
  payload['project'] = this.client.config.project;
11087
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
11088
+ uri.searchParams.append(key, value);
11089
+ }
11090
+ payload['project'] = this.client.config.project;
11028
11091
  for (const [key, value] of Object.entries(Client.flatten(payload))) {
11029
11092
  uri.searchParams.append(key, value);
11030
11093
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@appwrite.io/console",
3
3
  "homepage": "https://appwrite.io/support",
4
4
  "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
5
- "version": "1.0.0",
5
+ "version": "1.0.1",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "dist/cjs/sdk.js",
8
8
  "exports": {
package/src/client.ts CHANGED
@@ -304,7 +304,7 @@ class Client {
304
304
  'x-sdk-name': 'Console',
305
305
  'x-sdk-platform': 'console',
306
306
  'x-sdk-language': 'web',
307
- 'x-sdk-version': '1.0.0',
307
+ 'x-sdk-version': '1.0.1',
308
308
  'X-Appwrite-Response-Format': '1.6.0',
309
309
  };
310
310
 
@@ -545,10 +545,10 @@ class Client {
545
545
 
546
546
  /**
547
547
  * Subscribes to Appwrite events and passes you the payload in realtime.
548
- *
549
- * @param {string|string[]} channels
548
+ *
549
+ * @param {string|string[]} channels
550
550
  * Channel to subscribe - pass a single channel as a string or multiple with an array of strings.
551
- *
551
+ *
552
552
  * Possible channels are:
553
553
  * - account
554
554
  * - collections
@@ -681,21 +681,6 @@ class Client {
681
681
  return response;
682
682
  }
683
683
 
684
- async redirect(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise<string> {
685
- const { uri, options } = this.prepareRequest(method, url, headers, params);
686
-
687
- const response = await fetch(uri, {
688
- ...options,
689
- redirect: 'manual'
690
- });
691
-
692
- if (response.status !== 301 && response.status !== 302) {
693
- throw new AppwriteException('Invalid redirect', response.status);
694
- }
695
-
696
- return response.headers.get('location') || '';
697
- }
698
-
699
684
  async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise<any> {
700
685
  const { uri, options } = this.prepareRequest(method, url, headers, params);
701
686
 
@@ -1,3 +1,4 @@
1
+ import { Service } from '../service';
1
2
  import { AppwriteException, Client, type Payload, UploadProgress } from '../client';
2
3
  import type { Models } from '../models';
3
4
  import { AuthenticatorType } from '../enums/authenticator-type';
@@ -28,6 +29,7 @@ export class Account {
28
29
  'content-type': 'application/json',
29
30
  }
30
31
 
32
+
31
33
  return await this.client.call(
32
34
  'get',
33
35
  uri,
@@ -77,6 +79,7 @@ export class Account {
77
79
  'content-type': 'application/json',
78
80
  }
79
81
 
82
+
80
83
  return await this.client.call(
81
84
  'post',
82
85
  uri,
@@ -101,6 +104,7 @@ export class Account {
101
104
  'content-type': 'application/json',
102
105
  }
103
106
 
107
+
104
108
  return await this.client.call(
105
109
  'delete',
106
110
  uri,
@@ -141,6 +145,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
141
145
  'content-type': 'application/json',
142
146
  }
143
147
 
148
+
144
149
  return await this.client.call(
145
150
  'patch',
146
151
  uri,
@@ -169,6 +174,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
169
174
  'content-type': 'application/json',
170
175
  }
171
176
 
177
+
172
178
  return await this.client.call(
173
179
  'get',
174
180
  uri,
@@ -197,6 +203,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
197
203
  'content-type': 'application/json',
198
204
  }
199
205
 
206
+
200
207
  return await this.client.call(
201
208
  'delete',
202
209
  uri,
@@ -221,6 +228,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
221
228
  'content-type': 'application/json',
222
229
  }
223
230
 
231
+
224
232
  return await this.client.call(
225
233
  'post',
226
234
  uri,
@@ -249,6 +257,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
249
257
  'content-type': 'application/json',
250
258
  }
251
259
 
260
+
252
261
  return await this.client.call(
253
262
  'get',
254
263
  uri,
@@ -280,6 +289,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
280
289
  'content-type': 'application/json',
281
290
  }
282
291
 
292
+
283
293
  return await this.client.call(
284
294
  'patch',
285
295
  uri,
@@ -308,6 +318,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
308
318
  'content-type': 'application/json',
309
319
  }
310
320
 
321
+
311
322
  return await this.client.call(
312
323
  'post',
313
324
  uri,
@@ -343,6 +354,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
343
354
  'content-type': 'application/json',
344
355
  }
345
356
 
357
+
346
358
  return await this.client.call(
347
359
  'put',
348
360
  uri,
@@ -371,6 +383,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
371
383
  'content-type': 'application/json',
372
384
  }
373
385
 
386
+
374
387
  return await this.client.call(
375
388
  'delete',
376
389
  uri,
@@ -402,6 +415,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
402
415
  'content-type': 'application/json',
403
416
  }
404
417
 
418
+
405
419
  return await this.client.call(
406
420
  'post',
407
421
  uri,
@@ -440,6 +454,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
440
454
  'content-type': 'application/json',
441
455
  }
442
456
 
457
+
443
458
  return await this.client.call(
444
459
  'put',
445
460
  uri,
@@ -464,6 +479,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
464
479
  'content-type': 'application/json',
465
480
  }
466
481
 
482
+
467
483
  return await this.client.call(
468
484
  'get',
469
485
  uri,
@@ -488,6 +504,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
488
504
  'content-type': 'application/json',
489
505
  }
490
506
 
507
+
491
508
  return await this.client.call(
492
509
  'get',
493
510
  uri,
@@ -512,6 +529,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
512
529
  'content-type': 'application/json',
513
530
  }
514
531
 
532
+
515
533
  return await this.client.call(
516
534
  'post',
517
535
  uri,
@@ -536,6 +554,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
536
554
  'content-type': 'application/json',
537
555
  }
538
556
 
557
+
539
558
  return await this.client.call(
540
559
  'patch',
541
560
  uri,
@@ -567,6 +586,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
567
586
  'content-type': 'application/json',
568
587
  }
569
588
 
589
+
570
590
  return await this.client.call(
571
591
  'patch',
572
592
  uri,
@@ -602,6 +622,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
602
622
  'content-type': 'application/json',
603
623
  }
604
624
 
625
+
605
626
  return await this.client.call(
606
627
  'patch',
607
628
  uri,
@@ -640,6 +661,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
640
661
  'content-type': 'application/json',
641
662
  }
642
663
 
664
+
643
665
  return await this.client.call(
644
666
  'patch',
645
667
  uri,
@@ -664,6 +686,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
664
686
  'content-type': 'application/json',
665
687
  }
666
688
 
689
+
667
690
  return await this.client.call(
668
691
  'get',
669
692
  uri,
@@ -695,6 +718,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
695
718
  'content-type': 'application/json',
696
719
  }
697
720
 
721
+
698
722
  return await this.client.call(
699
723
  'patch',
700
724
  uri,
@@ -733,6 +757,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
733
757
  'content-type': 'application/json',
734
758
  }
735
759
 
760
+
736
761
  return await this.client.call(
737
762
  'post',
738
763
  uri,
@@ -780,6 +805,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
780
805
  'content-type': 'application/json',
781
806
  }
782
807
 
808
+
783
809
  return await this.client.call(
784
810
  'put',
785
811
  uri,
@@ -804,6 +830,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
804
830
  'content-type': 'application/json',
805
831
  }
806
832
 
833
+
807
834
  return await this.client.call(
808
835
  'get',
809
836
  uri,
@@ -828,6 +855,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
828
855
  'content-type': 'application/json',
829
856
  }
830
857
 
858
+
831
859
  return await this.client.call(
832
860
  'delete',
833
861
  uri,
@@ -852,6 +880,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
852
880
  'content-type': 'application/json',
853
881
  }
854
882
 
883
+
855
884
  return await this.client.call(
856
885
  'post',
857
886
  uri,
@@ -892,6 +921,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
892
921
  'content-type': 'application/json',
893
922
  }
894
923
 
924
+
895
925
  return await this.client.call(
896
926
  'post',
897
927
  uri,
@@ -930,6 +960,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
930
960
  'content-type': 'application/json',
931
961
  }
932
962
 
963
+
933
964
  return await this.client.call(
934
965
  'put',
935
966
  uri,
@@ -975,16 +1006,17 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
975
1006
  'content-type': 'application/json',
976
1007
  }
977
1008
 
978
- const location = await this.client.redirect(
979
- 'get',
980
- uri,
981
- apiHeaders,
982
- payload
983
- );
984
- if (typeof window !== 'undefined') {
985
- window.location.href = location;
1009
+ payload['project'] = this.client.config.project;
1010
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
1011
+ uri.searchParams.append(key, value);
1012
+ }
1013
+
1014
+ if (typeof window !== 'undefined' && window?.location) {
1015
+ window.location.href = uri.toString();
1016
+ return;
1017
+ } else {
1018
+ return uri.toString();
986
1019
  }
987
- return location.toString();
988
1020
  }
989
1021
  /**
990
1022
  * Update phone session
@@ -1017,6 +1049,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1017
1049
  'content-type': 'application/json',
1018
1050
  }
1019
1051
 
1052
+
1020
1053
  return await this.client.call(
1021
1054
  'put',
1022
1055
  uri,
@@ -1055,6 +1088,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1055
1088
  'content-type': 'application/json',
1056
1089
  }
1057
1090
 
1091
+
1058
1092
  return await this.client.call(
1059
1093
  'post',
1060
1094
  uri,
@@ -1083,6 +1117,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1083
1117
  'content-type': 'application/json',
1084
1118
  }
1085
1119
 
1120
+
1086
1121
  return await this.client.call(
1087
1122
  'get',
1088
1123
  uri,
@@ -1111,6 +1146,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1111
1146
  'content-type': 'application/json',
1112
1147
  }
1113
1148
 
1149
+
1114
1150
  return await this.client.call(
1115
1151
  'patch',
1116
1152
  uri,
@@ -1139,6 +1175,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1139
1175
  'content-type': 'application/json',
1140
1176
  }
1141
1177
 
1178
+
1142
1179
  return await this.client.call(
1143
1180
  'delete',
1144
1181
  uri,
@@ -1163,6 +1200,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1163
1200
  'content-type': 'application/json',
1164
1201
  }
1165
1202
 
1203
+
1166
1204
  return await this.client.call(
1167
1205
  'patch',
1168
1206
  uri,
@@ -1204,6 +1242,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1204
1242
  'content-type': 'application/json',
1205
1243
  }
1206
1244
 
1245
+
1207
1246
  return await this.client.call(
1208
1247
  'post',
1209
1248
  uri,
@@ -1238,6 +1277,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1238
1277
  'content-type': 'application/json',
1239
1278
  }
1240
1279
 
1280
+
1241
1281
  return await this.client.call(
1242
1282
  'put',
1243
1283
  uri,
@@ -1265,6 +1305,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1265
1305
  'content-type': 'application/json',
1266
1306
  }
1267
1307
 
1308
+
1268
1309
  return await this.client.call(
1269
1310
  'delete',
1270
1311
  uri,
@@ -1309,6 +1350,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1309
1350
  'content-type': 'application/json',
1310
1351
  }
1311
1352
 
1353
+
1312
1354
  return await this.client.call(
1313
1355
  'post',
1314
1356
  uri,
@@ -1358,6 +1400,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1358
1400
  'content-type': 'application/json',
1359
1401
  }
1360
1402
 
1403
+
1361
1404
  return await this.client.call(
1362
1405
  'post',
1363
1406
  uri,
@@ -1402,16 +1445,17 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1402
1445
  'content-type': 'application/json',
1403
1446
  }
1404
1447
 
1405
- const location = await this.client.redirect(
1406
- 'get',
1407
- uri,
1408
- apiHeaders,
1409
- payload
1410
- );
1411
- if (typeof window !== 'undefined') {
1412
- window.location.href = location;
1448
+ payload['project'] = this.client.config.project;
1449
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
1450
+ uri.searchParams.append(key, value);
1451
+ }
1452
+
1453
+ if (typeof window !== 'undefined' && window?.location) {
1454
+ window.location.href = uri.toString();
1455
+ return;
1456
+ } else {
1457
+ return uri.toString();
1413
1458
  }
1414
- return location.toString();
1415
1459
  }
1416
1460
  /**
1417
1461
  * Create phone token
@@ -1446,6 +1490,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1446
1490
  'content-type': 'application/json',
1447
1491
  }
1448
1492
 
1493
+
1449
1494
  return await this.client.call(
1450
1495
  'post',
1451
1496
  uri,
@@ -1480,6 +1525,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
1480
1525
  'content-type': 'application/json',
1481
1526
  }
1482
1527
 
1528
+
1483
1529
  return await this.client.call(
1484
1530
  'post',
1485
1531
  uri,
@@ -1518,6 +1564,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
1518
1564
  'content-type': 'application/json',
1519
1565
  }
1520
1566
 
1567
+
1521
1568
  return await this.client.call(
1522
1569
  'put',
1523
1570
  uri,
@@ -1542,6 +1589,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
1542
1589
  'content-type': 'application/json',
1543
1590
  }
1544
1591
 
1592
+
1545
1593
  return await this.client.call(
1546
1594
  'post',
1547
1595
  uri,
@@ -1580,6 +1628,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
1580
1628
  'content-type': 'application/json',
1581
1629
  }
1582
1630
 
1631
+
1583
1632
  return await this.client.call(
1584
1633
  'put',
1585
1634
  uri,