mezon-js 2.11.46 → 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.
@@ -805,593 +805,21 @@ var MezonApi = class {
805
805
  )
806
806
  ]);
807
807
  }
808
- /** Authenticate a user with an Apple ID against the server. */
809
- authenticateApple(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
810
- if (account === null || account === void 0) {
811
- throw new Error(
812
- "'account' is a required parameter but is null or undefined."
813
- );
814
- }
815
- const urlPath = "/v2/account/authenticate/apple";
816
- const queryParams = /* @__PURE__ */ new Map();
817
- queryParams.set("create", create);
818
- queryParams.set("username", username);
819
- let bodyJson = "";
820
- bodyJson = JSON.stringify(account || {});
821
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
822
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
823
- if (basicAuthUsername) {
824
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
825
- }
826
- return Promise.race([
827
- fetch(fullUrl, fetchOptions).then((response) => {
828
- if (response.status == 204) {
829
- return response;
830
- } else if (response.status >= 200 && response.status < 300) {
831
- return response.json();
832
- } else {
833
- throw response;
834
- }
835
- }),
836
- new Promise(
837
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
838
- )
839
- ]);
840
- }
841
- /** */
842
- checkLoginRequest(basicAuthUsername, basicAuthPassword, body, options = {}) {
843
- if (body === null || body === void 0) {
844
- throw new Error(
845
- "'body' is a required parameter but is null or undefined."
846
- );
847
- }
848
- const urlPath = "/v2/account/authenticate/checklogin";
849
- const queryParams = /* @__PURE__ */ new Map();
850
- let bodyJson = "";
851
- bodyJson = JSON.stringify(body || {});
852
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
853
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
854
- if (basicAuthUsername) {
855
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
856
- }
857
- return Promise.race([
858
- fetch(fullUrl, fetchOptions).then((response) => {
859
- if (response.status == 204) {
860
- return response;
861
- } else if (response.status >= 200 && response.status < 300) {
862
- return response.json();
863
- } else {
864
- throw response;
865
- }
866
- }),
867
- new Promise(
868
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
869
- )
870
- ]);
871
- }
872
- /** */
873
- confirmLogin(bearerToken, body, options = {}) {
874
- if (body === null || body === void 0) {
875
- throw new Error(
876
- "'body' is a required parameter but is null or undefined."
877
- );
878
- }
879
- const urlPath = "/v2/account/authenticate/confirmlogin";
880
- const queryParams = /* @__PURE__ */ new Map();
881
- let bodyJson = "";
882
- bodyJson = JSON.stringify(body || {});
883
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
884
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
885
- if (bearerToken) {
886
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
887
- }
888
- return Promise.race([
889
- fetch(fullUrl, fetchOptions).then((response) => {
890
- if (response.status == 204) {
891
- return response;
892
- } else if (response.status >= 200 && response.status < 300) {
893
- return response.json();
894
- } else {
895
- throw response;
896
- }
897
- }),
898
- new Promise(
899
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
900
- )
901
- ]);
902
- }
903
- /** */
904
- createQRLogin(basicAuthUsername, basicAuthPassword, body, options = {}) {
905
- if (body === null || body === void 0) {
906
- throw new Error(
907
- "'body' is a required parameter but is null or undefined."
908
- );
909
- }
910
- const urlPath = "/v2/account/authenticate/createqrlogin";
911
- const queryParams = /* @__PURE__ */ new Map();
912
- let bodyJson = "";
913
- bodyJson = JSON.stringify(body || {});
914
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
915
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
916
- if (basicAuthUsername) {
917
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
918
- }
919
- return Promise.race([
920
- fetch(fullUrl, fetchOptions).then((response) => {
921
- if (response.status == 204) {
922
- return response;
923
- } else if (response.status >= 200 && response.status < 300) {
924
- return response.json();
925
- } else {
926
- throw response;
927
- }
928
- }),
929
- new Promise(
930
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
931
- )
932
- ]);
933
- }
934
- /** Authenticate a user with a device id against the server. */
935
- authenticateDevice(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
936
- if (account === null || account === void 0) {
937
- throw new Error(
938
- "'account' is a required parameter but is null or undefined."
939
- );
940
- }
941
- const urlPath = "/v2/account/authenticate/device";
942
- const queryParams = /* @__PURE__ */ new Map();
943
- queryParams.set("create", create);
944
- queryParams.set("username", username);
945
- let bodyJson = "";
946
- bodyJson = JSON.stringify(account || {});
947
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
948
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
949
- if (basicAuthUsername) {
950
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
951
- }
952
- return Promise.race([
953
- fetch(fullUrl, fetchOptions).then((response) => {
954
- if (response.status == 204) {
955
- return response;
956
- } else if (response.status >= 200 && response.status < 300) {
957
- return response.json();
958
- } else {
959
- throw response;
960
- }
961
- }),
962
- new Promise(
963
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
964
- )
965
- ]);
966
- }
967
- /** Authenticate a user with an email+password against the server. */
968
- authenticateEmail(basicAuthUsername, basicAuthPassword, body, options = {}) {
969
- if (body === null || body === void 0) {
970
- throw new Error("'body' is a required parameter but is null or undefined.");
971
- }
972
- const urlPath = "/v2/account/authenticate/email";
973
- const queryParams = /* @__PURE__ */ new Map();
974
- let bodyJson = "";
975
- bodyJson = JSON.stringify(body || {});
976
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
977
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
978
- if (basicAuthUsername) {
979
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
980
- }
981
- return Promise.race([
982
- fetch(fullUrl, fetchOptions).then((response) => {
983
- if (response.status == 204) {
984
- return response;
985
- } else if (response.status >= 200 && response.status < 300) {
986
- return response.json();
987
- } else {
988
- throw response;
989
- }
990
- }),
991
- new Promise(
992
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
993
- )
994
- ]);
995
- }
996
- /** Authenticate a user with a Facebook OAuth token against the server. */
997
- authenticateFacebook(basicAuthUsername, basicAuthPassword, account, create, username, sync, options = {}) {
998
- if (account === null || account === void 0) {
999
- throw new Error(
1000
- "'account' is a required parameter but is null or undefined."
1001
- );
1002
- }
1003
- const urlPath = "/v2/account/authenticate/facebook";
1004
- const queryParams = /* @__PURE__ */ new Map();
1005
- queryParams.set("create", create);
1006
- queryParams.set("username", username);
1007
- queryParams.set("sync", sync);
1008
- let bodyJson = "";
1009
- bodyJson = JSON.stringify(account || {});
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 Instant Game token against the server. */
1031
- authenticateFacebookInstantGame(basicAuthUsername, basicAuthPassword, account, create, username, 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/facebookinstantgame";
1038
- const queryParams = /* @__PURE__ */ new Map();
1039
- queryParams.set("create", create);
1040
- queryParams.set("username", username);
1041
- let bodyJson = "";
1042
- bodyJson = JSON.stringify(account || {});
1043
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1044
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1045
- if (basicAuthUsername) {
1046
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1047
- }
1048
- return Promise.race([
1049
- fetch(fullUrl, fetchOptions).then((response) => {
1050
- if (response.status == 204) {
1051
- return response;
1052
- } else if (response.status >= 200 && response.status < 300) {
1053
- return response.json();
1054
- } else {
1055
- throw response;
1056
- }
1057
- }),
1058
- new Promise(
1059
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1060
- )
1061
- ]);
1062
- }
1063
- /** Authenticate a user with Apple's GameCenter against the server. */
1064
- authenticateGameCenter(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
1065
- if (account === null || account === void 0) {
1066
- throw new Error(
1067
- "'account' is a required parameter but is null or undefined."
1068
- );
1069
- }
1070
- const urlPath = "/v2/account/authenticate/gamecenter";
1071
- const queryParams = /* @__PURE__ */ new Map();
1072
- queryParams.set("create", create);
1073
- queryParams.set("username", username);
1074
- let bodyJson = "";
1075
- bodyJson = JSON.stringify(account || {});
1076
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1077
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1078
- if (basicAuthUsername) {
1079
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1080
- }
1081
- return Promise.race([
1082
- fetch(fullUrl, fetchOptions).then((response) => {
1083
- if (response.status == 204) {
1084
- return response;
1085
- } else if (response.status >= 200 && response.status < 300) {
1086
- return response.json();
1087
- } else {
1088
- throw response;
1089
- }
1090
- }),
1091
- new Promise(
1092
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1093
- )
1094
- ]);
1095
- }
1096
- /** Authenticate a user with Google against the server. */
1097
- authenticateGoogle(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
1098
- if (account === null || account === void 0) {
1099
- throw new Error(
1100
- "'account' is a required parameter but is null or undefined."
1101
- );
1102
- }
1103
- const urlPath = "/v2/account/authenticate/google";
1104
- const queryParams = /* @__PURE__ */ new Map();
1105
- queryParams.set("create", create);
1106
- queryParams.set("username", username);
1107
- let bodyJson = "";
1108
- bodyJson = JSON.stringify(account || {});
1109
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1110
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1111
- if (basicAuthUsername) {
1112
- fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1113
- }
1114
- return Promise.race([
1115
- fetch(fullUrl, fetchOptions).then((response) => {
1116
- if (response.status == 204) {
1117
- return response;
1118
- } else if (response.status >= 200 && response.status < 300) {
1119
- return response.json();
1120
- } else {
1121
- throw response;
1122
- }
1123
- }),
1124
- new Promise(
1125
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1126
- )
1127
- ]);
1128
- }
1129
- /** Authenticate a user with Mezon against the server. */
1130
- authenticateMezon(basicAuthUsername, basicAuthPassword, account, create, username, isRemember, options = {}) {
1131
- if (account === null || account === void 0) {
1132
- throw new Error("'account' is a required parameter but is null or undefined.");
1133
- }
1134
- const urlPath = "/v2/account/authenticate/mezon";
1135
- const queryParams = /* @__PURE__ */ new Map();
1136
- queryParams.set("create", create);
1137
- queryParams.set("username", username);
1138
- queryParams.set("is_remember", isRemember);
1139
- let bodyJson = "";
1140
- bodyJson = JSON.stringify(account || {});
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
- return Promise.race([
1147
- fetch(fullUrl, fetchOptions).then((response) => {
1148
- if (response.status == 204) {
1149
- return response;
1150
- } else if (response.status >= 200 && response.status < 300) {
1151
- return response.json();
1152
- } else {
1153
- throw response;
1154
- }
1155
- }),
1156
- new Promise(
1157
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1158
- )
1159
- ]);
1160
- }
1161
- /** Authenticate a user with Steam against the server. */
1162
- authenticateSteam(basicAuthUsername, basicAuthPassword, account, create, username, sync, options = {}) {
1163
- if (account === null || account === void 0) {
1164
- throw new Error(
1165
- "'account' is a required parameter but is null or undefined."
1166
- );
1167
- }
1168
- const urlPath = "/v2/account/authenticate/steam";
1169
- const queryParams = /* @__PURE__ */ new Map();
1170
- queryParams.set("create", create);
1171
- queryParams.set("username", username);
1172
- queryParams.set("sync", sync);
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
- /** Add an Apple ID to the social profiles on the current user's account. */
1196
- linkApple(bearerToken, body, options = {}) {
1197
- if (body === null || body === void 0) {
1198
- throw new Error(
1199
- "'body' is a required parameter but is null or undefined."
1200
- );
1201
- }
1202
- const urlPath = "/v2/account/link/apple";
1203
- const queryParams = /* @__PURE__ */ new Map();
1204
- let bodyJson = "";
1205
- bodyJson = JSON.stringify(body || {});
1206
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1207
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1208
- if (bearerToken) {
1209
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1210
- }
1211
- return Promise.race([
1212
- fetch(fullUrl, fetchOptions).then((response) => {
1213
- if (response.status == 204) {
1214
- return response;
1215
- } else if (response.status >= 200 && response.status < 300) {
1216
- return response.json();
1217
- } else {
1218
- throw response;
1219
- }
1220
- }),
1221
- new Promise(
1222
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1223
- )
1224
- ]);
1225
- }
1226
- /** Add a device ID to the social profiles on the current user's account. */
1227
- linkDevice(bearerToken, body, options = {}) {
1228
- if (body === null || body === void 0) {
1229
- throw new Error(
1230
- "'body' is a required parameter but is null or undefined."
1231
- );
1232
- }
1233
- const urlPath = "/v2/account/link/device";
1234
- const queryParams = /* @__PURE__ */ new Map();
1235
- let bodyJson = "";
1236
- bodyJson = JSON.stringify(body || {});
1237
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1238
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1239
- if (bearerToken) {
1240
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1241
- }
1242
- return Promise.race([
1243
- fetch(fullUrl, fetchOptions).then((response) => {
1244
- if (response.status == 204) {
1245
- return response;
1246
- } else if (response.status >= 200 && response.status < 300) {
1247
- return response.json();
1248
- } else {
1249
- throw response;
1250
- }
1251
- }),
1252
- new Promise(
1253
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1254
- )
1255
- ]);
1256
- }
1257
- /** Add an email+password to the social profiles on the current user's account. */
1258
- linkEmail(bearerToken, body, options = {}) {
1259
- if (body === null || body === void 0) {
1260
- throw new Error(
1261
- "'body' is a required parameter but is null or undefined."
1262
- );
1263
- }
1264
- const urlPath = "/v2/account/link/email";
1265
- const queryParams = /* @__PURE__ */ new Map();
1266
- let bodyJson = "";
1267
- bodyJson = JSON.stringify(body || {});
1268
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1269
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1270
- if (bearerToken) {
1271
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1272
- }
1273
- return Promise.race([
1274
- fetch(fullUrl, fetchOptions).then((response) => {
1275
- if (response.status == 204) {
1276
- return response;
1277
- } else if (response.status >= 200 && response.status < 300) {
1278
- return response.json();
1279
- } else {
1280
- throw response;
1281
- }
1282
- }),
1283
- new Promise(
1284
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1285
- )
1286
- ]);
1287
- }
1288
- /** Add Facebook to the social profiles on the current user's account. */
1289
- linkFacebook(bearerToken, account, sync, options = {}) {
1290
- if (account === null || account === void 0) {
1291
- throw new Error(
1292
- "'account' is a required parameter but is null or undefined."
1293
- );
1294
- }
1295
- const urlPath = "/v2/account/link/facebook";
1296
- const queryParams = /* @__PURE__ */ new Map();
1297
- queryParams.set("sync", sync);
1298
- let bodyJson = "";
1299
- bodyJson = JSON.stringify(account || {});
1300
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1301
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1302
- if (bearerToken) {
1303
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1304
- }
1305
- return Promise.race([
1306
- fetch(fullUrl, fetchOptions).then((response) => {
1307
- if (response.status == 204) {
1308
- return response;
1309
- } else if (response.status >= 200 && response.status < 300) {
1310
- return response.json();
1311
- } else {
1312
- throw response;
1313
- }
1314
- }),
1315
- new Promise(
1316
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1317
- )
1318
- ]);
1319
- }
1320
- /** Add Facebook Instant Game to the social profiles on the current user's account. */
1321
- linkFacebookInstantGame(bearerToken, body, options = {}) {
1322
- if (body === null || body === void 0) {
1323
- throw new Error(
1324
- "'body' is a required parameter but is null or undefined."
1325
- );
1326
- }
1327
- const urlPath = "/v2/account/link/facebookinstantgame";
1328
- const queryParams = /* @__PURE__ */ new Map();
1329
- let bodyJson = "";
1330
- bodyJson = JSON.stringify(body || {});
1331
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1332
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1333
- if (bearerToken) {
1334
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1335
- }
1336
- return Promise.race([
1337
- fetch(fullUrl, fetchOptions).then((response) => {
1338
- if (response.status == 204) {
1339
- return response;
1340
- } else if (response.status >= 200 && response.status < 300) {
1341
- return response.json();
1342
- } else {
1343
- throw response;
1344
- }
1345
- }),
1346
- new Promise(
1347
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1348
- )
1349
- ]);
1350
- }
1351
- /** Add Apple's GameCenter to the social profiles on the current user's account. */
1352
- linkGameCenter(bearerToken, body, options = {}) {
808
+ /** */
809
+ checkLoginRequest(basePath, basicAuthUsername, basicAuthPassword, body, options = {}) {
1353
810
  if (body === null || body === void 0) {
1354
811
  throw new Error(
1355
812
  "'body' is a required parameter but is null or undefined."
1356
813
  );
1357
814
  }
1358
- const urlPath = "/v2/account/link/gamecenter";
1359
- const queryParams = /* @__PURE__ */ new Map();
1360
- let bodyJson = "";
1361
- bodyJson = JSON.stringify(body || {});
1362
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1363
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1364
- if (bearerToken) {
1365
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1366
- }
1367
- return Promise.race([
1368
- fetch(fullUrl, fetchOptions).then((response) => {
1369
- if (response.status == 204) {
1370
- return response;
1371
- } else if (response.status >= 200 && response.status < 300) {
1372
- return response.json();
1373
- } else {
1374
- throw response;
1375
- }
1376
- }),
1377
- new Promise(
1378
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1379
- )
1380
- ]);
1381
- }
1382
- /** Add a mezon ID to the social profiles on the current user's account. */
1383
- linkMezon(bearerToken, body, options = {}) {
1384
- if (body === null || body === void 0) {
1385
- throw new Error("'body' is a required parameter but is null or undefined.");
1386
- }
1387
- const urlPath = "/v2/account/link/mezon";
815
+ const urlPath = "/v2/account/authenticate/checklogin";
1388
816
  const queryParams = /* @__PURE__ */ new Map();
1389
817
  let bodyJson = "";
1390
818
  bodyJson = JSON.stringify(body || {});
1391
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
819
+ const fullUrl = this.buildFullUrl(basePath, urlPath, queryParams);
1392
820
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1393
- if (bearerToken) {
1394
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
821
+ if (basicAuthUsername) {
822
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1395
823
  }
1396
824
  return Promise.race([
1397
825
  fetch(fullUrl, fetchOptions).then((response) => {
@@ -1408,18 +836,18 @@ var MezonApi = class {
1408
836
  )
1409
837
  ]);
1410
838
  }
1411
- /** Add Google to the social profiles on the current user's account. */
1412
- linkGoogle(bearerToken, body, options = {}) {
839
+ /** */
840
+ confirmLogin(basePath, bearerToken, body, options = {}) {
1413
841
  if (body === null || body === void 0) {
1414
842
  throw new Error(
1415
843
  "'body' is a required parameter but is null or undefined."
1416
844
  );
1417
845
  }
1418
- const urlPath = "/v2/account/link/google";
846
+ const urlPath = "/v2/account/authenticate/confirmlogin";
1419
847
  const queryParams = /* @__PURE__ */ new Map();
1420
848
  let bodyJson = "";
1421
849
  bodyJson = JSON.stringify(body || {});
1422
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
850
+ const fullUrl = this.buildFullUrl(basePath, urlPath, queryParams);
1423
851
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1424
852
  if (bearerToken) {
1425
853
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
@@ -1439,21 +867,21 @@ var MezonApi = class {
1439
867
  )
1440
868
  ]);
1441
869
  }
1442
- /** Add Steam to the social profiles on the current user's account. */
1443
- linkSteam(bearerToken, body, options = {}) {
870
+ /** */
871
+ createQRLogin(basePath, basicAuthUsername, basicAuthPassword, body, options = {}) {
1444
872
  if (body === null || body === void 0) {
1445
873
  throw new Error(
1446
874
  "'body' is a required parameter but is null or undefined."
1447
875
  );
1448
876
  }
1449
- const urlPath = "/v2/account/link/steam";
877
+ const urlPath = "/v2/account/authenticate/createqrlogin";
1450
878
  const queryParams = /* @__PURE__ */ new Map();
1451
879
  let bodyJson = "";
1452
880
  bodyJson = JSON.stringify(body || {});
1453
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
881
+ const fullUrl = this.buildFullUrl(basePath, urlPath, queryParams);
1454
882
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1455
- if (bearerToken) {
1456
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
883
+ if (basicAuthUsername) {
884
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1457
885
  }
1458
886
  return Promise.race([
1459
887
  fetch(fullUrl, fetchOptions).then((response) => {
@@ -1471,48 +899,15 @@ var MezonApi = class {
1471
899
  ]);
1472
900
  }
1473
901
  /** Authenticate a user with an email+password against the server. */
1474
- registrationEmail(bearerToken, body, options = {}) {
1475
- if (body === null || body === void 0) {
1476
- throw new Error(
1477
- "'body' is a required parameter but is null or undefined."
1478
- );
1479
- }
1480
- const urlPath = "/v2/account/registry";
1481
- const queryParams = /* @__PURE__ */ new Map();
1482
- let bodyJson = "";
1483
- bodyJson = JSON.stringify(body || {});
1484
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1485
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1486
- if (bearerToken) {
1487
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1488
- }
1489
- return Promise.race([
1490
- fetch(fullUrl, fetchOptions).then((response) => {
1491
- if (response.status == 204) {
1492
- return response;
1493
- } else if (response.status >= 200 && response.status < 300) {
1494
- return response.json();
1495
- } else {
1496
- throw response;
1497
- }
1498
- }),
1499
- new Promise(
1500
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1501
- )
1502
- ]);
1503
- }
1504
- /** Refresh a user's session using a refresh token retrieved from a previous authentication request. */
1505
- sessionRefresh(basicAuthUsername, basicAuthPassword, body, options = {}) {
902
+ authenticateEmail(basePath, basicAuthUsername, basicAuthPassword, body, options = {}) {
1506
903
  if (body === null || body === void 0) {
1507
- throw new Error(
1508
- "'body' is a required parameter but is null or undefined."
1509
- );
904
+ throw new Error("'body' is a required parameter but is null or undefined.");
1510
905
  }
1511
- const urlPath = "/v2/account/session/refresh";
906
+ const urlPath = "/v2/account/authenticate/email";
1512
907
  const queryParams = /* @__PURE__ */ new Map();
1513
908
  let bodyJson = "";
1514
909
  bodyJson = JSON.stringify(body || {});
1515
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
910
+ const fullUrl = this.buildFullUrl(basePath, urlPath, queryParams);
1516
911
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1517
912
  if (basicAuthUsername) {
1518
913
  fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
@@ -1532,52 +927,22 @@ var MezonApi = class {
1532
927
  )
1533
928
  ]);
1534
929
  }
1535
- /** Remove the Apple ID from the social profiles on the current user's account. */
1536
- unlinkApple(bearerToken, body, options = {}) {
1537
- if (body === null || body === void 0) {
1538
- throw new Error(
1539
- "'body' is a required parameter but is null or undefined."
1540
- );
1541
- }
1542
- const urlPath = "/v2/account/unlink/apple";
1543
- const queryParams = /* @__PURE__ */ new Map();
1544
- let bodyJson = "";
1545
- bodyJson = JSON.stringify(body || {});
1546
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1547
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1548
- if (bearerToken) {
1549
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1550
- }
1551
- return Promise.race([
1552
- fetch(fullUrl, fetchOptions).then((response) => {
1553
- if (response.status == 204) {
1554
- return response;
1555
- } else if (response.status >= 200 && response.status < 300) {
1556
- return response.json();
1557
- } else {
1558
- throw response;
1559
- }
1560
- }),
1561
- new Promise(
1562
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1563
- )
1564
- ]);
1565
- }
1566
- /** Remove the device ID from the social profiles on the current user's account. */
1567
- unlinkDevice(bearerToken, body, options = {}) {
1568
- if (body === null || body === void 0) {
1569
- throw new Error(
1570
- "'body' is a required parameter but is null or undefined."
1571
- );
930
+ /** Authenticate a user with Mezon against the server. */
931
+ authenticateMezon(basePath, basicAuthUsername, basicAuthPassword, account, create, username, isRemember, options = {}) {
932
+ if (account === null || account === void 0) {
933
+ throw new Error("'account' is a required parameter but is null or undefined.");
1572
934
  }
1573
- const urlPath = "/v2/account/unlink/device";
935
+ const urlPath = "/v2/account/authenticate/mezon";
1574
936
  const queryParams = /* @__PURE__ */ new Map();
937
+ queryParams.set("create", create);
938
+ queryParams.set("username", username);
939
+ queryParams.set("is_remember", isRemember);
1575
940
  let bodyJson = "";
1576
- bodyJson = JSON.stringify(body || {});
1577
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
941
+ bodyJson = JSON.stringify(account || {});
942
+ const fullUrl = this.buildFullUrl(basePath, urlPath, queryParams);
1578
943
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1579
- if (bearerToken) {
1580
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
944
+ if (basicAuthUsername) {
945
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1581
946
  }
1582
947
  return Promise.race([
1583
948
  fetch(fullUrl, fetchOptions).then((response) => {
@@ -1594,14 +959,14 @@ var MezonApi = class {
1594
959
  )
1595
960
  ]);
1596
961
  }
1597
- /** Remove the email+password from the social profiles on the current user's account. */
1598
- unlinkEmail(bearerToken, body, options = {}) {
962
+ /** Add an email+password to the social profiles on the current user's account. */
963
+ linkEmail(bearerToken, body, options = {}) {
1599
964
  if (body === null || body === void 0) {
1600
965
  throw new Error(
1601
966
  "'body' is a required parameter but is null or undefined."
1602
967
  );
1603
968
  }
1604
- const urlPath = "/v2/account/unlink/email";
969
+ const urlPath = "/v2/account/link/email";
1605
970
  const queryParams = /* @__PURE__ */ new Map();
1606
971
  let bodyJson = "";
1607
972
  bodyJson = JSON.stringify(body || {});
@@ -1625,14 +990,12 @@ var MezonApi = class {
1625
990
  )
1626
991
  ]);
1627
992
  }
1628
- /** Remove Facebook from the social profiles on the current user's account. */
1629
- unlinkFacebook(bearerToken, body, options = {}) {
993
+ /** Add a mezon ID to the social profiles on the current user's account. */
994
+ linkMezon(bearerToken, body, options = {}) {
1630
995
  if (body === null || body === void 0) {
1631
- throw new Error(
1632
- "'body' is a required parameter but is null or undefined."
1633
- );
996
+ throw new Error("'body' is a required parameter but is null or undefined.");
1634
997
  }
1635
- const urlPath = "/v2/account/unlink/facebook";
998
+ const urlPath = "/v2/account/link/mezon";
1636
999
  const queryParams = /* @__PURE__ */ new Map();
1637
1000
  let bodyJson = "";
1638
1001
  bodyJson = JSON.stringify(body || {});
@@ -1656,14 +1019,14 @@ var MezonApi = class {
1656
1019
  )
1657
1020
  ]);
1658
1021
  }
1659
- /** Remove Facebook Instant Game profile from the social profiles on the current user's account. */
1660
- unlinkFacebookInstantGame(bearerToken, body, options = {}) {
1022
+ /** Authenticate a user with an email+password against the server. */
1023
+ registrationEmail(bearerToken, body, options = {}) {
1661
1024
  if (body === null || body === void 0) {
1662
1025
  throw new Error(
1663
1026
  "'body' is a required parameter but is null or undefined."
1664
1027
  );
1665
1028
  }
1666
- const urlPath = "/v2/account/unlink/facebookinstantgame";
1029
+ const urlPath = "/v2/account/registry";
1667
1030
  const queryParams = /* @__PURE__ */ new Map();
1668
1031
  let bodyJson = "";
1669
1032
  bodyJson = JSON.stringify(body || {});
@@ -1687,21 +1050,21 @@ var MezonApi = class {
1687
1050
  )
1688
1051
  ]);
1689
1052
  }
1690
- /** Remove Apple's GameCenter from the social profiles on the current user's account. */
1691
- unlinkGameCenter(bearerToken, body, options = {}) {
1053
+ /** Refresh a user's session using a refresh token retrieved from a previous authentication request. */
1054
+ sessionRefresh(basicAuthUsername, basicAuthPassword, body, options = {}) {
1692
1055
  if (body === null || body === void 0) {
1693
1056
  throw new Error(
1694
1057
  "'body' is a required parameter but is null or undefined."
1695
1058
  );
1696
1059
  }
1697
- const urlPath = "/v2/account/unlink/gamecenter";
1060
+ const urlPath = "/v2/account/session/refresh";
1698
1061
  const queryParams = /* @__PURE__ */ new Map();
1699
1062
  let bodyJson = "";
1700
1063
  bodyJson = JSON.stringify(body || {});
1701
1064
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1702
1065
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1703
- if (bearerToken) {
1704
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1066
+ if (basicAuthUsername) {
1067
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
1705
1068
  }
1706
1069
  return Promise.race([
1707
1070
  fetch(fullUrl, fetchOptions).then((response) => {
@@ -1718,14 +1081,14 @@ var MezonApi = class {
1718
1081
  )
1719
1082
  ]);
1720
1083
  }
1721
- /** Remove Google from the social profiles on the current user's account. */
1722
- unlinkGoogle(bearerToken, body, options = {}) {
1084
+ /** Remove the email+password from the social profiles on the current user's account. */
1085
+ unlinkEmail(bearerToken, body, options = {}) {
1723
1086
  if (body === null || body === void 0) {
1724
1087
  throw new Error(
1725
1088
  "'body' is a required parameter but is null or undefined."
1726
1089
  );
1727
1090
  }
1728
- const urlPath = "/v2/account/unlink/google";
1091
+ const urlPath = "/v2/account/unlink/email";
1729
1092
  const queryParams = /* @__PURE__ */ new Map();
1730
1093
  let bodyJson = "";
1731
1094
  bodyJson = JSON.stringify(body || {});
@@ -1778,37 +1141,6 @@ var MezonApi = class {
1778
1141
  )
1779
1142
  ]);
1780
1143
  }
1781
- /** Remove Steam from the social profiles on the current user's account. */
1782
- unlinkSteam(bearerToken, body, options = {}) {
1783
- if (body === null || body === void 0) {
1784
- throw new Error(
1785
- "'body' is a required parameter but is null or undefined."
1786
- );
1787
- }
1788
- const urlPath = "/v2/account/unlink/steam";
1789
- const queryParams = /* @__PURE__ */ new Map();
1790
- let bodyJson = "";
1791
- bodyJson = JSON.stringify(body || {});
1792
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1793
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1794
- if (bearerToken) {
1795
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1796
- }
1797
- return Promise.race([
1798
- fetch(fullUrl, fetchOptions).then((response) => {
1799
- if (response.status == 204) {
1800
- return response;
1801
- } else if (response.status >= 200 && response.status < 300) {
1802
- return response.json();
1803
- } else {
1804
- throw response;
1805
- }
1806
- }),
1807
- new Promise(
1808
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1809
- )
1810
- ]);
1811
- }
1812
1144
  /** List activity */
1813
1145
  listActivity(bearerToken, options = {}) {
1814
1146
  const urlPath = "/v2/activity";
@@ -3844,79 +3176,15 @@ var MezonApi = class {
3844
3176
  new Promise(
3845
3177
  (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3846
3178
  )
3847
- ]);
3848
- }
3849
- /** Block one or more users by ID or username. */
3850
- blockFriends(bearerToken, ids, usernames, options = {}) {
3851
- const urlPath = "/v2/friend/block";
3852
- const queryParams = /* @__PURE__ */ new Map();
3853
- queryParams.set("ids", ids);
3854
- queryParams.set("usernames", usernames);
3855
- let bodyJson = "";
3856
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3857
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3858
- if (bearerToken) {
3859
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3860
- }
3861
- return Promise.race([
3862
- fetch(fullUrl, fetchOptions).then((response) => {
3863
- if (response.status == 204) {
3864
- return response;
3865
- } else if (response.status >= 200 && response.status < 300) {
3866
- return response.json();
3867
- } else {
3868
- throw response;
3869
- }
3870
- }),
3871
- new Promise(
3872
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3873
- )
3874
- ]);
3875
- }
3876
- /** Import Facebook friends and add them to a user's account. */
3877
- importFacebookFriends(bearerToken, account, reset, options = {}) {
3878
- if (account === null || account === void 0) {
3879
- throw new Error(
3880
- "'account' is a required parameter but is null or undefined."
3881
- );
3882
- }
3883
- const urlPath = "/v2/friend/facebook";
3884
- const queryParams = /* @__PURE__ */ new Map();
3885
- queryParams.set("reset", reset);
3886
- let bodyJson = "";
3887
- bodyJson = JSON.stringify(account || {});
3888
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3889
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3890
- if (bearerToken) {
3891
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3892
- }
3893
- return Promise.race([
3894
- fetch(fullUrl, fetchOptions).then((response) => {
3895
- if (response.status == 204) {
3896
- return response;
3897
- } else if (response.status >= 200 && response.status < 300) {
3898
- return response.json();
3899
- } else {
3900
- throw response;
3901
- }
3902
- }),
3903
- new Promise(
3904
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3905
- )
3906
- ]);
3907
- }
3908
- /** Import Steam friends and add them to a user's account. */
3909
- importSteamFriends(bearerToken, account, reset, options = {}) {
3910
- if (account === null || account === void 0) {
3911
- throw new Error(
3912
- "'account' is a required parameter but is null or undefined."
3913
- );
3914
- }
3915
- const urlPath = "/v2/friend/steam";
3179
+ ]);
3180
+ }
3181
+ /** Block one or more users by ID or username. */
3182
+ blockFriends(bearerToken, ids, usernames, options = {}) {
3183
+ const urlPath = "/v2/friend/block";
3916
3184
  const queryParams = /* @__PURE__ */ new Map();
3917
- queryParams.set("reset", reset);
3185
+ queryParams.set("ids", ids);
3186
+ queryParams.set("usernames", usernames);
3918
3187
  let bodyJson = "";
3919
- bodyJson = JSON.stringify(account || {});
3920
3188
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3921
3189
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3922
3190
  if (bearerToken) {
@@ -8558,52 +7826,14 @@ var Client = class {
8558
7826
  const basePath = `${scheme}${host}:${port}`;
8559
7827
  this.apiClient = new MezonApi(serverkey, basePath, timeout);
8560
7828
  }
8561
- /** Add users to a channel, or accept their join requests. */
8562
- addChannelUsers(session, channelId, ids) {
8563
- return __async(this, null, function* () {
8564
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
8565
- yield this.sessionRefresh(session);
8566
- }
8567
- return this.apiClient.addChannelUsers(session.token, channelId, ids).then((response) => {
8568
- return response !== void 0;
8569
- });
8570
- });
8571
- }
8572
- /** Add friends by ID or username to a user's account. */
8573
- addFriends(session, ids, usernames) {
8574
- return __async(this, null, function* () {
8575
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
8576
- yield this.sessionRefresh(session);
8577
- }
8578
- return this.apiClient.addFriends(session.token, ids, usernames).then((response) => {
8579
- return response !== void 0;
8580
- });
8581
- });
8582
- }
8583
- /** Authenticate a user with an Apple ID against the server. */
8584
- authenticateApple(_0, _1, _2) {
8585
- return __async(this, arguments, function* (token, create, username, vars = {}, options = {}) {
8586
- const request = {
8587
- token,
8588
- vars
8589
- };
8590
- return this.apiClient.authenticateApple(this.serverkey, "", request, create, username, options).then((apiSession) => {
8591
- return new Session(
8592
- apiSession.token || "",
8593
- apiSession.refresh_token || "",
8594
- apiSession.created || false,
8595
- false
8596
- );
8597
- });
8598
- });
8599
- }
8600
7829
  /** Authenticate a user with a custom id against the server. */
8601
- authenticateMezon(token, create, username, isRemember, vars = {}, options = {}) {
7830
+ authenticateMezon(basePath, token, create, username, isRemember, vars = {}, options = {}) {
8602
7831
  const request = {
8603
7832
  token,
8604
7833
  vars
8605
7834
  };
8606
7835
  return this.apiClient.authenticateMezon(
7836
+ basePath,
8607
7837
  this.serverkey,
8608
7838
  "",
8609
7839
  request,
@@ -8620,23 +7850,8 @@ var Client = class {
8620
7850
  );
8621
7851
  });
8622
7852
  }
8623
- /** Authenticate a user with a device id against the server. */
8624
- authenticateDevice(id, create, username, vars) {
8625
- const request = {
8626
- id,
8627
- vars
8628
- };
8629
- return this.apiClient.authenticateDevice(this.serverkey, "", request, create, username).then((apiSession) => {
8630
- return new Session(
8631
- apiSession.token || "",
8632
- apiSession.refresh_token || "",
8633
- apiSession.created || false,
8634
- false
8635
- );
8636
- });
8637
- }
8638
7853
  /** Authenticate a user with an email+password against the server. */
8639
- authenticateEmail(email, password, username, vars) {
7854
+ authenticateEmail(basePath, email, password, username, vars) {
8640
7855
  const request = {
8641
7856
  username,
8642
7857
  account: {
@@ -8645,75 +7860,7 @@ var Client = class {
8645
7860
  vars
8646
7861
  }
8647
7862
  };
8648
- return this.apiClient.authenticateEmail(this.serverkey, "", request, username).then((apiSession) => {
8649
- return new Session(
8650
- apiSession.token || "",
8651
- apiSession.refresh_token || "",
8652
- apiSession.created || false,
8653
- false
8654
- );
8655
- });
8656
- }
8657
- /** Authenticate a user with a Facebook Instant Game token against the server. */
8658
- authenticateFacebookInstantGame(signedPlayerInfo, create, username, vars, options = {}) {
8659
- const request = {
8660
- signed_player_info: signedPlayerInfo,
8661
- vars
8662
- };
8663
- return this.apiClient.authenticateFacebookInstantGame(
8664
- this.serverkey,
8665
- "",
8666
- { signed_player_info: request.signed_player_info, vars: request.vars },
8667
- create,
8668
- username,
8669
- options
8670
- ).then((apiSession) => {
8671
- return new Session(
8672
- apiSession.token || "",
8673
- apiSession.refresh_token || "",
8674
- apiSession.created || false,
8675
- false
8676
- );
8677
- });
8678
- }
8679
- /** Authenticate a user with a Facebook OAuth token against the server. */
8680
- authenticateFacebook(token, create, username, sync, vars, options = {}) {
8681
- const request = {
8682
- token,
8683
- vars
8684
- };
8685
- return this.apiClient.authenticateFacebook(
8686
- this.serverkey,
8687
- "",
8688
- request,
8689
- create,
8690
- username,
8691
- sync,
8692
- options
8693
- ).then((apiSession) => {
8694
- return new Session(
8695
- apiSession.token || "",
8696
- apiSession.refresh_token || "",
8697
- apiSession.created || false,
8698
- false
8699
- );
8700
- });
8701
- }
8702
- /** Authenticate a user with Google against the server. */
8703
- authenticateGoogle(_0, _1, _2, _3) {
8704
- return __async(this, arguments, function* (token, create, username, vars, options = {}) {
8705
- const request = {
8706
- token,
8707
- vars
8708
- };
8709
- const apiSession = yield this.apiClient.authenticateGoogle(
8710
- this.serverkey,
8711
- "",
8712
- request,
8713
- create,
8714
- username,
8715
- options
8716
- );
7863
+ return this.apiClient.authenticateEmail(basePath, this.serverkey, "", request, username).then((apiSession) => {
8717
7864
  return new Session(
8718
7865
  apiSession.token || "",
8719
7866
  apiSession.refresh_token || "",
@@ -8722,49 +7869,25 @@ var Client = class {
8722
7869
  );
8723
7870
  });
8724
7871
  }
8725
- /** Authenticate a user with GameCenter against the server. */
8726
- authenticateGameCenter(_0, _1, _2, _3, _4, _5, _6, _7, _8) {
8727
- return __async(this, arguments, function* (bundleId, playerId, publicKeyUrl, salt, signature, timestamp, username, create, vars, options = {}) {
8728
- const request = {
8729
- bundle_id: bundleId,
8730
- player_id: playerId,
8731
- public_key_url: publicKeyUrl,
8732
- salt,
8733
- signature,
8734
- timestamp_seconds: timestamp,
8735
- vars
8736
- };
8737
- const apiSession = yield this.apiClient.authenticateGameCenter(
8738
- this.serverkey,
8739
- "",
8740
- request,
8741
- create,
8742
- username,
8743
- options
8744
- );
8745
- return new Session(
8746
- apiSession.token || "",
8747
- apiSession.refresh_token || "",
8748
- apiSession.created || false,
8749
- false
8750
- );
7872
+ /** Add users to a channel, or accept their join requests. */
7873
+ addChannelUsers(session, channelId, ids) {
7874
+ return __async(this, null, function* () {
7875
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
7876
+ yield this.sessionRefresh(session);
7877
+ }
7878
+ return this.apiClient.addChannelUsers(session.token, channelId, ids).then((response) => {
7879
+ return response !== void 0;
7880
+ });
8751
7881
  });
8752
7882
  }
8753
- /** Authenticate a user with Steam against the server. */
8754
- authenticateSteam(token, create, username, sync, vars) {
7883
+ /** Add friends by ID or username to a user's account. */
7884
+ addFriends(session, ids, usernames) {
8755
7885
  return __async(this, null, function* () {
8756
- const request = {
8757
- token,
8758
- vars,
8759
- sync
8760
- };
8761
- return this.apiClient.authenticateSteam(this.serverkey, "", request, create, username).then((apiSession) => {
8762
- return new Session(
8763
- apiSession.token || "",
8764
- apiSession.refresh_token || "",
8765
- apiSession.created || false,
8766
- false
8767
- );
7886
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
7887
+ yield this.sessionRefresh(session);
7888
+ }
7889
+ return this.apiClient.addFriends(session.token, ids, usernames).then((response) => {
7890
+ return response !== void 0;
8768
7891
  });
8769
7892
  });
8770
7893
  }
@@ -9001,28 +8124,6 @@ var Client = class {
9001
8124
  return this.apiClient.getAccount(session.token);
9002
8125
  });
9003
8126
  }
9004
- /** Import Facebook friends and add them to a user's account. */
9005
- importFacebookFriends(session, request) {
9006
- return __async(this, null, function* () {
9007
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9008
- yield this.sessionRefresh(session);
9009
- }
9010
- return this.apiClient.importFacebookFriends(session.token, request).then((response) => {
9011
- return response !== void 0;
9012
- });
9013
- });
9014
- }
9015
- /** Import Steam friends and add them to a user's account. */
9016
- importSteamFriends(session, request, reset) {
9017
- return __async(this, null, function* () {
9018
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9019
- yield this.sessionRefresh(session);
9020
- }
9021
- return this.apiClient.importSteamFriends(session.token, request, reset).then((response) => {
9022
- return response !== void 0;
9023
- });
9024
- });
9025
- }
9026
8127
  /** Fetch zero or more users by ID and/or username. */
9027
8128
  getUsers(session, ids, usernames, facebookIds) {
9028
8129
  return __async(this, null, function* () {
@@ -9457,17 +8558,6 @@ var Client = class {
9457
8558
  });
9458
8559
  });
9459
8560
  }
9460
- /** Add an Apple ID to the social profiles on the current user's account. */
9461
- linkApple(session, request) {
9462
- return __async(this, null, function* () {
9463
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9464
- yield this.sessionRefresh(session);
9465
- }
9466
- return this.apiClient.linkApple(session.token, request).then((response) => {
9467
- return response !== void 0;
9468
- });
9469
- });
9470
- }
9471
8561
  //
9472
8562
  closeDirectMess(session, request) {
9473
8563
  return __async(this, null, function* () {
@@ -9501,17 +8591,6 @@ var Client = class {
9501
8591
  });
9502
8592
  });
9503
8593
  }
9504
- /** Add a device ID to the social profiles on the current user's account. */
9505
- linkDevice(session, request) {
9506
- return __async(this, null, function* () {
9507
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9508
- yield this.sessionRefresh(session);
9509
- }
9510
- return this.apiClient.linkDevice(session.token, request).then((response) => {
9511
- return response !== void 0;
9512
- });
9513
- });
9514
- }
9515
8594
  /** Add an email+password to the social profiles on the current user's account. */
9516
8595
  linkEmail(session, request) {
9517
8596
  return __async(this, null, function* () {
@@ -9523,61 +8602,6 @@ var Client = class {
9523
8602
  });
9524
8603
  });
9525
8604
  }
9526
- /** Add Facebook to the social profiles on the current user's account. */
9527
- linkFacebook(session, request) {
9528
- return __async(this, null, function* () {
9529
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9530
- yield this.sessionRefresh(session);
9531
- }
9532
- return this.apiClient.linkFacebook(session.token, request).then((response) => {
9533
- return response !== void 0;
9534
- });
9535
- });
9536
- }
9537
- /** Add Facebook Instant to the social profiles on the current user's account. */
9538
- linkFacebookInstantGame(session, request) {
9539
- return __async(this, null, function* () {
9540
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9541
- yield this.sessionRefresh(session);
9542
- }
9543
- return this.apiClient.linkFacebookInstantGame(session.token, request).then((response) => {
9544
- return response !== void 0;
9545
- });
9546
- });
9547
- }
9548
- /** Add Google to the social profiles on the current user's account. */
9549
- linkGoogle(session, request) {
9550
- return __async(this, null, function* () {
9551
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9552
- yield this.sessionRefresh(session);
9553
- }
9554
- return this.apiClient.linkGoogle(session.token, request).then((response) => {
9555
- return response !== void 0;
9556
- });
9557
- });
9558
- }
9559
- /** Add GameCenter to the social profiles on the current user's account. */
9560
- linkGameCenter(session, request) {
9561
- return __async(this, null, function* () {
9562
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9563
- yield this.sessionRefresh(session);
9564
- }
9565
- return this.apiClient.linkGameCenter(session.token, request).then((response) => {
9566
- return response !== void 0;
9567
- });
9568
- });
9569
- }
9570
- /** Add Steam to the social profiles on the current user's account. */
9571
- linkSteam(session, request) {
9572
- return __async(this, null, function* () {
9573
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9574
- yield this.sessionRefresh(session);
9575
- }
9576
- return this.apiClient.linkSteam(session.token, request).then((response) => {
9577
- return response !== void 0;
9578
- });
9579
- });
9580
- }
9581
8605
  /** List all friends for the current user. */
9582
8606
  listFriends(session, state, limit, cursor) {
9583
8607
  return __async(this, null, function* () {
@@ -9750,17 +8774,6 @@ var Client = class {
9750
8774
  return this.refreshTokenPromise;
9751
8775
  });
9752
8776
  }
9753
- /** Remove the Apple ID from the social profiles on the current user's account. */
9754
- unlinkApple(session, request) {
9755
- return __async(this, null, function* () {
9756
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9757
- yield this.sessionRefresh(session);
9758
- }
9759
- return this.apiClient.unlinkApple(session.token, request).then((response) => {
9760
- return response !== void 0;
9761
- });
9762
- });
9763
- }
9764
8777
  /** Remove custom ID from the social profiles on the current user's account. */
9765
8778
  unlinkCustom(session, request) {
9766
8779
  return __async(this, null, function* () {
@@ -9772,17 +8785,6 @@ var Client = class {
9772
8785
  });
9773
8786
  });
9774
8787
  }
9775
- /** Remove a device ID from the social profiles on the current user's account. */
9776
- unlinkDevice(session, request) {
9777
- return __async(this, null, function* () {
9778
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9779
- yield this.sessionRefresh(session);
9780
- }
9781
- return this.apiClient.unlinkDevice(session.token, request).then((response) => {
9782
- return response !== void 0;
9783
- });
9784
- });
9785
- }
9786
8788
  /** Remove an email+password from the social profiles on the current user's account. */
9787
8789
  unlinkEmail(session, request) {
9788
8790
  return __async(this, null, function* () {
@@ -9794,61 +8796,6 @@ var Client = class {
9794
8796
  });
9795
8797
  });
9796
8798
  }
9797
- /** Remove Facebook from the social profiles on the current user's account. */
9798
- unlinkFacebook(session, request) {
9799
- return __async(this, null, function* () {
9800
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9801
- yield this.sessionRefresh(session);
9802
- }
9803
- return this.apiClient.unlinkFacebook(session.token, request).then((response) => {
9804
- return response !== void 0;
9805
- });
9806
- });
9807
- }
9808
- /** Remove Facebook Instant social profiles from the current user's account. */
9809
- unlinkFacebookInstantGame(session, request) {
9810
- return __async(this, null, function* () {
9811
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9812
- yield this.sessionRefresh(session);
9813
- }
9814
- return this.apiClient.unlinkFacebookInstantGame(session.token, request).then((response) => {
9815
- return response !== void 0;
9816
- });
9817
- });
9818
- }
9819
- /** Remove Google from the social profiles on the current user's account. */
9820
- unlinkGoogle(session, request) {
9821
- return __async(this, null, function* () {
9822
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9823
- yield this.sessionRefresh(session);
9824
- }
9825
- return this.apiClient.unlinkGoogle(session.token, request).then((response) => {
9826
- return response !== void 0;
9827
- });
9828
- });
9829
- }
9830
- /** Remove GameCenter from the social profiles on the current user's account. */
9831
- unlinkGameCenter(session, request) {
9832
- return __async(this, null, function* () {
9833
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9834
- yield this.sessionRefresh(session);
9835
- }
9836
- return this.apiClient.unlinkGameCenter(session.token, request).then((response) => {
9837
- return response !== void 0;
9838
- });
9839
- });
9840
- }
9841
- /** Remove Steam from the social profiles on the current user's account. */
9842
- unlinkSteam(session, request) {
9843
- return __async(this, null, function* () {
9844
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
9845
- yield this.sessionRefresh(session);
9846
- }
9847
- return this.apiClient.unlinkSteam(session.token, request).then((response) => {
9848
- return response !== void 0;
9849
- });
9850
- });
9851
- }
9852
8799
  /** Update fields in the current user's account. */
9853
8800
  updateAccount(session, request) {
9854
8801
  return __async(this, null, function* () {
@@ -10853,9 +9800,10 @@ var Client = class {
10853
9800
  });
10854
9801
  });
10855
9802
  }
