mezon-js 2.9.54 → 2.9.56

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -81,10 +81,12 @@ export interface ApiAddAppRequest {
81
81
  appname?: string;
82
82
  //Creator of the app.
83
83
  creator_id?: string;
84
- //
84
+ //Role of this app.
85
85
  role?: ApiAppRole;
86
86
  //The password.
87
87
  token?: string;
88
+ //Is shadow.
89
+ is_shadow?: boolean;
88
90
  }
89
91
 
90
92
  /**
@@ -2879,39 +2881,6 @@ export class MezonApi {
2879
2881
  ]);
2880
2882
  }
2881
2883
 
2882
- /** */
2883
- getInfoLoginRequest(bearerToken: string,
2884
- loginId?:string,
2885
- options: any = {}): Promise<ApiLoginIDResponse> {
2886
-
2887
- const urlPath = "/v2/account/authenticate/getinfologin";
2888
- const queryParams = new Map<string, any>();
2889
- queryParams.set("login_id", loginId);
2890
-
2891
- let bodyJson : string = "";
2892
-
2893
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2894
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2895
- if (bearerToken) {
2896
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2897
- }
2898
-
2899
- return Promise.race([
2900
- fetch(fullUrl, fetchOptions).then((response) => {
2901
- if (response.status == 204) {
2902
- return response;
2903
- } else if (response.status >= 200 && response.status < 300) {
2904
- return response.json();
2905
- } else {
2906
- throw response;
2907
- }
2908
- }),
2909
- new Promise((_, reject) =>
2910
- setTimeout(reject, this.timeoutMs, "Request timed out.")
2911
- ),
2912
- ]);
2913
- }
2914
-
2915
2884
  /** Authenticate a user with Google against the server. */
