mezon-js 2.10.15 → 2.10.17
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 +41 -36
- package/client.ts +8 -3
- package/dist/api.gen.d.ts +2 -1
- package/dist/client.d.ts +3 -1
- package/dist/mezon-js.cjs.js +10 -6
- package/dist/mezon-js.esm.mjs +10 -6
- package/dist/socket.d.ts +3 -2
- package/package.json +1 -1
- package/socket.ts +7 -2
package/api.gen.ts
CHANGED
@@ -811,6 +811,8 @@ export interface ApiChannelMessage {
|
|
811
811
|
mode?: number;
|
812
812
|
// hide editted
|
813
813
|
hide_editted?: boolean;
|
814
|
+
//
|
815
|
+
topic_id?: string;
|
814
816
|
}
|
815
817
|
|
816
818
|
/** */
|
@@ -7495,42 +7497,45 @@ export class MezonApi {
|
|
7495
7497
|
}
|
7496
7498
|
|
7497
7499
|
/** Fetch list of notifications. */
|
7498
|
-
listNotifications(
|
7499
|
-
|
7500
|
-
clanId
|
7501
|
-
|
7502
|
-
|
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
|
-
|
7500
|
+
listNotifications(bearerToken: string,
|
7501
|
+
limit?:number,
|
7502
|
+
clanId?:string,
|
7503
|
+
notificationId?:string,
|
7504
|
+
code?:number,
|
7505
|
+
direction?:number,
|
7506
|
+
options: any = {}): Promise<ApiNotificationList> {
|
7507
|
+
|
7508
|
+
const urlPath = "/v2/notification";
|
7509
|
+
const queryParams = new Map<string, any>();
|
7510
|
+
queryParams.set("limit", limit);
|
7511
|
+
queryParams.set("clan_id", clanId);
|
7512
|
+
queryParams.set("notification_id", notificationId);
|
7513
|
+
queryParams.set("code", code);
|
7514
|
+
queryParams.set("direction", direction);
|
7515
|
+
|
7516
|
+
let bodyJson : string = "";
|
7517
|
+
|
7518
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
7519
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
7520
|
+
if (bearerToken) {
|
7521
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
7522
|
+
}
|
7523
|
+
|
7524
|
+
return Promise.race([
|
7525
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
7526
|
+
if (response.status == 204) {
|
7527
|
+
return response;
|
7528
|
+
} else if (response.status >= 200 && response.status < 300) {
|
7529
|
+
return response.json();
|
7530
|
+
} else {
|
7531
|
+
throw response;
|
7532
|
+
}
|
7533
|
+
}),
|
7534
|
+
new Promise((_, reject) =>
|
7535
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
7536
|
+
),
|
7537
|
+
]);
|
7538
|
+
}
|
7534
7539
|
|
7535
7540
|
/** set notification user channel. */
|
7536
7541
|
setNotificationChannelSetting(
|
package/client.ts
CHANGED
@@ -197,10 +197,11 @@ export enum NotificationType {
|
|
197
197
|
}
|
198
198
|
|
199
199
|
export enum WebrtcSignalingType {
|
200
|
+
WEBRTC_SDP_INIT = 0,
|
200
201
|
WEBRTC_SDP_OFFER = 1,
|
201
202
|
WEBRTC_SDP_ANSWER = 2,
|
202
203
|
WEBRTC_ICE_CANDIDATE = 3,
|
203
|
-
WEBRTC_SDP_QUIT = 4
|
204
|
+
WEBRTC_SDP_QUIT = 4
|
204
205
|
}
|
205
206
|
|
206
207
|
/** Response for an RPC function executed on the server. */
|
@@ -269,6 +270,8 @@ export interface ChannelMessage {
|
|
269
270
|
hide_editted?: boolean;
|
270
271
|
//
|
271
272
|
is_public?: boolean;
|
273
|
+
//
|
274
|
+
topic_id?: string;
|
272
275
|
}
|
273
276
|
|
274
277
|
/** A list of channel messages, usually a result of a list operation. */
|
@@ -2226,7 +2229,9 @@ export class Client {
|
|
2226
2229
|
session: Session,
|
2227
2230
|
clanId: string,
|
2228
2231
|
limit?: number,
|
2229
|
-
|
2232
|
+
notificationId?:string,
|
2233
|
+
code?:number,
|
2234
|
+
direction?:number,
|
2230
2235
|
): Promise<NotificationList> {
|
2231
2236
|
if (
|
2232
2237
|
this.autoRefreshSession &&
|
@@ -2237,7 +2242,7 @@ export class Client {
|
|
2237
2242
|
}
|
2238
2243
|
|
2239
2244
|
return this.apiClient
|
2240
|
-
.listNotifications(session.token, clanId,
|
2245
|
+
.listNotifications(session.token, limit, clanId, notificationId, code, direction)
|
2241
2246
|
.then((response: ApiNotificationList) => {
|
2242
2247
|
var result: NotificationList = {
|
2243
2248
|
cacheable_cursor: response.cacheable_cursor,
|
package/dist/api.gen.d.ts
CHANGED
@@ -467,6 +467,7 @@ export interface ApiChannelMessage {
|
|
467
467
|
username?: string;
|
468
468
|
mode?: number;
|
469
469
|
hide_editted?: boolean;
|
470
|
+
topic_id?: string;
|
470
471
|
}
|
471
472
|
/** */
|
472
473
|
export interface ApiChannelMessageHeader {
|
@@ -1838,7 +1839,7 @@ export declare class MezonApi {
|
|
1838
1839
|
/** Delete one or more notifications for the current user. */
|
1839
1840
|
deleteNotifications(bearerToken: string, ids?: Array<string>, options?: any): Promise<any>;
|
1840
1841
|
/** Fetch list of notifications. */
|
1841
|
-
listNotifications(bearerToken: string, clanId
|
1842
|
+
listNotifications(bearerToken: string, limit?: number, clanId?: string, notificationId?: string, code?: number, direction?: number, options?: any): Promise<ApiNotificationList>;
|
1842
1843
|
/** set notification user channel. */
|
1843
1844
|
setNotificationChannelSetting(bearerToken: string, body: ApiSetNotificationRequest, options?: any): Promise<any>;
|
1844
1845
|
/** set notification user channel. */
|
package/dist/client.d.ts
CHANGED
@@ -41,6 +41,7 @@ export declare enum NotificationType {
|
|
41
41
|
NOTHING_MESSAGE = 3
|
42
42
|
}
|
43
43
|
export declare enum WebrtcSignalingType {
|
44
|
+
WEBRTC_SDP_INIT = 0,
|
44
45
|
WEBRTC_SDP_OFFER = 1,
|
45
46
|
WEBRTC_SDP_ANSWER = 2,
|
46
47
|
WEBRTC_ICE_CANDIDATE = 3,
|
@@ -83,6 +84,7 @@ export interface ChannelMessage {
|
|
83
84
|
message_id?: string;
|
84
85
|
hide_editted?: boolean;
|
85
86
|
is_public?: boolean;
|
87
|
+
topic_id?: string;
|
86
88
|
}
|
87
89
|
/** A list of channel messages, usually a result of a list operation. */
|
88
90
|
export interface ChannelMessageList {
|
@@ -466,7 +468,7 @@ export declare class Client {
|
|
466
468
|
/** List all friends for the current user. */
|
467
469
|
listFriends(session: Session, state?: number, limit?: number, cursor?: string): Promise<Friends>;
|
468
470
|
/** Fetch list of notifications. */
|
469
|
-
listNotifications(session: Session, clanId: string, limit?: number,
|
471
|
+
listNotifications(session: Session, clanId: string, limit?: number, notificationId?: string, code?: number, direction?: number): Promise<NotificationList>;
|
470
472
|
/** Execute an RPC function on the server. */
|
471
473
|
rpc(session: Session, basicAuthUsername: string, basicAuthPassword: string, id: string, input: object): Promise<RpcResponse>;
|
472
474
|
/** Execute an RPC function on the server. */
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -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);
|
@@ -7765,7 +7767,7 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7765
7767
|
updateStatus(status) {
|
7766
7768
|
return this.send({ status_update: { status } });
|
7767
7769
|
}
|
7768
|
-
writeChatMessage(clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar, code) {
|
7770
|
+
writeChatMessage(clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar, code, topic_id) {
|
7769
7771
|
return __async(this, null, function* () {
|
7770
7772
|
const response = yield this.send({
|
7771
7773
|
channel_message_send: {
|
@@ -7780,7 +7782,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7780
7782
|
anonymous_message,
|
7781
7783
|
mention_everyone,
|
7782
7784
|
avatar,
|
7783
|
-
code
|
7785
|
+
code,
|
7786
|
+
topic_id
|
7784
7787
|
}
|
7785
7788
|
});
|
7786
7789
|
return response.channel_message_ack;
|
@@ -8039,6 +8042,7 @@ var NotificationType = /* @__PURE__ */ ((NotificationType2) => {
|
|
8039
8042
|
return NotificationType2;
|
8040
8043
|
})(NotificationType || {});
|
8041
8044
|
var WebrtcSignalingType = /* @__PURE__ */ ((WebrtcSignalingType2) => {
|
8045
|
+
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_INIT"] = 0] = "WEBRTC_SDP_INIT";
|
8042
8046
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_OFFER"] = 1] = "WEBRTC_SDP_OFFER";
|
8043
8047
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_ANSWER"] = 2] = "WEBRTC_SDP_ANSWER";
|
8044
8048
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_ICE_CANDIDATE"] = 3] = "WEBRTC_ICE_CANDIDATE";
|
@@ -9099,12 +9103,12 @@ var Client = class {
|
|
9099
9103
|
});
|
9100
9104
|
}
|
9101
9105
|
/** Fetch list of notifications. */
|
9102
|
-
listNotifications(session, clanId, limit,
|
9106
|
+
listNotifications(session, clanId, limit, notificationId, code, direction) {
|
9103
9107
|
return __async(this, null, function* () {
|
9104
9108
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
9105
9109
|
yield this.sessionRefresh(session);
|
9106
9110
|
}
|
9107
|
-
return this.apiClient.listNotifications(session.token, clanId,
|
9111
|
+
return this.apiClient.listNotifications(session.token, limit, clanId, notificationId, code, direction).then((response) => {
|
9108
9112
|
var result = {
|
9109
9113
|
cacheable_cursor: response.cacheable_cursor,
|
9110
9114
|
notifications: []
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -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);
|
@@ -7731,7 +7733,7 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7731
7733
|
updateStatus(status) {
|
7732
7734
|
return this.send({ status_update: { status } });
|
7733
7735
|
}
|
7734
|
-
writeChatMessage(clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar, code) {
|
7736
|
+
writeChatMessage(clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar, code, topic_id) {
|
7735
7737
|
return __async(this, null, function* () {
|
7736
7738
|
const response = yield this.send({
|
7737
7739
|
channel_message_send: {
|
@@ -7746,7 +7748,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7746
7748
|
anonymous_message,
|
7747
7749
|
mention_everyone,
|
7748
7750
|
avatar,
|
7749
|
-
code
|
7751
|
+
code,
|
7752
|
+
topic_id
|
7750
7753
|
}
|
7751
7754
|
});
|
7752
7755
|
return response.channel_message_ack;
|
@@ -8005,6 +8008,7 @@ var NotificationType = /* @__PURE__ */ ((NotificationType2) => {
|
|
8005
8008
|
return NotificationType2;
|
8006
8009
|
})(NotificationType || {});
|
8007
8010
|
var WebrtcSignalingType = /* @__PURE__ */ ((WebrtcSignalingType2) => {
|
8011
|
+
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_INIT"] = 0] = "WEBRTC_SDP_INIT";
|
8008
8012
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_OFFER"] = 1] = "WEBRTC_SDP_OFFER";
|
8009
8013
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_ANSWER"] = 2] = "WEBRTC_SDP_ANSWER";
|
8010
8014
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_ICE_CANDIDATE"] = 3] = "WEBRTC_ICE_CANDIDATE";
|
@@ -9065,12 +9069,12 @@ var Client = class {
|
|
9065
9069
|
});
|
9066
9070
|
}
|
9067
9071
|
/** Fetch list of notifications. */
|
9068
|
-
listNotifications(session, clanId, limit,
|
9072
|
+
listNotifications(session, clanId, limit, notificationId, code, direction) {
|
9069
9073
|
return __async(this, null, function* () {
|
9070
9074
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
9071
9075
|
yield this.sessionRefresh(session);
|
9072
9076
|
}
|
9073
|
-
return this.apiClient.listNotifications(session.token, clanId,
|
9077
|
+
return this.apiClient.listNotifications(session.token, limit, clanId, notificationId, code, direction).then((response) => {
|
9074
9078
|
var result = {
|
9075
9079
|
cacheable_cursor: response.cacheable_cursor,
|
9076
9080
|
notifications: []
|
package/dist/socket.d.ts
CHANGED
@@ -198,6 +198,7 @@ interface ChannelMessageSend {
|
|
198
198
|
avatar: string;
|
199
199
|
is_public: boolean;
|
200
200
|
code: number;
|
201
|
+
topic_id?: string;
|
201
202
|
};
|
202
203
|
}
|
203
204
|
/** Update a message previously sent to a realtime chat channel. */
|
@@ -693,7 +694,7 @@ export interface Socket {
|
|
693
694
|
/** Update the status for the current user online. */
|
694
695
|
updateStatus(status?: string): Promise<void>;
|
695
696
|
/** Send a chat message to a chat channel on the server. */
|
696
|
-
writeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: boolean, avatar?: string, code?: number): Promise<ChannelMessageAck>;
|
697
|
+
writeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: boolean, avatar?: string, code?: number, topic_id?: string): Promise<ChannelMessageAck>;
|
697
698
|
/** Send message typing */
|
698
699
|
writeMessageTyping(clan_id: string, channel_id: string, mode: number, is_public: boolean): Promise<MessageTypingEvent>;
|
699
700
|
/** Send message reaction */
|
@@ -886,7 +887,7 @@ export declare class DefaultSocket implements Socket {
|
|
886
887
|
unfollowUsers(user_ids: string[]): Promise<void>;
|
887
888
|
updateChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean): Promise<ChannelMessageAck>;
|
888
889
|
updateStatus(status?: string): Promise<void>;
|
889
|
-
writeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean, avatar?: string, code?: number): Promise<ChannelMessageAck>;
|
890
|
+
writeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean, avatar?: string, code?: number, topic_id?: string): Promise<ChannelMessageAck>;
|
890
891
|
writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<ApiMessageReaction>;
|
891
892
|
writeMessageTyping(clan_id: string, channel_id: string, mode: number, is_public: boolean): Promise<MessageTypingEvent>;
|
892
893
|
writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp_seconds: number): Promise<LastSeenMessageEvent>;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -287,6 +287,8 @@ interface ChannelMessageSend {
|
|
287
287
|
is_public: boolean;
|
288
288
|
// code
|
289
289
|
code: number;
|
290
|
+
//
|
291
|
+
topic_id?: string;
|
290
292
|
};
|
291
293
|
}
|
292
294
|
|
@@ -1010,7 +1012,8 @@ export interface Socket {
|
|
1010
1012
|
anonymous_message?: boolean,
|
1011
1013
|
mention_everyone?: boolean,
|
1012
1014
|
avatar?: string,
|
1013
|
-
code?: number
|
1015
|
+
code?: number,
|
1016
|
+
topic_id?: string,
|
1014
1017
|
): Promise<ChannelMessageAck>;
|
1015
1018
|
|
1016
1019
|
/** Send message typing */
|
@@ -2126,7 +2129,8 @@ export class DefaultSocket implements Socket {
|
|
2126
2129
|
anonymous_message?: boolean,
|
2127
2130
|
mention_everyone?: Boolean,
|
2128
2131
|
avatar?: string,
|
2129
|
-
code?: number
|
2132
|
+
code?: number,
|
2133
|
+
topic_id?: string,
|
2130
2134
|
): Promise<ChannelMessageAck> {
|
2131
2135
|
const response = await this.send({
|
2132
2136
|
channel_message_send: {
|
@@ -2142,6 +2146,7 @@ export class DefaultSocket implements Socket {
|
|
2142
2146
|
mention_everyone: mention_everyone,
|
2143
2147
|
avatar: avatar,
|
2144
2148
|
code: code,
|
2149
|
+
topic_id: topic_id,
|
2145
2150
|
},
|
2146
2151
|
});
|
2147
2152
|
return response.channel_message_ack;
|