mezon-js 2.8.56 → 2.8.58

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -346,8 +346,8 @@ export interface ApiAddRoleChannelDescRequest {
346
346
 
347
347
  /** App information. */
348
348
  export interface ApiApp {
349
- // app id
350
- id: string;
349
+ //
350
+ about?: string;
351
351
  //
352
352
  applogo?: string;
353
353
  //
@@ -357,6 +357,8 @@ export interface ApiApp {
357
357
  //The UNIX time when the app was disabled.
358
358
  disable_time?: string;
359
359
  //
360
+ id?: string;
361
+ //
360
362
  is_shadow?: boolean;
361
363
  //
362
364
  role?: number;
@@ -1047,6 +1049,8 @@ export interface ApiMessageReaction {
1047
1049
  channel_id:string;
1048
1050
  // The mode
1049
1051
  mode: number;
1052
+ // Is public
1053
+ is_public: boolean;
1050
1054
  // The channel label
1051
1055
  channel_label: string;
1052
1056
  /** The message that user react */
@@ -1152,6 +1156,8 @@ export interface ApiPermission {
1152
1156
  //
1153
1157
  id?: string;
1154
1158
  //
1159
+ level?: number;
1160
+ //
1155
1161
  scope?: number;
1156
1162
  //
1157
1163
  slug?: string;
@@ -1161,6 +1167,8 @@ export interface ApiPermission {
1161
1167
 
1162
1168
  /** A list of permission description, usually a result of a list operation. */
1163
1169
  export interface ApiPermissionList {
1170
+ //
1171
+ max_level_permission?: number;
1164
1172
  //A list of permission.
1165
1173
  permissions?: Array<ApiPermission>;
1166
1174
  }
@@ -1260,6 +1268,8 @@ export interface ApiRole {
1260
1268
  //
1261
1269
  id?: string;
1262
1270
  //
1271
+ max_level_permission?: number;
1272
+ //
1263
1273
  permission_list?: ApiPermissionList;
1264
1274
  //
1265
1275
  role_channel_active?: number;
@@ -5651,45 +5661,6 @@ export class MezonApi {
5651
5661
  ]);
5652
5662
  }
5653
5663
 
5654
- /** List user roles */
5655
- listRoles(bearerToken: string,
5656
- limit?:number,
5657
- state?:number,
5658
- cursor?:string,
5659
- clanId?:string,
5660
- options: any = {}): Promise<ApiRoleList> {
5661
-
5662
- const urlPath = "/v2/roles";
5663
- const queryParams = new Map<string, any>();
5664
- queryParams.set("limit", limit);
5665
- queryParams.set("state", state);
5666
- queryParams.set("cursor", cursor);
5667
- queryParams.set("clan_id", clanId);
5668
-
5669
- let bodyJson : string = "";
5670
-
5671
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5672
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5673
- if (bearerToken) {
5674
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5675
- }
5676
-
5677
- return Promise.race([
5678
- fetch(fullUrl, fetchOptions).then((response) => {
5679
- if (response.status == 204) {
5680
- return response;
5681
- } else if (response.status >= 200 && response.status < 300) {
5682
- return response.json();
5683
- } else {
5684
- throw response;
5685
- }
5686
- }),
5687
- new Promise((_, reject) =>
5688
- setTimeout(reject, this.timeoutMs, "Request timed out.")
5689
- ),
5690
- ]);
5691
- }
5692
-
5693
5664
  /** Create a new role for clan. */
5694
5665
  createRole(bearerToken: string,
5695
5666
  body:ApiCreateRoleRequest,
package/client.ts CHANGED
@@ -34,7 +34,6 @@ import {
34
34
  ApiClanDesc,
35
35
  ApiCategoryDesc,
36
36
  ApiCategoryDescList,
37
- ApiRoleList,
38
37
  ApiPermissionList,
39
38
  ApiRoleUserList,
40
39
  ApiRole,
@@ -1288,18 +1287,6 @@ export class Client {
1288
1287
  });
1289
1288
  }
1290
1289
 
1291
- /** List user roles */
1292
- async listRoles(session: Session, limit?:number, state?:number, cursor?:string, clanId?:string): Promise<ApiRoleList> {
1293
- if (this.autoRefreshSession && session.refresh_token &&
1294
- session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1295
- await this.sessionRefresh(session);
1296
- }
1297
-
1298
- return this.apiClient.listRoles(session.token, limit, state, cursor, clanId).then((response: ApiRoleList) => {
1299
- return Promise.resolve(response);
1300
- });
1301
- }
1302
-
1303
1290
  /** List event */
1304
1291
  async listEvents(session: Session, clanId?:string): Promise<ApiEventList> {
1305
1292
  if (this.autoRefreshSession && session.refresh_token &&
package/dist/api.gen.d.ts CHANGED
@@ -202,11 +202,12 @@ export interface ApiAddRoleChannelDescRequest {
202
202
  }
203
203
  /** App information. */
204
204
  export interface ApiApp {
205
- id: string;
205
+ about?: string;
206
206
  applogo?: string;
207
207
  appname?: string;
208
208
  creator_id?: string;
209
209
  disable_time?: string;
210
+ id?: string;
210
211
  is_shadow?: boolean;
211
212
  role?: number;
212
213
  token?: string;
@@ -605,6 +606,7 @@ export interface ApiMessageReaction {
605
606
  /** The channel this message belongs to. */
606
607
  channel_id: string;
607
608
  mode: number;
609
+ is_public: boolean;
608
610
  channel_label: string;
609
611
  /** The message that user react */
610
612
  message_id: string;
@@ -666,12 +668,14 @@ export interface ApiPermission {
666
668
  active?: number;
667
669
  description?: string;
668
670
  id?: string;
671
+ level?: number;
669
672
  scope?: number;
670
673
  slug?: string;
671
674
  title?: string;
672
675
  }
673
676
  /** A list of permission description, usually a result of a list operation. */
674
677
  export interface ApiPermissionList {
678
+ max_level_permission?: number;
675
679
  permissions?: Array<ApiPermission>;
676
680
  }
677
681
  /** */
@@ -729,6 +733,7 @@ export interface ApiRole {
729
733
  description?: string;
730
734
  display_online?: number;
731
735
  id?: string;
736
+ max_level_permission?: number;
732
737
  permission_list?: ApiPermissionList;
733
738
  role_channel_active?: number;
734
739
  role_icon?: string;
@@ -1194,8 +1199,6 @@ export declare class MezonApi {
1194
1199
  changeChannelCategory(bearerToken: string, newCategoryId: string, body: MezonChangeChannelCategoryBody, options?: any): Promise<any>;
1195
1200
  /** Update a role when Delete a role by ID. */
1196
1201
  deleteRoleChannelDesc(bearerToken: string, body: ApiDeleteRoleRequest, options?: any): Promise<any>;
1197
- /** List user roles */
1198
- listRoles(bearerToken: string, limit?: number, state?: number, cursor?: string, clanId?: string, options?: any): Promise<ApiRoleList>;
1199
1202
  /** Create a new role for clan. */
1200
1203
  createRole(bearerToken: string, body: ApiCreateRoleRequest, options?: any): Promise<ApiRole>;
1201
1204
  /** Update a role when Delete a role by ID. */
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, MezonUpdateAppBody } 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, 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";
@@ -413,8 +413,6 @@ export declare class Client {
413
413
  listClanDescs(session: Session, limit?: number, state?: number, cursor?: string): Promise<ApiClanDescList>;
414
414
  /** List categories. */
415
415
  listCategoryDescs(session: Session, clanId: string, creatorId?: string, categoryName?: string): Promise<ApiCategoryDescList>;
416
- /** List user roles */
417
- listRoles(session: Session, limit?: number, state?: number, cursor?: string, clanId?: string): Promise<ApiRoleList>;
418
416
  /** List event */
419
417
  listEvents(session: Session, clanId?: string): Promise<ApiEventList>;
420
418
  /** List permission */
@@ -3756,35 +3756,6 @@ var MezonApi = class {
3756
3756
  )
3757
3757
  ]);
3758
3758
  }
3759
- /** List user roles */
3760
- listRoles(bearerToken, limit, state, cursor, clanId, options = {}) {
3761
- const urlPath = "/v2/roles";
3762
- const queryParams = /* @__PURE__ */ new Map();
3763
- queryParams.set("limit", limit);
3764
- queryParams.set("state", state);
3765
- queryParams.set("cursor", cursor);
3766
- queryParams.set("clan_id", clanId);
3767
- let bodyJson = "";
3768
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3769
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3770
- if (bearerToken) {
3771
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3772
- }
3773
- return Promise.race([
3774
- fetch(fullUrl, fetchOptions).then((response) => {
3775
- if (response.status == 204) {
3776
- return response;
3777
- } else if (response.status >= 200 && response.status < 300) {
3778
- return response.json();
3779
- } else {
3780
- throw response;
3781
- }
3782
- }),
3783
- new Promise(
3784
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3785
- )
3786
- ]);
3787
- }
3788
3759
  /** Create a new role for clan. */
3789
3760
  createRole(bearerToken, body, options = {}) {
3790
3761
  if (body === null || body === void 0) {
@@ -4747,6 +4718,8 @@ var _DefaultSocket = class _DefaultSocket {
4747
4718
  this.onuserchannelremoved(message.user_channel_removed_event);
4748
4719
  } else if (message.user_clan_removed_event) {
4749
4720
  this.onuserclanremoved(message.user_clan_removed_event);
4721
+ } else if (message.clan_event_created) {
4722
+ this.oneventcreated(message.clan_event_created);
4750
4723
  } else {
4751
4724
  if (this.verbose && window && window.console) {
4752
4725
  console.log("Unrecognized message received: %o", message);
@@ -4934,6 +4907,11 @@ var _DefaultSocket = class _DefaultSocket {
4934
4907
  console.log(statusEvent);
4935
4908
  }
4936
4909
  }
4910
+ oneventcreated(clan_event_created) {
4911
+ if (this.verbose && window && window.console) {
4912
+ console.log(clan_event_created);
4913
+ }
4914
+ }
4937
4915
  send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
4938
4916
  const untypedMessage = message;
4939
4917
  return new Promise((resolve, reject) => {
@@ -4971,24 +4949,25 @@ var _DefaultSocket = class _DefaultSocket {
4971
4949
  return response.clan_join;
4972
4950
  });
4973
4951
  }
4974
- joinChat(clan_id, channel_id, channel_type) {
4952
+ joinChat(clan_id, channel_id, channel_type, is_public) {
4975
4953
  return __async(this, null, function* () {
4976
4954
  const response = yield this.send(
4977
4955
  {
4978
4956
  channel_join: {
4979
4957
  clan_id,
4980
4958
  channel_id,
4981
- channel_type
4959
+ channel_type,
4960
+ is_public
4982
4961
  }
4983
4962
  }
4984
4963
  );
4985
4964
  return response.channel;
4986
4965
  });
4987
4966
  }
4988
- leaveChat(clan_id, channel_id, channel_type) {
4989
- return this.send({ channel_leave: { clan_id, channel_id, channel_type } });
4967
+ leaveChat(clan_id, channel_id, channel_type, is_public) {
4968
+ return this.send({ channel_leave: { clan_id, channel_id, channel_type, is_public } });
4990
4969
  }
4991
- removeChatMessage(clan_id, channel_id, mode, message_id) {
4970
+ removeChatMessage(clan_id, channel_id, mode, is_public, message_id) {
4992
4971
  return __async(this, null, function* () {
4993
4972
  const response = yield this.send(
4994
4973
  {
@@ -4996,7 +4975,8 @@ var _DefaultSocket = class _DefaultSocket {
4996
4975
  clan_id,
4997
4976
  channel_id,
4998
4977
  mode,
4999
- message_id
4978
+ message_id,
4979
+ is_public
5000
4980
  }
5001
4981
  }
5002
4982
  );
@@ -5031,24 +5011,24 @@ var _DefaultSocket = class _DefaultSocket {
5031
5011
  unfollowUsers(user_ids) {
5032
5012
  return this.send({ status_unfollow: { user_ids } });
5033
5013
  }
5034
- updateChatMessage(clan_id, channel_id, mode, message_id, content, mentions, attachments, hideEditted) {
5014
+ updateChatMessage(clan_id, channel_id, mode, is_public, message_id, content, mentions, attachments, hideEditted) {
5035
5015
  return __async(this, null, function* () {
5036
- const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, attachments, mode, hide_editted: hideEditted } });
5016
+ const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, attachments, mode, is_public, hide_editted: hideEditted } });
5037
5017
  return response.channel_message_ack;
5038
5018
  });
5039
5019
  }
5040
5020
  updateStatus(status) {
5041
5021
  return this.send({ status_update: { status } });
5042
5022
  }
5043
- writeChatMessage(clan_id, channel_id, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar) {
5023
+ writeChatMessage(clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar) {
5044
5024
  return __async(this, null, function* () {
5045
- const response = yield this.send({ channel_message_send: { clan_id, channel_id, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar } });
5025
+ const response = yield this.send({ channel_message_send: { clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar } });
5046
5026
  return response.channel_message_ack;
5047
5027
  });
5048
5028
  }
5049
- writeMessageReaction(id, clan_id, channel_id, mode, message_id, emoji_id, emoji, count, message_sender_id, action_delete) {
5029
+ writeMessageReaction(id, clan_id, channel_id, mode, is_public, message_id, emoji_id, emoji, count, message_sender_id, action_delete) {
5050
5030
  return __async(this, null, function* () {
5051
- const response = yield this.send({ message_reaction_event: { id, clan_id, channel_id, mode, message_id, emoji_id, emoji, count, message_sender_id, action: action_delete } });
5031
+ const response = yield this.send({ message_reaction_event: { id, clan_id, channel_id, mode, is_public, message_id, emoji_id, emoji, count, message_sender_id, action: action_delete } });
5052
5032
  return response.message_reaction_event;
5053
5033
  });
5054
5034
  }
@@ -5058,15 +5038,15 @@ var _DefaultSocket = class _DefaultSocket {
5058
5038
  return response.message_typing_event;
5059
5039
  });
5060
5040
  }
5061
- writeLastSeenMessage(clan_id, channel_id, mode, message_id, timestamp_seconds) {
5041
+ writeLastSeenMessage(clan_id, channel_id, mode, is_public, message_id, timestamp_seconds) {
5062
5042
  return __async(this, null, function* () {
5063
- const response = yield this.send({ last_seen_message_event: { clan_id, channel_id, mode, message_id, timestamp_seconds } });
5043
+ const response = yield this.send({ last_seen_message_event: { clan_id, channel_id, mode, is_public, message_id, timestamp_seconds } });
5064
5044
  return response.last_seen_message_event;
5065
5045
  });
5066
5046
  }
5067
- writeLastPinMessage(clan_id, channel_id, mode, message_id, timestamp_seconds, operation) {
5047
+ writeLastPinMessage(clan_id, channel_id, mode, is_public, message_id, timestamp_seconds, operation) {
5068
5048
  return __async(this, null, function* () {
5069
- const response = yield this.send({ last_pin_message_event: { clan_id, channel_id, mode, message_id, timestamp_seconds, operation } });
5049
+ const response = yield this.send({ last_pin_message_event: { clan_id, channel_id, mode, is_public, message_id, timestamp_seconds, operation } });
5070
5050
  return response.last_pin_message_event;
5071
5051
  });
5072
5052
  }
@@ -5100,6 +5080,18 @@ var _DefaultSocket = class _DefaultSocket {
5100
5080
  return response.emojis_listed_event;
5101
5081
  });
5102
5082
  }
5083
+ listUserPermissionInChannel(clan_id, channel_id) {
5084
+ return __async(this, null, function* () {
5085
+ const response = yield this.send({ user_permission_in_channel_list_event: { clan_id, channel_id } });
5086
+ return response.user_permission_in_channel_list_event;
5087
+ });
5088
+ }
5089
+ listRoles(ClanId, Limit, State, Cursor) {
5090
+ return __async(this, null, function* () {
5091
+ const response = yield this.send({ role_list_event: { ClanId, Limit, State, Cursor } });
5092
+ return response.role_list_event;
5093
+ });
5094
+ }
5103
5095
  ListChannelByUserId() {
5104
5096
  return __async(this, null, function* () {
5105
5097
  const response = yield this.send({ channel_desc_list_event: {} });
@@ -5951,17 +5943,6 @@ var Client = class {
5951
5943
  });
5952
5944
  });
5953
5945
  }
5954
- /** List user roles */
5955
- listRoles(session, limit, state, cursor, clanId) {
5956
- return __async(this, null, function* () {
5957
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5958
- yield this.sessionRefresh(session);
5959
- }
5960
- return this.apiClient.listRoles(session.token, limit, state, cursor, clanId).then((response) => {
5961
- return Promise.resolve(response);
5962
- });
5963
- });
5964
- }
5965
5946
  /** List event */
5966
5947
  listEvents(session, clanId) {
5967
5948
  return __async(this, null, function* () {
@@ -3727,35 +3727,6 @@ var MezonApi = class {
3727
3727
  )
3728
3728
  ]);
3729
3729
  }
3730
- /** List user roles */
3731
- listRoles(bearerToken, limit, state, cursor, clanId, options = {}) {
3732
- const urlPath = "/v2/roles";
3733
- const queryParams = /* @__PURE__ */ new Map();
3734
- queryParams.set("limit", limit);
3735
- queryParams.set("state", state);
3736
- queryParams.set("cursor", cursor);
3737
- queryParams.set("clan_id", clanId);
3738
- let bodyJson = "";
3739
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3740
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3741
- if (bearerToken) {
3742
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3743
- }
3744
- return Promise.race([
3745
- fetch(fullUrl, fetchOptions).then((response) => {
3746
- if (response.status == 204) {
3747
- return response;
3748
- } else if (response.status >= 200 && response.status < 300) {
3749
- return response.json();
3750
- } else {
3751
- throw response;
3752
- }
3753
- }),
3754
- new Promise(
3755
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3756
- )
3757
- ]);
3758
- }
3759
3730
  /** Create a new role for clan. */
3760
3731
  createRole(bearerToken, body, options = {}) {
3761
3732
  if (body === null || body === void 0) {
@@ -4718,6 +4689,8 @@ var _DefaultSocket = class _DefaultSocket {
4718
4689
  this.onuserchannelremoved(message.user_channel_removed_event);
4719
4690
  } else if (message.user_clan_removed_event) {
4720
4691
  this.onuserclanremoved(message.user_clan_removed_event);
4692
+ } else if (message.clan_event_created) {
4693
+ this.oneventcreated(message.clan_event_created);
4721
4694
  } else {
4722
4695
  if (this.verbose && window && window.console) {
4723
4696
  console.log("Unrecognized message received: %o", message);
@@ -4905,6 +4878,11 @@ var _DefaultSocket = class _DefaultSocket {
4905
4878
  console.log(statusEvent);
4906
4879
  }
4907
4880
  }
4881
+ oneventcreated(clan_event_created) {
4882
+ if (this.verbose && window && window.console) {
4883
+ console.log(clan_event_created);
4884
+ }
4885
+ }
4908
4886
  send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
4909
4887
  const untypedMessage = message;
4910
4888
  return new Promise((resolve, reject) => {
@@ -4942,24 +4920,25 @@ var _DefaultSocket = class _DefaultSocket {
4942
4920
  return response.clan_join;
4943
4921
  });
4944
4922
  }
4945
- joinChat(clan_id, channel_id, channel_type) {
4923
+ joinChat(clan_id, channel_id, channel_type, is_public) {
4946
4924
  return __async(this, null, function* () {
4947
4925
  const response = yield this.send(
4948
4926
  {
4949
4927
  channel_join: {
4950
4928
  clan_id,
4951
4929
  channel_id,
4952
- channel_type
4930
+ channel_type,
4931
+ is_public
4953
4932
  }
4954
4933
  }
4955
4934
  );
4956
4935
  return response.channel;
4957
4936
  });
4958
4937
  }
4959
- leaveChat(clan_id, channel_id, channel_type) {
4960
- return this.send({ channel_leave: { clan_id, channel_id, channel_type } });
4938
+ leaveChat(clan_id, channel_id, channel_type, is_public) {
4939
+ return this.send({ channel_leave: { clan_id, channel_id, channel_type, is_public } });
4961
4940
  }
4962
- removeChatMessage(clan_id, channel_id, mode, message_id) {
4941
+ removeChatMessage(clan_id, channel_id, mode, is_public, message_id) {
4963
4942
  return __async(this, null, function* () {
4964
4943
  const response = yield this.send(
4965
4944
  {
@@ -4967,7 +4946,8 @@ var _DefaultSocket = class _DefaultSocket {
4967
4946
  clan_id,
4968
4947
  channel_id,
4969
4948
  mode,
4970
- message_id
4949
+ message_id,
4950
+ is_public
4971
4951
  }
4972
4952
  }
4973
4953
  );
@@ -5002,24 +4982,24 @@ var _DefaultSocket = class _DefaultSocket {
5002
4982
  unfollowUsers(user_ids) {
5003
4983
  return this.send({ status_unfollow: { user_ids } });
5004
4984
  }
5005
- updateChatMessage(clan_id, channel_id, mode, message_id, content, mentions, attachments, hideEditted) {
4985
+ updateChatMessage(clan_id, channel_id, mode, is_public, message_id, content, mentions, attachments, hideEditted) {
5006
4986
  return __async(this, null, function* () {
5007
- const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, attachments, mode, hide_editted: hideEditted } });
4987
+ const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, attachments, mode, is_public, hide_editted: hideEditted } });
5008
4988
  return response.channel_message_ack;
5009
4989
  });
5010
4990
  }
5011
4991
  updateStatus(status) {
5012
4992
  return this.send({ status_update: { status } });
5013
4993
  }
5014
- writeChatMessage(clan_id, channel_id, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar) {
4994
+ writeChatMessage(clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar) {
5015
4995
  return __async(this, null, function* () {
5016
- const response = yield this.send({ channel_message_send: { clan_id, channel_id, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar } });
4996
+ const response = yield this.send({ channel_message_send: { clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar } });
5017
4997
  return response.channel_message_ack;
5018
4998
  });
5019
4999
  }
5020
- writeMessageReaction(id, clan_id, channel_id, mode, message_id, emoji_id, emoji, count, message_sender_id, action_delete) {
5000
+ writeMessageReaction(id, clan_id, channel_id, mode, is_public, message_id, emoji_id, emoji, count, message_sender_id, action_delete) {
5021
5001
  return __async(this, null, function* () {
5022
- const response = yield this.send({ message_reaction_event: { id, clan_id, channel_id, mode, message_id, emoji_id, emoji, count, message_sender_id, action: action_delete } });
5002
+ const response = yield this.send({ message_reaction_event: { id, clan_id, channel_id, mode, is_public, message_id, emoji_id, emoji, count, message_sender_id, action: action_delete } });
5023
5003
  return response.message_reaction_event;
5024
5004
  });
5025
5005
  }
@@ -5029,15 +5009,15 @@ var _DefaultSocket = class _DefaultSocket {
5029
5009
  return response.message_typing_event;
5030
5010
  });
5031
5011
  }
5032
- writeLastSeenMessage(clan_id, channel_id, mode, message_id, timestamp_seconds) {
5012
+ writeLastSeenMessage(clan_id, channel_id, mode, is_public, message_id, timestamp_seconds) {
5033
5013
  return __async(this, null, function* () {
5034
- const response = yield this.send({ last_seen_message_event: { clan_id, channel_id, mode, message_id, timestamp_seconds } });
5014
+ const response = yield this.send({ last_seen_message_event: { clan_id, channel_id, mode, is_public, message_id, timestamp_seconds } });
5035
5015
  return response.last_seen_message_event;
5036
5016
  });
5037
5017
  }
5038
- writeLastPinMessage(clan_id, channel_id, mode, message_id, timestamp_seconds, operation) {
5018
+ writeLastPinMessage(clan_id, channel_id, mode, is_public, message_id, timestamp_seconds, operation) {
5039
5019
  return __async(this, null, function* () {
5040
- const response = yield this.send({ last_pin_message_event: { clan_id, channel_id, mode, message_id, timestamp_seconds, operation } });
5020
+ const response = yield this.send({ last_pin_message_event: { clan_id, channel_id, mode, is_public, message_id, timestamp_seconds, operation } });
5041
5021
  return response.last_pin_message_event;
5042
5022
  });
5043
5023
  }
@@ -5071,6 +5051,18 @@ var _DefaultSocket = class _DefaultSocket {
5071
5051
  return response.emojis_listed_event;
5072
5052
  });
5073
5053
  }
5054
+ listUserPermissionInChannel(clan_id, channel_id) {
5055
+ return __async(this, null, function* () {
5056
+ const response = yield this.send({ user_permission_in_channel_list_event: { clan_id, channel_id } });
5057
+ return response.user_permission_in_channel_list_event;
5058
+ });
5059
+ }
5060
+ listRoles(ClanId, Limit, State, Cursor) {
5061
+ return __async(this, null, function* () {
5062
+ const response = yield this.send({ role_list_event: { ClanId, Limit, State, Cursor } });
5063
+ return response.role_list_event;
5064
+ });
5065
+ }
5074
5066
  ListChannelByUserId() {
5075
5067
  return __async(this, null, function* () {
5076
5068
  const response = yield this.send({ channel_desc_list_event: {} });
@@ -5922,17 +5914,6 @@ var Client = class {
5922
5914
  });
5923
5915
  });
5924
5916
  }
5925
- /** List user roles */
5926
- listRoles(session, limit, state, cursor, clanId) {
5927
- return __async(this, null, function* () {
5928
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5929
- yield this.sessionRefresh(session);
5930
- }
5931
- return this.apiClient.listRoles(session.token, limit, state, cursor, clanId).then((response) => {
5932
- return Promise.resolve(response);
5933
- });
5934
- });
5935
- }
5936
5917
  /** List event */
5937
5918
  listEvents(session, clanId) {
5938
5919
  return __async(this, null, function* () {
package/dist/socket.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 { ApiChannelMessageHeader, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiRpc, ApiUser } from "./api.gen";
16
+ import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiPermissionList, ApiRoleList, ApiRpc, ApiUser } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { ChannelMessage, Notification } from "./client";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -69,6 +69,7 @@ interface ChannelLeave {
69
69
  channel_id: string;
70
70
  mode: number;
71
71
  channel_label: string;
72
+ is_public: boolean;
72
73
  };
73
74
  }
74
75
  export interface AddClanUserEvent {
@@ -109,6 +110,7 @@ export interface LastPinMessageEvent {
109
110
  user_id: string;
110
111
  /** operation */
111
112
  operation: number;
113
+ is_public: boolean;
112
114
  }
113
115
  /** Last seen message by user */
114
116
  export interface LastSeenMessageEvent {
@@ -127,6 +129,7 @@ export interface MessageTypingEvent {
127
129
  channel_label: string;
128
130
  /** Message sender, usually a user ID. */
129
131
  sender_id: string;
132
+ is_public: boolean;
130
133
  }
131
134
  export interface UserProfileUpdatedEvent {
132
135
  user_id: string;
@@ -170,6 +173,7 @@ interface ChannelMessageSend {
170
173
  anonymous_message?: boolean;
171
174
  mention_everyone?: boolean;
172
175
  avatar: string;
176
+ is_public: boolean;
173
177
  };
174
178
  }
175
179
  /** Update a message previously sent to a realtime chat channel. */
@@ -188,6 +192,7 @@ interface ChannelMessageUpdate {
188
192
  attachments?: Array<ApiMessageAttachment>;
189
193
  /** The mode payload. */
190
194
  mode: number;
195
+ is_public: boolean;
191
196
  };
192
197
  }
193
198
  /** Remove a message previously sent to a realtime chat channel. */
@@ -199,6 +204,7 @@ interface ChannelMessageRemove {
199
204
  channel_label: string;
200
205
  /** A unique ID for the chat message to be removed. */
201
206
  message_id: string;
207
+ is_public: boolean;
202
208
  };
203
209
  }
204
210
  /** Presence update for a particular realtime chat channel. */
@@ -254,6 +260,7 @@ export interface ChannelUpdatedEvent {
254
260
  channel_label: string;
255
261
  channel_type: number;
256
262
  status: number;
263
+ meeting_code: string;
257
264
  }
258
265
  export interface ChannelCreatedEvent {
259
266
  clan_id: string;
@@ -387,6 +394,18 @@ export interface EmojiListedEvent {
387
394
  clan_id: string;
388
395
  emoji_list?: Array<ClanEmoji>;
389
396
  }
397
+ export interface RoleListEvent {
398
+ Limit: number;
399
+ State: number;
400
+ Cursor: string;
401
+ ClanId: string;
402
+ roles: ApiRoleList;
403
+ }
404
+ export interface UserPermissionInChannelListEvent {
405
+ clan_id: string;
406
+ channel_id: string;
407
+ permissions: ApiPermissionList;
408
+ }
390
409
  /** */
391
410
  export interface ClanEmoji {
392
411
  category?: string;
@@ -484,29 +503,29 @@ export interface Socket {
484
503
  /** Join clan chat */
485
504
  joinClanChat(clan_id: string): Promise<ClanJoin>;
486
505
  /** Join a chat channel on the server. */
487
- joinChat(clan_id: string, channel_id: string, channel_type: number): Promise<Channel>;
506
+ joinChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<Channel>;
488
507
  /** Leave a chat channel on the server. */
489
- leaveChat(clan_id: string, channel_id: string, channel_type: number): Promise<void>;
508
+ leaveChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<void>;
490
509
  /** Remove a chat message from a chat channel on the server. */
491
- removeChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string): Promise<ChannelMessageAck>;
510
+ removeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string): Promise<ChannelMessageAck>;
492
511
  /** Execute an RPC function to the server. */
493
512
  rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc>;
494
513
  /** Unfollow one or more users from their status updates. */
495
514
  unfollowUsers(user_ids: string[]): Promise<void>;
496
515
  /** Update a chat message on a chat channel in the server. */
497
- updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean): Promise<ChannelMessageAck>;
516
+ updateChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean): Promise<ChannelMessageAck>;
498
517
  /** Update the status for the current user online. */
499
518
  updateStatus(status?: string): Promise<void>;
500
519
  /** Send a chat message to a chat channel on the server. */
501
- writeChatMessage(clan_id: string, channel_id: string, mode: number, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: boolean, avatar?: string): Promise<ChannelMessageAck>;
520
+ writeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: boolean, avatar?: string): Promise<ChannelMessageAck>;
502
521
  /** Send message typing */
503
- writeMessageTyping(clan_id: string, channel_id: string, mode: number): Promise<MessageTypingEvent>;
522
+ writeMessageTyping(clan_id: string, channel_id: string, mode: number, is_public: boolean): Promise<MessageTypingEvent>;
504
523
  /** Send message reaction */
505
- writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<ApiMessageReaction>;
524
+ writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<ApiMessageReaction>;
506
525
  /** Send last seen message */
507
- writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp_seconds: number): Promise<LastSeenMessageEvent>;
526
+ writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, timestamp_seconds: number): Promise<LastSeenMessageEvent>;
508
527
  /** Send last pin message */
509
- writeLastPinMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp_seconds: number, operation: number): Promise<LastPinMessageEvent>;
528
+ writeLastPinMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, timestamp_seconds: number, operation: number): Promise<LastPinMessageEvent>;
510
529
  /** Send custom user status */
511
530
  writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
512
531
  /** send voice joined */
@@ -566,6 +585,8 @@ export interface Socket {
566
585
  getHeartbeatTimeoutMs(): number;
567
586
  checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
568
587
  listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
588
+ listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
589
+ listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
569
590
  listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
570
591
  ListChannelByUserId(): Promise<ChannelDescListEvent>;
571
592
  ListUserClansByUserId(): Promise<AllUserClans>;
@@ -576,6 +597,7 @@ export interface Socket {
576
597
  getNotificationReactMessage(channel_id_req: string): Promise<NotifiReactMessageEvent>;
577
598
  GetPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent>;
578
599
  getNotificationChannelCategorySetting(clan_id: string): Promise<NotificationChannelCategorySettingEvent>;
600
+ oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
579
601
  }
580
602
  /** Reports an error received from a socket message. */
581
603
  export interface SocketError {
@@ -632,28 +654,31 @@ export declare class DefaultSocket implements Socket {
632
654
  onstreamdata(streamData: StreamData): void;
633
655
  onheartbeattimeout(): void;
634
656
  oncustomstatus(statusEvent: CustomStatusEvent): void;
657
+ oneventcreated(clan_event_created: ApiCreateEventRequest): void;
635
658
  send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout?: number): Promise<any>;
636
659
  followUsers(userIds: string[]): Promise<Status>;
637
660
  joinClanChat(clan_id: string): Promise<ClanJoin>;
638
- joinChat(clan_id: string, channel_id: string, channel_type: number): Promise<Channel>;
639
- leaveChat(clan_id: string, channel_id: string, channel_type: number): Promise<void>;
640
- removeChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string): Promise<ChannelMessageAck>;
661
+ joinChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<Channel>;
662
+ leaveChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<void>;
663
+ removeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string): Promise<ChannelMessageAck>;
641
664
  removePartyMember(party_id: string, member: Presence): Promise<void>;
642
665
  rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc>;
643
666
  sendPartyData(party_id: string, op_code: number, data: string | Uint8Array): Promise<void>;
644
667
  unfollowUsers(user_ids: string[]): Promise<void>;
645
- updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean): Promise<ChannelMessageAck>;
668
+ updateChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean): Promise<ChannelMessageAck>;
646
669
  updateStatus(status?: string): Promise<void>;
647
- writeChatMessage(clan_id: string, channel_id: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean, avatar?: string): Promise<ChannelMessageAck>;
648
- writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<ApiMessageReaction>;
670
+ writeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean, avatar?: string): Promise<ChannelMessageAck>;
671
+ writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<ApiMessageReaction>;
649
672
  writeMessageTyping(clan_id: string, channel_id: string, mode: number): Promise<MessageTypingEvent>;
650
- writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp_seconds: number): Promise<LastSeenMessageEvent>;
651
- writeLastPinMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp_seconds: number, operation: number): Promise<LastPinMessageEvent>;
673
+ writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, timestamp_seconds: number): Promise<LastSeenMessageEvent>;
674
+ writeLastPinMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, timestamp_seconds: number, operation: number): Promise<LastPinMessageEvent>;
652
675
  writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
653
676
  writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
654
677
  writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
655
678
  checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
656
679
  listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
680
+ listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
681
+ listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
657
682
  ListChannelByUserId(): Promise<ChannelDescListEvent>;
658
683
  ListUserClansByUserId(): Promise<AllUserClans>;
659
684
  hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.8.56",
3
+ "version": "2.8.58",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { ApiChannelMessageHeader, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiRpc, ApiUser} from "./api.gen";
17
+ import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiPermissionList, ApiRoleList, ApiRpc, ApiUser} from "./api.gen";
18
18
  import {Session} from "./session";
19
19
  import {ChannelMessage, Notification} from "./client";
20
20
  import {WebSocketAdapter, WebSocketAdapterText} from "./web_socket_adapter"
@@ -85,6 +85,8 @@ interface ChannelLeave {
85
85
  mode: number;
86
86
  // The channel label
87
87
  channel_label: string;
88
+ // Is public
89
+ is_public: boolean;
88
90
  };
89
91
  }