2916
2885
  authenticateGoogle(
2917
2886
  basicAuthUsername: string,
@@ -3822,7 +3791,7 @@ export class MezonApi {
3822
3791
  /** Create user activity */
3823
3792
  createActiviy(bearerToken: string,
3824
3793
  body:ApiCreateActivityRequest,
3825
- options: any = {}): Promise<any> {
3794
+ options: any = {}): Promise<ApiUserActivity> {
3826
3795
 
3827
3796
  if (body === null || body === undefined) {
3828
3797
  throw new Error("'body' is a required parameter but is null or undefined.");
package/client.ts CHANGED
@@ -131,6 +131,7 @@ import {
131
131
  ApiLoginIDResponse,
132
132
  ApiLoginRequest,
133
133
  ApiConfirmLoginRequest,
134
+ ApiUserActivity,
134
135
  } from "./api.gen";
135
136
 
136
137
  import { Session } from "./session";
@@ -4198,7 +4199,7 @@ export class Client {
4198
4199
  async createActiviy(
4199
4200
  session: Session,
4200
4201
  request: ApiCreateActivityRequest
4201
- ): Promise<any> {
4202
+ ): Promise<ApiUserActivity> {
4202
4203
  if (
4203
4204
  this.autoRefreshSession &&
4204
4205
  session.refresh_token &&
@@ -4228,14 +4229,21 @@ export class Client {
4228
4229
  return response
4229
4230
  }
4230
4231
 
4231
- async checkLoginRequest(requet: ApiConfirmLoginRequest): Promise<ApiSession> {
4232
+ async checkLoginRequest(requet: ApiConfirmLoginRequest): Promise<Session | null> {
4232
4233
  const apiSession = await this.apiClient.checkLoginRequest(
4233
4234
  this.serverkey,
4234
4235
  "",
4235
4236
  requet
4236
4237
  );
4238
+ if (!apiSession?.token) {
4239
+ return null
4240
+ }
4241
+ return new Session(
4242
+ apiSession.token || "",
4243
+ apiSession.refresh_token || "",
4244
+ apiSession.created || false
4245
+ );
4237
4246
 
4238
- return apiSession
4239
4247
  }
4240
4248
 
4241
4249
  async confirmLogin(
@@ -4256,23 +4264,4 @@ export class Client {
4256
4264
  return response;
4257
4265
  });
4258
4266
  }
4259
-
4260
- async getInfoLoginRequest(
4261
- session: Session,
4262
- loginId: string
4263
- ): Promise<any> {
4264
- if (
4265
- this.autoRefreshSession &&
4266
- session.refresh_token &&
4267
- session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4268
- ) {
4269
- await this.sessionRefresh(session);
4270
- }
4271
-
4272
- return this.apiClient
4273
- .getInfoLoginRequest(session.token, loginId)
4274
- .then((response: any) => {
4275
- return response;
4276
- });
4277
- }
4278
4267
  }
package/dist/api.gen.d.ts CHANGED
@@ -47,6 +47,7 @@ export interface ApiAddAppRequest {
47
47
  creator_id?: string;
48
48
  role?: ApiAppRole;
49
49
  token?: string;
50
+ is_shadow?: boolean;
50
51
  }
51
52
  /**
52
53
  * - USER_ROLE_ADMIN: All access
@@ -1383,8 +1384,6 @@ export declare class MezonApi {
1383
1384
  authenticateFacebookInstantGame(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountFacebookInstantGame, create?: boolean, username?: string, options?: any): Promise<ApiSession>;
1384
1385
  /** Authenticate a user with Apple's GameCenter against the server. */
1385
1386
  authenticateGameCenter(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountGameCenter, create?: boolean, username?: string, options?: any): Promise<ApiSession>;
1386
- /** */
1387
- getInfoLoginRequest(bearerToken: string, loginId?: string, options?: any): Promise<ApiLoginIDResponse>;
1388
1387
  /** Authenticate a user with Google against the server. */
1389
1388
  authenticateGoogle(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountGoogle, create?: boolean, username?: string, options?: any): Promise<ApiSession>;
1390
1389
  /** Authenticate a user with Steam against the server. */
@@ -1432,7 +1431,7 @@ export declare class MezonApi {
1432
1431
  /** List activity */
1433
1432
  listActivity(bearerToken: string, options?: any): Promise<ApiListUserActivity>;
1434
1433
  /** Create user activity */
1435
- createActiviy(bearerToken: string, body: ApiCreateActivityRequest, options?: any): Promise<any>;
1434
+ createActiviy(bearerToken: string, body: ApiCreateActivityRequest, options?: any): Promise<ApiUserActivity>;
1436
1435
  /** Add a new apps. */
1437
1436
  addApp(bearerToken: string, body: ApiAddAppRequest, options?: any): Promise<any>;
1438
1437
  /** List (and optionally filter) accounts. */
package/dist/client.d.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiSession, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest } from "./api.gen";
16
+ import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -593,9 +593,8 @@ export declare class Client {
593
593
  getListFavoriteChannel(session: Session, clanId: string): Promise<any>;
594
594
  /** List activity */
595
595
  listActivity(session: Session): Promise<ApiListUserActivity>;
596
- createActiviy(session: Session, request: ApiCreateActivityRequest): Promise<any>;
596
+ createActiviy(session: Session, request: ApiCreateActivityRequest): Promise<ApiUserActivity>;
597
597
  createQRLogin(requet: ApiLoginRequest): Promise<ApiLoginIDResponse>;
598
- checkLoginRequest(requet: ApiConfirmLoginRequest): Promise<ApiSession>;
598
+ checkLoginRequest(requet: ApiConfirmLoginRequest): Promise<Session | null>;
599
599
  confirmLogin(session: Session, body: ApiConfirmLoginRequest): Promise<any>;
600
- getInfoLoginRequest(session: Session, loginId: string): Promise<any>;
601
600
  }
@@ -1111,32 +1111,6 @@ var MezonApi = class {
1111
1111
  )
1112
1112
  ]);
1113
1113
  }
1114
- /** */
1115
- getInfoLoginRequest(bearerToken, loginId, options = {}) {
1116
- const urlPath = "/v2/account/authenticate/getinfologin";
1117
- const queryParams = /* @__PURE__ */ new Map();
1118
- queryParams.set("login_id", loginId);
1119
- let bodyJson = "";
1120
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1121
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
1122
- if (bearerToken) {
1123
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1124
- }
1125
- return Promise.race([
1126
- fetch(fullUrl, fetchOptions).then((response) => {
1127
- if (response.status == 204) {
1128
- return response;
1129
- } else if (response.status >= 200 && response.status < 300) {
1130
- return response.json();
1131
- } else {
1132
- throw response;
1133
- }
1134
- }),
1135
- new Promise(
1136
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1137
- )
1138
- ]);
1139
- }
1140
1114
  /** Authenticate a user with Google against the server. */
1141
1115
  authenticateGoogle(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
1142
1116
  if (account === null || account === void 0) {
@@ -9100,7 +9074,14 @@ var Client = class {
9100
9074
  "",
9101
9075
  requet
9102
9076
  );
9103
- return apiSession;
9077
+ if (!(apiSession == null ? void 0 : apiSession.token)) {
9078
+ return null;
9079
+ }
9080
+ return new Session(
9081
+ apiSession.token || "",
9082
+ apiSession.refresh_token || "",
9083
+ apiSession.created || false
9084
+ );
9104
9085
  });
9105
9086
  }
9106
9087
  confirmLogin(session, body) {
@@ -9113,14 +9094,4 @@ var Client = class {
9113
9094
  });
9114
9095
  });
