mezon-js 2.8.89 → 2.8.92
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 +164 -3
- package/dist/mezon-js.esm.mjs +164 -3
- package/dist/socket.d.ts +25 -0
- package/package.json +1 -1
- package/socket.ts +71 -2
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";
|
@@ -4906,8 +4992,14 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4906
4992
|
this.onchannelcreated(message.channel_created_event);
|
4907
4993
|
} else if (message.channel_deleted_event) {
|
4908
4994
|
this.onchanneldeleted(message.channel_deleted_event);
|
4909
|
-
} else if (message.
|
4910
|
-
this.onclandeleted(message.
|
4995
|
+
} else if (message.clan_deleted_event) {
|
4996
|
+
this.onclandeleted(message.clan_deleted_event);
|
4997
|
+
} else if (message.sticker_create_event) {
|
4998
|
+
this.onstickercreated(message.sticker_create_event);
|
4999
|
+
} else if (message.sticker_update_event) {
|
5000
|
+
this.onstickerupdated(message.sticker_update_event);
|
5001
|
+
} else if (message.sticker_delete_event) {
|
5002
|
+
this.onstickerdeleted(message.sticker_delete_event);
|
4911
5003
|
} else if (message.channel_updated_event) {
|
4912
5004
|
this.onchannelupdated(message.channel_updated_event);
|
4913
5005
|
} else if (message.clan_profile_updated_event) {
|
@@ -5150,6 +5242,21 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5150
5242
|
console.log(clanDeleted);
|
5151
5243
|
}
|
5152
5244
|
}
|
5245
|
+
onstickercreated(stickerCreated) {
|
5246
|
+
if (this.verbose && window && window.console) {
|
5247
|
+
console.log(stickerCreated);
|
5248
|
+
}
|
5249
|
+
}
|
5250
|
+
onstickerdeleted(stickerDeleted) {
|
5251
|
+
if (this.verbose && window && window.console) {
|
5252
|
+
console.log(stickerDeleted);
|
5253
|
+
}
|
5254
|
+
}
|
5255
|
+
onstickerupdated(stickerUpdated) {
|
5256
|
+
if (this.verbose && window && window.console) {
|
5257
|
+
console.log(stickerUpdated);
|
5258
|
+
}
|
5259
|
+
}
|
5153
5260
|
onchannelupdated(channelUpdated) {
|
5154
5261
|
if (this.verbose && window && window.console) {
|
5155
5262
|
console.log(channelUpdated);
|
@@ -5466,8 +5573,9 @@ var ChannelType = /* @__PURE__ */ ((ChannelType2) => {
|
|
5466
5573
|
ChannelType2[ChannelType2["CHANNEL_TYPE_DM"] = 3] = "CHANNEL_TYPE_DM";
|
5467
5574
|
ChannelType2[ChannelType2["CHANNEL_TYPE_VOICE"] = 4] = "CHANNEL_TYPE_VOICE";
|
5468
5575
|
ChannelType2[ChannelType2["CHANNEL_TYPE_FORUM"] = 5] = "CHANNEL_TYPE_FORUM";
|
5469
|
-
ChannelType2[ChannelType2["
|
5576
|
+
ChannelType2[ChannelType2["CHANNEL_TYPE_STREAMING"] = 6] = "CHANNEL_TYPE_STREAMING";
|
5470
5577
|
ChannelType2[ChannelType2["CHANNEL_TYPE_THREAD"] = 7] = "CHANNEL_TYPE_THREAD";
|
5578
|
+
ChannelType2[ChannelType2["CHANNEL_TYPE_ANNOUNCEMENT"] = 8] = "CHANNEL_TYPE_ANNOUNCEMENT";
|
5471
5579
|
return ChannelType2;
|
5472
5580
|
})(ChannelType || {});
|
5473
5581
|
var ChannelStreamMode = /* @__PURE__ */ ((ChannelStreamMode2) => {
|
@@ -7280,4 +7388,57 @@ var Client = class {
|
|
7280
7388
|
});
|
7281
7389
|
});
|
7282
7390
|
}
|
7391
|
+
listStreamingChannels(session, clanId) {
|
7392
|
+
return __async(this, null, function* () {
|
7393
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7394
|
+
yield this.sessionRefresh(session);
|
7395
|
+
}
|
7396
|
+
return this.apiClient.listStreamingChannels(session.token, clanId).then((response) => {
|
7397
|
+
return Promise.resolve(response);
|
7398
|
+
});
|
7399
|
+
});
|
7400
|
+
}
|
7401
|
+
/** List a channel's users. */
|
7402
|
+
listStreamingChannelUsers(session, clanId, channelId, channelType, state, limit, cursor) {
|
7403
|
+
return __async(this, null, function* () {
|
7404
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7405
|
+
yield this.sessionRefresh(session);
|
7406
|
+
}
|
7407
|
+
return this.apiClient.listStreamingChannelUsers(
|
7408
|
+
session.token,
|
7409
|
+
clanId,
|
7410
|
+
channelId,
|
7411
|
+
channelType,
|
7412
|
+
limit,
|
7413
|
+
state,
|
7414
|
+
cursor
|
7415
|
+
).then((response) => {
|
7416
|
+
var result = {
|
7417
|
+
streaming_channel_users: []
|
7418
|
+
};
|
7419
|
+
if (response.streaming_channel_users == null) {
|
7420
|
+
return Promise.resolve(result);
|
7421
|
+
}
|
7422
|
+
response.streaming_channel_users.forEach((gu) => {
|
7423
|
+
result.streaming_channel_users.push({
|
7424
|
+
id: gu.id,
|
7425
|
+
channel_id: gu.channel_id,
|
7426
|
+
user_id: gu.user_id,
|
7427
|
+
participant: gu.participant
|
7428
|
+
});
|
7429
|
+
});
|
7430
|
+
return Promise.resolve(result);
|
7431
|
+
});
|
7432
|
+
});
|
7433
|
+
}
|
7434
|
+
registerStreamingChannel(session, request) {
|
7435
|
+
return __async(this, null, function* () {
|
7436
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7437
|
+
yield this.sessionRefresh(session);
|
7438
|
+
}
|
7439
|
+
return this.apiClient.registerStreamingChannel(session.token, request).then((response) => {
|
7440
|
+
return response !== void 0;
|
7441
|
+
});
|
7442
|
+
});
|
7443
|
+
}
|
7283
7444
|
};
|
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";
|
@@ -4877,8 +4963,14 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4877
4963
|
this.onchannelcreated(message.channel_created_event);
|
4878
4964
|
} else if (message.channel_deleted_event) {
|
4879
4965
|
this.onchanneldeleted(message.channel_deleted_event);
|
4880
|
-
} else if (message.
|
4881
|
-
this.onclandeleted(message.
|
4966
|
+
} else if (message.clan_deleted_event) {
|
4967
|
+
this.onclandeleted(message.clan_deleted_event);
|
4968
|
+
} else if (message.sticker_create_event) {
|
4969
|
+
this.onstickercreated(message.sticker_create_event);
|
4970
|
+
} else if (message.sticker_update_event) {
|
4971
|
+
this.onstickerupdated(message.sticker_update_event);
|
4972
|
+
} else if (message.sticker_delete_event) {
|
4973
|
+
this.onstickerdeleted(message.sticker_delete_event);
|
4882
4974
|
} else if (message.channel_updated_event) {
|
4883
4975
|
this.onchannelupdated(message.channel_updated_event);
|
4884
4976
|
} else if (message.clan_profile_updated_event) {
|
@@ -5121,6 +5213,21 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5121
5213
|
console.log(clanDeleted);
|
5122
5214
|
}
|
5123
5215
|
}
|
5216
|
+
onstickercreated(stickerCreated) {
|
5217
|
+
if (this.verbose && window && window.console) {
|
5218
|
+
console.log(stickerCreated);
|
5219
|
+
}
|
5220
|
+
}
|
5221
|
+
onstickerdeleted(stickerDeleted) {
|
5222
|
+
if (this.verbose && window && window.console) {
|
5223
|
+
console.log(stickerDeleted);
|
5224
|
+
}
|
5225
|
+
}
|
5226
|
+
onstickerupdated(stickerUpdated) {
|
5227
|
+
if (this.verbose && window && window.console) {
|
5228
|
+
console.log(stickerUpdated);
|
5229
|
+
}
|
5230
|
+
}
|
5124
5231
|
onchannelupdated(channelUpdated) {
|
5125
5232
|
if (this.verbose && window && window.console) {
|
5126
5233
|
console.log(channelUpdated);
|
@@ -5437,8 +5544,9 @@ var ChannelType = /* @__PURE__ */ ((ChannelType2) => {
|
|
5437
5544
|
ChannelType2[ChannelType2["CHANNEL_TYPE_DM"] = 3] = "CHANNEL_TYPE_DM";
|
5438
5545
|
ChannelType2[ChannelType2["CHANNEL_TYPE_VOICE"] = 4] = "CHANNEL_TYPE_VOICE";
|
5439
5546
|
ChannelType2[ChannelType2["CHANNEL_TYPE_FORUM"] = 5] = "CHANNEL_TYPE_FORUM";
|
5440
|
-
ChannelType2[ChannelType2["
|
5547
|
+
ChannelType2[ChannelType2["CHANNEL_TYPE_STREAMING"] = 6] = "CHANNEL_TYPE_STREAMING";
|
5441
5548
|
ChannelType2[ChannelType2["CHANNEL_TYPE_THREAD"] = 7] = "CHANNEL_TYPE_THREAD";
|
5549
|
+
ChannelType2[ChannelType2["CHANNEL_TYPE_ANNOUNCEMENT"] = 8] = "CHANNEL_TYPE_ANNOUNCEMENT";
|
5442
5550
|
return ChannelType2;
|
5443
5551
|
})(ChannelType || {});
|
5444
5552
|
var ChannelStreamMode = /* @__PURE__ */ ((ChannelStreamMode2) => {
|
@@ -7251,6 +7359,59 @@ var Client = class {
|
|
7251
7359
|
});
|
7252
7360
|
});
|
7253
7361
|
}
|
7362
|
+
listStreamingChannels(session, clanId) {
|
7363
|
+
return __async(this, null, function* () {
|
7364
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7365
|
+
yield this.sessionRefresh(session);
|
7366
|
+
}
|
7367
|
+
return this.apiClient.listStreamingChannels(session.token, clanId).then((response) => {
|
7368
|
+
return Promise.resolve(response);
|
7369
|
+
});
|
7370
|
+
});
|
7371
|
+
}
|
7372
|
+
/** List a channel's users. */
|
7373
|
+
listStreamingChannelUsers(session, clanId, channelId, channelType, state, limit, cursor) {
|
7374
|
+
return __async(this, null, function* () {
|
7375
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7376
|
+
yield this.sessionRefresh(session);
|
7377
|
+
}
|
7378
|
+
return this.apiClient.listStreamingChannelUsers(
|
7379
|
+
session.token,
|
7380
|
+
clanId,
|
7381
|
+
channelId,
|
7382
|
+
channelType,
|
7383
|
+
limit,
|
7384
|
+
state,
|
7385
|
+
cursor
|
7386
|
+
).then((response) => {
|
7387
|
+
var result = {
|
7388
|
+
streaming_channel_users: []
|
7389
|
+
};
|
7390
|
+
if (response.streaming_channel_users == null) {
|
7391
|
+
return Promise.resolve(result);
|
7392
|
+
}
|
7393
|
+
response.streaming_channel_users.forEach((gu) => {
|
7394
|
+
result.streaming_channel_users.push({
|
7395
|
+
id: gu.id,
|
7396
|
+
channel_id: gu.channel_id,
|
7397
|
+
user_id: gu.user_id,
|
7398
|
+
participant: gu.participant
|
7399
|
+
});
|
7400
|
+
});
|
7401
|
+
return Promise.resolve(result);
|
7402
|
+
});
|
7403
|
+
});
|
7404
|
+
}
|
7405
|
+
registerStreamingChannel(session, request) {
|
7406
|
+
return __async(this, null, function* () {
|
7407
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7408
|
+
yield this.sessionRefresh(session);
|
7409
|
+
}
|
7410
|
+
return this.apiClient.registerStreamingChannel(session.token, request).then((response) => {
|
7411
|
+
return response !== void 0;
|
7412
|
+
});
|
7413
|
+
});
|
7414
|
+
}
|
7254
7415
|
};
|
7255
7416
|
export {
|
7256
7417
|
ChannelStreamMode,
|
package/dist/socket.d.ts
CHANGED
@@ -310,6 +310,25 @@ export interface ChannelDeletedEvent {
|
|
310
310
|
channel_id: string;
|
311
311
|
deletor: string;
|
312
312
|
}
|
313
|
+
export interface StickerCreateEvent {
|
314
|
+
clan_id: string;
|
315
|
+
source: string;
|
316
|
+
shortname: string;
|
317
|
+
category: string;
|
318
|
+
creator_id: string;
|
319
|
+
sticker_id: string;
|
320
|
+
logo: string;
|
321
|
+
clan_name: string;
|
322
|
+
}
|
323
|
+
export interface StickerUpdateEvent {
|
324
|
+
shortname: string;
|
325
|
+
sticker_id: string;
|
326
|
+
user_id: string;
|
327
|
+
}
|
328
|
+
export interface StickerDeleteEvent {
|
329
|
+
sticker_id: string;
|
330
|
+
user_id: string;
|
331
|
+
}
|
313
332
|
export interface ClanDeletedEvent {
|
314
333
|
clan_id: string;
|
315
334
|
deletor: string;
|
@@ -629,6 +648,9 @@ export interface Socket {
|
|
629
648
|
onvoiceleaved: (voiceParticipant: VoiceLeavedEvent) => void;
|
630
649
|
onchannelcreated: (channelCreated: ChannelCreatedEvent) => void;
|
631
650
|
onchanneldeleted: (channelDeleted: ChannelDeletedEvent) => void;
|
651
|
+
onstickercreated: (stickerCreated: StickerCreateEvent) => void;
|
652
|
+
onstickerupdated: (stickerUpdated: StickerUpdateEvent) => void;
|
653
|
+
onstickerdeleted: (stickerDeleted: StickerDeleteEvent) => void;
|
632
654
|
onclandeleted: (clanDeleted: ClanDeletedEvent) => void;
|
633
655
|
onchannelupdated: (channelUpdated: ChannelUpdatedEvent) => void;
|
634
656
|
onclanprofileupdated: (clanprofile: ClanProfileUpdatedEvent) => void;
|
@@ -701,6 +723,9 @@ export declare class DefaultSocket implements Socket {
|
|
701
723
|
onchannelcreated(channelCreated: ChannelCreatedEvent): void;
|
702
724
|
onchanneldeleted(channelDeleted: ChannelDeletedEvent): void;
|
703
725
|
onclandeleted(clanDeleted: ClanDeletedEvent): void;
|
726
|
+
onstickercreated(stickerCreated: StickerCreateEvent): void;
|
727
|
+
onstickerdeleted(stickerDeleted: StickerDeleteEvent): void;
|
728
|
+
onstickerupdated(stickerUpdated: StickerUpdateEvent): void;
|
704
729
|
onchannelupdated(channelUpdated: ChannelUpdatedEvent): void;
|
705
730
|
onclanprofileupdated(clanprofile: ClanProfileUpdatedEvent): void;
|
706
731
|
onclanupdated(clan: ClanUpdatedEvent): void;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -456,6 +456,41 @@ export interface ChannelDeletedEvent {
|
|
456
456
|
deletor: string;
|
457
457
|
}
|
458
458
|
|
459
|
+
export interface StickerCreateEvent {
|
460
|
+
// clan id
|
461
|
+
clan_id: string;
|
462
|
+
// source
|
463
|
+
source: string;
|
464
|
+
// shortname
|
465
|
+
shortname: string;
|
466
|
+
// category
|
467
|
+
category: string;
|
468
|
+
// creator_id
|
469
|
+
creator_id: string;
|
470
|
+
// sticker id
|
471
|
+
sticker_id: string;
|
472
|
+
// logo
|
473
|
+
logo: string;
|
474
|
+
// clan name
|
475
|
+
clan_name: string
|
476
|
+
}
|
477
|
+
|
478
|
+
export interface StickerUpdateEvent {
|
479
|
+
// shortname
|
480
|
+
shortname: string;
|
481
|
+
// sticker id
|
482
|
+
sticker_id: string;
|
483
|
+
// user id update
|
484
|
+
user_id: string;
|
485
|
+
}
|
486
|
+
|
487
|
+
export interface StickerDeleteEvent {
|
488
|
+
// sticker id
|
489
|
+
sticker_id: string;
|
490
|
+
// user id delete
|
491
|
+
user_id: string;
|
492
|
+
}
|
493
|
+
|
459
494
|
export interface ClanDeletedEvent {
|
460
495
|
// clan id
|
461
496
|
clan_id: string;
|
@@ -945,6 +980,15 @@ export interface Socket {
|
|
945
980
|
// when channel is deleted
|
946
981
|
onchanneldeleted: (channelDeleted: ChannelDeletedEvent) => void;
|
947
982
|
|
983
|
+
// when sticker is created
|
984
|
+
onstickercreated: (stickerCreated: StickerCreateEvent) => void;
|
985
|
+
|
986
|
+
// when sticker is updated
|
987
|
+
onstickerupdated: (stickerUpdated: StickerUpdateEvent) => void;
|
988
|
+
|
989
|
+
// when sticker is deleted
|
990
|
+
onstickerdeleted: (stickerDeleted: StickerDeleteEvent) => void;
|
991
|
+
|
948
992
|
// when clan is deleted
|
949
993
|
onclandeleted: (clanDeleted: ClanDeletedEvent) => void;
|
950
994
|
|
@@ -1078,8 +1122,14 @@ export class DefaultSocket implements Socket {
|
|
1078
1122
|
this.onchannelcreated(message.channel_created_event)
|
1079
1123
|
} else if (message.channel_deleted_event) {
|
1080
1124
|
this.onchanneldeleted(message.channel_deleted_event)
|
1081
|
-
} else if (message.
|
1082
|
-
this.onclandeleted(message.
|
1125
|
+
} else if (message.clan_deleted_event) {
|
1126
|
+
this.onclandeleted(message.clan_deleted_event)
|
1127
|
+
} else if (message.sticker_create_event) {
|
1128
|
+
this.onstickercreated(message.sticker_create_event)
|
1129
|
+
} else if (message.sticker_update_event) {
|
1130
|
+
this.onstickerupdated(message.sticker_update_event)
|
1131
|
+
} else if (message.sticker_delete_event) {
|
1132
|
+
this.onstickerdeleted(message.sticker_delete_event)
|
1083
1133
|
} else if (message.channel_updated_event) {
|
1084
1134
|
this.onchannelupdated(message.channel_updated_event)
|
1085
1135
|
} else if (message.clan_profile_updated_event) {
|
@@ -1357,6 +1407,25 @@ export class DefaultSocket implements Socket {
|
|
1357
1407
|
}
|
1358
1408
|
}
|
1359
1409
|
|
1410
|
+
onstickercreated(stickerCreated: StickerCreateEvent) {
|
1411
|
+
if (this.verbose && window && window.console) {
|
1412
|
+
console.log(stickerCreated);
|
1413
|
+
}
|
1414
|
+
}
|
1415
|
+
|
1416
|
+
onstickerdeleted(stickerDeleted: StickerDeleteEvent) {
|
1417
|
+
if (this.verbose && window && window.console) {
|
1418
|
+
console.log(stickerDeleted);
|
1419
|
+
}
|
1420
|
+
}
|
1421
|
+
|
1422
|
+
onstickerupdated(stickerUpdated: StickerUpdateEvent) {
|
1423
|
+
if (this.verbose && window && window.console) {
|
1424
|
+
console.log(stickerUpdated);
|
1425
|
+
}
|
1426
|
+
}
|
1427
|
+
|
1428
|
+
|
1360
1429
|
onchannelupdated(channelUpdated: ChannelUpdatedEvent) {
|
1361
1430
|
if (this.verbose && window && window.console) {
|
1362
1431
|
console.log(channelUpdated);
|