90
92
 
@@ -148,6 +150,8 @@ export interface LastPinMessageEvent {
148
150
  user_id: string;
149
151
  /** operation */
150
152
  operation: number;
153
+ // Is public
154
+ is_public: boolean;
151
155
  }
152
156
 
153
157
  /** Last seen message by user */
@@ -172,6 +176,8 @@ export interface MessageTypingEvent {
172
176
  channel_label: string;
173
177
  /** Message sender, usually a user ID. */
174
178
  sender_id: string;
179
+ // Is public
180
+ is_public: boolean;
175
181
  }
176
182
 
177
183
  // user profile updated event
@@ -233,6 +239,8 @@ interface ChannelMessageSend {
233
239
  mention_everyone?: boolean;
234
240
  //
235
241
  avatar: string;
242
+ // Is public
243
+ is_public: boolean;
236
244
  };
237
245
  }
238
246
 
@@ -253,6 +261,8 @@ interface ChannelMessageUpdate {
253
261
  attachments?: Array<ApiMessageAttachment>;
254
262
  /** The mode payload. */
255
263
  mode: number;
264
+ // Is public
265
+ is_public: boolean;
256
266
  };
257
267
  }
258
268
 
@@ -267,6 +277,8 @@ interface ChannelMessageRemove {
267
277
  channel_label: string;
268
278
  /** A unique ID for the chat message to be removed. */
269
279
  message_id: string;
280
+ // Is public
281
+ is_public: boolean;
270
282
  };
