mezon-js 2.11.45 → 2.12.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.
@@ -839,593 +839,21 @@ var MezonApi = class {
839
839
  )
840
840
  ]);
841
841
  }
842
- /** Authenticate a user with an Apple ID against the server. */
843
- authenticateApple(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
844
- if (account === null || account === void 0) {
845
- throw new Error(
846
- "'account' is a required parameter but is null or undefined."
847
- );
848
- }
849
- const urlPath = "/v2/account/authenticate/apple";
850
- const queryParams = /* @__PURE__ */ new Map();
851
- queryParams.set("create", create);
852
- queryParams.set("username", username);
853
- let bodyJson = "";
854
- bodyJson = JSON.stringify(account || {});
855
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
856
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
857
- if (basicAuthUsername) {
858
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
859
- }
860
- return Promise.race([
861
- fetch(fullUrl, fetchOptions).then((response) => {
862
- if (response.status == 204) {
863
- return response;
864
- } else if (response.status >= 200 && response.status < 300) {
865
- return response.json();
866
- } else {
867
- throw response;
868
- }
869
- }),
870
- new Promise(
871
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
872
- )
873
- ]);
874
- }
875
- /** */
876
- checkLoginRequest(basicAuthUsername, basicAuthPassword, body, options = {}) {
877
- if (body === null || body === void 0) {
878
- throw new Error(
879
- "'body' is a required parameter but is null or undefined."
880
- );
881
- }
882
- const urlPath = "/v2/account/authenticate/checklogin";
883
- const queryParams = /* @__PURE__ */ new Map();
884
- let bodyJson = "";
885
- bodyJson = JSON.stringify(body || {});
886
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
887
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
888
- if (basicAuthUsername) {
889
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
890
- }
891
- return Promise.race([
892
- fetch(fullUrl, fetchOptions).then((response) => {
893
- if (response.status == 204) {
894
- return response;
895
- } else if (response.status >= 200 && response.status < 300) {
896
- return response.json();
897
- } else {
898
- throw response;
899
- }
900
- }),
901
- new Promise(
902
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
903
- )
904
- ]);
905
- }
906
- /** */
907
- confirmLogin(bearerToken, body, options = {}) {
908
- if (body === null || body === void 0) {
909
- throw new Error(
910
- "'body' is a required parameter but is null or undefined."
911
- );
912
- }
913
- const urlPath = "/v2/account/authenticate/confirmlogin";
914
- const queryParams = /* @__PURE__ */ new Map();
915
- let bodyJson = "";
916
- bodyJson = JSON.stringify(body || {});
917
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
918
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
919
- if (bearerToken) {
920
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
921
- }
922
- return Promise.race([
923
- fetch(fullUrl, fetchOptions).then((response) => {
924
- if (response.status == 204) {
925
- return response;
926
- } else if (response.status >= 200 && response.status < 300) {
927
- return response.json();
928
- } else {
929
- throw response;
930
- }
931
- }),
932
- new Promise(
933
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
934
- )
935
- ]);
936
- }
937
- /** */
938
- createQRLogin(basicAuthUsername, basicAuthPassword, body, options = {}) {
939
- if (body === null || body === void 0) {
940
- throw new Error(
941
- "'body' is a required parameter but is null or undefined."
942
- );
943
- }
944
- const urlPath = "/v2/account/authenticate/createqrlogin";
945
- const queryParams = /* @__PURE__ */ new Map();
946
- let bodyJson = "";
947
- bodyJson = JSON.stringify(body || {});
948
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
949
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
950
- if (basicAuthUsername) {
951
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
952
- }
953
- return Promise.race([
954
- fetch(fullUrl, fetchOptions).then((response) => {
955
- if (response.status == 204) {
956
- return response;
957
- } else if (response.status >= 200 && response.status < 300) {
958
- return response.json();
959
- } else {
960
- throw response;
961
- }
962
- }),
963
- new Promise(
964
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
965
- )
966
- ]);
967
- }
968
- /** Authenticate a user with a device id against the server. */
969
- authenticateDevice(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
970
- if (account === null || account === void 0) {
971
- throw new Error(
972
- "'account' is a required parameter but is null or undefined."
973
- );
974
- }
975
- const urlPath = "/v2/account/authenticate/device";
976
- const queryParams = /* @__PURE__ */ new Map();
977
- queryParams.set("create", create);
978
- queryParams.set("username", username);
979
- let bodyJson = "";
980
- bodyJson = JSON.stringify(account || {});
981
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
982
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
983
- if (basicAuthUsername) {
984
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
985
- }
986
- return Promise.race([
987
- fetch(fullUrl, fetchOptions).then((response) => {
988
- if (response.status == 204) {
989
- return response;
990
- } else if (response.status >= 200 && response.status < 300) {
991
- return response.json();
992
- } else {
993
- throw response;
994
- }
995
- }),
996
- new Promise(
997
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
998
- )
999
- ]);
1000
- }
1001
- /** Authenticate a user with an email+password against the server. */
1002
- authenticateEmail(basicAuthUsername, basicAuthPassword, body, options = {}) {
1003
- if (body === null || body === void 0) {
1004
- throw new Error("'body' is a required parameter but is null or undefined.");
1005
- }
1006
- const urlPath = "/v2/account/authenticate/email";
1007
- const queryParams = /* @__PURE__ */ new Map();
1008
- let bodyJson = "";
1009
- bodyJson = JSON.stringify(body || {});
1010
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1011
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1012
- if (basicAuthUsername) {
1013
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1014
- }
1015
- return Promise.race([
1016
- fetch(fullUrl, fetchOptions).then((response) => {
1017
- if (response.status == 204) {
1018
- return response;
1019
- } else if (response.status >= 200 && response.status < 300) {
1020
- return response.json();
1021
- } else {
1022
- throw response;
1023
- }
1024
- }),
1025
- new Promise(
1026
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1027
- )
1028
- ]);
1029
- }
1030
- /** Authenticate a user with a Facebook OAuth token against the server. */
1031
- authenticateFacebook(basicAuthUsername, basicAuthPassword, account, create, username, sync, options = {}) {
1032
- if (account === null || account === void 0) {
1033
- throw new Error(
1034
- "'account' is a required parameter but is null or undefined."
1035
- );
1036
- }
1037
- const urlPath = "/v2/account/authenticate/facebook";
1038
- const queryParams = /* @__PURE__ */ new Map();
1039
- queryParams.set("create", create);
1040
- queryParams.set("username", username);
1041
- queryParams.set("sync", sync);
1042
- let bodyJson = "";
1043
- bodyJson = JSON.stringify(account || {});
1044
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1045
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1046
- if (basicAuthUsername) {
1047
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1048
- }
1049
- return Promise.race([
1050
- fetch(fullUrl, fetchOptions).then((response) => {
1051
- if (response.status == 204) {
1052
- return response;
1053
- } else if (response.status >= 200 && response.status < 300) {
1054
- return response.json();
1055
- } else {
1056
- throw response;
1057
- }
1058
- }),
1059
- new Promise(
1060
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1061
- )
1062
- ]);
1063
- }
1064
- /** Authenticate a user with a Facebook Instant Game token against the server. */
1065
- authenticateFacebookInstantGame(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
1066
- if (account === null || account === void 0) {
1067
- throw new Error(
1068
- "'account' is a required parameter but is null or undefined."
1069
- );
1070
- }
1071
- const urlPath = "/v2/account/authenticate/facebookinstantgame";
1072
- const queryParams = /* @__PURE__ */ new Map();
1073
- queryParams.set("create", create);
1074
- queryParams.set("username", username);
1075
- let bodyJson = "";
1076
- bodyJson = JSON.stringify(account || {});
1077
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1078
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1079
- if (basicAuthUsername) {
1080
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1081
- }
1082
- return Promise.race([
1083
- fetch(fullUrl, fetchOptions).then((response) => {
1084
- if (response.status == 204) {
1085
- return response;
1086
- } else if (response.status >= 200 && response.status < 300) {
1087
- return response.json();
1088
- } else {
1089
- throw response;
1090
- }
1091
- }),
1092
- new Promise(
1093
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1094
- )
1095
- ]);
1096
- }
1097
- /** Authenticate a user with Apple's GameCenter against the server. */
1098
- authenticateGameCenter(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
1099
- if (account === null || account === void 0) {
1100
- throw new Error(
1101
- "'account' is a required parameter but is null or undefined."
1102
- );
1103
- }
1104
- const urlPath = "/v2/account/authenticate/gamecenter";
1105
- const queryParams = /* @__PURE__ */ new Map();
1106
- queryParams.set("create", create);
1107
- queryParams.set("username", username);
1108
- let bodyJson = "";
1109
- bodyJson = JSON.stringify(account || {});
1110
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1111
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1112
- if (basicAuthUsername) {
1113
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1114
- }
1115
- return Promise.race([
1116
- fetch(fullUrl, fetchOptions).then((response) => {
1117
- if (response.status == 204) {
1118
- return response;
1119
- } else if (response.status >= 200 && response.status < 300) {
1120
- return response.json();
1121
- } else {
1122
- throw response;
1123
- }
1124
- }),
1125
- new Promise(
1126
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1127
- )
1128
- ]);
1129
- }
1130
- /** Authenticate a user with Google against the server. */
1131
- authenticateGoogle(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
1132
- if (account === null || account === void 0) {
1133
- throw new Error(
1134
- "'account' is a required parameter but is null or undefined."
1135
- );
1136
- }
1137
- const urlPath = "/v2/account/authenticate/google";
1138
- const queryParams = /* @__PURE__ */ new Map();
1139
- queryParams.set("create", create);
1140
- queryParams.set("username", username);
1141
- let bodyJson = "";
1142
- bodyJson = JSON.stringify(account || {});
1143
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1144
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1145
- if (basicAuthUsername) {
1146
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1147
- }
1148
- return Promise.race([
1149
- fetch(fullUrl, fetchOptions).then((response) => {
1150
- if (response.status == 204) {
1151
- return response;
1152
- } else if (response.status >= 200 && response.status < 300) {
1153
- return response.json();
1154
- } else {
1155
- throw response;
1156
- }
1157
- }),
1158
- new Promise(
1159
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1160
- )
1161
- ]);
1162
- }
1163
- /** Authenticate a user with Mezon against the server. */
1164
- authenticateMezon(basicAuthUsername, basicAuthPassword, account, create, username, isRemember, options = {}) {
1165
- if (account === null || account === void 0) {
1166
- throw new Error("'account' is a required parameter but is null or undefined.");
1167
- }
1168
- const urlPath = "/v2/account/authenticate/mezon";
1169
- const queryParams = /* @__PURE__ */ new Map();
1170
- queryParams.set("create", create);
1171
- queryParams.set("username", username);
1172
- queryParams.set("is_remember", isRemember);
1173
- let bodyJson = "";
1174
- bodyJson = JSON.stringify(account || {});
1175
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1176
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1177
- if (basicAuthUsername) {
1178
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1179
- }
1180
- return Promise.race([
1181
- fetch(fullUrl, fetchOptions).then((response) => {
1182
- if (response.status == 204) {
1183
- return response;
1184
- } else if (response.status >= 200 && response.status < 300) {
1185
- return response.json();
1186
- } else {
1187
- throw response;
1188
- }
1189
- }),
1190
- new Promise(
1191
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1192
- )
1193
- ]);
1194
- }
1195
- /** Authenticate a user with Steam against the server. */
1196
- authenticateSteam(basicAuthUsername, basicAuthPassword, account, create, username, sync, options = {}) {
1197
- if (account === null || account === void 0) {
1198
- throw new Error(
1199
- "'account' is a required parameter but is null or undefined."
1200
- );
1201
- }
1202
- const urlPath = "/v2/account/authenticate/steam";
1203
- const queryParams = /* @__PURE__ */ new Map();
1204
- queryParams.set("create", create);
1205
- queryParams.set("username", username);
1206
- queryParams.set("sync", sync);
1207
- let bodyJson = "";
1208
- bodyJson = JSON.stringify(account || {});
1209
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1210
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1211
- if (basicAuthUsername) {
1212
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1213
- }
1214
- return Promise.race([
1215
- fetch(fullUrl, fetchOptions).then((response) => {
1216
- if (response.status == 204) {
1217
- return response;
1218
- } else if (response.status >= 200 && response.status < 300) {
1219
- return response.json();
1220
- } else {
1221
- throw response;
1222
- }
1223
- }),
1224
- new Promise(
1225
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1226
- )
1227
- ]);
1228
- }
1229
- /** Add an Apple ID to the social profiles on the current user's account. */
1230
- linkApple(bearerToken, body, options = {}) {
1231
- if (body === null || body === void 0) {
1232
- throw new Error(
1233
- "'body' is a required parameter but is null or undefined."
1234
- );
1235
- }
1236
- const urlPath = "/v2/account/link/apple";
1237
- const queryParams = /* @__PURE__ */ new Map();
1238
- let bodyJson = "";
1239
- bodyJson = JSON.stringify(body || {});
1240
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1241
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1242
- if (bearerToken) {
1243
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1244
- }
1245
- return Promise.race([
1246
- fetch(fullUrl, fetchOptions).then((response) => {
1247
- if (response.status == 204) {
1248
- return response;
1249
- } else if (response.status >= 200 && response.status < 300) {
1250
- return response.json();
1251
- } else {
1252
- throw response;
1253
- }
1254
- }),
1255
- new Promise(
1256
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1257
- )
1258
- ]);
1259
- }
1260
- /** Add a device ID to the social profiles on the current user's account. */
1261
- linkDevice(bearerToken, body, options = {}) {
1262
- if (body === null || body === void 0) {
1263
- throw new Error(
1264
- "'body' is a required parameter but is null or undefined."
1265
- );
1266
- }
1267
- const urlPath = "/v2/account/link/device";
1268
- const queryParams = /* @__PURE__ */ new Map();
1269
- let bodyJson = "";
1270
- bodyJson = JSON.stringify(body || {});
1271
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1272
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1273
- if (bearerToken) {
1274
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1275
- }
1276
- return Promise.race([
1277
- fetch(fullUrl, fetchOptions).then((response) => {
1278
- if (response.status == 204) {
1279
- return response;
1280
- } else if (response.status >= 200 && response.status < 300) {
1281
- return response.json();
1282
- } else {
1283
- throw response;
1284
- }
1285
- }),
1286
- new Promise(
1287
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1288
- )
1289
- ]);
1290
- }
1291
- /** Add an email+password to the social profiles on the current user's account. */
1292
- linkEmail(bearerToken, body, options = {}) {
1293
- if (body === null || body === void 0) {
1294
- throw new Error(
1295
- "'body' is a required parameter but is null or undefined."
1296
- );
1297
- }
1298
- const urlPath = "/v2/account/link/email";
1299
- const queryParams = /* @__PURE__ */ new Map();
1300
- let bodyJson = "";
1301
- bodyJson = JSON.stringify(body || {});
1302
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1303
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1304
- if (bearerToken) {
1305
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1306
- }
1307
- return Promise.race([
1308
- fetch(fullUrl, fetchOptions).then((response) => {
1309
- if (response.status == 204) {
1310
- return response;
1311
- } else if (response.status >= 200 && response.status < 300) {
1312
- return response.json();
1313
- } else {
1314
- throw response;
1315
- }
1316
- }),
1317
- new Promise(
1318
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1319
- )
1320
- ]);
1321
- }
1322
- /** Add Facebook to the social profiles on the current user's account. */
1323
- linkFacebook(bearerToken, account, sync, options = {}) {
1324
- if (account === null || account === void 0) {
1325
- throw new Error(
1326
- "'account' is a required parameter but is null or undefined."
1327
- );
1328
- }
1329
- const urlPath = "/v2/account/link/facebook";
1330
- const queryParams = /* @__PURE__ */ new Map();
1331
- queryParams.set("sync", sync);
1332
- let bodyJson = "";
1333
- bodyJson = JSON.stringify(account || {});
1334
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1335
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1336
- if (bearerToken) {
1337
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1338
- }
1339
- return Promise.race([
1340
- fetch(fullUrl, fetchOptions).then((response) => {
1341
- if (response.status == 204) {
1342
- return response;
1343
- } else if (response.status >= 200 && response.status < 300) {
1344
- return response.json();
1345
- } else {
1346
- throw response;
1347
- }
1348
- }),
1349
- new Promise(
1350
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1351
- )
1352
- ]);
1353
- }
1354
- /** Add Facebook Instant Game to the social profiles on the current user's account. */
1355
- linkFacebookInstantGame(bearerToken, body, options = {}) {
1356
- if (body === null || body === void 0) {
1357
- throw new Error(
1358
- "'body' is a required parameter but is null or undefined."
1359
- );
1360
- }
1361
- const urlPath = "/v2/account/link/facebookinstantgame";
1362
- const queryParams = /* @__PURE__ */ new Map();
1363
- let bodyJson = "";
1364
- bodyJson = JSON.stringify(body || {});
1365
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1366
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1367
- if (bearerToken) {
1368
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1369
- }
1370
- return Promise.race([
1371
- fetch(fullUrl, fetchOptions).then((response) => {
1372
- if (response.status == 204) {
1373
- return response;
1374
- } else if (response.status >= 200 && response.status < 300) {
1375
- return response.json();
1376
- } else {
1377
- throw response;
1378
- }
1379
- }),
1380
- new Promise(
1381
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1382
- )
1383
- ]);
1384
- }
1385
- /** Add Apple's GameCenter to the social profiles on the current user's account. */
1386
- linkGameCenter(bearerToken, body, options = {}) {
842
+ /** */
843
+ checkLoginRequest(basePath, basicAuthUsername, basicAuthPassword, body, options = {}) {
1387
844
  if (body === null || body === void 0) {
1388
845
  throw new Error(
1389
846
  "'body' is a required parameter but is null or undefined."
1390
847
  );
1391
848
  }
1392
- const urlPath = "/v2/account/link/gamecenter";
1393
- const queryParams = /* @__PURE__ */ new Map();
1394
- let bodyJson = "";
1395
- bodyJson = JSON.stringify(body || {});
1396
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1397
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1398
- if (bearerToken) {
1399
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1400
- }
1401
- return Promise.race([
1402
- fetch(fullUrl, fetchOptions).then((response) => {
1403
- if (response.status == 204) {
1404
- return response;
1405
- } else if (response.status >= 200 && response.status < 300) {
1406
- return response.json();
1407
- } else {
1408
- throw response;
1409
- }
1410
- }),
1411
- new Promise(
1412
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1413
- )
1414
- ]);
1415
- }
1416
- /** Add a mezon ID to the social profiles on the current user's account. */
1417
- linkMezon(bearerToken, body, options = {}) {
1418
- if (body === null || body === void 0) {
1419
- throw new Error("'body' is a required parameter but is null or undefined.");
1420
- }
1421
- const urlPath = "/v2/account/link/mezon";
849
+ const urlPath = "/v2/account/authenticate/checklogin";
1422
850
  const queryParams = /* @__PURE__ */ new Map();
1423
851
  let bodyJson = "";
1424
852
  bodyJson = JSON.stringify(body || {});
1425
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
853
+ const fullUrl = this.buildFullUrl(basePath, urlPath, queryParams);
1426
854
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1427
- if (bearerToken) {
1428
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
855
+ if (basicAuthUsername) {
856
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1429
857
  }
1430
858
  return Promise.race([
1431
859
  fetch(fullUrl, fetchOptions).then((response) => {
@@ -1442,18 +870,18 @@ var MezonApi = class {
1442
870
  )
1443
871
  ]);
1444
872
  }
1445
- /** Add Google to the social profiles on the current user's account. */
1446
- linkGoogle(bearerToken, body, options = {}) {
873
+ /** */
874
+ confirmLogin(basePath, bearerToken, body, options = {}) {
1447
875
  if (body === null || body === void 0) {
1448
876
  throw new Error(
1449
877
  "'body' is a required parameter but is null or undefined."
1450
878
  );
1451
879
  }
1452
- const urlPath = "/v2/account/link/google";
880
+ const urlPath = "/v2/account/authenticate/confirmlogin";
1453
881
  const queryParams = /* @__PURE__ */ new Map();
1454
882
  let bodyJson = "";
1455
883
  bodyJson = JSON.stringify(body || {});
1456
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
884
+ const fullUrl = this.buildFullUrl(basePath, urlPath, queryParams);
1457
885
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1458
886
  if (bearerToken) {
1459
887
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
@@ -1473,21 +901,21 @@ var MezonApi = class {
1473
901
  )
1474
902
  ]);
1475
903
  }
1476
- /** Add Steam to the social profiles on the current user's account. */
1477
- linkSteam(bearerToken, body, options = {}) {
904
+ /** */
905
+ createQRLogin(basePath, basicAuthUsername, basicAuthPassword, body, options = {}) {
1478
906
  if (body === null || body === void 0) {
1479
907
  throw new Error(
1480
908
  "'body' is a required parameter but is null or undefined."
1481
909
  );
1482
910
  }
1483
- const urlPath = "/v2/account/link/steam";
911
+ const urlPath = "/v2/account/authenticate/createqrlogin";
1484
912
  const queryParams = /* @__PURE__ */ new Map();
1485
913
  let bodyJson = "";
1486
914
  bodyJson = JSON.stringify(body || {});
1487
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
915
+ const fullUrl = this.buildFullUrl(basePath, urlPath, queryParams);
1488
916
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1489
- if (bearerToken) {
1490
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
917
+ if (basicAuthUsername) {
918
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1491
919
  }
1492
920
  return Promise.race([
1493
921
  fetch(fullUrl, fetchOptions).then((response) => {
@@ -1505,48 +933,15 @@ var MezonApi = class {
1505
933
  ]);
1506
934
  }
1507
935
  /** Authenticate a user with an email+password against the server. */
1508
- registrationEmail(bearerToken, body, options = {}) {
1509
- if (body === null || body === void 0) {
1510
- throw new Error(
1511
- "'body' is a required parameter but is null or undefined."
1512
- );
1513
- }
1514
- const urlPath = "/v2/account/registry";
1515
- const queryParams = /* @__PURE__ */ new Map();
1516
- let bodyJson = "";
1517
- bodyJson = JSON.stringify(body || {});
1518
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1519
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1520
- if (bearerToken) {
1521
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1522
- }
1523
- return Promise.race([
1524
- fetch(fullUrl, fetchOptions).then((response) => {
1525
- if (response.status == 204) {
1526
- return response;
1527
- } else if (response.status >= 200 && response.status < 300) {
1528
- return response.json();
1529
- } else {
1530
- throw response;
1531
- }
1532
- }),
1533
- new Promise(
1534
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1535
- )
1536
- ]);
1537
- }
1538
- /** Refresh a user's session using a refresh token retrieved from a previous authentication request. */
1539
- sessionRefresh(basicAuthUsername, basicAuthPassword, body, options = {}) {
936
+ authenticateEmail(basePath, basicAuthUsername, basicAuthPassword, body, options = {}) {
1540
937
  if (body === null || body === void 0) {
1541
- throw new Error(
1542
- "'body' is a required parameter but is null or undefined."
1543
- );
938
+ throw new Error("'body' is a required parameter but is null or undefined.");
1544
939
  }
1545
- const urlPath = "/v2/account/session/refresh";
940
+ const urlPath = "/v2/account/authenticate/email";
1546
941
  const queryParams = /* @__PURE__ */ new Map();
1547
942
  let bodyJson = "";
1548
943
  bodyJson = JSON.stringify(body || {});
1549
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
944
+ const fullUrl = this.buildFullUrl(basePath, urlPath, queryParams);
1550
945
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1551
946
  if (basicAuthUsername) {
1552
947
  fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
@@ -1566,52 +961,22 @@ var MezonApi = class {
1566
961
  )
1567
962
  ]);
1568
963
  }
1569
- /** Remove the Apple ID from the social profiles on the current user's account. */
1570
- unlinkApple(bearerToken, body, options = {}) {
1571
- if (body === null || body === void 0) {
1572
- throw new Error(
1573
- "'body' is a required parameter but is null or undefined."
1574
- );
1575
- }
1576
- const urlPath = "/v2/account/unlink/apple";
1577
- const queryParams = /* @__PURE__ */ new Map();
1578
- let bodyJson = "";
1579
- bodyJson = JSON.stringify(body || {});
1580
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1581
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1582
- if (bearerToken) {
1583
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1584
- }
1585
- return Promise.race([
1586
- fetch(fullUrl, fetchOptions).then((response) => {
1587
- if (response.status == 204) {
1588
- return response;
1589
- } else if (response.status >= 200 && response.status < 300) {
1590
- return response.json();
1591
- } else {
1592
- throw response;
1593
- }
1594
- }),
1595
- new Promise(
1596
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1597
- )
1598
- ]);
1599
- }
1600
- /** Remove the device ID from the social profiles on the current user's account. */
1601
- unlinkDevice(bearerToken, body, options = {}) {
1602
- if (body === null || body === void 0) {
1603
- throw new Error(
1604
- "'body' is a required parameter but is null or undefined."
1605
- );
964
+ /** Authenticate a user with Mezon against the server. */
965
+ authenticateMezon(basePath, basicAuthUsername, basicAuthPassword, account, create, username, isRemember, options = {}) {
966
+ if (account === null || account === void 0) {
967
+ throw new Error("'account' is a required parameter but is null or undefined.");
1606
968
  }
1607
- const urlPath = "/v2/account/unlink/device";
969
+ const urlPath = "/v2/account/authenticate/mezon";
1608
970
  const queryParams = /* @__PURE__ */ new Map();
971
+ queryParams.set("create", create);
972
+ queryParams.set("username", username);
973
+ queryParams.set("is_remember", isRemember);
1609
974
  let bodyJson = "";
1610
- bodyJson = JSON.stringify(body || {});
1611
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
975
+ bodyJson = JSON.stringify(account || {});
976
+ const fullUrl = this.buildFullUrl(basePath, urlPath, queryParams);
1612
977
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1613
- if (bearerToken) {
1614
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
978
+ if (basicAuthUsername) {
979
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1615
980
  }
1616
981
  return Promise.race([
1617
982
  fetch(fullUrl, fetchOptions).then((response) => {
@@ -1628,14 +993,14 @@ var MezonApi = class {
1628
993
  )
1629
994
  ]);
1630
995
  }
1631
- /** Remove the email+password from the social profiles on the current user's account. */
1632
- unlinkEmail(bearerToken, body, options = {}) {
996
+ /** Add an email+password to the social profiles on the current user's account. */
997
+ linkEmail(bearerToken, body, options = {}) {
1633
998
  if (body === null || body === void 0) {
1634
999
  throw new Error(
1635
1000
  "'body' is a required parameter but is null or undefined."
1636
1001
  );
1637
1002
  }
1638
- const urlPath = "/v2/account/unlink/email";
1003
+ const urlPath = "/v2/account/link/email";
1639
1004
  const queryParams = /* @__PURE__ */ new Map();
1640
1005
  let bodyJson = "";
1641
1006
  bodyJson = JSON.stringify(body || {});
@@ -1659,14 +1024,12 @@ var MezonApi = class {
1659
1024
  )
1660
1025
  ]);
1661
1026
  }
1662
- /** Remove Facebook from the social profiles on the current user's account. */
1663
- unlinkFacebook(bearerToken, body, options = {}) {
1027
+ /** Add a mezon ID to the social profiles on the current user's account. */
1028
+ linkMezon(bearerToken, body, options = {}) {
1664
1029
  if (body === null || body === void 0) {
1665
- throw new Error(
1666
- "'body' is a required parameter but is null or undefined."
1667
- );
1030
+ throw new Error("'body' is a required parameter but is null or undefined.");
1668
1031
  }
1669
- const urlPath = "/v2/account/unlink/facebook";
1032
+ const urlPath = "/v2/account/link/mezon";
1670
1033
  const queryParams = /* @__PURE__ */ new Map();
1671
1034
  let bodyJson = "";
1672
1035
  bodyJson = JSON.stringify(body || {});
@@ -1690,14 +1053,14 @@ var MezonApi = class {
1690
1053
  )
1691
1054
  ]);
1692
1055
  }
1693
- /** Remove Facebook Instant Game profile from the social profiles on the current user's account. */
1694
- unlinkFacebookInstantGame(bearerToken, body, options = {}) {
1056
+ /** Authenticate a user with an email+password against the server. */
1057
+ registrationEmail(bearerToken, body, options = {}) {
1695
1058
  if (body === null || body === void 0) {
1696
1059
  throw new Error(
1697
1060
  "'body' is a required parameter but is null or undefined."
1698
1061
  );
1699
1062
  }
1700
- const urlPath = "/v2/account/unlink/facebookinstantgame";
1063
+ const urlPath = "/v2/account/registry";
1701
1064
  const queryParams = /* @__PURE__ */ new Map();
1702
1065
  let bodyJson = "";
1703
1066
  bodyJson = JSON.stringify(body || {});
@@ -1721,21 +1084,21 @@ var MezonApi = class {
1721
1084
  )
1722
1085
  ]);
1723
1086
  }
1724
- /** Remove Apple's GameCenter from the social profiles on the current user's account. */
1725
- unlinkGameCenter(bearerToken, body, options = {}) {
1087
+ /** Refresh a user's session using a refresh token retrieved from a previous authentication request. */
1088
+ sessionRefresh(basicAuthUsername, basicAuthPassword, body, options = {}) {
1726
1089
  if (body === null || body === void 0) {
1727
1090
  throw new Error(
1728
1091
  "'body' is a required parameter but is null or undefined."
1729
1092
  );
1730
1093
  }
1731
- const urlPath = "/v2/account/unlink/gamecenter";
1094
+ const urlPath = "/v2/account/session/refresh";
1732
1095
  const queryParams = /* @__PURE__ */ new Map();
1733
1096
  let bodyJson = "";
1734
1097
  bodyJson = JSON.stringify(body || {});
1735
1098
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1736
1099
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1737
- if (bearerToken) {
1738
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1100
+ if (basicAuthUsername) {
1101
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1739
1102
  }
1740
1103
  return Promise.race([
1741
1104
  fetch(fullUrl, fetchOptions).then((response) => {
@@ -1752,14 +1115,14 @@ var MezonApi = class {
1752
1115
  )
1753
1116
  ]);
1754
1117
  }
1755
- /** Remove Google from the social profiles on the current user's account. */
1756
- unlinkGoogle(bearerToken, body, options = {}) {
1118
+ /** Remove the email+password from the social profiles on the current user's account. */
1119
+ unlinkEmail(bearerToken, body, options = {}) {
1757
1120
  if (body === null || body === void 0) {
1758
1121
  throw new Error(
1759
1122
  "'body' is a required parameter but is null or undefined."
1760
1123
  );
1761
1124
  }
1762
- const urlPath = "/v2/account/unlink/google";
1125
+ const urlPath = "/v2/account/unlink/email";
1763
1126
  const queryParams = /* @__PURE__ */ new Map();
1764
1127
  let bodyJson = "";
1765
1128
  bodyJson = JSON.stringify(body || {});
@@ -1812,37 +1175,6 @@ var MezonApi = class {
1812
1175
  )
1813
1176
  ]);
1814
1177
  }
1815
- /** Remove Steam from the social profiles on the current user's account. */
1816
- unlinkSteam(bearerToken, body, options = {}) {
1817
- if (body === null || body === void 0) {
1818
- throw new Error(
1819
- "'body' is a required parameter but is null or undefined."
1820
- );
1821
- }
1822
- const urlPath = "/v2/account/unlink/steam";
1823
- const queryParams = /* @__PURE__ */ new Map();
1824
- let bodyJson = "";
1825
- bodyJson = JSON.stringify(body || {});
1826
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1827
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1828
- if (bearerToken) {
1829
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1830
- }
1831
- return Promise.race([
1832
- fetch(fullUrl, fetchOptions).then((response) => {
1833
- if (response.status == 204) {
1834
- return response;
1835
- } else if (response.status >= 200 && response.status < 300) {
1836
- return response.json();
1837
- } else {
1838
- throw response;
1839
- }
1840
- }),
1841
- new Promise(
1842
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1843
- )
1844
- ]);
1845
- }
1846
1178
  /** List activity */
1847
1179
  listActivity(bearerToken, options = {}) {
1848
1180
  const urlPath = "/v2/activity";
@@ -3878,79 +3210,15 @@ var MezonApi = class {
3878
3210
  new Promise(
3879
3211
  (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3880
3212
  )
3881
- ]);
3882
- }
3883
- /** Block one or more users by ID or username. */
3884
- blockFriends(bearerToken, ids, usernames, options = {}) {
3885
- const urlPath = "/v2/friend/block";
3886
- const queryParams = /* @__PURE__ */ new Map();
3887
- queryParams.set("ids", ids);
3888
- queryParams.set("usernames", usernames);
3889
- let bodyJson = "";
3890
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3891
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3892
- if (bearerToken) {
3893
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3894
- }
3895
- return Promise.race([
3896
- fetch(fullUrl, fetchOptions).then((response) => {
3897
- if (response.status == 204) {
3898
- return response;
3899
- } else if (response.status >= 200 && response.status < 300) {
3900
- return response.json();
3901
- } else {
3902
- throw response;
3903
- }
3904
- }),
3905
- new Promise(
3906
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3907
- )
3908
- ]);
3909
- }
3910
- /** Import Facebook friends and add them to a user's account. */
3911
- importFacebookFriends(bearerToken, account, reset, options = {}) {
3912
- if (account === null || account === void 0) {
3913
- throw new Error(
3914
- "'account' is a required parameter but is null or undefined."
3915
- );
3916
- }
3917
- const urlPath = "/v2/friend/facebook";
3918
- const queryParams = /* @__PURE__ */ new Map();
3919
- queryParams.set("reset", reset);
3920
- let bodyJson = "";
3921
- bodyJson = JSON.stringify(account || {});
3922
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3923
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3924
- if (bearerToken) {
3925
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3926
- }
3927
- return Promise.race([
3928
- fetch(fullUrl, fetchOptions).then((response) => {
3929
- if (response.status == 204) {
3930
- return response;
3931
- } else if (response.status >= 200 && response.status < 300) {
3932
- return response.json();
3933
- } else {
3934
- throw response;
3935
- }
3936
- }),
3937
- new Promise(
3938
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3939
- )
3940
- ]);
3941
- }
3942
- /** Import Steam friends and add them to a user's account. */
3943
- importSteamFriends(bearerToken, account, reset, options = {}) {
3944
- if (account === null || account === void 0) {
3945
- throw new Error(
3946
- "'account' is a required parameter but is null or undefined."
3947
- );
3948
- }
3949
- const urlPath = "/v2/friend/steam";
3213
+ ]);
3214
+ }
3215
+ /** Block one or more users by ID or username. */
3216
+ blockFriends(bearerToken, ids, usernames, options = {}) {
3217
+ const urlPath = "/v2/friend/block";
3950
3218
  const queryParams = /* @__PURE__ */ new Map();
3951
- queryParams.set("reset", reset);
3219
+ queryParams.set("ids", ids);
3220
+ queryParams.set("usernames", usernames);
3952
3221
  let bodyJson = "";
3953
- bodyJson = JSON.stringify(account || {});
3954
3222
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3955
3223
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3956
3224
  if (bearerToken) {
@@ -8592,52 +7860,14 @@ var Client = class {
8592
7860
  const basePath = `${scheme}${host}:${port}`;
8593
7861
  this.apiClient = new MezonApi(serverkey, basePath, timeout);
8594
7862
  }
8595
- /** Add users to a channel, or accept their join requests. */
8596
- addChannelUsers(session, channelId, ids) {
8597
- return __async(this, null, function* () {
8598
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
8599
- yield this.sessionRefresh(session);
8600
- }
8601
- return this.apiClient.addChannelUsers(session.token, channelId, ids).then((response) => {
8602
- return response !== void 0;
8603
- });
8604
- });
8605
- }
8606
- /** Add friends by ID or username to a user's account. */
8607
- addFriends(session, ids, usernames) {
8608
- return __async(this, null, function* () {
8609
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
8610
- yield this.sessionRefresh(session);
8611
- }
8612
- return this.apiClient.addFriends(session.token, ids, usernames).then((response) => {
8613
- return response !== void 0;
8614
- });
8615
- });
8616
- }
8617
- /** Authenticate a user with an Apple ID against the server. */
8618
- authenticateApple(_0, _1, _2) {
8619
- return __async(this, arguments, function* (token, create, username, vars = {}, options = {}) {
8620
- const request = {
8621
- token,
8622
- vars
8623
- };
8624
- return this.apiClient.authenticateApple(this.serverkey, "", request, create, username, options).then((apiSession) => {
8625
- return new Session(
8626
- apiSession.token || "",
8627
- apiSession.refresh_token || "",
8628
- apiSession.created || false,
8629
- false
8630
- );
8631
- });
8632
- });
8633
- }
8634
7863
  /** Authenticate a user with a custom id against the server. */
8635
- authenticateMezon(token, create, username, isRemember, vars = {}, options = {}) {
7864
+ authenticateMezon(basePath, token, create, username, isRemember, vars = {}, options = {}) {
8636
7865
  const request = {
8637
7866
  token,
8638
7867
  vars
8639
7868
  };
8640
7869
  return this.apiClient.authenticateMezon(
7870
+ basePath,
8641
7871
  this.serverkey,
8642
7872
  "",
8643
7873
  request,
@@ -8654,23 +7884,8 @@ var Client = class {
8654
7884
  );
8655
7885
  });
8656
7886
  }
8657
- /** Authenticate a user with a device id against the server. */
8658
- authenticateDevice(id, create, username, vars) {
8659
- const request = {
8660
- id,
8661
- vars
8662
- };
8663
- return this.apiClient.authenticateDevice(this.serverkey, "", request, create, username).then((apiSession) => {
8664
- return new Session(
8665
- apiSession.token || "",
8666
- apiSession.refresh_token || "",
8667
- apiSession.created || false,
8668
- false
8669
- );
8670
- });
8671
- }
8672
7887
  /** Authenticate a user with an email+password against the server. */
8673
- authenticateEmail(email, password, username, vars) {
7888
+ authenticateEmail(basePath, email, password, username, vars) {
8674
7889
  const request = {
8675
7890
  username,
8676
7891
  account: {
@@ -8679,75 +7894,7 @@ var Client = class {
8679
7894
  vars
8680
7895
  }
8681
7896
  };
8682
- return this.apiClient.authenticateEmail(this.serverkey, "", request, username).then((apiSession) => {
8683
- return new Session(
8684
- apiSession.token || "",
8685
- apiSession.refresh_token || "",
8686
- apiSession.created || false,
8687
- false
8688
- );
8689
- });
8690
- }
8691
- /** Authenticate a user with a Facebook Instant Game token against the server. */
8692
- authenticateFacebookInstantGame(signedPlayerInfo, create, username, vars, options = {}) {
8693
- const request = {
8694
- signed_player_info: signedPlayerInfo,
8695
- vars
8696
- };
8697
- return this.apiClient.authenticateFacebookInstantGame(
8698
- this.serverkey,
8699
- "",
8700
- { signed_player_info: request.signed_player_info, vars: request.vars },
8701
- create,
8702
- username,
8703
- options
8704
- ).then((apiSession) => {
8705
- return new Session(
8706
- apiSession.token || "",
8707
- apiSession.refresh_token || "",
8708
- apiSession.created || false,
8709
- false
8710
- );
8711
- });
8712
- }
8713
- /** Authenticate a user with a Facebook OAuth token against the server. */
8714
- authenticateFacebook(token, create, username, sync, vars, options = {}) {
8715
- const request = {
8716
- token,
8717
- vars
8718
- };
8719
- return this.apiClient.authenticateFacebook(
8720
- this.serverkey,
8721
- "",
8722
- request,
8723
- create,
8724
- username,
8725
- sync,
8726
- options
8727
- ).then((apiSession) => {
8728
- return new Session(
8729
- apiSession.token || "",
8730
- apiSession.refresh_token || "",
8731
- apiSession.created || false,
8732
- false
8733
- );
8734
- });
8735
- }
8736
- /** Authenticate a user with Google against the server. */
8737
- authenticateGoogle(_0, _1, _2, _3) {
8738
- return __async(this, arguments, function* (token, create, username, vars, options = {}) {
8739
- const request = {
8740
- token,
8741
- vars
8742
- };
8743
- const apiSession = yield this.apiClient.authenticateGoogle(
8744
- this.serverkey,
8745
- "",
8746
- request,
8747
- create,
8748
- username,
8749
- options
8750
- );
7897
+ return this.apiClient.authenticateEmail(basePath, this.serverkey, "", request, username).then((apiSession) => {
8751
7898
  return new Session(
8752
7899
  apiSession.token || "",
8753
7900
  apiSession.refresh_token || "",
@@ -8756,49 +7903,25 @@ var Client = class {
8756
7903
  );
8757
7904
  });
8758
7905
  }
8759
- /** Authenticate a user with GameCenter against the server. */
8760
- authenticateGameCenter(_0, _1, _2, _3, _4, _5, _6, _7, _8) {
8761
- return __async(this, arguments, function* (bundleId, playerId, publicKeyUrl, salt, signature, timestamp, username, create, vars, options = {}) {
8762
- const request = {
8763
- bundle_id: bundleId,
8764
- player_id: playerId,
8765
- public_key_url: publicKeyUrl,
8766
- salt,
8767
- signature,
8768
- timestamp_seconds: timestamp,
8769
- vars
8770
- };
8771
- const apiSession = yield this.apiClient.authenticateGameCenter(
8772
- this.serverkey,
8773
- "",
8774
- request,
8775
- create,
8776
- username,
8777
- options
8778
- );
8779
- return new Session(
8780
- apiSession.token || "",
8781
- apiSession.refresh_token || "",
8782
- apiSession.created || false,
8783
- false
8784
- );
7906
+ /** Add users to a channel, or accept their join requests. */
7907
+ addChannelUsers(session, channelId, ids) {
7908
+ return __async(this, null, function* () {
7909
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
7910
+ yield this.sessionRefresh(session);
7911
+ }
7912
+ return this.apiClient.addChannelUsers(session.token, channelId, ids).then((response) => {
7913
+ return response !== void 0;
7914
+ });
8785
7915
  });
8786
7916
  }
8787
- /** Authenticate a user with Steam against the server. */
8788
- authenticateSteam(token, create, username, sync, vars) {
7917
+ /** Add friends by ID or username to a user's account. */
7918
+ addFriends(session, ids, usernames) {
8789
7919
  return __async(this, null, function* () {
8790
- const request = {
8791
- token,
8792
- vars,
8793
- sync
8794
- };
8795
- return this.apiClient.authenticateSteam(this.serverkey, "", request, create, username).then((apiSession) => {
8796
- return new Session(
8797
- apiSession.token || "",
8798
- apiSession.refresh_token || "",
8799
- apiSession.created || false,
8800
- false
8801
- );
7920
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
7921
+ yield this.sessionRefresh(session);
7922
+ }
7923
+ return this.apiClient.addFriends(session.token, ids, usernames).then((response) => {
7924
+ return response !== void 0;
8802
7925
  });
8803
7926
  });
8804
7927
  }
@@ -9035,28 +8158,6 @@ var Client = class {
9035
8158
  return this.apiClient.getAccount(session.token);
9036
8159
  });
9037
8160
  }
9038
- /** Import Facebook friends and add them to a user's account. */
9039
- importFacebookFriends(session, request) {
9040
- return __async(this, null, function* () {
9041
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9042
- yield this.sessionRefresh(session);
9043
- }
9044
- return this.apiClient.importFacebookFriends(session.token, request).then((response) => {
9045
- return response !== void 0;
9046
- });
9047
- });
9048
- }
9049
- /** Import Steam friends and add them to a user's account. */
9050
- importSteamFriends(session, request, reset) {
9051
- return __async(this, null, function* () {
9052
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9053
- yield this.sessionRefresh(session);
9054
- }
9055
- return this.apiClient.importSteamFriends(session.token, request, reset).then((response) => {
9056
- return response !== void 0;
9057
- });
9058
- });
9059
- }
9060
8161
  /** Fetch zero or more users by ID and/or username. */
9061
8162
  getUsers(session, ids, usernames, facebookIds) {
9062
8163
  return __async(this, null, function* () {
@@ -9491,17 +8592,6 @@ var Client = class {
9491
8592
  });
9492
8593
  });
9493
8594
  }
9494
- /** Add an Apple ID to the social profiles on the current user's account. */
9495
- linkApple(session, request) {
9496
- return __async(this, null, function* () {
9497
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9498
- yield this.sessionRefresh(session);
9499
- }
9500
- return this.apiClient.linkApple(session.token, request).then((response) => {
9501
- return response !== void 0;
9502
- });
9503
- });
9504
- }
9505
8595
  //
9506
8596
  closeDirectMess(session, request) {
9507
8597
  return __async(this, null, function* () {
@@ -9535,17 +8625,6 @@ var Client = class {
9535
8625
  });
9536
8626
  });
9537
8627
  }
9538
- /** Add a device ID to the social profiles on the current user's account. */
9539
- linkDevice(session, request) {
9540
- return __async(this, null, function* () {
9541
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9542
- yield this.sessionRefresh(session);
9543
- }
9544
- return this.apiClient.linkDevice(session.token, request).then((response) => {
9545
- return response !== void 0;
9546
- });
9547
- });
9548
- }
9549
8628
  /** Add an email+password to the social profiles on the current user's account. */
9550
8629
  linkEmail(session, request) {
9551
8630
  return __async(this, null, function* () {
@@ -9557,61 +8636,6 @@ var Client = class {
9557
8636
  });
9558
8637
  });
9559
8638
  }
9560
- /** Add Facebook to the social profiles on the current user's account. */
9561
- linkFacebook(session, request) {
9562
- return __async(this, null, function* () {
9563
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9564
- yield this.sessionRefresh(session);
9565
- }
9566
- return this.apiClient.linkFacebook(session.token, request).then((response) => {
9567
- return response !== void 0;
9568
- });
9569
- });
9570
- }
9571
- /** Add Facebook Instant to the social profiles on the current user's account. */
9572
- linkFacebookInstantGame(session, request) {
9573
- return __async(this, null, function* () {
9574
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9575
- yield this.sessionRefresh(session);
9576
- }
9577
- return this.apiClient.linkFacebookInstantGame(session.token, request).then((response) => {
9578
- return response !== void 0;
9579
- });
9580
- });
9581
- }
9582
- /** Add Google to the social profiles on the current user's account. */
9583
- linkGoogle(session, request) {
9584
- return __async(this, null, function* () {
9585
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9586
- yield this.sessionRefresh(session);
9587
- }
9588
- return this.apiClient.linkGoogle(session.token, request).then((response) => {
9589
- return response !== void 0;
9590
- });
9591
- });
9592
- }
9593
- /** Add GameCenter to the social profiles on the current user's account. */
9594
- linkGameCenter(session, request) {
9595
- return __async(this, null, function* () {
9596
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9597
- yield this.sessionRefresh(session);
9598
- }
9599
- return this.apiClient.linkGameCenter(session.token, request).then((response) => {
9600
- return response !== void 0;
9601
- });
9602
- });
9603
- }
9604
- /** Add Steam to the social profiles on the current user's account. */
9605
- linkSteam(session, request) {
9606
- return __async(this, null, function* () {
9607
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9608
- yield this.sessionRefresh(session);
9609
- }
9610
- return this.apiClient.linkSteam(session.token, request).then((response) => {
9611
- return response !== void 0;
9612
- });
9613
- });
9614
- }
9615
8639
  /** List all friends for the current user. */
9616
8640
  listFriends(session, state, limit, cursor) {
9617
8641
  return __async(this, null, function* () {
@@ -9784,17 +8808,6 @@ var Client = class {
9784
8808
  return this.refreshTokenPromise;
9785
8809
  });
9786
8810
  }
9787
- /** Remove the Apple ID from the social profiles on the current user's account. */
9788
- unlinkApple(session, request) {
9789
- return __async(this, null, function* () {
9790
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9791
- yield this.sessionRefresh(session);
9792
- }
9793
- return this.apiClient.unlinkApple(session.token, request).then((response) => {
9794
- return response !== void 0;
9795
- });
9796
- });
9797
- }
9798
8811
  /** Remove custom ID from the social profiles on the current user's account. */
9799
8812
  unlinkCustom(session, request) {
9800
8813
  return __async(this, null, function* () {
@@ -9806,17 +8819,6 @@ var Client = class {
9806
8819
  });
9807
8820
  });
9808
8821
  }
9809
- /** Remove a device ID from the social profiles on the current user's account. */
9810
- unlinkDevice(session, request) {
9811
- return __async(this, null, function* () {
9812
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9813
- yield this.sessionRefresh(session);
9814
- }
9815
- return this.apiClient.unlinkDevice(session.token, request).then((response) => {
9816
- return response !== void 0;
9817
- });
9818
- });
9819
- }
9820
8822
  /** Remove an email+password from the social profiles on the current user's account. */
9821
8823
  unlinkEmail(session, request) {
9822
8824
  return __async(this, null, function* () {
@@ -9828,61 +8830,6 @@ var Client = class {
9828
8830
  });
9829
8831
  });
9830
8832
  }
9831
- /** Remove Facebook from the social profiles on the current user's account. */
9832
- unlinkFacebook(session, request) {
9833
- return __async(this, null, function* () {
9834
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9835
- yield this.sessionRefresh(session);
9836
- }
9837
- return this.apiClient.unlinkFacebook(session.token, request).then((response) => {
9838
- return response !== void 0;
9839
- });
9840
- });
9841
- }
9842
- /** Remove Facebook Instant social profiles from the current user's account. */
9843
- unlinkFacebookInstantGame(session, request) {
9844
- return __async(this, null, function* () {
9845
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9846
- yield this.sessionRefresh(session);
9847
- }
9848
- return this.apiClient.unlinkFacebookInstantGame(session.token, request).then((response) => {
9849
- return response !== void 0;
9850
- });
9851
- });
9852
- }
9853
- /** Remove Google from the social profiles on the current user's account. */
9854
- unlinkGoogle(session, request) {
9855
- return __async(this, null, function* () {
9856
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9857
- yield this.sessionRefresh(session);
9858
- }
9859
- return this.apiClient.unlinkGoogle(session.token, request).then((response) => {
9860
- return response !== void 0;
9861
- });
9862
- });
9863
- }
9864
- /** Remove GameCenter from the social profiles on the current user's account. */
9865
- unlinkGameCenter(session, request) {
9866
- return __async(this, null, function* () {
9867
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9868
- yield this.sessionRefresh(session);
9869
- }
9870
- return this.apiClient.unlinkGameCenter(session.token, request).then((response) => {
9871
- return response !== void 0;
9872
- });
9873
- });
9874
- }
9875
- /** Remove Steam from the social profiles on the current user's account. */
9876
- unlinkSteam(session, request) {
9877
- return __async(this, null, function* () {
9878
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9879
- yield this.sessionRefresh(session);
9880
- }
9881
- return this.apiClient.unlinkSteam(session.token, request).then((response) => {
9882
- return response !== void 0;
9883
- });
9884
- });
9885
- }
9886
8833
  /** Update fields in the current user's account. */