9115
9096
  }
9116
- getInfoLoginRequest(session, loginId) {
9117
- return __async(this, null, function* () {
9118
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9119
- yield this.sessionRefresh(session);
9120
- }
9121
- return this.apiClient.getInfoLoginRequest(session.token, loginId).then((response) => {
9122
- return response;
9123
- });
9124
- });
9125
- }
9126
9097
  };
@@ -1082,32 +1082,6 @@ var MezonApi = class {
1082
1082
  )
1083
1083
  ]);
1084
1084
  }
1085
- /** */
1086
- getInfoLoginRequest(bearerToken, loginId, options = {}) {
1087
- const urlPath = "/v2/account/authenticate/getinfologin";
1088
- const queryParams = /* @__PURE__ */ new Map();
1089
- queryParams.set("login_id", loginId);
1090
- let bodyJson = "";
1091
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1092
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
1093
- if (bearerToken) {
1094
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1095
- }
1096
- return Promise.race([
1097
- fetch(fullUrl, fetchOptions).then((response) => {
1098
- if (response.status == 204) {
1099
- return response;
1100
- } else if (response.status >= 200 && response.status < 300) {
1101
- return response.json();
1102
- } else {
1103
- throw response;
1104
- }
1105
- }),
1106
- new Promise(
1107
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1108
- )
1109
- ]);
1110
- }
1111
1085
  /** Authenticate a user with Google against the server. */
1112
1086
  authenticateGoogle(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
1113
1087
  if (account === null || account === void 0) {
@@ -9071,7 +9045,14 @@ var Client = class {
9071
9045
  "",
9072
9046
  requet
9073
9047
  );
9074
- return apiSession;
9048
+ if (!(apiSession == null ? void 0 : apiSession.token)) {
9049
+ return null;
9050
+ }
9051
+ return new Session(
9052
+ apiSession.token || "",
9053
+ apiSession.refresh_token || "",
9054
+ apiSession.created || false
9055
+ );
9075
9056
  });
9076
9057
  }
9077
9058
  confirmLogin(session, body) {
@@ -9084,16 +9065,6 @@ var Client = class {
9084
9065
  });
9085
9066
  });
9086
9067
  }
9087
- getInfoLoginRequest(session, loginId) {
9088
- return __async(this, null, function* () {
9089
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9090
- yield this.sessionRefresh(session);
9091
- }
9092
- return this.apiClient.getInfoLoginRequest(session.token, loginId).then((response) => {
9093
- return response;
9094
- });
9095
- });
9096
- }
9097
9068
  };
9098
9069
  export {
9099
9070
  ChannelStreamMode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.54",
4
+ "version": "2.9.56",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"