mezon-js 2.8.91 → 2.8.93
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +166 -0
- package/client.ts +90 -1
- package/dist/api.gen.d.ts +39 -0
- package/dist/client.d.ts +8 -3
- package/dist/mezon-js.cjs.js +153 -6
- package/dist/mezon-js.esm.mjs +153 -6
- package/dist/socket.d.ts +23 -6
- package/package.json +1 -1
- package/socket.ts +38 -10
package/api.gen.ts
CHANGED
@@ -876,6 +876,30 @@ export interface ApiEvent {
|
|
876
876
|
timestamp?: string;
|
877
877
|
}
|
878
878
|
|
879
|
+
/** */
|
880
|
+
export interface ApiRegisterStreamingChannelRequest {
|
881
|
+
//
|
882
|
+
channel_id?: string;
|
883
|
+
//
|
884
|
+
clan_id?: string;
|
885
|
+
}
|
886
|
+
|
887
|
+
/** */
|
888
|
+
export interface ApiRegisterStreamingChannelResponse {
|
889
|
+
//
|
890
|
+
channel_id?: string;
|
891
|
+
//
|
892
|
+
clan_id?: string;
|
893
|
+
//
|
894
|
+
streaming_url?: string;
|
895
|
+
}
|
896
|
+
|
897
|
+
/** */
|
898
|
+
export interface ApiListStreamingChannelsResponse {
|
899
|
+
//
|
900
|
+
streaming_channels?: Array<ApiStreamingChannelResponse>;
|
901
|
+
}
|
902
|
+
|
879
903
|
/** */
|
880
904
|
export interface ApiEventList {
|
881
905
|
//A list of event.
|
@@ -1493,6 +1517,36 @@ export interface ApiSortParam {
|
|
1493
1517
|
order?: string;
|
1494
1518
|
}
|
1495
1519
|
|
1520
|
+
/** */
|
1521
|
+
export interface ApiStreamingChannelResponse {
|
1522
|
+
//
|
1523
|
+
channel_id?: string;
|
1524
|
+
//
|
1525
|
+
clan_id?: string;
|
1526
|
+
//
|
1527
|
+
is_streaming?: boolean;
|
1528
|
+
//
|
1529
|
+
streaming_url?: string;
|
1530
|
+
}
|
1531
|
+
|
1532
|
+
/** A list of users belonging to a channel, along with their role. */
|
1533
|
+
export interface ApiStreamingChannelUser {
|
1534
|
+
//
|
1535
|
+
channel_id?: string;
|
1536
|
+
//
|
1537
|
+
id?: string;
|
1538
|
+
//
|
1539
|
+
participant?: string;
|
1540
|
+
//user for a channel.
|
1541
|
+
user_id?: string;
|
1542
|
+
}
|
1543
|
+
|
1544
|
+
/** A list of users belonging to a channel, along with their role. */
|
1545
|
+
export interface ApiStreamingChannelUserList {
|
1546
|
+
//
|
1547
|
+
streaming_channel_users?: Array<ApiStreamingChannelUser>;
|
1548
|
+
}
|
1549
|
+
|
1496
1550
|
/** System message details. */
|
1497
1551
|
export interface ApiSystemMessage {
|
1498
1552
|
//
|
@@ -6298,6 +6352,118 @@ export class MezonApi {
|
|
6298
6352
|
]);
|
6299
6353
|
}
|
6300
6354
|
|
6355
|
+
/** List streaming channels. */
|
6356
|
+
listStreamingChannels(bearerToken: string,
|
6357
|
+
clanId?:string,
|
6358
|
+
options: any = {}): Promise<ApiListStreamingChannelsResponse> {
|
6359
|
+
|
6360
|
+
const urlPath = "/v2/streaming-channels";
|
6361
|
+
const queryParams = new Map<string, any>();
|
6362
|
+
queryParams.set("clan_id", clanId);
|
6363
|
+
|
6364
|
+
let bodyJson : string = "";
|
6365
|
+
|
6366
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6367
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
6368
|
+
if (bearerToken) {
|
6369
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6370
|
+
}
|
6371
|
+
|
6372
|
+
return Promise.race([
|
6373
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6374
|
+
if (response.status == 204) {
|
6375
|
+
return response;
|
6376
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6377
|
+
return response.json();
|
6378
|
+
} else {
|
6379
|
+
throw response;
|
6380
|
+
}
|
6381
|
+
}),
|
6382
|
+
new Promise((_, reject) =>
|
6383
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6384
|
+
),
|
6385
|
+
]);
|
6386
|
+
}
|
6387
|
+
|
6388
|
+
/** Register streaming in channel ( for bot - get streaming key) */
|
6389
|
+
registerStreamingChannel(bearerToken: string,
|
6390
|
+
body:ApiRegisterStreamingChannelRequest,
|
6391
|
+
options: any = {}): Promise<ApiRegisterStreamingChannelResponse> {
|
6392
|
+
|
6393
|
+
if (body === null || body === undefined) {
|
6394
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
6395
|
+
}
|
6396
|
+
const urlPath = "/v2/streaming-channels";
|
6397
|
+
const queryParams = new Map<string, any>();
|
6398
|
+
|
6399
|
+
let bodyJson : string = "";
|
6400
|
+
bodyJson = JSON.stringify(body || {});
|
6401
|
+
|
6402
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6403
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
6404
|
+
if (bearerToken) {
|
6405
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6406
|
+
}
|
6407
|
+
|
6408
|
+
return Promise.race([
|
6409
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6410
|
+
if (response.status == 204) {
|
6411
|
+
return response;
|
6412
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6413
|
+
return response.json();
|
6414
|
+
} else {
|
6415
|
+
throw response;
|
6416
|
+
}
|
6417
|
+
}),
|
6418
|
+
new Promise((_, reject) =>
|
6419
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6420
|
+
),
|
6421
|
+
]);
|
6422
|
+
}
|
6423
|
+
|
6424
|
+
/** List all users that are part of a channel. */
|
6425
|
+
listStreamingChannelUsers(bearerToken: string,
|
6426
|
+
clanId?:string,
|
6427
|
+
channelId?:string,
|
6428
|
+
channelType?:number,
|
6429
|
+
limit?:number,
|
6430
|
+
state?:number,
|
6431
|
+
cursor?:string,
|
6432
|
+
options: any = {}): Promise<ApiStreamingChannelUserList> {
|
6433
|
+
|
6434
|
+
const urlPath = "/v2/streaming-channels/users";
|
6435
|
+
const queryParams = new Map<string, any>();
|
6436
|
+
queryParams.set("clan_id", clanId);
|
6437
|
+
queryParams.set("channel_id", channelId);
|
6438
|
+
queryParams.set("channel_type", channelType);
|
6439
|
+
queryParams.set("limit", limit);
|
6440
|
+
queryParams.set("state", state);
|
6441
|
+
queryParams.set("cursor", cursor);
|
6442
|
+
|
6443
|
+
let bodyJson : string = "";
|
6444
|
+
|
6445
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6446
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
6447
|
+
if (bearerToken) {
|
6448
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6449
|
+
}
|
6450
|
+
|
6451
|
+
return Promise.race([
|
6452
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6453
|
+
if (response.status == 204) {
|
6454
|
+
return response;
|
6455
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6456
|
+
return response.json();
|
6457
|
+
} else {
|
6458
|
+
throw response;
|
6459
|
+
}
|
6460
|
+
}),
|
6461
|
+
new Promise((_, reject) =>
|
6462
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6463
|
+
),
|
6464
|
+
]);
|
6465
|
+
}
|
6466
|
+
|
6301
6467
|
/** Get the list of system messages. */
|
6302
6468
|
getSystemMessagesList(bearerToken: string,
|
6303
6469
|
options: any = {}): Promise<ApiSystemMessagesList> {
|
package/client.ts
CHANGED
@@ -102,6 +102,10 @@ import {
|
|
102
102
|
MezonUpdateSystemMessageBody,
|
103
103
|
ApiUpdateCategoryOrderRequest,
|
104
104
|
ApiGiveCoffeeEvent,
|
105
|
+
ApiListStreamingChannelsResponse,
|
106
|
+
ApiStreamingChannelUserList,
|
107
|
+
ApiRegisterStreamingChannelRequest,
|
108
|
+
ApiRegisterStreamingChannelResponse,
|
105
109
|
} from "./api.gen";
|
106
110
|
|
107
111
|
import { Session } from "./session";
|
@@ -120,8 +124,9 @@ export enum ChannelType {
|
|
120
124
|
CHANNEL_TYPE_DM = 3,
|
121
125
|
CHANNEL_TYPE_VOICE = 4,
|
122
126
|
CHANNEL_TYPE_FORUM = 5,
|
123
|
-
|
127
|
+
CHANNEL_TYPE_STREAMING = 6,
|
124
128
|
CHANNEL_TYPE_THREAD = 7,
|
129
|
+
CHANNEL_TYPE_ANNOUNCEMENT = 8,
|
125
130
|
}
|
126
131
|
export enum ChannelStreamMode {
|
127
132
|
STREAM_MODE_CHANNEL = 2,
|
@@ -3464,4 +3469,88 @@ export class Client {
|
|
3464
3469
|
return response !== undefined;
|
3465
3470
|
});
|
3466
3471
|
}
|
3472
|
+
|
3473
|
+
async listStreamingChannels(
|
3474
|
+
session: Session,
|
3475
|
+
clanId: string
|
3476
|
+
): Promise<ApiListStreamingChannelsResponse> {
|
3477
|
+
if (
|
3478
|
+
this.autoRefreshSession &&
|
3479
|
+
session.refresh_token &&
|
3480
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
3481
|
+
) {
|
3482
|
+
await this.sessionRefresh(session);
|
3483
|
+
}
|
3484
|
+
|
3485
|
+
return this.apiClient
|
3486
|
+
.listStreamingChannels(session.token, clanId)
|
3487
|
+
.then((response: ApiListStreamingChannelsResponse) => {
|
3488
|
+
return Promise.resolve(response);
|
3489
|
+
});
|
3490
|
+
}
|
3491
|
+
|
3492
|
+
/** List a channel's users. */
|
3493
|
+
async listStreamingChannelUsers(
|
3494
|
+
session: Session,
|
3495
|
+
clanId: string,
|
3496
|
+
channelId: string,
|
3497
|
+
channelType: number,
|
3498
|
+
state?: number,
|
3499
|
+
limit?: number,
|
3500
|
+
cursor?: string
|
3501
|
+
): Promise<ApiStreamingChannelUserList> {
|
3502
|
+
if (
|
3503
|
+
this.autoRefreshSession &&
|
3504
|
+
session.refresh_token &&
|
3505
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
3506
|
+
) {
|
3507
|
+
await this.sessionRefresh(session);
|
3508
|
+
}
|
3509
|
+
|
3510
|
+
return this.apiClient
|
3511
|
+
.listStreamingChannelUsers(
|
3512
|
+
session.token,
|
3513
|
+
clanId,
|
3514
|
+
channelId,
|
3515
|
+
channelType,
|
3516
|
+
limit,
|
3517
|
+
state,
|
3518
|
+
cursor
|
3519
|
+
)
|
3520
|
+
.then((response: ApiStreamingChannelUserList) => {
|
3521
|
+
var result: ApiStreamingChannelUserList = {
|
3522
|
+
streaming_channel_users: [],
|
3523
|
+
};
|
3524
|
+
|
3525
|
+
if (response.streaming_channel_users == null) {
|
3526
|
+
return Promise.resolve(result);
|
3527
|
+
}
|
3528
|
+
|
3529
|
+
response.streaming_channel_users!.forEach((gu) => {
|
3530
|
+
result.streaming_channel_users!.push({
|
3531
|
+
id: gu.id,
|
3532
|
+
channel_id: gu.channel_id,
|
3533
|
+
user_id: gu.user_id,
|
3534
|
+
participant: gu.participant,
|
3535
|
+
});
|
3536
|
+
});
|
3537
|
+
return Promise.resolve(result);
|
3538
|
+
});
|
3539
|
+
}
|
3540
|
+
|
3541
|
+
async registerStreamingChannel(session: Session, request: ApiRegisterStreamingChannelRequest) {
|
3542
|
+
if (
|
3543
|
+
this.autoRefreshSession &&
|
3544
|
+
session.refresh_token &&
|
3545
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
3546
|
+
) {
|
3547
|
+
await this.sessionRefresh(session);
|
3548
|
+
}
|
3549
|
+
|
3550
|
+
return this.apiClient
|
3551
|
+
.registerStreamingChannel(session.token, request)
|
3552
|
+
.then((response: ApiRegisterStreamingChannelResponse) => {
|
3553
|
+
return response !== undefined;
|
3554
|
+
});
|
3555
|
+
}
|
3467
3556
|
}
|
package/dist/api.gen.d.ts
CHANGED
@@ -503,6 +503,21 @@ export interface ApiEvent {
|
|
503
503
|
timestamp?: string;
|
504
504
|
}
|
505
505
|
/** */
|
506
|
+
export interface ApiRegisterStreamingChannelRequest {
|
507
|
+
channel_id?: string;
|
508
|
+
clan_id?: string;
|
509
|
+
}
|
510
|
+
/** */
|
511
|
+
export interface ApiRegisterStreamingChannelResponse {
|
512
|
+
channel_id?: string;
|
513
|
+
clan_id?: string;
|
514
|
+
streaming_url?: string;
|
515
|
+
}
|
516
|
+
/** */
|
517
|
+
export interface ApiListStreamingChannelsResponse {
|
518
|
+
streaming_channels?: Array<ApiStreamingChannelResponse>;
|
519
|
+
}
|
520
|
+
/** */
|
506
521
|
export interface ApiEventList {
|
507
522
|
events?: Array<ApiEventManagement>;
|
508
523
|
}
|
@@ -863,6 +878,24 @@ export interface ApiSortParam {
|
|
863
878
|
field_name?: string;
|
864
879
|
order?: string;
|
865
880
|
}
|
881
|
+
/** */
|
882
|
+
export interface ApiStreamingChannelResponse {
|
883
|
+
channel_id?: string;
|
884
|
+
clan_id?: string;
|
885
|
+
is_streaming?: boolean;
|
886
|
+
streaming_url?: string;
|
887
|
+
}
|
888
|
+
/** A list of users belonging to a channel, along with their role. */
|
889
|
+
export interface ApiStreamingChannelUser {
|
890
|
+
channel_id?: string;
|
891
|
+
id?: string;
|
892
|
+
participant?: string;
|
893
|
+
user_id?: string;
|
894
|
+
}
|
895
|
+
/** A list of users belonging to a channel, along with their role. */
|
896
|
+
export interface ApiStreamingChannelUserList {
|
897
|
+
streaming_channel_users?: Array<ApiStreamingChannelUser>;
|
898
|
+
}
|
866
899
|
/** System message details. */
|
867
900
|
export interface ApiSystemMessage {
|
868
901
|
boost_message?: string;
|
@@ -1257,6 +1290,12 @@ export declare class MezonApi {
|
|
1257
1290
|
deleteClanStickerById(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
|
1258
1291
|
/** Update a sticker by ID */
|
1259
1292
|
updateClanStickerById(bearerToken: string, id: string, body: MezonUpdateClanStickerByIdBody, options?: any): Promise<any>;
|
1293
|
+
/** List streaming channels. */
|
1294
|
+
listStreamingChannels(bearerToken: string, clanId?: string, options?: any): Promise<ApiListStreamingChannelsResponse>;
|
1295
|
+
/** Register streaming in channel ( for bot - get streaming key) */
|
1296
|
+
registerStreamingChannel(bearerToken: string, body: ApiRegisterStreamingChannelRequest, options?: any): Promise<ApiRegisterStreamingChannelResponse>;
|
1297
|
+
/** List all users that are part of a channel. */
|
1298
|
+
listStreamingChannelUsers(bearerToken: string, clanId?: string, channelId?: string, channelType?: number, limit?: number, state?: number, cursor?: string, options?: any): Promise<ApiStreamingChannelUserList>;
|
1260
1299
|
/** Get the list of system messages. */
|
1261
1300
|
getSystemMessagesList(bearerToken: string, options?: any): Promise<ApiSystemMessagesList>;
|
1262
1301
|
/** Create a system messages. */
|
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 } 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 } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -23,8 +23,9 @@ export declare enum ChannelType {
|
|
23
23
|
CHANNEL_TYPE_DM = 3,
|
24
24
|
CHANNEL_TYPE_VOICE = 4,
|
25
25
|
CHANNEL_TYPE_FORUM = 5,
|
26
|
-
|
27
|
-
CHANNEL_TYPE_THREAD = 7
|
26
|
+
CHANNEL_TYPE_STREAMING = 6,
|
27
|
+
CHANNEL_TYPE_THREAD = 7,
|
28
|
+
CHANNEL_TYPE_ANNOUNCEMENT = 8
|
28
29
|
}
|
29
30
|
export declare enum ChannelStreamMode {
|
30
31
|
STREAM_MODE_CHANNEL = 2,
|
@@ -551,4 +552,8 @@ export declare class Client {
|
|
551
552
|
updateCategoryOrder(session: Session, request: ApiUpdateCategoryOrderRequest): Promise<any>;
|
552
553
|
deleteCategoryOrder(session: Session, clanId: string): Promise<any>;
|
553
554
|
givecoffee(session: Session, request: ApiGiveCoffeeEvent): Promise<boolean>;
|
555
|
+
listStreamingChannels(session: Session, clanId: string): Promise<ApiListStreamingChannelsResponse>;
|
556
|
+
/** List a channel's users. */
|
557
|
+
listStreamingChannelUsers(session: Session, clanId: string, channelId: string, channelType: number, state?: number, limit?: number, cursor?: string): Promise<ApiStreamingChannelUserList>;
|
558
|
+
registerStreamingChannel(session: Session, request: ApiRegisterStreamingChannelRequest): Promise<boolean>;
|
554
559
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -4247,6 +4247,92 @@ var MezonApi = class {
|
|
4247
4247
|
)
|
4248
4248
|
]);
|
4249
4249
|
}
|
4250
|
+
/** List streaming channels. */
|
4251
|
+
listStreamingChannels(bearerToken, clanId, options = {}) {
|
4252
|
+
const urlPath = "/v2/streaming-channels";
|
4253
|
+
const queryParams = /* @__PURE__ */ new Map();
|
4254
|
+
queryParams.set("clan_id", clanId);
|
4255
|
+
let bodyJson = "";
|
4256
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4257
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
4258
|
+
if (bearerToken) {
|
4259
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4260
|
+
}
|
4261
|
+
return Promise.race([
|
4262
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4263
|
+
if (response.status == 204) {
|
4264
|
+
return response;
|
4265
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4266
|
+
return response.json();
|
4267
|
+
} else {
|
4268
|
+
throw response;
|
4269
|
+
}
|
4270
|
+
}),
|
4271
|
+
new Promise(
|
4272
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4273
|
+
)
|
4274
|
+
]);
|
4275
|
+
}
|
4276
|
+
/** Register streaming in channel ( for bot - get streaming key) */
|
4277
|
+
registerStreamingChannel(bearerToken, body, options = {}) {
|
4278
|
+
if (body === null || body === void 0) {
|
4279
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
4280
|
+
}
|
4281
|
+
const urlPath = "/v2/streaming-channels";
|
4282
|
+
const queryParams = /* @__PURE__ */ new Map();
|
4283
|
+
let bodyJson = "";
|
4284
|
+
bodyJson = JSON.stringify(body || {});
|
4285
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4286
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
4287
|
+
if (bearerToken) {
|
4288
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4289
|
+
}
|
4290
|
+
return Promise.race([
|
4291
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4292
|
+
if (response.status == 204) {
|
4293
|
+
return response;
|
4294
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4295
|
+
return response.json();
|
4296
|
+
} else {
|
4297
|
+
throw response;
|
4298
|
+
}
|
4299
|
+
}),
|
4300
|
+
new Promise(
|
4301
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4302
|
+
)
|
4303
|
+
]);
|
4304
|
+
}
|
4305
|
+
/** List all users that are part of a channel. */
|
4306
|
+
listStreamingChannelUsers(bearerToken, clanId, channelId, channelType, limit, state, cursor, options = {}) {
|
4307
|
+
const urlPath = "/v2/streaming-channels/users";
|
4308
|
+
const queryParams = /* @__PURE__ */ new Map();
|
4309
|
+
queryParams.set("clan_id", clanId);
|
4310
|
+
queryParams.set("channel_id", channelId);
|
4311
|
+
queryParams.set("channel_type", channelType);
|
4312
|
+
queryParams.set("limit", limit);
|
4313
|
+
queryParams.set("state", state);
|
4314
|
+
queryParams.set("cursor", cursor);
|
4315
|
+
let bodyJson = "";
|
4316
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4317
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
4318
|
+
if (bearerToken) {
|
4319
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4320
|
+
}
|
4321
|
+
return Promise.race([
|
4322
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4323
|
+
if (response.status == 204) {
|
4324
|
+
return response;
|
4325
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4326
|
+
return response.json();
|
4327
|
+
} else {
|
4328
|
+
throw response;
|
4329
|
+
}
|
4330
|
+
}),
|
4331
|
+
new Promise(
|
4332
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4333
|
+
)
|
4334
|
+
]);
|
4335
|
+
}
|
4250
4336
|
/** Get the list of system messages. */
|
4251
4337
|
getSystemMessagesList(bearerToken, options = {}) {
|
4252
4338
|
const urlPath = "/v2/systemmessages";
|
@@ -4904,6 +4990,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4904
4990
|
this.onvoiceleaved(message.voice_leaved_event);
|
4905
4991
|
} else if (message.channel_created_event) {
|
4906
4992
|
this.onchannelcreated(message.channel_created_event);
|
4993
|
+
} else if (message.role_event) {
|
4994
|
+
this.onroleevent(message.role_event);
|
4907
4995
|
} else if (message.channel_deleted_event) {
|
4908
4996
|
this.onchanneldeleted(message.channel_deleted_event);
|
4909
4997
|
} else if (message.clan_deleted_event) {
|
@@ -5146,6 +5234,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5146
5234
|
console.log(channelCreated);
|
5147
5235
|
}
|
5148
5236
|
}
|
5237
|
+
onroleevent(roleEvent) {
|
5238
|
+
if (this.verbose && window && window.console) {
|
5239
|
+
console.log(roleEvent);
|
5240
|
+
}
|
5241
|
+
}
|
5149
5242
|
onchanneldeleted(channelDeleted) {
|
5150
5243
|
if (this.verbose && window && window.console) {
|
5151
5244
|
console.log(channelDeleted);
|
@@ -5365,15 +5458,15 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5365
5458
|
return response.custom_status_event;
|
5366
5459
|
});
|
5367
5460
|
}
|
5368
|
-
|
5461
|
+
checkDuplicateName(name, condition_id, type) {
|
5369
5462
|
return __async(this, null, function* () {
|
5370
|
-
const response = yield this.send({
|
5371
|
-
return response.
|
5463
|
+
const response = yield this.send({ check_name_existed_event: { name, condition_id, type } });
|
5464
|
+
return response.check_name_existed_event;
|
5372
5465
|
});
|
5373
5466
|
}
|
5374
|
-
|
5467
|
+
listClanEmojiByUserId() {
|
5375
5468
|
return __async(this, null, function* () {
|
5376
|
-
const response = yield this.send({ emojis_listed_event: {
|
5469
|
+
const response = yield this.send({ emojis_listed_event: {} });
|
5377
5470
|
return response.emojis_listed_event;
|
5378
5471
|
});
|
5379
5472
|
}
|
@@ -5487,8 +5580,9 @@ var ChannelType = /* @__PURE__ */ ((ChannelType2) => {
|
|
5487
5580
|
ChannelType2[ChannelType2["CHANNEL_TYPE_DM"] = 3] = "CHANNEL_TYPE_DM";
|
5488
5581
|
ChannelType2[ChannelType2["CHANNEL_TYPE_VOICE"] = 4] = "CHANNEL_TYPE_VOICE";
|
5489
5582
|
ChannelType2[ChannelType2["CHANNEL_TYPE_FORUM"] = 5] = "CHANNEL_TYPE_FORUM";
|
5490
|
-
ChannelType2[ChannelType2["
|
5583
|
+
ChannelType2[ChannelType2["CHANNEL_TYPE_STREAMING"] = 6] = "CHANNEL_TYPE_STREAMING";
|
5491
5584
|
ChannelType2[ChannelType2["CHANNEL_TYPE_THREAD"] = 7] = "CHANNEL_TYPE_THREAD";
|
5585
|
+
ChannelType2[ChannelType2["CHANNEL_TYPE_ANNOUNCEMENT"] = 8] = "CHANNEL_TYPE_ANNOUNCEMENT";
|
5492
5586
|
return ChannelType2;
|
5493
5587
|
})(ChannelType || {});
|
5494
5588
|
var ChannelStreamMode = /* @__PURE__ */ ((ChannelStreamMode2) => {
|
@@ -7301,4 +7395,57 @@ var Client = class {
|
|
7301
7395
|
});
|
7302
7396
|
});
|
7303
7397
|
}
|
7398
|
+
listStreamingChannels(session, clanId) {
|
7399
|
+
return __async(this, null, function* () {
|
7400
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7401
|
+
yield this.sessionRefresh(session);
|
7402
|
+
}
|
7403
|
+
return this.apiClient.listStreamingChannels(session.token, clanId).then((response) => {
|
7404
|
+
return Promise.resolve(response);
|
7405
|
+
});
|
7406
|
+
});
|
7407
|
+
}
|
7408
|
+
/** List a channel's users. */
|
7409
|
+
listStreamingChannelUsers(session, clanId, channelId, channelType, state, limit, cursor) {
|
7410
|
+
return __async(this, null, function* () {
|
7411
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7412
|
+
yield this.sessionRefresh(session);
|
7413
|
+
}
|
7414
|
+
return this.apiClient.listStreamingChannelUsers(
|
7415
|
+
session.token,
|
7416
|
+
clanId,
|
7417
|
+
channelId,
|
7418
|
+
channelType,
|
7419
|
+
limit,
|
7420
|
+
state,
|
7421
|
+
cursor
|
7422
|
+
).then((response) => {
|
7423
|
+
var result = {
|
7424
|
+
streaming_channel_users: []
|
7425
|
+
};
|
7426
|
+
if (response.streaming_channel_users == null) {
|
7427
|
+
return Promise.resolve(result);
|
7428
|
+
}
|
7429
|
+
response.streaming_channel_users.forEach((gu) => {
|
7430
|
+
result.streaming_channel_users.push({
|
7431
|
+
id: gu.id,
|
7432
|
+
channel_id: gu.channel_id,
|
7433
|
+
user_id: gu.user_id,
|
7434
|
+
participant: gu.participant
|
7435
|
+
});
|
7436
|
+
});
|
7437
|
+
return Promise.resolve(result);
|
7438
|
+
});
|
7439
|
+
});
|
7440
|
+
}
|
7441
|
+
registerStreamingChannel(session, request) {
|
7442
|
+
return __async(this, null, function* () {
|
7443
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7444
|
+
yield this.sessionRefresh(session);
|
7445
|
+
}
|
7446
|
+
return this.apiClient.registerStreamingChannel(session.token, request).then((response) => {
|
7447
|
+
return response !== void 0;
|
7448
|
+
});
|
7449
|
+
});
|
7450
|
+
}
|
7304
7451
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -4218,6 +4218,92 @@ var MezonApi = class {
|
|
4218
4218
|
)
|
4219
4219
|
]);
|
4220
4220
|
}
|
4221
|
+
/** List streaming channels. */
|
4222
|
+
listStreamingChannels(bearerToken, clanId, options = {}) {
|
4223
|
+
const urlPath = "/v2/streaming-channels";
|
4224
|
+
const queryParams = /* @__PURE__ */ new Map();
|
4225
|
+
queryParams.set("clan_id", clanId);
|
4226
|
+
let bodyJson = "";
|
4227
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4228
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
4229
|
+
if (bearerToken) {
|
4230
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4231
|
+
}
|
4232
|
+
return Promise.race([
|
4233
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4234
|
+
if (response.status == 204) {
|
4235
|
+
return response;
|
4236
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4237
|
+
return response.json();
|
4238
|
+
} else {
|
4239
|
+
throw response;
|
4240
|
+
}
|
4241
|
+
}),
|
4242
|
+
new Promise(
|
4243
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4244
|
+
)
|
4245
|
+
]);
|
4246
|
+
}
|
4247
|
+
/** Register streaming in channel ( for bot - get streaming key) */
|
4248
|
+
registerStreamingChannel(bearerToken, body, options = {}) {
|
4249
|
+
if (body === null || body === void 0) {
|
4250
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
4251
|
+
}
|
4252
|
+
const urlPath = "/v2/streaming-channels";
|
4253
|
+
const queryParams = /* @__PURE__ */ new Map();
|
4254
|
+
let bodyJson = "";
|
4255
|
+
bodyJson = JSON.stringify(body || {});
|
4256
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4257
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
4258
|
+
if (bearerToken) {
|
4259
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4260
|
+
}
|
4261
|
+
return Promise.race([
|
4262
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4263
|
+
if (response.status == 204) {
|
4264
|
+
return response;
|
4265
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4266
|
+
return response.json();
|
4267
|
+
} else {
|
4268
|
+
throw response;
|
4269
|
+
}
|
4270
|
+
}),
|
4271
|
+
new Promise(
|
4272
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4273
|
+
)
|
4274
|
+
]);
|
4275
|
+
}
|
4276
|
+
/** List all users that are part of a channel. */
|
4277
|
+
listStreamingChannelUsers(bearerToken, clanId, channelId, channelType, limit, state, cursor, options = {}) {
|
4278
|
+
const urlPath = "/v2/streaming-channels/users";
|
4279
|
+
const queryParams = /* @__PURE__ */ new Map();
|
4280
|
+
queryParams.set("clan_id", clanId);
|
4281
|
+
queryParams.set("channel_id", channelId);
|
4282
|
+
queryParams.set("channel_type", channelType);
|
4283
|
+
queryParams.set("limit", limit);
|
4284
|
+
queryParams.set("state", state);
|
4285
|
+
queryParams.set("cursor", cursor);
|
4286
|
+
let bodyJson = "";
|
4287
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4288
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
4289
|
+
if (bearerToken) {
|
4290
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4291
|
+
}
|
4292
|
+
return Promise.race([
|
4293
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4294
|
+
if (response.status == 204) {
|
4295
|
+
return response;
|
4296
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4297
|
+
return response.json();
|
4298
|
+
} else {
|
4299
|
+
throw response;
|
4300
|
+
}
|
4301
|
+
}),
|
4302
|
+
new Promise(
|
4303
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4304
|
+
)
|
4305
|
+
]);
|
4306
|
+
}
|
4221
4307
|
/** Get the list of system messages. */
|
4222
4308
|
getSystemMessagesList(bearerToken, options = {}) {
|
4223
4309
|
const urlPath = "/v2/systemmessages";
|
@@ -4875,6 +4961,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4875
4961
|
this.onvoiceleaved(message.voice_leaved_event);
|
4876
4962
|
} else if (message.channel_created_event) {
|
4877
4963
|
this.onchannelcreated(message.channel_created_event);
|
4964
|
+
} else if (message.role_event) {
|
4965
|
+
this.onroleevent(message.role_event);
|
4878
4966
|
} else if (message.channel_deleted_event) {
|
4879
4967
|
this.onchanneldeleted(message.channel_deleted_event);
|
4880
4968
|
} else if (message.clan_deleted_event) {
|
@@ -5117,6 +5205,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5117
5205
|
console.log(channelCreated);
|
5118
5206
|
}
|
5119
5207
|
}
|
5208
|
+
onroleevent(roleEvent) {
|
5209
|
+
if (this.verbose && window && window.console) {
|
5210
|
+
console.log(roleEvent);
|
5211
|
+
}
|
5212
|
+
}
|
5120
5213
|
onchanneldeleted(channelDeleted) {
|
5121
5214
|
if (this.verbose && window && window.console) {
|
5122
5215
|
console.log(channelDeleted);
|
@@ -5336,15 +5429,15 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5336
5429
|
return response.custom_status_event;
|
5337
5430
|
});
|
5338
5431
|
}
|
5339
|
-
|
5432
|
+
checkDuplicateName(name, condition_id, type) {
|
5340
5433
|
return __async(this, null, function* () {
|
5341
|
-
const response = yield this.send({
|
5342
|
-
return response.
|
5434
|
+
const response = yield this.send({ check_name_existed_event: { name, condition_id, type } });
|
5435
|
+
return response.check_name_existed_event;
|
5343
5436
|
});
|
5344
5437
|
}
|
5345
|
-
|
5438
|
+
listClanEmojiByUserId() {
|
5346
5439
|
return __async(this, null, function* () {
|
5347
|
-
const response = yield this.send({ emojis_listed_event: {
|
5440
|
+
const response = yield this.send({ emojis_listed_event: {} });
|
5348
5441
|
return response.emojis_listed_event;
|
5349
5442
|
});
|
5350
5443
|
}
|
@@ -5458,8 +5551,9 @@ var ChannelType = /* @__PURE__ */ ((ChannelType2) => {
|
|
5458
5551
|
ChannelType2[ChannelType2["CHANNEL_TYPE_DM"] = 3] = "CHANNEL_TYPE_DM";
|
5459
5552
|
ChannelType2[ChannelType2["CHANNEL_TYPE_VOICE"] = 4] = "CHANNEL_TYPE_VOICE";
|
5460
5553
|
ChannelType2[ChannelType2["CHANNEL_TYPE_FORUM"] = 5] = "CHANNEL_TYPE_FORUM";
|
5461
|
-
ChannelType2[ChannelType2["
|
5554
|
+
ChannelType2[ChannelType2["CHANNEL_TYPE_STREAMING"] = 6] = "CHANNEL_TYPE_STREAMING";
|
5462
5555
|
ChannelType2[ChannelType2["CHANNEL_TYPE_THREAD"] = 7] = "CHANNEL_TYPE_THREAD";
|
5556
|
+
ChannelType2[ChannelType2["CHANNEL_TYPE_ANNOUNCEMENT"] = 8] = "CHANNEL_TYPE_ANNOUNCEMENT";
|
5463
5557
|
return ChannelType2;
|
5464
5558
|
})(ChannelType || {});
|
5465
5559
|
var ChannelStreamMode = /* @__PURE__ */ ((ChannelStreamMode2) => {
|
@@ -7272,6 +7366,59 @@ var Client = class {
|
|
7272
7366
|
});
|
7273
7367
|
});
|
7274
7368
|
}
|
7369
|
+
listStreamingChannels(session, clanId) {
|
7370
|
+
return __async(this, null, function* () {
|
7371
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7372
|
+
yield this.sessionRefresh(session);
|
7373
|
+
}
|
7374
|
+
return this.apiClient.listStreamingChannels(session.token, clanId).then((response) => {
|
7375
|
+
return Promise.resolve(response);
|
7376
|
+
});
|
7377
|
+
});
|
7378
|
+
}
|
7379
|
+
/** List a channel's users. */
|
7380
|
+
listStreamingChannelUsers(session, clanId, channelId, channelType, state, limit, cursor) {
|
7381
|
+
return __async(this, null, function* () {
|
7382
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7383
|
+
yield this.sessionRefresh(session);
|
7384
|
+
}
|
7385
|
+
return this.apiClient.listStreamingChannelUsers(
|
7386
|
+
session.token,
|
7387
|
+
clanId,
|
7388
|
+
channelId,
|
7389
|
+
channelType,
|
7390
|
+
limit,
|
7391
|
+
state,
|
7392
|
+
cursor
|
7393
|
+
).then((response) => {
|
7394
|
+
var result = {
|
7395
|
+
streaming_channel_users: []
|
7396
|
+
};
|
7397
|
+
if (response.streaming_channel_users == null) {
|
7398
|
+
return Promise.resolve(result);
|
7399
|
+
}
|
7400
|
+
response.streaming_channel_users.forEach((gu) => {
|
7401
|
+
result.streaming_channel_users.push({
|
7402
|
+
id: gu.id,
|
7403
|
+
channel_id: gu.channel_id,
|
7404
|
+
user_id: gu.user_id,
|
7405
|
+
participant: gu.participant
|
7406
|
+
});
|
7407
|
+
});
|
7408
|
+
return Promise.resolve(result);
|
7409
|
+
});
|
7410
|
+
});
|
7411
|
+
}
|
7412
|
+
registerStreamingChannel(session, request) {
|
7413
|
+
return __async(this, null, function* () {
|
7414
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7415
|
+
yield this.sessionRefresh(session);
|
7416
|
+
}
|
7417
|
+
return this.apiClient.registerStreamingChannel(session.token, request).then((response) => {
|
7418
|
+
return response !== void 0;
|
7419
|
+
});
|
7420
|
+
});
|
7421
|
+
}
|
7275
7422
|
};
|
7276
7423
|
export {
|
7277
7424
|
ChannelStreamMode,
|
package/dist/socket.d.ts
CHANGED
@@ -424,9 +424,11 @@ interface StatusUpdate {
|
|
424
424
|
status?: string;
|
425
425
|
};
|
426
426
|
}
|
427
|
-
export interface
|
427
|
+
export interface CheckNameExistedEvent {
|
428
428
|
clan_name: string;
|
429
429
|
exist: boolean;
|
430
|
+
condition_id: string;
|
431
|
+
type: number;
|
430
432
|
}
|
431
433
|
/** */
|
432
434
|
export interface StrickerListedEvent {
|
@@ -446,7 +448,6 @@ export interface ClanSticker {
|
|
446
448
|
}
|
447
449
|
/** */
|
448
450
|
export interface EmojiListedEvent {
|
449
|
-
clan_id: string;
|
450
451
|
emoji_list?: Array<ClanEmoji>;
|
451
452
|
}
|
452
453
|
export interface RoleListEvent {
|
@@ -456,6 +457,17 @@ export interface RoleListEvent {
|
|
456
457
|
ClanId: string;
|
457
458
|
roles: ApiRoleList;
|
458
459
|
}
|
460
|
+
export interface RoleEvent {
|
461
|
+
clan_id: string;
|
462
|
+
role_id: string;
|
463
|
+
creator_id: string;
|
464
|
+
user_ids_assigned: Array<string>;
|
465
|
+
permission_ids_assigned: Array<string>;
|
466
|
+
user_ids_removed: Array<string>;
|
467
|
+
permission_ids_removed: Array<string>;
|
468
|
+
role_title: string;
|
469
|
+
status: string;
|
470
|
+
}
|
459
471
|
export interface UserPermissionInChannelListEvent {
|
460
472
|
clan_id: string;
|
461
473
|
channel_id: string;
|
@@ -468,6 +480,9 @@ export interface ClanEmoji {
|
|
468
480
|
id?: string;
|
469
481
|
shortname?: string;
|
470
482
|
src?: string;
|
483
|
+
logo?: string;
|
484
|
+
clan_name?: string;
|
485
|
+
clan_id?: string;
|
471
486
|
}
|
472
487
|
/** */
|
473
488
|
export interface ChannelDescListEvent {
|
@@ -647,6 +662,7 @@ export interface Socket {
|
|
647
662
|
onvoicejoined: (voiceParticipant: VoiceJoinedEvent) => void;
|
648
663
|
onvoiceleaved: (voiceParticipant: VoiceLeavedEvent) => void;
|
649
664
|
onchannelcreated: (channelCreated: ChannelCreatedEvent) => void;
|
665
|
+
onroleevent: (roleEvent: RoleEvent) => void;
|
650
666
|
onchanneldeleted: (channelDeleted: ChannelDeletedEvent) => void;
|
651
667
|
onstickercreated: (stickerCreated: StickerCreateEvent) => void;
|
652
668
|
onstickerupdated: (stickerUpdated: StickerUpdateEvent) => void;
|
@@ -657,8 +673,8 @@ export interface Socket {
|
|
657
673
|
onclanupdated: (clan: ClanUpdatedEvent) => void;
|
658
674
|
setHeartbeatTimeoutMs(ms: number): void;
|
659
675
|
getHeartbeatTimeoutMs(): number;
|
660
|
-
|
661
|
-
|
676
|
+
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
677
|
+
listClanEmojiByUserId(): Promise<EmojiListedEvent>;
|
662
678
|
listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
|
663
679
|
listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
|
664
680
|
listStickersByUserId(): Promise<StrickerListedEvent>;
|
@@ -721,6 +737,7 @@ export declare class DefaultSocket implements Socket {
|
|
721
737
|
onvoicejoined(voiceParticipant: VoiceJoinedEvent): void;
|
722
738
|
onvoiceleaved(voiceParticipant: VoiceLeavedEvent): void;
|
723
739
|
onchannelcreated(channelCreated: ChannelCreatedEvent): void;
|
740
|
+
onroleevent(roleEvent: RoleEvent): void;
|
724
741
|
onchanneldeleted(channelDeleted: ChannelDeletedEvent): void;
|
725
742
|
onclandeleted(clanDeleted: ClanDeletedEvent): void;
|
726
743
|
onstickercreated(stickerCreated: StickerCreateEvent): void;
|
@@ -753,8 +770,8 @@ export declare class DefaultSocket implements Socket {
|
|
753
770
|
writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
|
754
771
|
writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
|
755
772
|
writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
|
756
|
-
|
757
|
-
|
773
|
+
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
774
|
+
listClanEmojiByUserId(): Promise<EmojiListedEvent>;
|
758
775
|
listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
|
759
776
|
listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
|
760
777
|
listChannelByUserId(): Promise<ChannelDescListEvent>;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -612,9 +612,11 @@ interface StatusUpdate {
|
|
612
612
|
/** Status string to set, if not present the user will appear offline. */
|
613
613
|
status_update: {status?: string;};
|
614
614
|
}
|
615
|
-
export interface
|
615
|
+
export interface CheckNameExistedEvent {
|
616
616
|
clan_name: string;
|
617
617
|
exist: boolean;
|
618
|
+
condition_id : string;
|
619
|
+
type: number;
|
618
620
|
}
|
619
621
|
|
620
622
|
|
@@ -648,8 +650,6 @@ export interface ClanSticker {
|
|
648
650
|
|
649
651
|
/** */
|
650
652
|
export interface EmojiListedEvent {
|
651
|
-
// clan id
|
652
|
-
clan_id: string;
|
653
653
|
// emoji data
|
654
654
|
emoji_list?: Array<ClanEmoji>;
|
655
655
|
}
|
@@ -666,6 +666,18 @@ export interface RoleListEvent {
|
|
666
666
|
roles: ApiRoleList;
|
667
667
|
}
|
668
668
|
|
669
|
+
export interface RoleEvent {
|
670
|
+
clan_id: string;
|
671
|
+
role_id: string;
|
672
|
+
creator_id: string;
|
673
|
+
user_ids_assigned: Array<string>;
|
674
|
+
permission_ids_assigned: Array<string>;
|
675
|
+
user_ids_removed: Array<string>;
|
676
|
+
permission_ids_removed: Array<string>;
|
677
|
+
role_title: string;
|
678
|
+
status: string;
|
679
|
+
}
|
680
|
+
|
669
681
|
export interface UserPermissionInChannelListEvent {
|
670
682
|
//
|
671
683
|
clan_id: string;
|
@@ -687,6 +699,12 @@ export interface ClanEmoji {
|
|
687
699
|
shortname?: string;
|
688
700
|
//
|
689
701
|
src?: string;
|
702
|
+
//
|
703
|
+
logo?: string;
|
704
|
+
//
|
705
|
+
clan_name?: string;
|
706
|
+
//
|
707
|
+
clan_id?: string;
|
690
708
|
}
|
691
709
|
|
692
710
|
/** */
|
@@ -977,6 +995,8 @@ export interface Socket {
|
|
977
995
|
// when channel is created
|
978
996
|
onchannelcreated: (channelCreated: ChannelCreatedEvent) => void;
|
979
997
|
|
998
|
+
onroleevent: (roleEvent: RoleEvent) => void;
|
999
|
+
|
980
1000
|
// when channel is deleted
|
981
1001
|
onchanneldeleted: (channelDeleted: ChannelDeletedEvent) => void;
|
982
1002
|
|
@@ -1007,9 +1027,9 @@ export interface Socket {
|
|
1007
1027
|
/* Get the heartbeat timeout used by the socket to detect if it has lost connectivity to the server. */
|
1008
1028
|
getHeartbeatTimeoutMs() : number;
|
1009
1029
|
|
1010
|
-
|
1030
|
+
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
1011
1031
|
|
1012
|
-
|
1032
|
+
listClanEmojiByUserId(): Promise<EmojiListedEvent>;
|
1013
1033
|
|
1014
1034
|
listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
|
1015
1035
|
|
@@ -1120,6 +1140,8 @@ export class DefaultSocket implements Socket {
|
|
1120
1140
|
this.onvoiceleaved(message.voice_leaved_event)
|
1121
1141
|
} else if (message.channel_created_event) {
|
1122
1142
|
this.onchannelcreated(message.channel_created_event)
|
1143
|
+
} else if (message.role_event) {
|
1144
|
+
this.onroleevent(message.role_event)
|
1123
1145
|
} else if (message.channel_deleted_event) {
|
1124
1146
|
this.onchanneldeleted(message.channel_deleted_event)
|
1125
1147
|
} else if (message.clan_deleted_event) {
|
@@ -1395,6 +1417,12 @@ export class DefaultSocket implements Socket {
|
|
1395
1417
|
}
|
1396
1418
|
}
|
1397
1419
|
|
1420
|
+
onroleevent(roleEvent: RoleEvent) {
|
1421
|
+
if (this.verbose && window && window.console) {
|
1422
|
+
console.log(roleEvent);
|
1423
|
+
}
|
1424
|
+
}
|
1425
|
+
|
1398
1426
|
onchanneldeleted(channelDeleted: ChannelDeletedEvent) {
|
1399
1427
|
if (this.verbose && window && window.console) {
|
1400
1428
|
console.log(channelDeleted);
|
@@ -1629,13 +1657,13 @@ export class DefaultSocket implements Socket {
|
|
1629
1657
|
return response.custom_status_event
|
1630
1658
|
}
|
1631
1659
|
|
1632
|
-
async
|
1633
|
-
const response = await this.send({
|
1634
|
-
return response.
|
1660
|
+
async checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent> {
|
1661
|
+
const response = await this.send({check_name_existed_event: {name: name, condition_id: condition_id, type: type}});
|
1662
|
+
return response.check_name_existed_event
|
1635
1663
|
}
|
1636
1664
|
|
1637
|
-
async
|
1638
|
-
const response = await this.send({emojis_listed_event: {
|
1665
|
+
async listClanEmojiByUserId(): Promise<EmojiListedEvent> {
|
1666
|
+
const response = await this.send({emojis_listed_event: {}});
|
1639
1667
|
return response.emojis_listed_event
|
1640
1668
|
}
|
1641
1669
|
|