271
283
  }
272
284
 
@@ -360,6 +372,8 @@ export interface ChannelUpdatedEvent {
360
372
  channel_type: number;
361
373
  // status
362
374
  status: number;
375
+ // meeting code
376
+ meeting_code: string;
363
377
  }
364
378
 
365
379
  export interface ChannelCreatedEvent {
@@ -548,6 +562,27 @@ export interface EmojiListedEvent {
548
562
  emoji_list?: Array<ClanEmoji>;
549
563
  }
550
564
 
565
+ export interface RoleListEvent {
566
+ Limit: number;
567
+ // The role state to list.
568
+ State: number;
569
+ // Cursor to start from
570
+ Cursor: string;
571
+ // The clan of this role
572
+ ClanId: string;
573
+ //
574
+ roles: ApiRoleList;
575
+ }
576
+
577
+ export interface UserPermissionInChannelListEvent {
578
+ //
579
+ clan_id: string;
580
+ //
581
+ channel_id: string;
582
+ // A list of permission.
583
+ permissions: ApiPermissionList;
584
+ }
585
+
551
586
  /** */
552
587
  export interface ClanEmoji {
553
588
  //
@@ -716,13 +751,13 @@ export interface Socket {
716
751
  joinClanChat(clan_id: string) : Promise<ClanJoin>;
717
752
 
718
753
  /** Join a chat channel on the server. */
719
- joinChat(clan_id: string, channel_id: string, channel_type: number) : Promise<Channel>;
754
+ joinChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean) : Promise<Channel>;
720
755
 
721
756
  /** Leave a chat channel on the server. */
722
- leaveChat(clan_id: string, channel_id: string, channel_type: number) : Promise<void>;
757
+ leaveChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean) : Promise<void>;
723
758
 
724
759
  /** Remove a chat message from a chat channel on the server. */
725
- removeChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string) : Promise<ChannelMessageAck>;
760
+ removeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string) : Promise<ChannelMessageAck>;
726
761
 
