mezon-js 2.10.16 → 2.10.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api.gen.ts +50 -46
- package/client.ts +6 -4
- package/dist/api.gen.d.ts +3 -2
- package/dist/client.d.ts +2 -2
- package/dist/mezon-js.cjs.js +12 -9
- package/dist/mezon-js.esm.mjs +12 -9
- package/package.json +1 -1
- package/socket.ts +1 -0
package/api.gen.ts
CHANGED
@@ -607,6 +607,8 @@ export interface ApiChannelAttachment {
|
|
607
607
|
uploader?: string;
|
608
608
|
//
|
609
609
|
url?: string;
|
610
|
+
//message id.
|
611
|
+
message_id?: string;
|
610
612
|
}
|
611
613
|
|
612
614
|
/** */
|
@@ -5360,23 +5362,22 @@ export class MezonApi {
|
|
5360
5362
|
}
|
5361
5363
|
|
5362
5364
|
/** list user add channel by channel ids */
|
5363
|
-
|
5364
|
-
|
5365
|
-
|
5366
|
-
|
5367
|
-
|
5368
|
-
|
5369
|
-
const urlPath = "/v2/channeldesc/users/add";
|
5365
|
+
listChannelUsersUC(bearerToken: string,
|
5366
|
+
channelId?:string,
|
5367
|
+
limit?:number,
|
5368
|
+
options: any = {}): Promise<ApiAllUsersAddChannelResponse> {
|
5369
|
+
|
5370
|
+
const urlPath = "/v2/channeldesc/users";
|
5370
5371
|
const queryParams = new Map<string, any>();
|
5371
5372
|
queryParams.set("channel_id", channelId);
|
5372
5373
|
queryParams.set("limit", limit);
|
5373
5374
|
|
5374
|
-
let bodyJson: string = "";
|
5375
|
+
let bodyJson : string = "";
|
5375
5376
|
|
5376
5377
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
5377
5378
|
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
5378
5379
|
if (bearerToken) {
|
5379
|
-
|
5380
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
5380
5381
|
}
|
5381
5382
|
|
5382
5383
|
return Promise.race([
|
@@ -5393,7 +5394,7 @@ export class MezonApi {
|
|
5393
5394
|
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
5394
5395
|
),
|
5395
5396
|
]);
|
5396
|
-
|
5397
|
+
}
|
5397
5398
|
|
5398
5399
|
/** Delete a channel by ID. */
|
5399
5400
|
deleteChannelDesc(
|
@@ -7497,42 +7498,45 @@ export class MezonApi {
|
|
7497
7498
|
}
|
7498
7499
|
|
7499
7500
|
/** Fetch list of notifications. */
|
7500
|
-
listNotifications(
|
7501
|
-
|
7502
|
-
clanId
|
7503
|
-
|
7504
|
-
|
7505
|
-
|
7506
|
-
|
7507
|
-
|
7508
|
-
|
7509
|
-
|
7510
|
-
|
7511
|
-
|
7512
|
-
|
7513
|
-
|
7514
|
-
|
7515
|
-
|
7516
|
-
|
7517
|
-
|
7518
|
-
|
7519
|
-
|
7520
|
-
|
7521
|
-
|
7522
|
-
|
7523
|
-
|
7524
|
-
|
7525
|
-
|
7526
|
-
|
7527
|
-
|
7528
|
-
|
7529
|
-
|
7530
|
-
}
|
7531
|
-
|
7532
|
-
|
7533
|
-
|
7534
|
-
|
7535
|
-
|
7501
|
+
listNotifications(bearerToken: string,
|
7502
|
+
limit?:number,
|
7503
|
+
clanId?:string,
|
7504
|
+
notificationId?:string,
|
7505
|
+
code?:number,
|
7506
|
+
direction?:number,
|
7507
|
+
options: any = {}): Promise<ApiNotificationList> {
|
7508
|
+
|
7509
|
+
const urlPath = "/v2/notification";
|
7510
|
+
const queryParams = new Map<string, any>();
|
7511
|
+
queryParams.set("limit", limit);
|
7512
|
+
queryParams.set("clan_id", clanId);
|
7513
|
+
queryParams.set("notification_id", notificationId);
|
7514
|
+
queryParams.set("code", code);
|
7515
|
+
queryParams.set("direction", direction);
|
7516
|
+
|
7517
|
+
let bodyJson : string = "";
|
7518
|
+
|
7519
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
7520
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
7521
|
+
if (bearerToken) {
|
7522
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
7523
|
+
}
|
7524
|
+
|
7525
|
+
return Promise.race([
|
7526
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
7527
|
+
if (response.status == 204) {
|
7528
|
+
return response;
|
7529
|
+
} else if (response.status >= 200 && response.status < 300) {
|
7530
|
+
return response.json();
|
7531
|
+
} else {
|
7532
|
+
throw response;
|
7533
|
+
}
|
7534
|
+
}),
|
7535
|
+
new Promise((_, reject) =>
|
7536
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
7537
|
+
),
|
7538
|
+
]);
|
7539
|
+
}
|
7536
7540
|
|
7537
7541
|
/** set notification user channel. */
|
7538
7542
|
setNotificationChannelSetting(
|
package/client.ts
CHANGED
@@ -2229,7 +2229,9 @@ export class Client {
|
|
2229
2229
|
session: Session,
|
2230
2230
|
clanId: string,
|
2231
2231
|
limit?: number,
|
2232
|
-
|
2232
|
+
notificationId?:string,
|
2233
|
+
code?:number,
|
2234
|
+
direction?:number,
|
2233
2235
|
): Promise<NotificationList> {
|
2234
2236
|
if (
|
2235
2237
|
this.autoRefreshSession &&
|
@@ -2240,7 +2242,7 @@ export class Client {
|
|
2240
2242
|
}
|
2241
2243
|
|
2242
2244
|
return this.apiClient
|
2243
|
-
.listNotifications(session.token, clanId,
|
2245
|
+
.listNotifications(session.token, limit, clanId, notificationId, code, direction)
|
2244
2246
|
.then((response: ApiNotificationList) => {
|
2245
2247
|
var result: NotificationList = {
|
2246
2248
|
cacheable_cursor: response.cacheable_cursor,
|
@@ -3849,7 +3851,7 @@ export class Client {
|
|
3849
3851
|
});
|
3850
3852
|
}
|
3851
3853
|
|
3852
|
-
async
|
3854
|
+
async listChannelUsersUC(
|
3853
3855
|
session: Session,
|
3854
3856
|
channel_id: string,
|
3855
3857
|
limit: number
|
@@ -3863,7 +3865,7 @@ export class Client {
|
|
3863
3865
|
}
|
3864
3866
|
|
3865
3867
|
return this.apiClient
|
3866
|
-
.
|
3868
|
+
.listChannelUsersUC(session.token, channel_id, limit)
|
3867
3869
|
.then((response: any) => {
|
3868
3870
|
return Promise.resolve(response);
|
3869
3871
|
});
|
package/dist/api.gen.d.ts
CHANGED
@@ -356,6 +356,7 @@ export interface ApiChannelAttachment {
|
|
356
356
|
id?: string;
|
357
357
|
uploader?: string;
|
358
358
|
url?: string;
|
359
|
+
message_id?: string;
|
359
360
|
}
|
360
361
|
/** */
|
361
362
|
export interface ApiChannelAttachmentList {
|
@@ -1731,7 +1732,7 @@ export declare class MezonApi {
|
|
1731
1732
|
/** Create a new channel with the current user as the owner. */
|
1732
1733
|
createChannelDesc(bearerToken: string, body: ApiCreateChannelDescRequest, options?: any): Promise<ApiChannelDescription>;
|
1733
1734
|
/** list user add channel by channel ids */
|
1734
|
-
|
1735
|
+
listChannelUsersUC(bearerToken: string, channelId?: string, limit?: number, options?: any): Promise<ApiAllUsersAddChannelResponse>;
|
1735
1736
|
/** Delete a channel by ID. */
|
1736
1737
|
deleteChannelDesc(bearerToken: string, channelId: string, options?: any): Promise<any>;
|
1737
1738
|
/** Update fields in a given channel. */
|
@@ -1839,7 +1840,7 @@ export declare class MezonApi {
|
|
1839
1840
|
/** Delete one or more notifications for the current user. */
|
1840
1841
|
deleteNotifications(bearerToken: string, ids?: Array<string>, options?: any): Promise<any>;
|
1841
1842
|
/** Fetch list of notifications. */
|
1842
|
-
listNotifications(bearerToken: string, clanId
|
1843
|
+
listNotifications(bearerToken: string, limit?: number, clanId?: string, notificationId?: string, code?: number, direction?: number, options?: any): Promise<ApiNotificationList>;
|
1843
1844
|
/** set notification user channel. */
|
1844
1845
|
setNotificationChannelSetting(bearerToken: string, body: ApiSetNotificationRequest, options?: any): Promise<any>;
|
1845
1846
|
/** set notification user channel. */
|
package/dist/client.d.ts
CHANGED
@@ -468,7 +468,7 @@ export declare class Client {
|
|
468
468
|
/** List all friends for the current user. */
|
469
469
|
listFriends(session: Session, state?: number, limit?: number, cursor?: string): Promise<Friends>;
|
470
470
|
/** Fetch list of notifications. */
|
471
|
-
listNotifications(session: Session, clanId: string, limit?: number,
|
471
|
+
listNotifications(session: Session, clanId: string, limit?: number, notificationId?: string, code?: number, direction?: number): Promise<NotificationList>;
|
472
472
|
/** Execute an RPC function on the server. */
|
473
473
|
rpc(session: Session, basicAuthUsername: string, basicAuthPassword: string, id: string, input: object): Promise<RpcResponse>;
|
474
474
|
/** Execute an RPC function on the server. */
|
@@ -585,7 +585,7 @@ export declare class Client {
|
|
585
585
|
getNotificationReactMessage(session: Session, channelId: string): Promise<ApiNotifiReactMessage>;
|
586
586
|
hashtagDMList(session: Session, userId: Array<string>, limit: number): Promise<ApiHashtagDmList>;
|
587
587
|
listChannelByUserId(session: Session): Promise<ApiChannelDescList>;
|
588
|
-
|
588
|
+
listChannelUsersUC(session: Session, channel_id: string, limit: number): Promise<ApiAllUsersAddChannelResponse>;
|
589
589
|
getListEmojisByUserId(session: Session): Promise<ApiEmojiListedResponse>;
|
590
590
|
getListStickersByUserId(session: Session): Promise<ApiStickerListedResponse>;
|
591
591
|
listUserClansByUserId(session: Session): Promise<ApiAllUserClans>;
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -2767,8 +2767,8 @@ var MezonApi = class {
|
|
2767
2767
|
]);
|
2768
2768
|
}
|
2769
2769
|
/** list user add channel by channel ids */
|
2770
|
-
|
2771
|
-
const urlPath = "/v2/channeldesc/users
|
2770
|
+
listChannelUsersUC(bearerToken, channelId, limit, options = {}) {
|
2771
|
+
const urlPath = "/v2/channeldesc/users";
|
2772
2772
|
const queryParams = /* @__PURE__ */ new Map();
|
2773
2773
|
queryParams.set("channel_id", channelId);
|
2774
2774
|
queryParams.set("limit", limit);
|
@@ -4440,12 +4440,14 @@ var MezonApi = class {
|
|
4440
4440
|
]);
|
4441
4441
|
}
|
4442
4442
|
/** Fetch list of notifications. */
|
4443
|
-
listNotifications(bearerToken, clanId,
|
4443
|
+
listNotifications(bearerToken, limit, clanId, notificationId, code, direction, options = {}) {
|
4444
4444
|
const urlPath = "/v2/notification";
|
4445
4445
|
const queryParams = /* @__PURE__ */ new Map();
|
4446
4446
|
queryParams.set("limit", limit);
|
4447
4447
|
queryParams.set("clan_id", clanId);
|
4448
|
-
queryParams.set("
|
4448
|
+
queryParams.set("notification_id", notificationId);
|
4449
|
+
queryParams.set("code", code);
|
4450
|
+
queryParams.set("direction", direction);
|
4449
4451
|
let bodyJson = "";
|
4450
4452
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4451
4453
|
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
@@ -7234,7 +7236,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7234
7236
|
hide_editted: message.channel_message.hide_editted,
|
7235
7237
|
is_public: message.channel_message.is_public,
|
7236
7238
|
create_time_seconds: message.channel_message.create_time_seconds,
|
7237
|
-
update_time_seconds: message.channel_message.update_time_seconds
|
7239
|
+
update_time_seconds: message.channel_message.update_time_seconds,
|
7240
|
+
topic_id: message.channel_message.topic_id
|
7238
7241
|
};
|
7239
7242
|
this.onchannelmessage(e);
|
7240
7243
|
} else if (message.message_typing_event) {
|
@@ -9101,12 +9104,12 @@ var Client = class {
|
|
9101
9104
|
});
|
9102
9105
|
}
|
9103
9106
|
/** Fetch list of notifications. */
|
9104
|
-
listNotifications(session, clanId, limit,
|
9107
|
+
listNotifications(session, clanId, limit, notificationId, code, direction) {
|
9105
9108
|
return __async(this, null, function* () {
|
9106
9109
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
9107
9110
|
yield this.sessionRefresh(session);
|
9108
9111
|
}
|
9109
|
-
return this.apiClient.listNotifications(session.token, clanId,
|
9112
|
+
return this.apiClient.listNotifications(session.token, limit, clanId, notificationId, code, direction).then((response) => {
|
9110
9113
|
var result = {
|
9111
9114
|
cacheable_cursor: response.cacheable_cursor,
|
9112
9115
|
notifications: []
|
@@ -10025,12 +10028,12 @@ var Client = class {
|
|
10025
10028
|
});
|
10026
10029
|
});
|
10027
10030
|
}
|
10028
|
-
|
10031
|
+
listChannelUsersUC(session, channel_id, limit) {
|
10029
10032
|
return __async(this, null, function* () {
|
10030
10033
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10031
10034
|
yield this.sessionRefresh(session);
|
10032
10035
|
}
|
10033
|
-
return this.apiClient.
|
10036
|
+
return this.apiClient.listChannelUsersUC(session.token, channel_id, limit).then((response) => {
|
10034
10037
|
return Promise.resolve(response);
|
10035
10038
|
});
|
10036
10039
|
});
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -2733,8 +2733,8 @@ var MezonApi = class {
|
|
2733
2733
|
]);
|
2734
2734
|
}
|
2735
2735
|
/** list user add channel by channel ids */
|
2736
|
-
|
2737
|
-
const urlPath = "/v2/channeldesc/users
|
2736
|
+
listChannelUsersUC(bearerToken, channelId, limit, options = {}) {
|
2737
|
+
const urlPath = "/v2/channeldesc/users";
|
2738
2738
|
const queryParams = /* @__PURE__ */ new Map();
|
2739
2739
|
queryParams.set("channel_id", channelId);
|
2740
2740
|
queryParams.set("limit", limit);
|
@@ -4406,12 +4406,14 @@ var MezonApi = class {
|
|
4406
4406
|
]);
|
4407
4407
|
}
|
4408
4408
|
/** Fetch list of notifications. */
|
4409
|
-
listNotifications(bearerToken, clanId,
|
4409
|
+
listNotifications(bearerToken, limit, clanId, notificationId, code, direction, options = {}) {
|
4410
4410
|
const urlPath = "/v2/notification";
|
4411
4411
|
const queryParams = /* @__PURE__ */ new Map();
|
4412
4412
|
queryParams.set("limit", limit);
|
4413
4413
|
queryParams.set("clan_id", clanId);
|
4414
|
-
queryParams.set("
|
4414
|
+
queryParams.set("notification_id", notificationId);
|
4415
|
+
queryParams.set("code", code);
|
4416
|
+
queryParams.set("direction", direction);
|
4415
4417
|
let bodyJson = "";
|
4416
4418
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4417
4419
|
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
@@ -7200,7 +7202,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7200
7202
|
hide_editted: message.channel_message.hide_editted,
|
7201
7203
|
is_public: message.channel_message.is_public,
|
7202
7204
|
create_time_seconds: message.channel_message.create_time_seconds,
|
7203
|
-
update_time_seconds: message.channel_message.update_time_seconds
|
7205
|
+
update_time_seconds: message.channel_message.update_time_seconds,
|
7206
|
+
topic_id: message.channel_message.topic_id
|
7204
7207
|
};
|
7205
7208
|
this.onchannelmessage(e);
|
7206
7209
|
} else if (message.message_typing_event) {
|
@@ -9067,12 +9070,12 @@ var Client = class {
|
|
9067
9070
|
});
|
9068
9071
|
}
|
9069
9072
|
/** Fetch list of notifications. */
|
9070
|
-
listNotifications(session, clanId, limit,
|
9073
|
+
listNotifications(session, clanId, limit, notificationId, code, direction) {
|
9071
9074
|
return __async(this, null, function* () {
|
9072
9075
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
9073
9076
|
yield this.sessionRefresh(session);
|
9074
9077
|
}
|
9075
|
-
return this.apiClient.listNotifications(session.token, clanId,
|
9078
|
+
return this.apiClient.listNotifications(session.token, limit, clanId, notificationId, code, direction).then((response) => {
|
9076
9079
|
var result = {
|
9077
9080
|
cacheable_cursor: response.cacheable_cursor,
|
9078
9081
|
notifications: []
|
@@ -9991,12 +9994,12 @@ var Client = class {
|
|
9991
9994
|
});
|
9992
9995
|
});
|
9993
9996
|
}
|
9994
|
-
|
9997
|
+
listChannelUsersUC(session, channel_id, limit) {
|
9995
9998
|
return __async(this, null, function* () {
|
9996
9999
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
9997
10000
|
yield this.sessionRefresh(session);
|
9998
10001
|
}
|
9999
|
-
return this.apiClient.
|
10002
|
+
return this.apiClient.listChannelUsersUC(session.token, channel_id, limit).then((response) => {
|
10000
10003
|
return Promise.resolve(response);
|
10001
10004
|
});
|
10002
10005
|
});
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -1472,6 +1472,7 @@ export class DefaultSocket implements Socket {
|
|
1472
1472
|
is_public: message.channel_message.is_public,
|
1473
1473
|
create_time_seconds: message.channel_message.create_time_seconds,
|
1474
1474
|
update_time_seconds: message.channel_message.update_time_seconds,
|
1475
|
+
topic_id: message.channel_message.topic_id,
|
1475
1476
|
};
|
1476
1477
|
this.onchannelmessage(e);
|
1477
1478
|
} else if (message.message_typing_event) {
|