mezon-js 2.8.49 → 2.8.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api.gen.ts CHANGED
@@ -44,6 +44,8 @@ export interface MezonChangeChannelCategoryBody {
44
44
 
45
45
  /** Update app information. */
46
46
  export interface MezonUpdateAppBody {
47
+ //about the app.
48
+ about?: string;
47
49
  //Avatar URL.
48
50
  applogo?: string;
49
51
  //Username.
@@ -311,7 +313,7 @@ export interface ApiAccountGameCenter {
311
313
  //The verification signature data generated.
312
314
  signature?: string;
313
315
  //Time since UNIX epoch when the signature was created.
314
- timestamp_seconds?: string;
316
+ timestamp_seconds?: number;
315
317
  //Extra information that will be bundled in the session token.
316
318
  vars?: Record<string, string>;
317
319
  }
@@ -559,7 +561,7 @@ export interface ApiChannelMessageHeader {
559
561
  //
560
562
  sender_id?: string;
561
563
  //
562
- timestamp?: string;
564
+ timestamp_seconds?: number;
563
565
  }
564
566
 
565
567
  /** A list of channel messages, usually a result of a list operation. */
@@ -3114,7 +3116,7 @@ export class MezonApi {
3114
3116
  bodyJson = JSON.stringify(body || {});
3115
3117
 
3116
3118
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3117
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3119
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
3118
3120
  if (bearerToken) {
3119
3121
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3120
3122
  }
package/client.ts CHANGED
@@ -97,6 +97,7 @@ import {
97
97
  ApiAppList,
98
98
  ApiApp,
99
99
  MezonUpdateRoleDeleteBody,
100
+ MezonUpdateAppBody,
100
101
  } from "./api.gen";
101
102
 
102
103
  import { Session } from "./session";
@@ -616,7 +617,7 @@ export class Client {
616
617
  publicKeyUrl: string,
617
618
  salt: string,
618
619
  signature: string,
619
- timestamp: string,
620
+ timestamp: number,
620
621
  username?: string,
621
622
  create?: boolean,
622
623
  vars?: Record<string, string>,
@@ -1855,6 +1856,18 @@ export class Client {
1855
1856
  });
1856
1857
  }
1857
1858
 
1859
+ /** Update fields in a given event. */
1860
+ async updateApp(session: Session, roleId: string, request: MezonUpdateAppBody): Promise<boolean> {
1861
+ if (this.autoRefreshSession && session.refresh_token &&
1862
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1863
+ await this.sessionRefresh(session);
1864
+ }
1865
+
1866
+ return this.apiClient.updateApp(session.token, roleId, request).then((response: any) => {
1867
+ return response !== undefined;
1868
+ });
1869
+ }
1870
+
1858
1871
  /** Update fields in a given clan profile. */
1859
1872
  async createLinkInviteUser(session: Session, request: ApiLinkInviteUserRequest): Promise<ApiLinkInviteUser> {
1860
1873
  if (this.autoRefreshSession && session.refresh_token &&
package/dist/api.gen.d.ts CHANGED
@@ -22,6 +22,7 @@ export interface MezonChangeChannelCategoryBody {
22
22
  }
23
23
  /** Update app information. */
24
24
  export interface MezonUpdateAppBody {
25
+ about?: string;
25
26
  applogo?: string;
26
27
  appname?: string;
27
28
  metadata?: string;
@@ -180,7 +181,7 @@ export interface ApiAccountGameCenter {
180
181
  public_key_url?: string;
181
182
  salt?: string;
182
183
  signature?: string;
183
- timestamp_seconds?: string;
184
+ timestamp_seconds?: number;
184
185
  vars?: Record<string, string>;
185
186
  }
186
187
  /** Send a Google token to the server. Used with authenticate/link/unlink. */
@@ -318,7 +319,7 @@ export interface ApiChannelMessageHeader {
318
319
  reaction?: string;
319
320
  referece?: string;
320
321
  sender_id?: string;
321
- timestamp?: string;
322
+ timestamp_seconds?: number;
322
323
  }
323
324
  /** A list of channel messages, usually a result of a list operation. */
324
325
  export interface ApiChannelMessageList {
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, ApiRoleList, 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, MezonUpdateRoleDeleteBody } from "./api.gen";
16
+ import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, 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, MezonUpdateRoleDeleteBody, MezonUpdateAppBody } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -343,7 +343,7 @@ export declare class Client {
343
343
  /** Authenticate a user with Google against the server. */
344
344
  authenticateGoogle(token: string, create?: boolean, username?: string, vars?: Record<string, string>, options?: any): Promise<Session>;
345
345
  /** Authenticate a user with GameCenter against the server. */
346
- authenticateGameCenter(bundleId: string, playerId: string, publicKeyUrl: string, salt: string, signature: string, timestamp: string, username?: string, create?: boolean, vars?: Record<string, string>, options?: any): Promise<Session>;
346
+ authenticateGameCenter(bundleId: string, playerId: string, publicKeyUrl: string, salt: string, signature: string, timestamp: number, username?: string, create?: boolean, vars?: Record<string, string>, options?: any): Promise<Session>;
347
347
  /** Authenticate a user with Steam against the server. */
348
348
  authenticateSteam(token: string, create?: boolean, username?: string, sync?: boolean, vars?: Record<string, string>): Promise<Session>;
349
349
  /** Block one or more users by ID or username. */
@@ -493,6 +493,8 @@ export declare class Client {
493
493
  updateRole(session: Session, roleId: string, request: ApiUpdateRoleRequest): Promise<boolean>;
494
494
  /** Update fields in a given event. */
495
495
  updateEvent(session: Session, roleId: string, request: ApiUpdateEventRequest): Promise<boolean>;
496
+ /** Update fields in a given event. */
497
+ updateApp(session: Session, roleId: string, request: MezonUpdateAppBody): Promise<boolean>;
496
498
  /** Update fields in a given clan profile. */
497
499
  createLinkInviteUser(session: Session, request: ApiLinkInviteUserRequest): Promise<ApiLinkInviteUser>;
498
500
  /** Get link invite user */
@@ -1777,7 +1777,7 @@ var MezonApi = class {
1777
1777
  let bodyJson = "";
1778
1778
  bodyJson = JSON.stringify(body || {});
1779
1779
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1780
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1780
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
1781
1781
  if (bearerToken) {
1782
1782
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1783
1783
  }
@@ -6465,6 +6465,17 @@ var Client = class {
6465
6465
  });
6466
6466
  });
6467
6467
  }
6468
+ /** Update fields in a given event. */
6469
+ updateApp(session, roleId, request) {
6470
+ return __async(this, null, function* () {
6471
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6472
+ yield this.sessionRefresh(session);
6473
+ }
6474
+ return this.apiClient.updateApp(session.token, roleId, request).then((response) => {
6475
+ return response !== void 0;
6476
+ });
6477
+ });
6478
+ }
6468
6479
  /** Update fields in a given clan profile. */
6469
6480
  createLinkInviteUser(session, request) {
6470
6481
  return __async(this, null, function* () {
@@ -1748,7 +1748,7 @@ var MezonApi = class {
1748
1748
  let bodyJson = "";
1749
1749
  bodyJson = JSON.stringify(body || {});
1750
1750
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1751
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1751
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
1752
1752
  if (bearerToken) {
1753
1753
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1754
1754
  }
@@ -6436,6 +6436,17 @@ var Client = class {
6436
6436
  });
6437
6437
  });
6438
6438
  }
6439
+ /** Update fields in a given event. */
6440
+ updateApp(session, roleId, request) {
6441
+ return __async(this, null, function* () {
6442
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6443
+ yield this.sessionRefresh(session);
6444
+ }
6445
+ return this.apiClient.updateApp(session.token, roleId, request).then((response) => {
6446
+ return response !== void 0;
6447
+ });
6448
+ });
6449
+ }
6439
6450
  /** Update fields in a given clan profile. */
6440
6451
  createLinkInviteUser(session, request) {
6441
6452
  return __async(this, null, function* () {
package/dist/socket.d.ts CHANGED
@@ -73,7 +73,7 @@ interface ChannelLeave {
73
73
  }
74
74
  export interface AddClanUserEvent {
75
75
  clan_id: string;
76
- user_id: string;
76
+ user: AddUsers;
77
77
  }
78
78
  /** UserChannelAddedEvent */
79
79
  export interface UserChannelAddedEvent {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.8.49",
3
+ "version": "2.8.52",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -91,8 +91,8 @@ interface ChannelLeave {
91
91
  export interface AddClanUserEvent {
92
92
  //the clan id
93
93
  clan_id: string;
94
- // the user id
95
- user_id: string;
94
+ // the user
95
+ user: AddUsers;
96
96
  }
97
97
 
98
98
  /** UserChannelAddedEvent */