727
762
  /** Execute an RPC function to the server. */
728
763
  rpc(id?: string, payload?: string, http_key?: string) : Promise<ApiRpc>
@@ -731,25 +766,25 @@ export interface Socket {
731
766
  unfollowUsers(user_ids : string[]) : Promise<void>;
732
767
 
733
768
  /** Update a chat message on a chat channel in the server. */
734
- updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id : string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean) : Promise<ChannelMessageAck>;
769
+ updateChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id : string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean) : Promise<ChannelMessageAck>;
735
770
 
736
771
  /** Update the status for the current user online. */
737
772
  updateStatus(status? : string) : Promise<void>;
738
773
 
739
774
  /** Send a chat message to a chat channel on the server. */
740
- writeChatMessage(clan_id: string, channel_id: string, mode: number, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?:boolean, avatar?: string) : Promise<ChannelMessageAck>;
775
+ writeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?:boolean, avatar?: string) : Promise<ChannelMessageAck>;
741
776
 
742
777
  /** Send message typing */
743
- writeMessageTyping(clan_id: string, channel_id: string, mode: number) : Promise<MessageTypingEvent>;
778
+ writeMessageTyping(clan_id: string, channel_id: string, mode: number, is_public: boolean) : Promise<MessageTypingEvent>;
744
779
 