9887
8834
  updateAccount(session, request) {
9888
8835
  return __async(this, null, function* () {
@@ -10887,9 +9834,10 @@ var Client = class {
10887
9834
  });
10888
9835
  });
10889
9836
  }
10890
- createQRLogin(requet) {
9837
+ createQRLogin(basePath, requet) {
10891
9838
  return __async(this, null, function* () {
10892
9839
  const apiSession = yield this.apiClient.createQRLogin(
9840
+ basePath,
10893
9841
  this.serverkey,
10894
9842
  "",
10895
9843
  requet
@@ -10901,9 +9849,10 @@ var Client = class {
10901
9849
  return response;
10902
9850
  });
10903
9851
  }
10904
- checkLoginRequest(requet) {
9852
+ checkLoginRequest(basePath, requet) {
10905
9853
  return __async(this, null, function* () {
10906
9854
  const apiSession = yield this.apiClient.checkLoginRequest(
9855
+ basePath,
10907
9856
  this.serverkey,
10908
9857
  "",
10909
9858
  requet
@@ -10919,12 +9868,12 @@ var Client = class {
10919
9868
  );
10920
9869
  });
10921
9870
  }
10922
- confirmLogin(session, body) {
9871
+ confirmLogin(basePath, session, body) {
10923
9872
  return __async(this, null, function* () {
10924
9873
  if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
10925
9874
  yield this.sessionRefresh(session);
10926
9875
  }
10927
- return this.apiClient.confirmLogin(session.token, body).then((response) => {
9876
+ return this.apiClient.confirmLogin(basePath, session.token, body).then((response) => {
10928
9877
  return response;
10929
9878
  });
10930
9879
  });