mezon-js 2.8.97 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -188,6 +188,8 @@ export interface MezonUpdateRoleBody {
188
188
  description?: string;
189
189
  //
190
190
  display_online?: number;
191
+ //
192
+ max_permission_id: string;
191
193
  //The permissions to remove.
192
194
  remove_permission_ids?: Array<string>;
193
195
  //The users to remove.
@@ -819,6 +821,8 @@ export interface ApiCreateRoleRequest {
819
821
  //
820
822
  display_online?: number;
821
823
  //
824
+ max_permission_id: string;
825
+ //
822
826
  role_icon?: string;
823
827
  //
824
828
  title?: string;
@@ -1625,7 +1629,9 @@ export interface ApiUpdateCategoryOrderRequest {
1625
1629
  /** */
1626
1630
  export interface ApiUpdateRoleChannelRequest {
1627
1631
  //
1628
- channel_id?: string;
1632
+ channel_id: string;
1633
+ //
1634
+ max_permission_id: string;
1629
1635
  //The permissions to add.
1630
1636
  permission_update?: Array<ApiPermissionUpdate>;
1631
1637
  //The ID of the role to update.
@@ -5960,7 +5966,6 @@ export class MezonApi {
5960
5966
  roleId:string,
5961
5967
  channelId?:string,
5962
5968
  clanId?:string,
5963
- maxPermissionsLevel?:string,
5964
5969
  options: any = {}): Promise<any> {
5965
5970
 
5966
5971
  if (roleId === null || roleId === undefined) {
@@ -5971,8 +5976,6 @@ export class MezonApi {
5971
5976
  const queryParams = new Map<string, any>();
5972
5977
  queryParams.set("channel_id", channelId);
5973
5978
  queryParams.set("clan_id", clanId);
5974
- queryParams.set("max_permissions_level", maxPermissionsLevel);
5975
-
5976
5979
  let bodyJson : string = "";
5977
5980
 
5978
5981
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
package/client.ts CHANGED
@@ -466,6 +466,7 @@ export interface ApiUpdateRoleRequest {
466
466
  remove_permission_ids: string[];
467
467
  //
468
468
  clan_id: string;
469
+ max_permission_id: string;
469
470
  }
470
471
 
471
472
  /** A client for Mezon server. */
package/dist/api.gen.d.ts CHANGED
@@ -107,6 +107,7 @@ export interface MezonUpdateRoleBody {
107
107
  color?: string;
108
108
  description?: string;
109
109
  display_online?: number;
110
+ max_permission_id: string;
110
111
  remove_permission_ids?: Array<string>;
111
112
  remove_user_ids?: Array<string>;
112
113
  role_icon?: string;
@@ -467,6 +468,7 @@ export interface ApiCreateRoleRequest {
467
468
  color?: string;
468
469
  description?: string;
469
470
  display_online?: number;
471
+ max_permission_id: string;
470
472
  role_icon?: string;
471
473
  title?: string;
472
474
  }
@@ -942,7 +944,8 @@ export interface ApiUpdateCategoryOrderRequest {
942
944
  }
943
945
  /** */
944
946
  export interface ApiUpdateRoleChannelRequest {
945
- channel_id?: string;
947
+ channel_id: string;
948
+ max_permission_id: string;
946
949
  permission_update?: Array<ApiPermissionUpdate>;
947
950
  role_id?: string;
948
951
  }
@@ -1271,7 +1274,7 @@ export declare class MezonApi {
1271
1274
  /** Update a role when Delete a role by ID. */
1272
1275
  updateRoleDelete(bearerToken: string, roleId: string, body: MezonUpdateRoleDeleteBody, options?: any): Promise<any>;
1273
1276
  /** Delete a role by ID. */
1274
- deleteRole(bearerToken: string, roleId: string, channelId?: string, clanId?: string, maxPermissionsLevel?: string, options?: any): Promise<any>;
1277
+ deleteRole(bearerToken: string, roleId: string, channelId?: string, clanId?: string, options?: any): Promise<any>;
1275
1278
  /** Update fields in a given role. */
1276
1279
  updateRole(bearerToken: string, roleId: string, body: MezonUpdateRoleBody, options?: any): Promise<any>;
1277
1280
  /** List role permissions */
package/dist/client.d.ts CHANGED
@@ -312,6 +312,7 @@ export interface ApiUpdateRoleRequest {
312
312
  /** The permissions to remove. */
313
313
  remove_permission_ids: string[];
314
314
  clan_id: string;
315
+ max_permission_id: string;
315
316
  }
316
317
  /** A client for Mezon server. */
317
318
  export declare class Client {
@@ -3941,7 +3941,7 @@ var MezonApi = class {
3941
3941
  ]);
3942
3942
  }
3943
3943
  /** Delete a role by ID. */
3944
- deleteRole(bearerToken, roleId, channelId, clanId, maxPermissionsLevel, options = {}) {
3944
+ deleteRole(bearerToken, roleId, channelId, clanId, options = {}) {
3945
3945
  if (roleId === null || roleId === void 0) {
3946
3946
  throw new Error("'roleId' is a required parameter but is null or undefined.");
3947
3947
  }
@@ -3949,7 +3949,6 @@ var MezonApi = class {
3949
3949
  const queryParams = /* @__PURE__ */ new Map();
3950
3950
  queryParams.set("channel_id", channelId);
3951
3951
  queryParams.set("clan_id", clanId);
3952
- queryParams.set("max_permissions_level", maxPermissionsLevel);
3953
3952
  let bodyJson = "";
3954
3953
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3955
3954
  const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
@@ -5091,6 +5090,16 @@ var _DefaultSocket = class _DefaultSocket {
5091
5090
  this.oneventcreated(message.clan_event_created);
5092
5091
  } else if (message.give_coffee_event) {
5093
5092
  this.oncoffeegiven(message.give_coffee_event);
5093
+ } else if (message.role_assign_event) {
5094
+ this.onroleassign(message.role_assign_event);
5095
+ } else if (message.streaming_started_event) {
5096
+ this.onstreamingchannelstarted(message.streaming_started_event);
5097
+ } else if (message.streaming_ended_event) {
5098
+ this.onstreamingchannelended(message.streaming_ended_event);
5099
+ } else if (message.streaming_joined_event) {
5100
+ this.onstreamingchanneljoined(message.streaming_joined_event);
5101
+ } else if (message.streaming_leaved_event) {
5102
+ this.onstreamingchannelleaved(message.streaming_leaved_event);
5094
5103
  } else {
5095
5104
  if (this.verbose && window && window.console) {
5096
5105
  console.log("Unrecognized message received: %o", message);
@@ -5318,6 +5327,31 @@ var _DefaultSocket = class _DefaultSocket {
5318
5327
  console.log(give_coffee_event);
5319
5328
  }
5320
5329
  }
5330
+ onroleassign(role_assign_event) {
5331
+ if (this.verbose && window && window.console) {
5332
+ console.log(role_assign_event);
5333
+ }
5334
+ }
5335
+ onstreamingchannelstarted(streaming_started_event) {
5336
+ if (this.verbose && window && window.console) {
5337
+ console.log(streaming_started_event);
5338
+ }
5339
+ }
5340
+ onstreamingchannelended(streaming_ended_event) {
5341
+ if (this.verbose && window && window.console) {
5342
+ console.log(streaming_ended_event);
5343
+ }
5344
+ }
5345
+ onstreamingchanneljoined(streaming_joined_event) {
5346
+ if (this.verbose && window && window.console) {
5347
+ console.log(streaming_joined_event);
5348
+ }
5349
+ }
5350
+ onstreamingchannelleaved(streaming_leaved_event) {
5351
+ if (this.verbose && window && window.console) {
5352
+ console.log(streaming_leaved_event);
5353
+ }
5354
+ }
5321
5355
  send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
5322
5356
  const untypedMessage = message;
5323
5357
  return new Promise((resolve, reject) => {
@@ -3912,7 +3912,7 @@ var MezonApi = class {
3912
3912
  ]);
3913
3913
  }
3914
3914
  /** Delete a role by ID. */
3915
- deleteRole(bearerToken, roleId, channelId, clanId, maxPermissionsLevel, options = {}) {
3915
+ deleteRole(bearerToken, roleId, channelId, clanId, options = {}) {
3916
3916
  if (roleId === null || roleId === void 0) {
3917
3917
  throw new Error("'roleId' is a required parameter but is null or undefined.");
3918
3918
  }
@@ -3920,7 +3920,6 @@ var MezonApi = class {
3920
3920
  const queryParams = /* @__PURE__ */ new Map();
3921
3921
  queryParams.set("channel_id", channelId);
3922
3922
  queryParams.set("clan_id", clanId);
3923
- queryParams.set("max_permissions_level", maxPermissionsLevel);
3924
3923
  let bodyJson = "";
3925
3924
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3926
3925
  const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
@@ -5062,6 +5061,16 @@ var _DefaultSocket = class _DefaultSocket {
5062
5061
  this.oneventcreated(message.clan_event_created);
5063
5062
  } else if (message.give_coffee_event) {
5064
5063
  this.oncoffeegiven(message.give_coffee_event);
5064
+ } else if (message.role_assign_event) {
5065
+ this.onroleassign(message.role_assign_event);
5066
+ } else if (message.streaming_started_event) {
5067
+ this.onstreamingchannelstarted(message.streaming_started_event);
5068
+ } else if (message.streaming_ended_event) {
5069
+ this.onstreamingchannelended(message.streaming_ended_event);
5070
+ } else if (message.streaming_joined_event) {
5071
+ this.onstreamingchanneljoined(message.streaming_joined_event);
5072
+ } else if (message.streaming_leaved_event) {
5073
+ this.onstreamingchannelleaved(message.streaming_leaved_event);
5065
5074
  } else {
5066
5075
  if (this.verbose && window && window.console) {
5067
5076
  console.log("Unrecognized message received: %o", message);
@@ -5289,6 +5298,31 @@ var _DefaultSocket = class _DefaultSocket {
5289
5298
  console.log(give_coffee_event);
5290
5299
  }
5291
5300
  }
5301
+ onroleassign(role_assign_event) {
5302
+ if (this.verbose && window && window.console) {
5303
+ console.log(role_assign_event);
5304
+ }
5305
+ }
5306
+ onstreamingchannelstarted(streaming_started_event) {
5307
+ if (this.verbose && window && window.console) {
5308
+ console.log(streaming_started_event);
5309
+ }
5310
+ }
5311
+ onstreamingchannelended(streaming_ended_event) {
5312
+ if (this.verbose && window && window.console) {
5313
+ console.log(streaming_ended_event);
5314
+ }
5315
+ }
5316
+ onstreamingchanneljoined(streaming_joined_event) {
5317
+ if (this.verbose && window && window.console) {
5318
+ console.log(streaming_joined_event);
5319
+ }
5320
+ }
5321
+ onstreamingchannelleaved(streaming_leaved_event) {
5322
+ if (this.verbose && window && window.console) {
5323
+ console.log(streaming_leaved_event);
5324
+ }
5325
+ }
5292
5326
  send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
5293
5327
  const untypedMessage = message;
5294
5328
  return new Promise((resolve, reject) => {
package/dist/socket.d.ts CHANGED
@@ -577,6 +577,63 @@ export interface GetUserEmojiUsageEvent {
577
577
  clanId: string;
578
578
  user_emoji_usage: Array<UserEmojiUsage>;
579
579
  }
580
+ /** On role assign */
581
+ export interface RoleAssignedEvent {
582
+ /** The clan of this role */
583
+ ClanId: string;
584
+ /** Role ID */
585
+ role_id: string;
586
+ /** UserIds Assigned */
587
+ user_ids_assigned: string[];
588
+ /** UserIds Removed */
589
+ user_ids_removed: string[];
590
+ }
591
+ /** Streaming Joined event */
592
+ export interface StreamingLeavedEvent {
593
+ /** id */
594
+ id: string;
595
+ /** The unique identifier of the chat clan. */
596
+ clan_id: string;
597
+ /** streaming channel name */
598
+ streaming_channel_id: string;
599
+ /** streaming user_id */
600
+ streaming_user_id: string;
601
+ }
602
+ /** Streaming Joined event */
603
+ export interface StreamingJoinedEvent {
604
+ /** The unique identifier of the chat clan. */
605
+ clan_id: string;
606
+ /** The channel name */
607
+ clan_name: string;
608
+ /** id streaming */
609
+ id: string;
610
+ /** streaming participant */
611
+ participant: string;
612
+ /** user id */
613
+ user_id: string;
614
+ /** streaming channel label */
615
+ streaming_channel_label: string;
616
+ /** streaming channel id */
617
+ streaming_channel_id: string;
618
+ }
619
+ /** Streaming start event */
620
+ export interface StreamingStartedEvent {
621
+ /** clan id */
622
+ clan_id: string;
623
+ /** channel id */
624
+ channel_id: string;
625
+ /** stream url */
626
+ streaming_url: string;
627
+ /** status */
628
+ is_streaming: boolean;
629
+ }
630
+ /** Streaming start event */
631
+ export interface StreamingEndedEvent {
632
+ /** clan id */
633
+ clan_id: string;
634
+ /** channel id */
635
+ channel_id: string;
636
+ }
580
637
  /** A socket connection to Mezon server. */
581
638
  export interface Socket {
582
639
  /** Connection is Open */
@@ -692,6 +749,11 @@ export interface Socket {
692
749
  oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
693
750
  oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
694
751
  oneventemoji: (event_emoji: EventEmoji) => void;
752
+ onroleassign: (role_assign_event: RoleAssignedEvent) => void;
753
+ onstreamingchannelstarted: (streaming_started_event: StreamingStartedEvent) => void;
754
+ onstreamingchannelended: (streaming_ended_event: StreamingEndedEvent) => void;
755
+ onstreamingchanneljoined: (streaming_joined_event: StreamingJoinedEvent) => void;
756
+ onstreamingchannelleaved: (streaming_leaved_event: StreamingLeavedEvent) => void;
695
757
  }
696
758
  /** Reports an error received from a socket message. */
697
759
  export interface SocketError {
@@ -756,6 +818,11 @@ export declare class DefaultSocket implements Socket {
756
818
  oncustomstatus(statusEvent: CustomStatusEvent): void;
757
819
  oneventcreated(clan_event_created: ApiCreateEventRequest): void;
758
820
  oncoffeegiven(give_coffee_event: ApiGiveCoffeeEvent): void;
821
+ onroleassign(role_assign_event: RoleAssignedEvent): void;
822
+ onstreamingchannelstarted(streaming_started_event: StreamingStartedEvent): void;
823
+ onstreamingchannelended(streaming_ended_event: StreamingEndedEvent): void;
824
+ onstreamingchanneljoined(streaming_joined_event: StreamingJoinedEvent): void;
825
+ onstreamingchannelleaved(streaming_leaved_event: StreamingLeavedEvent): void;
759
826
  send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout?: number): Promise<any>;
760
827
  followUsers(userIds: string[]): Promise<Status>;
761
828
  joinClanChat(clan_id: string): Promise<ClanJoin>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.8.97",
4
+ "version": "2.9.0",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -863,6 +863,68 @@ export interface GetUserEmojiUsageEvent {
863
863
  user_emoji_usage: Array<UserEmojiUsage>;
864
864
  }
865
865
 
866
+ /** On role assign */
867
+ export interface RoleAssignedEvent {
868
+ /** The clan of this role */
869
+ ClanId: string;
870
+ /** Role ID */
871
+ role_id: string;
872
+ /** UserIds Assigned */
873
+ user_ids_assigned: string[];
874
+ /** UserIds Removed */
875
+ user_ids_removed: string[];
876
+ }
877
+
878
+ /** Streaming Joined event */
879
+ export interface StreamingLeavedEvent {
880
+ /** id */
881
+ id: string;
882
+ /** The unique identifier of the chat clan. */
883
+ clan_id: string;
884
+ /** streaming channel name */
885
+ streaming_channel_id: string;
886
+ /** streaming user_id */
887
+ streaming_user_id: string;
888
+ }
889
+
890
+ /** Streaming Joined event */
891
+ export interface StreamingJoinedEvent {
892
+ /** The unique identifier of the chat clan. */
893
+ clan_id: string;
894
+ /** The channel name */
895
+ clan_name: string;
896
+ /** id streaming */
897
+ id: string;
898
+ /** streaming participant */
899
+ participant: string;
900
+ /** user id */
901
+ user_id: string;
902
+ /** streaming channel label */
903
+ streaming_channel_label: string;
904
+ /** streaming channel id */
905
+ streaming_channel_id: string;
906
+ }
907
+
908
+ /** Streaming start event */
909
+ export interface StreamingStartedEvent {
910
+ /** clan id */
911
+ clan_id: string;
912
+ /** channel id */
913
+ channel_id: string;
914
+ /** stream url */
915
+ streaming_url: string;
916
+ /** status */
917
+ is_streaming: boolean;
918
+ }
919
+
920
+ /** Streaming start event */
921
+ export interface StreamingEndedEvent {
922
+ /** clan id */
923
+ clan_id: string;
924
+ /** channel id */
925
+ channel_id: string;
926
+ }
927
+
866
928
  /** A socket connection to Mezon server. */
867
929
  export interface Socket {
868
930
  /** Connection is Open */
@@ -1064,6 +1126,16 @@ export interface Socket {
1064
1126
 
1065
1127
  oneventemoji: (event_emoji: EventEmoji) => void;
1066
1128
 
1129
+ onroleassign: (role_assign_event: RoleAssignedEvent) => void;
1130
+
1131
+ onstreamingchannelstarted: (streaming_started_event: StreamingStartedEvent) => void;
1132
+
1133
+ onstreamingchannelended: (streaming_ended_event: StreamingEndedEvent) => void;
1134
+
1135
+ onstreamingchanneljoined: (streaming_joined_event: StreamingJoinedEvent) => void;
1136
+
1137
+ onstreamingchannelleaved: (streaming_leaved_event: StreamingLeavedEvent) => void;
1138
+
1067
1139
  }
1068
1140
 
1069
1141
  /** Reports an error received from a socket message. */
@@ -1246,9 +1318,19 @@ export class DefaultSocket implements Socket {
1246
1318
  } else if (message.user_clan_removed_event) {
1247
1319
  this.onuserclanremoved(<UserClanRemovedEvent>message.user_clan_removed_event);
1248
1320
  } else if(message.clan_event_created){
1249
- this.oneventcreated(message.clan_event_created);
1321
+ this.oneventcreated(message.clan_event_created);
1250
1322
  } else if(message.give_coffee_event){
1251
1323
  this.oncoffeegiven(<ApiGiveCoffeeEvent>message.give_coffee_event);
1324
+ } else if(message.role_assign_event){
1325
+ this.onroleassign(<RoleAssignedEvent>message.role_assign_event);
1326
+ } else if(message.streaming_started_event){
1327
+ this.onstreamingchannelstarted(<StreamingStartedEvent>message.streaming_started_event);
1328
+ } else if(message.streaming_ended_event){
1329
+ this.onstreamingchannelended(<StreamingEndedEvent>message.streaming_ended_event);
1330
+ } else if(message.streaming_joined_event){
1331
+ this.onstreamingchanneljoined(<StreamingJoinedEvent>message.streaming_joined_event);
1332
+ } else if(message.streaming_leaved_event){
1333
+ this.onstreamingchannelleaved(<StreamingLeavedEvent>message.streaming_leaved_event);
1252
1334
  } else {
1253
1335
  if (this.verbose && window && window.console) {
1254
1336
  console.log("Unrecognized message received: %o", message);
@@ -1520,6 +1602,36 @@ export class DefaultSocket implements Socket {
1520
1602
  console.log(give_coffee_event);
1521
1603
  }
1522
1604
  }
1605
+
1606
+ onroleassign(role_assign_event: RoleAssignedEvent) {
1607
+ if (this.verbose && window && window.console) {
1608
+ console.log(role_assign_event);
1609
+ }
1610
+ }
1611
+
1612
+ onstreamingchannelstarted(streaming_started_event: StreamingStartedEvent) {
1613
+ if (this.verbose && window && window.console) {
1614
+ console.log(streaming_started_event);
1615
+ }
1616
+ }
1617
+
1618
+ onstreamingchannelended(streaming_ended_event: StreamingEndedEvent) {
1619
+ if (this.verbose && window && window.console) {
1620
+ console.log(streaming_ended_event);
1621
+ }
1622
+ }
1623
+
1624
+ onstreamingchanneljoined(streaming_joined_event: StreamingJoinedEvent) {
1625
+ if (this.verbose && window && window.console) {
1626
+ console.log(streaming_joined_event);
1627
+ }
1628
+ }
1629
+
1630
+ onstreamingchannelleaved(streaming_leaved_event: StreamingLeavedEvent) {
1631
+ if (this.verbose && window && window.console) {
1632
+ console.log(streaming_leaved_event);
1633
+ }
1634
+ }
1523
1635
 
1524
1636
  send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent |
1525
1637
  ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout = DefaultSocket.DefaultSendTimeoutMs): Promise<any> {