745
780
  /** Send message reaction */
746
- writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean) : Promise<ApiMessageReaction>;
781
+ writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean) : Promise<ApiMessageReaction>;
747
782
 
748
783
  /** Send last seen message */
749
- writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp_seconds: number) : Promise<LastSeenMessageEvent>;
784
+ writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, timestamp_seconds: number) : Promise<LastSeenMessageEvent>;
750
785
 
751
786
  /** Send last pin message */
752
- writeLastPinMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp_seconds: number, operation: number) : Promise<LastPinMessageEvent>;
787
+ writeLastPinMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, timestamp_seconds: number, operation: number) : Promise<LastPinMessageEvent>;
753
788
 
754
789
  /** Send custom user status */
755
790
  writeCustomStatus(clan_id: string, status: string) : Promise<CustomStatusEvent>;
@@ -855,6 +890,10 @@ export interface Socket {
855
890
 
856
891
  listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
857
892
 
893
+ listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
894
+
895
+ listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
896
+
858
897
  listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
859
898
 
860
899
  ListChannelByUserId(): Promise<ChannelDescListEvent>;
@@ -874,6 +913,8 @@ export interface Socket {
874
913
  GetPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent>;
875
914
 
876
915
  getNotificationChannelCategorySetting(clan_id : string): Promise<NotificationChannelCategorySettingEvent>;
916
+
917
+ oneventcreated: (clan_event_created: ApiCreateEventRequest) => void
877
918
  }
878
919
 
879
920
  /** Reports an error received from a socket message. */
@@ -1042,7 +1083,9 @@ export class DefaultSocket implements Socket {
1042
1083
  this.onuserchannelremoved(<UserChannelRemovedEvent>message.user_channel_removed_event);
1043
1084
  } else if (message.user_clan_removed_event) {
1044
1085
  this.onuserclanremoved(<UserClanRemovedEvent>message.user_clan_removed_event);
1045
- } else {
1086
+ } else if(message.clan_event_created){
1087
+ this.oneventcreated(message.clan_event_created);
1088
+ }else {
1046
1089
  if (this.verbose && window && window.console) {
1047
1090
  console.log("Unrecognized message received: %o", message);
1048
1091
  }
@@ -1265,6 +1308,12 @@ export class DefaultSocket implements Socket {
1265
1308
  }
1266
1309
  }
1267
1310
 
1311
+ oneventcreated(clan_event_created: ApiCreateEventRequest) {
1312
+ if (this.verbose && window && window.console) {
1313
+ console.log(clan_event_created);
1314
+ }
1315
+ }
1316
+
1268
1317
  send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent |
1269
1318
  ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout = DefaultSocket.DefaultSendTimeoutMs): Promise<any> {
1270
1319
  const untypedMessage = message as any;
@@ -1309,13 +1358,14 @@ export class DefaultSocket implements Socket {
1309
1358
  return response.clan_join;
1310
1359
  }
1311
1360
 
1312
- async joinChat(clan_id: string, channel_id: string, channel_type: number): Promise<Channel> {
1361
+ async joinChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<Channel> {
1313
1362
 
1314
1363
  const response = await this.send({
1315
1364
  channel_join: {
1316
1365
  clan_id: clan_id,
1317
1366
  channel_id: channel_id,
1318
1367
  channel_type: channel_type,
1368
+ is_public: is_public
1319
1369
  }
1320
1370
  }
1321
1371
  );
@@ -1323,18 +1373,19 @@ export class DefaultSocket implements Socket {
1323
1373
  return response.channel;
1324
1374
  }
1325
1375
 
1326
- leaveChat(clan_id: string, channel_id: string, channel_type: number): Promise<void> {
1327
- return this.send({channel_leave: {clan_id: clan_id, channel_id: channel_id, channel_type: channel_type}});
1376
+ leaveChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<void> {
1377
+ return this.send({channel_leave: {clan_id: clan_id, channel_id: channel_id, channel_type: channel_type, is_public: is_public}});
1328
1378
  }
1329
1379
 
1330
- async removeChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string): Promise<ChannelMessageAck> {
1380
+ async removeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string): Promise<ChannelMessageAck> {
1331
1381
  const response = await this.send(
1332
1382
  {
1333
1383
  channel_message_remove: {
1334
1384
  clan_id: clan_id,
1335
1385
  channel_id: channel_id,
1336
1386
  mode: mode,
1337
- message_id: message_id
1387
+ message_id: message_id,
1388
+ is_public: is_public
1338
1389
  }
1339
1390
  }
1340
1391
  );
@@ -1370,8 +1421,8 @@ export class DefaultSocket implements Socket {
1370
1421
  return this.send({status_unfollow: {user_ids: user_ids}});
1371
1422
  }
1372
1423
 
1373
- async updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id : string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean): Promise<ChannelMessageAck> {
1374
- const response = await this.send({channel_message_update: {clan_id: clan_id, channel_id: channel_id, message_id: message_id, content: content, mentions: mentions, attachments: attachments, mode: mode, hide_editted: hideEditted}});
1424
+ async updateChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id : string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean): Promise<ChannelMessageAck> {
1425
+ const response = await this.send({channel_message_update: {clan_id: clan_id, channel_id: channel_id, message_id: message_id, content: content, mentions: mentions, attachments: attachments, mode: mode, is_public: is_public, hide_editted: hideEditted}});
1375
1426
  return response.channel_message_ack;
1376
1427
  }
1377
1428
 
@@ -1379,13 +1430,13 @@ export class DefaultSocket implements Socket {
1379
1430
  return this.send({status_update: {status: status}});
1380
1431
  }
1381
1432
 
1382
- async writeChatMessage(clan_id: string, channel_id: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?:Boolean, avatar?: string ): Promise<ChannelMessageAck> {
1383
- const response = await this.send({channel_message_send: {clan_id: clan_id, channel_id: channel_id, mode: mode, content: content, mentions: mentions, attachments: attachments, references: references, anonymous_message: anonymous_message, mention_everyone: mention_everyone, avatar: avatar}});
1433
+ async writeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?:Boolean, avatar?: string ): Promise<ChannelMessageAck> {
1434
+ const response = await this.send({channel_message_send: {clan_id: clan_id, channel_id: channel_id, mode: mode, is_public: is_public, content: content, mentions: mentions, attachments: attachments, references: references, anonymous_message: anonymous_message, mention_everyone: mention_everyone, avatar: avatar}});
1384
1435
  return response.channel_message_ack;
1385
1436
  }
1386
1437
 
1387
- async writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<ApiMessageReaction> {
1388
- const response = await this.send({message_reaction_event: {id: id, clan_id: clan_id, channel_id: channel_id, mode: mode, message_id: message_id, emoji_id: emoji_id, emoji: emoji, count: count, message_sender_id: message_sender_id, action: action_delete}});
1438
+ async writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<ApiMessageReaction> {
1439
+ const response = await this.send({message_reaction_event: {id: id, clan_id: clan_id, channel_id: channel_id, mode: mode, is_public: is_public, message_id: message_id, emoji_id: emoji_id, emoji: emoji, count: count, message_sender_id: message_sender_id, action: action_delete}});
1389
1440
  return response.message_reaction_event
1390
1441
  }
1391
1442
 
@@ -1394,13 +1445,13 @@ export class DefaultSocket implements Socket {
1394
1445
  return response.message_typing_event
1395
1446
  }
1396
1447
 
1397
- async writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp_seconds: number): Promise<LastSeenMessageEvent> {
1398
- const response = await this.send({last_seen_message_event: {clan_id: clan_id, channel_id: channel_id, mode: mode, message_id: message_id, timestamp_seconds: timestamp_seconds}});
1448
+ async writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, timestamp_seconds: number): Promise<LastSeenMessageEvent> {
1449
+ const response = await this.send({last_seen_message_event: {clan_id: clan_id, channel_id: channel_id, mode: mode, is_public: is_public, message_id: message_id, timestamp_seconds: timestamp_seconds}});
1399
1450
  return response.last_seen_message_event
1400
1451
  }
1401
1452
 
1402
- async writeLastPinMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp_seconds: number, operation: number): Promise<LastPinMessageEvent> {
1403
- const response = await this.send({last_pin_message_event: {clan_id: clan_id, channel_id: channel_id, mode: mode, message_id: message_id, timestamp_seconds: timestamp_seconds, operation: operation}});
1453
+ async writeLastPinMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, timestamp_seconds: number, operation: number): Promise<LastPinMessageEvent> {
1454
+ const response = await this.send({last_pin_message_event: {clan_id: clan_id, channel_id: channel_id, mode: mode, is_public: is_public, message_id: message_id, timestamp_seconds: timestamp_seconds, operation: operation}});
1404
1455
  return response.last_pin_message_event
1405
1456
  }
1406
1457
 
@@ -1429,6 +1480,16 @@ export class DefaultSocket implements Socket {
1429
1480
  return response.emojis_listed_event
1430
1481
  }
1431
1482
 
1483
+ async listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent> {
1484
+ const response = await this.send({user_permission_in_channel_list_event : {clan_id: clan_id, channel_id: channel_id }});
1485
+ return response.user_permission_in_channel_list_event
1486
+ }
1487
+
1488
+ async listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent> {
1489
+ const response = await this.send({role_list_event: {ClanId: ClanId, Limit: Limit, State: State, Cursor: Cursor}});
1490
+ return response.role_list_event
1491
+ }
1492
+
1432
1493
  async ListChannelByUserId(): Promise<ChannelDescListEvent> {
1433
1494
  const response = await this.send({channel_desc_list_event: {}});
1434
1495
  return response.channel_desc_list_event