mezon-js 2.8.57 → 2.8.58
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +12 -41
- package/client.ts +0 -13
- package/dist/api.gen.d.ts +6 -3
- package/dist/client.d.ts +1 -3
- package/dist/mezon-js.cjs.js +30 -56
- package/dist/mezon-js.esm.mjs +30 -56
- package/dist/socket.d.ts +40 -18
- package/package.json +1 -1
- package/socket.ts +74 -25
package/api.gen.ts
CHANGED
@@ -346,8 +346,8 @@ export interface ApiAddRoleChannelDescRequest {
|
|
346
346
|
|
347
347
|
/** App information. */
|
348
348
|
export interface ApiApp {
|
349
|
-
//
|
350
|
-
|
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
|
-
|
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,
|
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 */
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -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) {
|
@@ -4978,24 +4949,25 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4978
4949
|
return response.clan_join;
|
4979
4950
|
});
|
4980
4951
|
}
|
4981
|
-
joinChat(clan_id, channel_id, channel_type) {
|
4952
|
+
joinChat(clan_id, channel_id, channel_type, is_public) {
|
4982
4953
|
return __async(this, null, function* () {
|
4983
4954
|
const response = yield this.send(
|
4984
4955
|
{
|
4985
4956
|
channel_join: {
|
4986
4957
|
clan_id,
|
4987
4958
|
channel_id,
|
4988
|
-
channel_type
|
4959
|
+
channel_type,
|
4960
|
+
is_public
|
4989
4961
|
}
|
4990
4962
|
}
|
4991
4963
|
);
|
4992
4964
|
return response.channel;
|
4993
4965
|
});
|
4994
4966
|
}
|
4995
|
-
leaveChat(clan_id, channel_id, channel_type) {
|
4996
|
-
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 } });
|
4997
4969
|
}
|
4998
|
-
removeChatMessage(clan_id, channel_id, mode, message_id) {
|
4970
|
+
removeChatMessage(clan_id, channel_id, mode, is_public, message_id) {
|
4999
4971
|
return __async(this, null, function* () {
|
5000
4972
|
const response = yield this.send(
|
5001
4973
|
{
|
@@ -5003,7 +4975,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5003
4975
|
clan_id,
|
5004
4976
|
channel_id,
|
5005
4977
|
mode,
|
5006
|
-
message_id
|
4978
|
+
message_id,
|
4979
|
+
is_public
|
5007
4980
|
}
|
5008
4981
|
}
|
5009
4982
|
);
|
@@ -5038,24 +5011,24 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5038
5011
|
unfollowUsers(user_ids) {
|
5039
5012
|
return this.send({ status_unfollow: { user_ids } });
|
5040
5013
|
}
|
5041
|
-
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) {
|
5042
5015
|
return __async(this, null, function* () {
|
5043
|
-
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 } });
|
5044
5017
|
return response.channel_message_ack;
|
5045
5018
|
});
|
5046
5019
|
}
|
5047
5020
|
updateStatus(status) {
|
5048
5021
|
return this.send({ status_update: { status } });
|
5049
5022
|
}
|
5050
|
-
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) {
|
5051
5024
|
return __async(this, null, function* () {
|
5052
|
-
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 } });
|
5053
5026
|
return response.channel_message_ack;
|
5054
5027
|
});
|
5055
5028
|
}
|
5056
|
-
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) {
|
5057
5030
|
return __async(this, null, function* () {
|
5058
|
-
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 } });
|
5059
5032
|
return response.message_reaction_event;
|
5060
5033
|
});
|
5061
5034
|
}
|
@@ -5065,15 +5038,15 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5065
5038
|
return response.message_typing_event;
|
5066
5039
|
});
|
5067
5040
|
}
|
5068
|
-
writeLastSeenMessage(clan_id, channel_id, mode, message_id, timestamp_seconds) {
|
5041
|
+
writeLastSeenMessage(clan_id, channel_id, mode, is_public, message_id, timestamp_seconds) {
|
5069
5042
|
return __async(this, null, function* () {
|
5070
|
-
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 } });
|
5071
5044
|
return response.last_seen_message_event;
|
5072
5045
|
});
|
5073
5046
|
}
|
5074
|
-
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) {
|
5075
5048
|
return __async(this, null, function* () {
|
5076
|
-
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 } });
|
5077
5050
|
return response.last_pin_message_event;
|
5078
5051
|
});
|
5079
5052
|
}
|
@@ -5107,6 +5080,18 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5107
5080
|
return response.emojis_listed_event;
|
5108
5081
|
});
|
5109
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
|
+
}
|
5110
5095
|
ListChannelByUserId() {
|
5111
5096
|
return __async(this, null, function* () {
|
5112
5097
|
const response = yield this.send({ channel_desc_list_event: {} });
|
@@ -5958,17 +5943,6 @@ var Client = class {
|
|
5958
5943
|
});
|
5959
5944
|
});
|
5960
5945
|
}
|
5961
|
-
/** List user roles */
|
5962
|
-
listRoles(session, limit, state, cursor, clanId) {
|
5963
|
-
return __async(this, null, function* () {
|
5964
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5965
|
-
yield this.sessionRefresh(session);
|
5966
|
-
}
|
5967
|
-
return this.apiClient.listRoles(session.token, limit, state, cursor, clanId).then((response) => {
|
5968
|
-
return Promise.resolve(response);
|
5969
|
-
});
|
5970
|
-
});
|
5971
|
-
}
|
5972
5946
|
/** List event */
|
5973
5947
|
listEvents(session, clanId) {
|
5974
5948
|
return __async(this, null, function* () {
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -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) {
|
@@ -4949,24 +4920,25 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4949
4920
|
return response.clan_join;
|
4950
4921
|
});
|
4951
4922
|
}
|
4952
|
-
joinChat(clan_id, channel_id, channel_type) {
|
4923
|
+
joinChat(clan_id, channel_id, channel_type, is_public) {
|
4953
4924
|
return __async(this, null, function* () {
|
4954
4925
|
const response = yield this.send(
|
4955
4926
|
{
|
4956
4927
|
channel_join: {
|
4957
4928
|
clan_id,
|
4958
4929
|
channel_id,
|
4959
|
-
channel_type
|
4930
|
+
channel_type,
|
4931
|
+
is_public
|
4960
4932
|
}
|
4961
4933
|
}
|
4962
4934
|
);
|
4963
4935
|
return response.channel;
|
4964
4936
|
});
|
4965
4937
|
}
|
4966
|
-
leaveChat(clan_id, channel_id, channel_type) {
|
4967
|
-
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 } });
|
4968
4940
|
}
|
4969
|
-
removeChatMessage(clan_id, channel_id, mode, message_id) {
|
4941
|
+
removeChatMessage(clan_id, channel_id, mode, is_public, message_id) {
|
4970
4942
|
return __async(this, null, function* () {
|
4971
4943
|
const response = yield this.send(
|
4972
4944
|
{
|
@@ -4974,7 +4946,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4974
4946
|
clan_id,
|
4975
4947
|
channel_id,
|
4976
4948
|
mode,
|
4977
|
-
message_id
|
4949
|
+
message_id,
|
4950
|
+
is_public
|
4978
4951
|
}
|
4979
4952
|
}
|
4980
4953
|
);
|
@@ -5009,24 +4982,24 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5009
4982
|
unfollowUsers(user_ids) {
|
5010
4983
|
return this.send({ status_unfollow: { user_ids } });
|
5011
4984
|
}
|
5012
|
-
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) {
|
5013
4986
|
return __async(this, null, function* () {
|
5014
|
-
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 } });
|
5015
4988
|
return response.channel_message_ack;
|
5016
4989
|
});
|
5017
4990
|
}
|
5018
4991
|
updateStatus(status) {
|
5019
4992
|
return this.send({ status_update: { status } });
|
5020
4993
|
}
|
5021
|
-
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) {
|
5022
4995
|
return __async(this, null, function* () {
|
5023
|
-
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 } });
|
5024
4997
|
return response.channel_message_ack;
|
5025
4998
|
});
|
5026
4999
|
}
|
5027
|
-
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) {
|
5028
5001
|
return __async(this, null, function* () {
|
5029
|
-
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 } });
|
5030
5003
|
return response.message_reaction_event;
|
5031
5004
|
});
|
5032
5005
|
}
|
@@ -5036,15 +5009,15 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5036
5009
|
return response.message_typing_event;
|
5037
5010
|
});
|
5038
5011
|
}
|
5039
|
-
writeLastSeenMessage(clan_id, channel_id, mode, message_id, timestamp_seconds) {
|
5012
|
+
writeLastSeenMessage(clan_id, channel_id, mode, is_public, message_id, timestamp_seconds) {
|
5040
5013
|
return __async(this, null, function* () {
|
5041
|
-
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 } });
|
5042
5015
|
return response.last_seen_message_event;
|
5043
5016
|
});
|
5044
5017
|
}
|
5045
|
-
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) {
|
5046
5019
|
return __async(this, null, function* () {
|
5047
|
-
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 } });
|
5048
5021
|
return response.last_pin_message_event;
|
5049
5022
|
});
|
5050
5023
|
}
|
@@ -5078,6 +5051,18 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5078
5051
|
return response.emojis_listed_event;
|
5079
5052
|
});
|
5080
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
|
+
}
|
5081
5066
|
ListChannelByUserId() {
|
5082
5067
|
return __async(this, null, function* () {
|
5083
5068
|
const response = yield this.send({ channel_desc_list_event: {} });
|
@@ -5929,17 +5914,6 @@ var Client = class {
|
|
5929
5914
|
});
|
5930
5915
|
});
|
5931
5916
|
}
|
5932
|
-
/** List user roles */
|
5933
|
-
listRoles(session, limit, state, cursor, clanId) {
|
5934
|
-
return __async(this, null, function* () {
|
5935
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5936
|
-
yield this.sessionRefresh(session);
|
5937
|
-
}
|
5938
|
-
return this.apiClient.listRoles(session.token, limit, state, cursor, clanId).then((response) => {
|
5939
|
-
return Promise.resolve(response);
|
5940
|
-
});
|
5941
|
-
});
|
5942
|
-
}
|
5943
5917
|
/** List event */
|
5944
5918
|
listEvents(session, clanId) {
|
5945
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, ApiCreateEventRequest, 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. */
|
@@ -388,6 +394,18 @@ export interface EmojiListedEvent {
|
|
388
394
|
clan_id: string;
|
389
395
|
emoji_list?: Array<ClanEmoji>;
|
390
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
|
+
}
|
391
409
|
/** */
|
392
410
|
export interface ClanEmoji {
|
393
411
|
category?: string;
|
@@ -485,29 +503,29 @@ export interface Socket {
|
|
485
503
|
/** Join clan chat */
|
486
504
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
487
505
|
/** Join a chat channel on the server. */
|
488
|
-
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>;
|
489
507
|
/** Leave a chat channel on the server. */
|
490
|
-
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>;
|
491
509
|
/** Remove a chat message from a chat channel on the server. */
|
492
|
-
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>;
|
493
511
|
/** Execute an RPC function to the server. */
|
494
512
|
rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc>;
|
495
513
|
/** Unfollow one or more users from their status updates. */
|
496
514
|
unfollowUsers(user_ids: string[]): Promise<void>;
|
497
515
|
/** Update a chat message on a chat channel in the server. */
|
498
|
-
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>;
|
499
517
|
/** Update the status for the current user online. */
|
500
518
|
updateStatus(status?: string): Promise<void>;
|
501
519
|
/** Send a chat message to a chat channel on the server. */
|
502
|
-
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>;
|
503
521
|
/** Send message typing */
|
504
|
-
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>;
|
505
523
|
/** Send message reaction */
|
506
|
-
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>;
|
507
525
|
/** Send last seen message */
|
508
|
-
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>;
|
509
527
|
/** Send last pin message */
|
510
|
-
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>;
|
511
529
|
/** Send custom user status */
|
512
530
|
writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
|
513
531
|
/** send voice joined */
|
@@ -567,6 +585,8 @@ export interface Socket {
|
|
567
585
|
getHeartbeatTimeoutMs(): number;
|
568
586
|
checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
|
569
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>;
|
570
590
|
listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
|
571
591
|
ListChannelByUserId(): Promise<ChannelDescListEvent>;
|
572
592
|
ListUserClansByUserId(): Promise<AllUserClans>;
|
@@ -638,25 +658,27 @@ export declare class DefaultSocket implements Socket {
|
|
638
658
|
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout?: number): Promise<any>;
|
639
659
|
followUsers(userIds: string[]): Promise<Status>;
|
640
660
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
641
|
-
joinChat(clan_id: string, channel_id: string, channel_type: number): Promise<Channel>;
|
642
|
-
leaveChat(clan_id: string, channel_id: string, channel_type: number): Promise<void>;
|
643
|
-
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>;
|
644
664
|
removePartyMember(party_id: string, member: Presence): Promise<void>;
|
645
665
|
rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc>;
|
646
666
|
sendPartyData(party_id: string, op_code: number, data: string | Uint8Array): Promise<void>;
|
647
667
|
unfollowUsers(user_ids: string[]): Promise<void>;
|
648
|
-
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>;
|
649
669
|
updateStatus(status?: string): Promise<void>;
|
650
|
-
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>;
|
651
|
-
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>;
|
652
672
|
writeMessageTyping(clan_id: string, channel_id: string, mode: number): Promise<MessageTypingEvent>;
|
653
|
-
writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp_seconds: number): Promise<LastSeenMessageEvent>;
|
654
|
-
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>;
|
655
675
|
writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
|
656
676
|
writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
|
657
677
|
writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
|
658
678
|
checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
|
659
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>;
|
660
682
|
ListChannelByUserId(): Promise<ChannelDescListEvent>;
|
661
683
|
ListUserClansByUserId(): Promise<AllUserClans>;
|
662
684
|
hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import { ApiChannelMessageHeader, ApiCreateEventRequest, 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
|
|
@@ -550,6 +562,27 @@ export interface EmojiListedEvent {
|
|
550
562
|
emoji_list?: Array<ClanEmoji>;
|
551
563
|
}
|
552
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
|
+
|
553
586
|
/** */
|
554
587
|
export interface ClanEmoji {
|
555
588
|
//
|
@@ -718,13 +751,13 @@ export interface Socket {
|
|
718
751
|
joinClanChat(clan_id: string) : Promise<ClanJoin>;
|
719
752
|
|
720
753
|
/** Join a chat channel on the server. */
|
721
|
-
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>;
|
722
755
|
|
723
756
|
/** Leave a chat channel on the server. */
|
724
|
-
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>;
|
725
758
|
|
726
759
|
/** Remove a chat message from a chat channel on the server. */
|
727
|
-
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>;
|
728
761
|
|
729
762
|
/** Execute an RPC function to the server. */
|
730
763
|
rpc(id?: string, payload?: string, http_key?: string) : Promise<ApiRpc>
|
@@ -733,25 +766,25 @@ export interface Socket {
|
|
733
766
|
unfollowUsers(user_ids : string[]) : Promise<void>;
|
734
767
|
|
735
768
|
/** Update a chat message on a chat channel in the server. */
|
736
|
-
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>;
|
737
770
|
|
738
771
|
/** Update the status for the current user online. */
|
739
772
|
updateStatus(status? : string) : Promise<void>;
|
740
773
|
|
741
774
|
/** Send a chat message to a chat channel on the server. */
|
742
|
-
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>;
|
743
776
|
|
744
777
|
/** Send message typing */
|
745
|
-
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>;
|
746
779
|
|
747
780
|
/** Send message reaction */
|
748
|
-
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>;
|
749
782
|
|
750
783
|
/** Send last seen message */
|
751
|
-
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>;
|
752
785
|
|
753
786
|
/** Send last pin message */
|
754
|
-
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>;
|
755
788
|
|
756
789
|
/** Send custom user status */
|
757
790
|
writeCustomStatus(clan_id: string, status: string) : Promise<CustomStatusEvent>;
|
@@ -857,6 +890,10 @@ export interface Socket {
|
|
857
890
|
|
858
891
|
listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
|
859
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
|
+
|
860
897
|
listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
|
861
898
|
|
862
899
|
ListChannelByUserId(): Promise<ChannelDescListEvent>;
|
@@ -1321,13 +1358,14 @@ export class DefaultSocket implements Socket {
|
|
1321
1358
|
return response.clan_join;
|
1322
1359
|
}
|
1323
1360
|
|
1324
|
-
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> {
|
1325
1362
|
|
1326
1363
|
const response = await this.send({
|
1327
1364
|
channel_join: {
|
1328
1365
|
clan_id: clan_id,
|
1329
1366
|
channel_id: channel_id,
|
1330
1367
|
channel_type: channel_type,
|
1368
|
+
is_public: is_public
|
1331
1369
|
}
|
1332
1370
|
}
|
1333
1371
|
);
|
@@ -1335,18 +1373,19 @@ export class DefaultSocket implements Socket {
|
|
1335
1373
|
return response.channel;
|
1336
1374
|
}
|
1337
1375
|
|
1338
|
-
leaveChat(clan_id: string, channel_id: string, channel_type: number): Promise<void> {
|
1339
|
-
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}});
|
1340
1378
|
}
|
1341
1379
|
|
1342
|
-
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> {
|
1343
1381
|
const response = await this.send(
|
1344
1382
|
{
|
1345
1383
|
channel_message_remove: {
|
1346
1384
|
clan_id: clan_id,
|
1347
1385
|
channel_id: channel_id,
|
1348
1386
|
mode: mode,
|
1349
|
-
message_id: message_id
|
1387
|
+
message_id: message_id,
|
1388
|
+
is_public: is_public
|
1350
1389
|
}
|
1351
1390
|
}
|
1352
1391
|
);
|
@@ -1382,8 +1421,8 @@ export class DefaultSocket implements Socket {
|
|
1382
1421
|
return this.send({status_unfollow: {user_ids: user_ids}});
|
1383
1422
|
}
|
1384
1423
|
|
1385
|
-
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> {
|
1386
|
-
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}});
|
1387
1426
|
return response.channel_message_ack;
|
1388
1427
|
}
|
1389
1428
|
|
@@ -1391,13 +1430,13 @@ export class DefaultSocket implements Socket {
|
|
1391
1430
|
return this.send({status_update: {status: status}});
|
1392
1431
|
}
|
1393
1432
|
|
1394
|
-
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> {
|
1395
|
-
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}});
|
1396
1435
|
return response.channel_message_ack;
|
1397
1436
|
}
|
1398
1437
|
|
1399
|
-
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> {
|
1400
|
-
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}});
|
1401
1440
|
return response.message_reaction_event
|
1402
1441
|
}
|
1403
1442
|
|
@@ -1406,13 +1445,13 @@ export class DefaultSocket implements Socket {
|
|
1406
1445
|
return response.message_typing_event
|
1407
1446
|
}
|
1408
1447
|
|
1409
|
-
async writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp_seconds: number): Promise<LastSeenMessageEvent> {
|
1410
|
-
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}});
|
1411
1450
|
return response.last_seen_message_event
|
1412
1451
|
}
|
1413
1452
|
|
1414
|
-
async writeLastPinMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp_seconds: number, operation: number): Promise<LastPinMessageEvent> {
|
1415
|
-
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}});
|
1416
1455
|
return response.last_pin_message_event
|
1417
1456
|
}
|
1418
1457
|
|
@@ -1441,6 +1480,16 @@ export class DefaultSocket implements Socket {
|
|
1441
1480
|
return response.emojis_listed_event
|
1442
1481
|
}
|
1443
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
|
+
|
1444
1493
|
async ListChannelByUserId(): Promise<ChannelDescListEvent> {
|
1445
1494
|
const response = await this.send({channel_desc_list_event: {}});
|
1446
1495
|
return response.channel_desc_list_event
|