10856
- createQRLogin(requet) {
9803
+ createQRLogin(basePath, requet) {
10857
9804
  return __async(this, null, function* () {
10858
9805
  const apiSession = yield this.apiClient.createQRLogin(
9806
+ basePath,
10859
9807
  this.serverkey,
10860
9808
  "",
10861
9809
  requet
@@ -10867,9 +9815,10 @@ var Client = class {
10867
9815
  return response;
10868
9816
  });
10869
9817
  }
10870
- checkLoginRequest(requet) {
9818
+ checkLoginRequest(basePath, requet) {
10871
9819
  return __async(this, null, function* () {
10872
9820
  const apiSession = yield this.apiClient.checkLoginRequest(
9821
+ basePath,
10873
9822
  this.serverkey,
10874
9823
  "",
10875
9824
  requet
@@ -10885,12 +9834,12 @@ var Client = class {
10885
9834
  );
10886
9835
  });
10887
9836
  }
10888
- confirmLogin(session, body) {
9837
+ confirmLogin(basePath, session, body) {
10889
9838
  return __async(this, null, function* () {
10890
9839
  if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
10891
9840
  yield this.sessionRefresh(session);
10892
9841
  }
10893
- return this.apiClient.confirmLogin(session.token, body).then((response) => {
9842
+ return this.apiClient.confirmLogin(basePath, session.token, body).then((response) => {
10894
9843
  return response;
10895
9844
  });
10896
9845
  });