mezon-js 2.9.22 → 2.9.24
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +46 -0
- package/client.ts +20 -0
- package/dist/api.gen.d.ts +8 -0
- package/dist/client.d.ts +2 -1
- package/dist/mezon-js.cjs.js +46 -84
- package/dist/mezon-js.esm.mjs +46 -84
- package/dist/socket.d.ts +9 -105
- package/package.json +1 -1
- package/socket.ts +19 -231
package/api.gen.ts
CHANGED
@@ -1226,6 +1226,16 @@ export interface ApiMessageDeleted {
|
|
1226
1226
|
message_id?: string;
|
1227
1227
|
}
|
1228
1228
|
|
1229
|
+
/** */
|
1230
|
+
export interface ApiMarkAsReadRequest {
|
1231
|
+
//
|
1232
|
+
category_id?: string;
|
1233
|
+
//
|
1234
|
+
channel_id?: string;
|
1235
|
+
//
|
1236
|
+
clan_id?: string;
|
1237
|
+
}
|
1238
|
+
|
1229
1239
|
/** */
|
1230
1240
|
export interface ApiMessageMention {
|
1231
1241
|
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was created.
|
@@ -6100,6 +6110,42 @@ export class MezonApi {
|
|
6100
6110
|
]);
|
6101
6111
|
}
|
6102
6112
|
|
6113
|
+
/** Mark as read */
|
6114
|
+
markAsRead(bearerToken: string,
|
6115
|
+
body:ApiMarkAsReadRequest,
|
6116
|
+
options: any = {}): Promise<any> {
|
6117
|
+
|
6118
|
+
if (body === null || body === undefined) {
|
6119
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
6120
|
+
}
|
6121
|
+
const urlPath = "/v2/markasread";
|
6122
|
+
const queryParams = new Map<string, any>();
|
6123
|
+
|
6124
|
+
let bodyJson : string = "";
|
6125
|
+
bodyJson = JSON.stringify(body || {});
|
6126
|
+
|
6127
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6128
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
6129
|
+
if (bearerToken) {
|
6130
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6131
|
+
}
|
6132
|
+
|
6133
|
+
return Promise.race([
|
6134
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6135
|
+
if (response.status == 204) {
|
6136
|
+
return response;
|
6137
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6138
|
+
return response.json();
|
6139
|
+
} else {
|
6140
|
+
throw response;
|
6141
|
+
}
|
6142
|
+
}),
|
6143
|
+
new Promise((_, reject) =>
|
6144
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6145
|
+
),
|
6146
|
+
]);
|
6147
|
+
}
|
6148
|
+
|
6103
6149
|
/** set mute notification user channel. */
|
6104
6150
|
setMuteNotificationCategory(
|
6105
6151
|
bearerToken: string,
|
package/client.ts
CHANGED
@@ -120,6 +120,7 @@ import {
|
|
120
120
|
ApiAllUserClans,
|
121
121
|
ApiUserPermissionInChannelListResponse,
|
122
122
|
ApiPermissionRoleChannelListEventResponse,
|
123
|
+
ApiMarkAsReadRequest,
|
123
124
|
} from "./api.gen";
|
124
125
|
|
125
126
|
import { Session } from "./session";
|
@@ -3899,4 +3900,23 @@ export class Client {
|
|
3899
3900
|
return Promise.resolve(result);
|
3900
3901
|
});
|
3901
3902
|
}
|
3903
|
+
|
3904
|
+
async markAsRead(
|
3905
|
+
session: Session,
|
3906
|
+
request: ApiMarkAsReadRequest
|
3907
|
+
): Promise<any> {
|
3908
|
+
if (
|
3909
|
+
this.autoRefreshSession &&
|
3910
|
+
session.refresh_token &&
|
3911
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
3912
|
+
) {
|
3913
|
+
await this.sessionRefresh(session);
|
3914
|
+
}
|
3915
|
+
|
3916
|
+
return this.apiClient
|
3917
|
+
.markAsRead(session.token, request)
|
3918
|
+
.then((response: any) => {
|
3919
|
+
return Promise.resolve(response);
|
3920
|
+
});
|
3921
|
+
}
|
3902
3922
|
}
|
package/dist/api.gen.d.ts
CHANGED
@@ -710,6 +710,12 @@ export interface ApiMessageDeleted {
|
|
710
710
|
message_id?: string;
|
711
711
|
}
|
712
712
|
/** */
|
713
|
+
export interface ApiMarkAsReadRequest {
|
714
|
+
category_id?: string;
|
715
|
+
channel_id?: string;
|
716
|
+
clan_id?: string;
|
717
|
+
}
|
718
|
+
/** */
|
713
719
|
export interface ApiMessageMention {
|
714
720
|
create_time?: string;
|
715
721
|
id?: string;
|
@@ -1416,6 +1422,8 @@ export declare class MezonApi {
|
|
1416
1422
|
inviteUser(bearerToken: string, inviteId: string, options?: any): Promise<ApiInviteUserRes>;
|
1417
1423
|
/** List HashtagDMList */
|
1418
1424
|
listChannelByUserId(bearerToken: string, options?: any): Promise<ApiChannelDescList>;
|
1425
|
+
/** Mark as read */
|
1426
|
+
markAsRead(bearerToken: string, body: ApiMarkAsReadRequest, options?: any): Promise<any>;
|
1419
1427
|
/** set mute notification user channel. */
|
1420
1428
|
setMuteNotificationCategory(bearerToken: string, body: ApiSetMuteNotificationRequest, options?: any): Promise<any>;
|
1421
1429
|
/** set mute notification user channel. */
|
package/dist/client.d.ts
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse } from "./api.gen";
|
16
|
+
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -576,4 +576,5 @@ export declare class Client {
|
|
576
576
|
listRoles(session: Session, clanId?: string, limit?: string, state?: string, cursor?: string): Promise<ApiRoleListEventResponse>;
|
577
577
|
listUserPermissionInChannel(session: Session, clanId?: string, channelId?: string): Promise<ApiUserPermissionInChannelListResponse>;
|
578
578
|
getPermissionByRoleIdChannelId(session: Session, roleId?: string, channelId?: string, userId?: string): Promise<ApiPermissionRoleChannelListEventResponse>;
|
579
|
+
markAsRead(session: Session, request: ApiMarkAsReadRequest): Promise<any>;
|
579
580
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -3824,6 +3824,35 @@ var MezonApi = class {
|
|
3824
3824
|
)
|
3825
3825
|
]);
|
3826
3826
|
}
|
3827
|
+
/** Mark as read */
|
3828
|
+
markAsRead(bearerToken, body, options = {}) {
|
3829
|
+
if (body === null || body === void 0) {
|
3830
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
3831
|
+
}
|
3832
|
+
const urlPath = "/v2/markasread";
|
3833
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3834
|
+
let bodyJson = "";
|
3835
|
+
bodyJson = JSON.stringify(body || {});
|
3836
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3837
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
3838
|
+
if (bearerToken) {
|
3839
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3840
|
+
}
|
3841
|
+
return Promise.race([
|
3842
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3843
|
+
if (response.status == 204) {
|
3844
|
+
return response;
|
3845
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3846
|
+
return response.json();
|
3847
|
+
} else {
|
3848
|
+
throw response;
|
3849
|
+
}
|
3850
|
+
}),
|
3851
|
+
new Promise(
|
3852
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3853
|
+
)
|
3854
|
+
]);
|
3855
|
+
}
|
3827
3856
|
/** set mute notification user channel. */
|
3828
3857
|
setMuteNotificationCategory(bearerToken, body, options = {}) {
|
3829
3858
|
if (body === null || body === void 0) {
|
@@ -5921,6 +5950,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5921
5950
|
this.onstreamingchannelleaved(message.streaming_leaved_event);
|
5922
5951
|
} else if (message.set_permission_channel_event) {
|
5923
5952
|
this.onsetpermissionchannel(message.set_permission_channel_event);
|
5953
|
+
} else if (message.event_user_permission_channel) {
|
5954
|
+
this.onuserpermissionchannel(message.event_user_permission_channel);
|
5924
5955
|
} else {
|
5925
5956
|
if (this.verbose && window && window.console) {
|
5926
5957
|
console.log("Unrecognized message received: %o", message);
|
@@ -6183,6 +6214,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6183
6214
|
console.log(set_permission_channel_event);
|
6184
6215
|
}
|
6185
6216
|
}
|
6217
|
+
onuserpermissionchannel(event_user_permission_channel) {
|
6218
|
+
if (this.verbose && window && window.console) {
|
6219
|
+
console.log(event_user_permission_channel);
|
6220
|
+
}
|
6221
|
+
}
|
6186
6222
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
6187
6223
|
const untypedMessage = message;
|
6188
6224
|
return new Promise((resolve, reject) => {
|
@@ -6338,90 +6374,6 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6338
6374
|
return response.check_name_existed_event;
|
6339
6375
|
});
|
6340
6376
|
}
|
6341
|
-
listClanEmojiByUserId() {
|
6342
|
-
return __async(this, null, function* () {
|
6343
|
-
const response = yield this.send({ emojis_listed_event: {} });
|
6344
|
-
return response.emojis_listed_event;
|
6345
|
-
});
|
6346
|
-
}
|
6347
|
-
listUserPermissionInChannel(clan_id, channel_id) {
|
6348
|
-
return __async(this, null, function* () {
|
6349
|
-
const response = yield this.send({ user_permission_in_channel_list_event: { clan_id, channel_id } });
|
6350
|
-
return response.user_permission_in_channel_list_event;
|
6351
|
-
});
|
6352
|
-
}
|
6353
|
-
listRoles(ClanId, Limit, State, Cursor) {
|
6354
|
-
return __async(this, null, function* () {
|
6355
|
-
const response = yield this.send({ role_list_event: { ClanId, Limit, State, Cursor } });
|
6356
|
-
return response.role_list_event;
|
6357
|
-
});
|
6358
|
-
}
|
6359
|
-
listChannelByUserId() {
|
6360
|
-
return __async(this, null, function* () {
|
6361
|
-
const response = yield this.send({ channel_desc_list_event: {} });
|
6362
|
-
return response.channel_desc_list_event;
|
6363
|
-
});
|
6364
|
-
}
|
6365
|
-
listUserClansByUserId() {
|
6366
|
-
return __async(this, null, function* () {
|
6367
|
-
const response = yield this.send({ all_user_clans: {} });
|
6368
|
-
return response.all_user_clans;
|
6369
|
-
});
|
6370
|
-
}
|
6371
|
-
listUsersAddChannelByChannelId(channelId, limit) {
|
6372
|
-
return __async(this, null, function* () {
|
6373
|
-
const response = yield this.send({ all_users_add_channel_event: { channel_id: channelId, limit } });
|
6374
|
-
return response.all_users_add_channel_event;
|
6375
|
-
});
|
6376
|
-
}
|
6377
|
-
hashtagDMList(user_id, limit) {
|
6378
|
-
return __async(this, null, function* () {
|
6379
|
-
const response = yield this.send({ hashtag_dm_list_event: { user_id, limit } });
|
6380
|
-
return response.hashtag_dm_list_event;
|
6381
|
-
});
|
6382
|
-
}
|
6383
|
-
getPermissionByRoleIdChannelId(role_id, channel_id, user_id) {
|
6384
|
-
return __async(this, null, function* () {
|
6385
|
-
const response = yield this.send({ permission_role_channel_list_event: { role_id, channel_id, user_id } });
|
6386
|
-
return response.permission_role_channel_list_event;
|
6387
|
-
});
|
6388
|
-
}
|
6389
|
-
listStickersByUserId() {
|
6390
|
-
return __async(this, null, function* () {
|
6391
|
-
const response = yield this.send({ sticker_listed_event: {} });
|
6392
|
-
return response.sticker_listed_event;
|
6393
|
-
});
|
6394
|
-
}
|
6395
|
-
getNotificationChannelSetting(channel_id) {
|
6396
|
-
return __async(this, null, function* () {
|
6397
|
-
const response = yield this.send({ notification_channel_setting_event: { channel_id } });
|
6398
|
-
return response.notification_channel_setting_event;
|
6399
|
-
});
|
6400
|
-
}
|
6401
|
-
getNotificationCategorySetting(category_id) {
|
6402
|
-
return __async(this, null, function* () {
|
6403
|
-
const response = yield this.send({ notification_category_setting_event: { category_id } });
|
6404
|
-
return response.notification_category_setting_event;
|
6405
|
-
});
|
6406
|
-
}
|
6407
|
-
getNotificationClanSetting(clan_id) {
|
6408
|
-
return __async(this, null, function* () {
|
6409
|
-
const response = yield this.send({ notification_clan_setting_event: { clan_id } });
|
6410
|
-
return response.notification_clan_setting_event;
|
6411
|
-
});
|
6412
|
-
}
|
6413
|
-
getNotificationReactMessage(channel_id) {
|
6414
|
-
return __async(this, null, function* () {
|
6415
|
-
const response = yield this.send({ notifi_react_message_event: { channel_id } });
|
6416
|
-
return response.notifi_react_message_event;
|
6417
|
-
});
|
6418
|
-
}
|
6419
|
-
getNotificationChannelCategorySetting(clan_id) {
|
6420
|
-
return __async(this, null, function* () {
|
6421
|
-
const response = yield this.send({ notification_channel_category_setting_event: { clan_id } });
|
6422
|
-
return response.notification_channel_category_setting_event;
|
6423
|
-
});
|
6424
|
-
}
|
6425
6377
|
pingPong() {
|
6426
6378
|
return __async(this, null, function* () {
|
6427
6379
|
if (!this.adapter.isOpen()) {
|
@@ -8511,4 +8463,14 @@ var Client = class {
|
|
8511
8463
|
});
|
8512
8464
|
});
|
8513
8465
|
}
|
8466
|
+
markAsRead(session, request) {
|
8467
|
+
return __async(this, null, function* () {
|
8468
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
8469
|
+
yield this.sessionRefresh(session);
|
8470
|
+
}
|
8471
|
+
return this.apiClient.markAsRead(session.token, request).then((response) => {
|
8472
|
+
return Promise.resolve(response);
|
8473
|
+
});
|
8474
|
+
});
|
8475
|
+
}
|
8514
8476
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -3795,6 +3795,35 @@ var MezonApi = class {
|
|
3795
3795
|
)
|
3796
3796
|
]);
|
3797
3797
|
}
|
3798
|
+
/** Mark as read */
|
3799
|
+
markAsRead(bearerToken, body, options = {}) {
|
3800
|
+
if (body === null || body === void 0) {
|
3801
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
3802
|
+
}
|
3803
|
+
const urlPath = "/v2/markasread";
|
3804
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3805
|
+
let bodyJson = "";
|
3806
|
+
bodyJson = JSON.stringify(body || {});
|
3807
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3808
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
3809
|
+
if (bearerToken) {
|
3810
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3811
|
+
}
|
3812
|
+
return Promise.race([
|
3813
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3814
|
+
if (response.status == 204) {
|
3815
|
+
return response;
|
3816
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3817
|
+
return response.json();
|
3818
|
+
} else {
|
3819
|
+
throw response;
|
3820
|
+
}
|
3821
|
+
}),
|
3822
|
+
new Promise(
|
3823
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3824
|
+
)
|
3825
|
+
]);
|
3826
|
+
}
|
3798
3827
|
/** set mute notification user channel. */
|
3799
3828
|
setMuteNotificationCategory(bearerToken, body, options = {}) {
|
3800
3829
|
if (body === null || body === void 0) {
|
@@ -5892,6 +5921,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5892
5921
|
this.onstreamingchannelleaved(message.streaming_leaved_event);
|
5893
5922
|
} else if (message.set_permission_channel_event) {
|
5894
5923
|
this.onsetpermissionchannel(message.set_permission_channel_event);
|
5924
|
+
} else if (message.event_user_permission_channel) {
|
5925
|
+
this.onuserpermissionchannel(message.event_user_permission_channel);
|
5895
5926
|
} else {
|
5896
5927
|
if (this.verbose && window && window.console) {
|
5897
5928
|
console.log("Unrecognized message received: %o", message);
|
@@ -6154,6 +6185,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6154
6185
|
console.log(set_permission_channel_event);
|
6155
6186
|
}
|
6156
6187
|
}
|
6188
|
+
onuserpermissionchannel(event_user_permission_channel) {
|
6189
|
+
if (this.verbose && window && window.console) {
|
6190
|
+
console.log(event_user_permission_channel);
|
6191
|
+
}
|
6192
|
+
}
|
6157
6193
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
6158
6194
|
const untypedMessage = message;
|
6159
6195
|
return new Promise((resolve, reject) => {
|
@@ -6309,90 +6345,6 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6309
6345
|
return response.check_name_existed_event;
|
6310
6346
|
});
|
6311
6347
|
}
|
6312
|
-
listClanEmojiByUserId() {
|
6313
|
-
return __async(this, null, function* () {
|
6314
|
-
const response = yield this.send({ emojis_listed_event: {} });
|
6315
|
-
return response.emojis_listed_event;
|
6316
|
-
});
|
6317
|
-
}
|
6318
|
-
listUserPermissionInChannel(clan_id, channel_id) {
|
6319
|
-
return __async(this, null, function* () {
|
6320
|
-
const response = yield this.send({ user_permission_in_channel_list_event: { clan_id, channel_id } });
|
6321
|
-
return response.user_permission_in_channel_list_event;
|
6322
|
-
});
|
6323
|
-
}
|
6324
|
-
listRoles(ClanId, Limit, State, Cursor) {
|
6325
|
-
return __async(this, null, function* () {
|
6326
|
-
const response = yield this.send({ role_list_event: { ClanId, Limit, State, Cursor } });
|
6327
|
-
return response.role_list_event;
|
6328
|
-
});
|
6329
|
-
}
|
6330
|
-
listChannelByUserId() {
|
6331
|
-
return __async(this, null, function* () {
|
6332
|
-
const response = yield this.send({ channel_desc_list_event: {} });
|
6333
|
-
return response.channel_desc_list_event;
|
6334
|
-
});
|
6335
|
-
}
|
6336
|
-
listUserClansByUserId() {
|
6337
|
-
return __async(this, null, function* () {
|
6338
|
-
const response = yield this.send({ all_user_clans: {} });
|
6339
|
-
return response.all_user_clans;
|
6340
|
-
});
|
6341
|
-
}
|
6342
|
-
listUsersAddChannelByChannelId(channelId, limit) {
|
6343
|
-
return __async(this, null, function* () {
|
6344
|
-
const response = yield this.send({ all_users_add_channel_event: { channel_id: channelId, limit } });
|
6345
|
-
return response.all_users_add_channel_event;
|
6346
|
-
});
|
6347
|
-
}
|
6348
|
-
hashtagDMList(user_id, limit) {
|
6349
|
-
return __async(this, null, function* () {
|
6350
|
-
const response = yield this.send({ hashtag_dm_list_event: { user_id, limit } });
|
6351
|
-
return response.hashtag_dm_list_event;
|
6352
|
-
});
|
6353
|
-
}
|
6354
|
-
getPermissionByRoleIdChannelId(role_id, channel_id, user_id) {
|
6355
|
-
return __async(this, null, function* () {
|
6356
|
-
const response = yield this.send({ permission_role_channel_list_event: { role_id, channel_id, user_id } });
|
6357
|
-
return response.permission_role_channel_list_event;
|
6358
|
-
});
|
6359
|
-
}
|
6360
|
-
listStickersByUserId() {
|
6361
|
-
return __async(this, null, function* () {
|
6362
|
-
const response = yield this.send({ sticker_listed_event: {} });
|
6363
|
-
return response.sticker_listed_event;
|
6364
|
-
});
|
6365
|
-
}
|
6366
|
-
getNotificationChannelSetting(channel_id) {
|
6367
|
-
return __async(this, null, function* () {
|
6368
|
-
const response = yield this.send({ notification_channel_setting_event: { channel_id } });
|
6369
|
-
return response.notification_channel_setting_event;
|
6370
|
-
});
|
6371
|
-
}
|
6372
|
-
getNotificationCategorySetting(category_id) {
|
6373
|
-
return __async(this, null, function* () {
|
6374
|
-
const response = yield this.send({ notification_category_setting_event: { category_id } });
|
6375
|
-
return response.notification_category_setting_event;
|
6376
|
-
});
|
6377
|
-
}
|
6378
|
-
getNotificationClanSetting(clan_id) {
|
6379
|
-
return __async(this, null, function* () {
|
6380
|
-
const response = yield this.send({ notification_clan_setting_event: { clan_id } });
|
6381
|
-
return response.notification_clan_setting_event;
|
6382
|
-
});
|
6383
|
-
}
|
6384
|
-
getNotificationReactMessage(channel_id) {
|
6385
|
-
return __async(this, null, function* () {
|
6386
|
-
const response = yield this.send({ notifi_react_message_event: { channel_id } });
|
6387
|
-
return response.notifi_react_message_event;
|
6388
|
-
});
|
6389
|
-
}
|
6390
|
-
getNotificationChannelCategorySetting(clan_id) {
|
6391
|
-
return __async(this, null, function* () {
|
6392
|
-
const response = yield this.send({ notification_channel_category_setting_event: { clan_id } });
|
6393
|
-
return response.notification_channel_category_setting_event;
|
6394
|
-
});
|
6395
|
-
}
|
6396
6348
|
pingPong() {
|
6397
6349
|
return __async(this, null, function* () {
|
6398
6350
|
if (!this.adapter.isOpen()) {
|
@@ -8482,6 +8434,16 @@ var Client = class {
|
|
8482
8434
|
});
|
8483
8435
|
});
|
8484
8436
|
}
|
8437
|
+
markAsRead(session, request) {
|
8438
|
+
return __async(this, null, function* () {
|
8439
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
8440
|
+
yield this.sessionRefresh(session);
|
8441
|
+
}
|
8442
|
+
return this.apiClient.markAsRead(session.token, request).then((response) => {
|
8443
|
+
return Promise.resolve(response);
|
8444
|
+
});
|
8445
|
+
});
|
8446
|
+
}
|
8485
8447
|
};
|
8486
8448
|
export {
|
8487
8449
|
ChannelStreamMode,
|
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 {
|
16
|
+
import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiPermissionUpdate, ApiRole, ApiRpc } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { ChannelMessage, Notification } from "./client";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -338,15 +338,6 @@ export interface ClanDeletedEvent {
|
|
338
338
|
clan_id: string;
|
339
339
|
deletor: string;
|
340
340
|
}
|
341
|
-
export interface PermissionRoleChannelListEvent {
|
342
|
-
role_id?: string;
|
343
|
-
channel_id?: string;
|
344
|
-
permission_role_channel?: Array<PermissionRoleChannel>;
|
345
|
-
}
|
346
|
-
export interface PermissionRoleChannel {
|
347
|
-
permission_id?: string;
|
348
|
-
active?: boolean;
|
349
|
-
}
|
350
341
|
export interface ClanUpdatedEvent {
|
351
342
|
clan_id: string;
|
352
343
|
clan_name: string;
|
@@ -436,10 +427,6 @@ export interface CheckNameExistedEvent {
|
|
436
427
|
type: number;
|
437
428
|
}
|
438
429
|
/** */
|
439
|
-
export interface StrickerListedEvent {
|
440
|
-
stickers?: Array<ClanSticker>;
|
441
|
-
}
|
442
|
-
/** */
|
443
430
|
export interface ClanSticker {
|
444
431
|
category?: string;
|
445
432
|
clan_id?: string;
|
@@ -451,25 +438,11 @@ export interface ClanSticker {
|
|
451
438
|
logo?: string;
|
452
439
|
clan_name?: string;
|
453
440
|
}
|
454
|
-
/** */
|
455
|
-
export interface EmojiListedEvent {
|
456
|
-
emoji_list?: Array<ClanEmoji>;
|
457
|
-
}
|
458
|
-
export interface RoleListEvent {
|
459
|
-
Limit: number;
|
460
|
-
State: number;
|
461
|
-
Cursor: string;
|
462
|
-
ClanId: string;
|
463
|
-
roles: ApiRoleList;
|
464
|
-
}
|
465
441
|
export interface RoleEvent {
|
466
442
|
role: ApiRole;
|
467
443
|
status: number;
|
468
444
|
user_id: string;
|
469
445
|
}
|
470
|
-
export interface AllUsersAddChannelEvent {
|
471
|
-
user_ids: Array<string>;
|
472
|
-
}
|
473
446
|
export interface EventEmoji {
|
474
447
|
id: string;
|
475
448
|
clan_id: string;
|
@@ -481,11 +454,6 @@ export interface EventEmoji {
|
|
481
454
|
logo: string;
|
482
455
|
clan_name: string;
|
483
456
|
}
|
484
|
-
export interface UserPermissionInChannelListEvent {
|
485
|
-
clan_id: string;
|
486
|
-
channel_id: string;
|
487
|
-
permissions: ApiPermissionList;
|
488
|
-
}
|
489
457
|
/** */
|
490
458
|
export interface ClanEmoji {
|
491
459
|
category?: string;
|
@@ -498,14 +466,6 @@ export interface ClanEmoji {
|
|
498
466
|
clan_id?: string;
|
499
467
|
}
|
500
468
|
/** */
|
501
|
-
export interface ChannelDescListEvent {
|
502
|
-
channeldesc?: ApiChannelDescList;
|
503
|
-
}
|
504
|
-
/** */
|
505
|
-
export interface AllUserClans {
|
506
|
-
user?: Array<ApiUser>;
|
507
|
-
}
|
508
|
-
/** */
|
509
469
|
export interface ChannelDescription {
|
510
470
|
clan_id?: string;
|
511
471
|
channel_id?: string;
|
@@ -518,11 +478,6 @@ export interface ChannelDescription {
|
|
518
478
|
parrent_id?: string;
|
519
479
|
last_sent_message?: ApiChannelMessageHeader;
|
520
480
|
}
|
521
|
-
export interface HashtagDmListEvent {
|
522
|
-
user_id?: Array<string>;
|
523
|
-
limit?: number;
|
524
|
-
hashtag_dm?: ApiHashtagDmList;
|
525
|
-
}
|
526
481
|
export interface HashtagDm {
|
527
482
|
channel_id?: string;
|
528
483
|
channel_label?: string;
|
@@ -533,37 +488,10 @@ export interface HashtagDm {
|
|
533
488
|
channel_private?: number;
|
534
489
|
parrent_id?: string;
|
535
490
|
}
|
536
|
-
export interface NotificationChannelSettingEvent {
|
537
|
-
channel_id?: string;
|
538
|
-
notification_user_channel?: NotificationUserChannel;
|
539
|
-
}
|
540
|
-
export interface NotificationUserChannel {
|
541
|
-
active?: number;
|
542
|
-
id?: string;
|
543
|
-
notification_setting_type?: number;
|
544
|
-
time_mute?: string;
|
545
|
-
}
|
546
|
-
export interface NotificationCategorySettingEvent {
|
547
|
-
category_id?: string;
|
548
|
-
notification_user_channel?: NotificationUserChannel;
|
549
|
-
}
|
550
|
-
export interface NotificationClanSettingEvent {
|
551
|
-
clan_id?: string;
|
552
|
-
notification_setting?: NotificationSetting;
|
553
|
-
}
|
554
491
|
export interface NotificationSetting {
|
555
492
|
id?: string;
|
556
493
|
notification_setting_type?: number;
|
557
494
|
}
|
558
|
-
export interface NotifiReactMessageEvent {
|
559
|
-
channel_id?: string;
|
560
|
-
notifi_react_message?: NotifiReactMessage;
|
561
|
-
}
|
562
|
-
export interface NotifiReactMessage {
|
563
|
-
id?: string;
|
564
|
-
user_id?: string;
|
565
|
-
channel_id_req?: string;
|
566
|
-
}
|
567
495
|
export interface NotificationChannelCategorySetting {
|
568
496
|
id: string;
|
569
497
|
channel_category_label: string;
|
@@ -571,10 +499,6 @@ export interface NotificationChannelCategorySetting {
|
|
571
499
|
channel_category_title: string;
|
572
500
|
action: number;
|
573
501
|
}
|
574
|
-
export interface NotificationChannelCategorySettingEvent {
|
575
|
-
clan_id?: string;
|
576
|
-
notification_channel_category_settings_list?: ApiNotificationChannelCategorySettingList;
|
577
|
-
}
|
578
502
|
export interface UserEmojiUsage {
|
579
503
|
user_id: string;
|
580
504
|
emoji_id: string;
|
@@ -656,6 +580,12 @@ export interface SetPermissionChannelEvent {
|
|
656
580
|
channel_id: string;
|
657
581
|
/** List permission update */
|
658
582
|
permission_updates: ApiPermissionUpdate[];
|
583
|
+
/** */
|
584
|
+
caller: string;
|
585
|
+
}
|
586
|
+
export interface EventUserPermissionChannel {
|
587
|
+
user_id: string;
|
588
|
+
channel_id: string;
|
659
589
|
}
|
660
590
|
/** A socket connection to Mezon server. */
|
661
591
|
export interface Socket {
|
@@ -757,20 +687,6 @@ export interface Socket {
|
|
757
687
|
setHeartbeatTimeoutMs(ms: number): void;
|
758
688
|
getHeartbeatTimeoutMs(): number;
|
759
689
|
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
760
|
-
listClanEmojiByUserId(): Promise<EmojiListedEvent>;
|
761
|
-
listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
|
762
|
-
listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
|
763
|
-
listStickersByUserId(): Promise<StrickerListedEvent>;
|
764
|
-
listChannelByUserId(): Promise<ChannelDescListEvent>;
|
765
|
-
listUserClansByUserId(): Promise<AllUserClans>;
|
766
|
-
listUsersAddChannelByChannelId(channelId: string, limit: number): Promise<AllUsersAddChannelEvent>;
|
767
|
-
hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
|
768
|
-
getNotificationChannelSetting(channel_id: string): Promise<NotificationChannelSettingEvent>;
|
769
|
-
getNotificationCategorySetting(category_id: string): Promise<NotificationCategorySettingEvent>;
|
770
|
-
getNotificationClanSetting(clan_id: string): Promise<NotificationClanSettingEvent>;
|
771
|
-
getNotificationReactMessage(channel_id_req: string): Promise<NotifiReactMessageEvent>;
|
772
|
-
getPermissionByRoleIdChannelId(role_id: string, channel_id: string, user_id: string): Promise<PermissionRoleChannelListEvent>;
|
773
|
-
getNotificationChannelCategorySetting(clan_id: string): Promise<NotificationChannelCategorySettingEvent>;
|
774
690
|
oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
|
775
691
|
oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
|
776
692
|
oneventemoji: (event_emoji: EventEmoji) => void;
|
@@ -780,6 +696,7 @@ export interface Socket {
|
|
780
696
|
onstreamingchanneljoined: (streaming_joined_event: StreamingJoinedEvent) => void;
|
781
697
|
onstreamingchannelleaved: (streaming_leaved_event: StreamingLeavedEvent) => void;
|
782
698
|
onsetpermissionchannel: (set_permission_channel_event: SetPermissionChannelEvent) => void;
|
699
|
+
onuserpermissionchannel: (event_user_permission_channel: EventUserPermissionChannel) => void;
|
783
700
|
}
|
784
701
|
/** Reports an error received from a socket message. */
|
785
702
|
export interface SocketError {
|
@@ -851,6 +768,7 @@ export declare class DefaultSocket implements Socket {
|
|
851
768
|
onstreamingchanneljoined(streaming_joined_event: StreamingJoinedEvent): void;
|
852
769
|
onstreamingchannelleaved(streaming_leaved_event: StreamingLeavedEvent): void;
|
853
770
|
onsetpermissionchannel(set_permission_channel_event: SetPermissionChannelEvent): void;
|
771
|
+
onuserpermissionchannel(event_user_permission_channel: EventUserPermissionChannel): void;
|
854
772
|
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout?: number): Promise<any>;
|
855
773
|
followUsers(userIds: string[]): Promise<Status>;
|
856
774
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
@@ -870,20 +788,6 @@ export declare class DefaultSocket implements Socket {
|
|
870
788
|
writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
|
871
789
|
writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
|
872
790
|
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
873
|
-
listClanEmojiByUserId(): Promise<EmojiListedEvent>;
|
874
|
-
listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
|
875
|
-
listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
|
876
|
-
listChannelByUserId(): Promise<ChannelDescListEvent>;
|
877
|
-
listUserClansByUserId(): Promise<AllUserClans>;
|
878
|
-
listUsersAddChannelByChannelId(channelId: string, limit: number): Promise<AllUsersAddChannelEvent>;
|
879
|
-
hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
|
880
|
-
getPermissionByRoleIdChannelId(role_id: string, channel_id: string, user_id: string): Promise<PermissionRoleChannelListEvent>;
|
881
|
-
listStickersByUserId(): Promise<StrickerListedEvent>;
|
882
|
-
getNotificationChannelSetting(channel_id: string): Promise<NotificationChannelSettingEvent>;
|
883
|
-
getNotificationCategorySetting(category_id: string): Promise<NotificationCategorySettingEvent>;
|
884
|
-
getNotificationClanSetting(clan_id: string): Promise<NotificationClanSettingEvent>;
|
885
|
-
getNotificationReactMessage(channel_id: string): Promise<NotifiReactMessageEvent>;
|
886
|
-
getNotificationChannelCategorySetting(clan_id: string): Promise<NotificationChannelCategorySettingEvent>;
|
887
791
|
private pingPong;
|
888
792
|
}
|
889
793
|
export {};
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import {
|
17
|
+
import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiPermissionUpdate, ApiRole, ApiRpc} 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"
|
@@ -506,24 +506,6 @@ export interface ClanDeletedEvent {
|
|
506
506
|
deletor: string;
|
507
507
|
}
|
508
508
|
|
509
|
-
// A list of permission role channel.
|
510
|
-
export interface PermissionRoleChannelListEvent {
|
511
|
-
//
|
512
|
-
role_id?: string;
|
513
|
-
//
|
514
|
-
channel_id?: string;
|
515
|
-
// A list of permission.
|
516
|
-
permission_role_channel?: Array<PermissionRoleChannel>;
|
517
|
-
}
|
518
|
-
|
519
|
-
// Permission role channel
|
520
|
-
export interface PermissionRoleChannel {
|
521
|
-
// Permission id
|
522
|
-
permission_id?: string;
|
523
|
-
// active
|
524
|
-
active?: boolean;
|
525
|
-
}
|
526
|
-
|
527
509
|
// clan updated event
|
528
510
|
export interface ClanUpdatedEvent {
|
529
511
|
// the clan id
|
@@ -627,13 +609,6 @@ export interface CheckNameExistedEvent {
|
|
627
609
|
type: number;
|
628
610
|
}
|
629
611
|
|
630
|
-
|
631
|
-
/** */
|
632
|
-
export interface StrickerListedEvent {
|
633
|
-
// sticker data
|
634
|
-
stickers?: Array<ClanSticker>;
|
635
|
-
}
|
636
|
-
|
637
612
|
/** */
|
638
613
|
export interface ClanSticker {
|
639
614
|
//
|
@@ -656,34 +631,12 @@ export interface ClanSticker {
|
|
656
631
|
clan_name?: string;
|
657
632
|
}
|
658
633
|
|
659
|
-
/** */
|
660
|
-
export interface EmojiListedEvent {
|
661
|
-
// emoji data
|
662
|
-
emoji_list?: Array<ClanEmoji>;
|
663
|
-
}
|
664
|
-
|
665
|
-
export interface RoleListEvent {
|
666
|
-
Limit: number;
|
667
|
-
// The role state to list.
|
668
|
-
State: number;
|
669
|
-
// Cursor to start from
|
670
|
-
Cursor: string;
|
671
|
-
// The clan of this role
|
672
|
-
ClanId: string;
|
673
|
-
//
|
674
|
-
roles: ApiRoleList;
|
675
|
-
}
|
676
|
-
|
677
634
|
export interface RoleEvent {
|
678
635
|
role: ApiRole;
|
679
636
|
status: number;
|
680
637
|
user_id: string;
|
681
638
|
}
|
682
639
|
|
683
|
-
export interface AllUsersAddChannelEvent {
|
684
|
-
user_ids: Array<string>;
|
685
|
-
}
|
686
|
-
|
687
640
|
export interface EventEmoji {
|
688
641
|
id : string
|
689
642
|
clan_id: string
|
@@ -696,15 +649,6 @@ export interface EventEmoji {
|
|
696
649
|
clan_name: string
|
697
650
|
}
|
698
651
|
|
699
|
-
export interface UserPermissionInChannelListEvent {
|
700
|
-
//
|
701
|
-
clan_id: string;
|
702
|
-
//
|
703
|
-
channel_id: string;
|
704
|
-
// A list of permission.
|
705
|
-
permissions: ApiPermissionList;
|
706
|
-
}
|
707
|
-
|
708
652
|
/** */
|
709
653
|
export interface ClanEmoji {
|
710
654
|
//
|
@@ -725,18 +669,6 @@ export interface ClanEmoji {
|
|
725
669
|
clan_id?: string;
|
726
670
|
}
|
727
671
|
|
728
|
-
/** */
|
729
|
-
export interface ChannelDescListEvent {
|
730
|
-
//
|
731
|
-
channeldesc?: ApiChannelDescList;
|
732
|
-
}
|
733
|
-
|
734
|
-
/** */
|
735
|
-
export interface AllUserClans {
|
736
|
-
//
|
737
|
-
user?: Array<ApiUser>;
|
738
|
-
}
|
739
|
-
|
740
672
|
/** */
|
741
673
|
export interface ChannelDescription {
|
742
674
|
// The clan of this channel
|
@@ -761,16 +693,6 @@ export interface ChannelDescription {
|
|
761
693
|
last_sent_message?: ApiChannelMessageHeader;
|
762
694
|
}
|
763
695
|
|
764
|
-
// A list of Channel
|
765
|
-
export interface HashtagDmListEvent {
|
766
|
-
// user Id
|
767
|
-
user_id?: Array<string>;
|
768
|
-
// Max number of records to return. Between 1 and 100.
|
769
|
-
limit?: number;
|
770
|
-
// A list of channel.
|
771
|
-
hashtag_dm?: ApiHashtagDmList;
|
772
|
-
}
|
773
|
-
|
774
696
|
// hashtagDM
|
775
697
|
export interface HashtagDm {
|
776
698
|
// The channel id.
|
@@ -791,38 +713,6 @@ export interface HashtagDm {
|
|
791
713
|
parrent_id?: string;
|
792
714
|
}
|
793
715
|
|
794
|
-
export interface NotificationChannelSettingEvent {
|
795
|
-
// The channel id.
|
796
|
-
channel_id?: string;
|
797
|
-
//
|
798
|
-
notification_user_channel?: NotificationUserChannel;
|
799
|
-
}
|
800
|
-
|
801
|
-
export interface NotificationUserChannel {
|
802
|
-
//
|
803
|
-
active?: number;
|
804
|
-
//
|
805
|
-
id?: string;
|
806
|
-
//
|
807
|
-
notification_setting_type?: number;
|
808
|
-
//
|
809
|
-
time_mute?: string;
|
810
|
-
}
|
811
|
-
|
812
|
-
export interface NotificationCategorySettingEvent {
|
813
|
-
//
|
814
|
-
category_id?: string;
|
815
|
-
//
|
816
|
-
notification_user_channel?: NotificationUserChannel;
|
817
|
-
}
|
818
|
-
|
819
|
-
export interface NotificationClanSettingEvent {
|
820
|
-
// The clan of this channel
|
821
|
-
clan_id?: string;
|
822
|
-
//
|
823
|
-
notification_setting?: NotificationSetting;
|
824
|
-
}
|
825
|
-
|
826
716
|
export interface NotificationSetting {
|
827
717
|
//
|
828
718
|
id?: string;
|
@@ -830,22 +720,6 @@ export interface NotificationSetting {
|
|
830
720
|
notification_setting_type?: number;
|
831
721
|
}
|
832
722
|
|
833
|
-
export interface NotifiReactMessageEvent {
|
834
|
-
//
|
835
|
-
channel_id?: string;
|
836
|
-
//
|
837
|
-
notifi_react_message?: NotifiReactMessage;
|
838
|
-
}
|
839
|
-
|
840
|
-
export interface NotifiReactMessage {
|
841
|
-
//
|
842
|
-
id?: string;
|
843
|
-
//
|
844
|
-
user_id?: string;
|
845
|
-
//
|
846
|
-
channel_id_req?: string;
|
847
|
-
}
|
848
|
-
|
849
723
|
export interface NotificationChannelCategorySetting {
|
850
724
|
// Notification id
|
851
725
|
id: string;
|
@@ -859,11 +733,6 @@ export interface NotificationChannelCategorySetting {
|
|
859
733
|
action: number
|
860
734
|
}
|
861
735
|
|
862
|
-
export interface NotificationChannelCategorySettingEvent {
|
863
|
-
clan_id? : string;
|
864
|
-
notification_channel_category_settings_list?: ApiNotificationChannelCategorySettingList
|
865
|
-
}
|
866
|
-
|
867
736
|
export interface UserEmojiUsage {
|
868
737
|
user_id: string;
|
869
738
|
emoji_id: string;
|
@@ -953,6 +822,13 @@ export interface SetPermissionChannelEvent {
|
|
953
822
|
channel_id: string;
|
954
823
|
/** List permission update */
|
955
824
|
permission_updates: ApiPermissionUpdate[];
|
825
|
+
/** */
|
826
|
+
caller: string;
|
827
|
+
}
|
828
|
+
|
829
|
+
export interface EventUserPermissionChannel{
|
830
|
+
user_id: string;
|
831
|
+
channel_id: string;
|
956
832
|
}
|
957
833
|
|
958
834
|
/** A socket connection to Mezon server. */
|
@@ -1127,34 +1003,6 @@ export interface Socket {
|
|
1127
1003
|
|
1128
1004
|
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
1129
1005
|
|
1130
|
-
listClanEmojiByUserId(): Promise<EmojiListedEvent>;
|
1131
|
-
|
1132
|
-
listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
|
1133
|
-
|
1134
|
-
listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
|
1135
|
-
|
1136
|
-
listStickersByUserId(): Promise<StrickerListedEvent>;
|
1137
|
-
|
1138
|
-
listChannelByUserId(): Promise<ChannelDescListEvent>;
|
1139
|
-
|
1140
|
-
listUserClansByUserId(): Promise<AllUserClans>;
|
1141
|
-
|
1142
|
-
listUsersAddChannelByChannelId(channelId: string, limit: number): Promise<AllUsersAddChannelEvent>;
|
1143
|
-
|
1144
|
-
hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
|
1145
|
-
|
1146
|
-
getNotificationChannelSetting(channel_id: string): Promise<NotificationChannelSettingEvent>;
|
1147
|
-
|
1148
|
-
getNotificationCategorySetting(category_id: string): Promise<NotificationCategorySettingEvent>;
|
1149
|
-
|
1150
|
-
getNotificationClanSetting(clan_id: string): Promise<NotificationClanSettingEvent>;
|
1151
|
-
|
1152
|
-
getNotificationReactMessage(channel_id_req: string): Promise<NotifiReactMessageEvent>;
|
1153
|
-
|
1154
|
-
getPermissionByRoleIdChannelId(role_id: string, channel_id: string, user_id: string): Promise<PermissionRoleChannelListEvent>;
|
1155
|
-
|
1156
|
-
getNotificationChannelCategorySetting(clan_id : string): Promise<NotificationChannelCategorySettingEvent>;
|
1157
|
-
|
1158
1006
|
oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
|
1159
1007
|
|
1160
1008
|
oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
|
@@ -1172,6 +1020,8 @@ export interface Socket {
|
|
1172
1020
|
onstreamingchannelleaved: (streaming_leaved_event: StreamingLeavedEvent) => void;
|
1173
1021
|
|
1174
1022
|
onsetpermissionchannel: (set_permission_channel_event: SetPermissionChannelEvent) => void;
|
1023
|
+
|
1024
|
+
onuserpermissionchannel: (event_user_permission_channel: EventUserPermissionChannel) => void;
|
1175
1025
|
}
|
1176
1026
|
|
1177
1027
|
/** Reports an error received from a socket message. */
|
@@ -1371,7 +1221,9 @@ export class DefaultSocket implements Socket {
|
|
1371
1221
|
this.onstreamingchannelleaved(<StreamingLeavedEvent>message.streaming_leaved_event);
|
1372
1222
|
} else if(message.set_permission_channel_event){
|
1373
1223
|
this.onsetpermissionchannel(<SetPermissionChannelEvent>message.set_permission_channel_event);
|
1374
|
-
}else {
|
1224
|
+
} else if(message.event_user_permission_channel){
|
1225
|
+
this.onuserpermissionchannel(<EventUserPermissionChannel>message.event_user_permission_channel);
|
1226
|
+
} else {
|
1375
1227
|
if (this.verbose && window && window.console) {
|
1376
1228
|
console.log("Unrecognized message received: %o", message);
|
1377
1229
|
}
|
@@ -1685,6 +1537,12 @@ export class DefaultSocket implements Socket {
|
|
1685
1537
|
}
|
1686
1538
|
}
|
1687
1539
|
|
1540
|
+
onuserpermissionchannel(event_user_permission_channel: EventUserPermissionChannel){
|
1541
|
+
if (this.verbose && window && window.console) {
|
1542
|
+
console.log(event_user_permission_channel);
|
1543
|
+
}
|
1544
|
+
}
|
1545
|
+
|
1688
1546
|
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent |
|
1689
1547
|
ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout = DefaultSocket.DefaultSendTimeoutMs): Promise<any> {
|
1690
1548
|
const untypedMessage = message as any;
|
@@ -1839,76 +1697,6 @@ export class DefaultSocket implements Socket {
|
|
1839
1697
|
return response.check_name_existed_event
|
1840
1698
|
}
|
1841
1699
|
|
1842
|
-
async listClanEmojiByUserId(): Promise<EmojiListedEvent> {
|
1843
|
-
const response = await this.send({emojis_listed_event: {}});
|
1844
|
-
return response.emojis_listed_event
|
1845
|
-
}
|
1846
|
-
|
1847
|
-
async listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent> {
|
1848
|
-
const response = await this.send({user_permission_in_channel_list_event : {clan_id: clan_id, channel_id: channel_id }});
|
1849
|
-
return response.user_permission_in_channel_list_event
|
1850
|
-
}
|
1851
|
-
|
1852
|
-
async listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent> {
|
1853
|
-
const response = await this.send({role_list_event: {ClanId: ClanId, Limit: Limit, State: State, Cursor: Cursor}});
|
1854
|
-
return response.role_list_event
|
1855
|
-
}
|
1856
|
-
|
1857
|
-
async listChannelByUserId(): Promise<ChannelDescListEvent> {
|
1858
|
-
const response = await this.send({channel_desc_list_event: {}});
|
1859
|
-
return response.channel_desc_list_event
|
1860
|
-
}
|
1861
|
-
|
1862
|
-
async listUserClansByUserId(): Promise<AllUserClans> {
|
1863
|
-
const response = await this.send({all_user_clans: {}});
|
1864
|
-
return response.all_user_clans
|
1865
|
-
}
|
1866
|
-
|
1867
|
-
async listUsersAddChannelByChannelId(channelId: string, limit: number): Promise<AllUsersAddChannelEvent> {
|
1868
|
-
const response = await this.send({all_users_add_channel_event: {channel_id: channelId, limit: limit}});
|
1869
|
-
return response.all_users_add_channel_event
|
1870
|
-
}
|
1871
|
-
|
1872
|
-
async hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent> {
|
1873
|
-
const response = await this.send({hashtag_dm_list_event: {user_id: user_id, limit: limit }});
|
1874
|
-
return response.hashtag_dm_list_event
|
1875
|
-
}
|
1876
|
-
|
1877
|
-
async getPermissionByRoleIdChannelId(role_id: string, channel_id: string, user_id: string): Promise<PermissionRoleChannelListEvent> {
|
1878
|
-
const response = await this.send({permission_role_channel_list_event: {role_id: role_id, channel_id: channel_id, user_id: user_id }});
|
1879
|
-
return response.permission_role_channel_list_event
|
1880
|
-
}
|
1881
|
-
|
1882
|
-
async listStickersByUserId(): Promise<StrickerListedEvent> {
|
1883
|
-
const response = await this.send({sticker_listed_event: {}});
|
1884
|
-
return response.sticker_listed_event
|
1885
|
-
}
|
1886
|
-
|
1887
|
-
async getNotificationChannelSetting(channel_id: string): Promise<NotificationChannelSettingEvent> {
|
1888
|
-
const response = await this.send({notification_channel_setting_event: {channel_id: channel_id}})
|
1889
|
-
return response.notification_channel_setting_event
|
1890
|
-
}
|
1891
|
-
|
1892
|
-
async getNotificationCategorySetting(category_id: string): Promise<NotificationCategorySettingEvent> {
|
1893
|
-
const response = await this.send({notification_category_setting_event: {category_id: category_id}})
|
1894
|
-
return response.notification_category_setting_event
|
1895
|
-
}
|
1896
|
-
|
1897
|
-
async getNotificationClanSetting(clan_id: string): Promise<NotificationClanSettingEvent> {
|
1898
|
-
const response = await this.send({notification_clan_setting_event: {clan_id: clan_id}})
|
1899
|
-
return response.notification_clan_setting_event
|
1900
|
-
}
|
1901
|
-
|
1902
|
-
async getNotificationReactMessage(channel_id: string): Promise<NotifiReactMessageEvent> {
|
1903
|
-
const response = await this.send({notifi_react_message_event: {channel_id: channel_id}})
|
1904
|
-
return response.notifi_react_message_event
|
1905
|
-
}
|
1906
|
-
|
1907
|
-
async getNotificationChannelCategorySetting(clan_id: string): Promise<NotificationChannelCategorySettingEvent> {
|
1908
|
-
const response = await this.send({notification_channel_category_setting_event: {clan_id : clan_id}})
|
1909
|
-
return response.notification_channel_category_setting_event
|
1910
|
-
}
|
1911
|
-
|
1912
1700
|
private async pingPong(): Promise<void> {
|
1913
1701
|
if (!this.adapter.isOpen()) {
|
1914
1702
|
return;
|