mezon-js 2.11.6 → 2.11.8
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 +13 -4
- package/client.ts +14 -11
- package/dist/api.gen.d.ts +7 -4
- package/dist/client.d.ts +4 -4
- package/dist/mezon-js.cjs.js +24 -14
- package/dist/mezon-js.esm.mjs +24 -14
- package/dist/socket.d.ts +11 -3
- package/package.json +1 -1
- package/socket.ts +18 -2
package/api.gen.ts
CHANGED
@@ -1780,7 +1780,7 @@ export interface ApiNotification {
|
|
1780
1780
|
//
|
1781
1781
|
channel_id?: string;
|
1782
1782
|
//
|
1783
|
-
channel_type?:
|
1783
|
+
channel_type?: number;
|
1784
1784
|
//
|
1785
1785
|
clan_id?: string;
|
1786
1786
|
//Category code for this notification.
|
@@ -1797,6 +1797,12 @@ export interface ApiNotification {
|
|
1797
1797
|
sender_id?: string;
|
1798
1798
|
//Subject of the notification.
|
1799
1799
|
subject?: string;
|
1800
|
+
//category.
|
1801
|
+
category?: number;
|
1802
|
+
//
|
1803
|
+
topic_id?: string;
|
1804
|
+
//
|
1805
|
+
channel?: ApiChannelDescription;
|
1800
1806
|
}
|
1801
1807
|
|
1802
1808
|
/** */
|
@@ -7828,11 +7834,13 @@ export class MezonApi {
|
|
7828
7834
|
deleteNotifications(
|
7829
7835
|
bearerToken: string,
|
7830
7836
|
ids?: Array<string>,
|
7837
|
+
category?: number,
|
7831
7838
|
options: any = {}
|
7832
7839
|
): Promise<any> {
|
7833
7840
|
const urlPath = "/v2/notification";
|
7834
7841
|
const queryParams = new Map<string, any>();
|
7835
7842
|
queryParams.set("ids", ids);
|
7843
|
+
queryParams.set("category", category);
|
7836
7844
|
|
7837
7845
|
let bodyJson: string = "";
|
7838
7846
|
|
@@ -7864,7 +7872,7 @@ export class MezonApi {
|
|
7864
7872
|
limit?: number,
|
7865
7873
|
clanId?: string,
|
7866
7874
|
notificationId?: string,
|
7867
|
-
|
7875
|
+
category?: number,
|
7868
7876
|
direction?: number,
|
7869
7877
|
options: any = {}
|
7870
7878
|
): Promise<ApiNotificationList> {
|
@@ -7873,7 +7881,7 @@ export class MezonApi {
|
|
7873
7881
|
queryParams.set("limit", limit);
|
7874
7882
|
queryParams.set("clan_id", clanId);
|
7875
7883
|
queryParams.set("notification_id", notificationId);
|
7876
|
-
|
7884
|
+
queryParams.set("category", category);
|
7877
7885
|
queryParams.set("direction", direction);
|
7878
7886
|
|
7879
7887
|
let bodyJson: string = "";
|
@@ -11226,13 +11234,14 @@ export class MezonApi {
|
|
11226
11234
|
/** Create mezon OAuth client */
|
11227
11235
|
getMezonOauthClient(bearerToken: string,
|
11228
11236
|
clientId?:string,
|
11237
|
+
clientName?:string,
|
11229
11238
|
options: any = {}
|
11230
11239
|
): Promise<ApiMezonOauthClient> {
|
11231
11240
|
|
11232
11241
|
const urlPath = "/v2/mznoauthclient";
|
11233
11242
|
const queryParams = new Map<string, any>();
|
11234
11243
|
queryParams.set("client_id", clientId);
|
11235
|
-
|
11244
|
+
queryParams.set("client_name", clientName);
|
11236
11245
|
let bodyJson : string = "";
|
11237
11246
|
|
11238
11247
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
package/client.ts
CHANGED
@@ -1167,7 +1167,8 @@ export class Client {
|
|
1167
1167
|
/** Delete one or more notifications */
|
1168
1168
|
async deleteNotifications(
|
1169
1169
|
session: Session,
|
1170
|
-
ids?: Array<string
|
1170
|
+
ids?: Array<string>,
|
1171
|
+
category?: number
|
1171
1172
|
): Promise<boolean> {
|
1172
1173
|
if (
|
1173
1174
|
this.autoRefreshSession &&
|
@@ -1178,7 +1179,7 @@ export class Client {
|
|
1178
1179
|
}
|
1179
1180
|
|
1180
1181
|
return this.apiClient
|
1181
|
-
.deleteNotifications(session.token, ids)
|
1182
|
+
.deleteNotifications(session.token, ids, category)
|
1182
1183
|
.then((response: any) => {
|
1183
1184
|
return Promise.resolve(response != undefined);
|
1184
1185
|
});
|
@@ -2254,9 +2255,9 @@ export class Client {
|
|
2254
2255
|
clanId: string,
|
2255
2256
|
limit?: number,
|
2256
2257
|
notificationId?: string,
|
2257
|
-
|
2258
|
+
category?: number,
|
2258
2259
|
direction?: number
|
2259
|
-
): Promise<
|
2260
|
+
): Promise<ApiNotificationList> {
|
2260
2261
|
if (
|
2261
2262
|
this.autoRefreshSession &&
|
2262
2263
|
session.refresh_token &&
|
@@ -2271,11 +2272,11 @@ export class Client {
|
|
2271
2272
|
limit,
|
2272
2273
|
clanId,
|
2273
2274
|
notificationId,
|
2274
|
-
|
2275
|
+
category,
|
2275
2276
|
direction
|
2276
2277
|
)
|
2277
2278
|
.then((response: ApiNotificationList) => {
|
2278
|
-
var result:
|
2279
|
+
var result: ApiNotificationList = {
|
2279
2280
|
cacheable_cursor: response.cacheable_cursor,
|
2280
2281
|
notifications: [],
|
2281
2282
|
};
|
@@ -2286,13 +2287,14 @@ export class Client {
|
|
2286
2287
|
|
2287
2288
|
response.notifications!.forEach((n) => {
|
2288
2289
|
result.notifications!.push({
|
2289
|
-
code: n.code ? Number(n.code) : 0,
|
2290
|
-
create_time: n.create_time,
|
2291
2290
|
id: n.id,
|
2292
|
-
persistent: n.persistent,
|
2293
|
-
sender_id: n.sender_id,
|
2294
2291
|
subject: n.subject,
|
2295
2292
|
content: n.content ? safeJSONParse(n.content) : undefined,
|
2293
|
+
code: n.code ? Number(n.code) : 0,
|
2294
|
+
sender_id: n.sender_id,
|
2295
|
+
create_time: n.create_time,
|
2296
|
+
persistent: n.persistent,
|
2297
|
+
category: n.category,
|
2296
2298
|
});
|
2297
2299
|
});
|
2298
2300
|
return Promise.resolve(result);
|
@@ -4979,6 +4981,7 @@ export class Client {
|
|
4979
4981
|
async getMezonOauthClient(
|
4980
4982
|
session: Session,
|
4981
4983
|
clientId?:string,
|
4984
|
+
clientName?:string,
|
4982
4985
|
): Promise<ApiMezonOauthClient> {
|
4983
4986
|
if (
|
4984
4987
|
this.autoRefreshSession &&
|
@@ -4989,7 +4992,7 @@ export class Client {
|
|
4989
4992
|
}
|
4990
4993
|
|
4991
4994
|
return this.apiClient
|
4992
|
-
.getMezonOauthClient(session.token, clientId)
|
4995
|
+
.getMezonOauthClient(session.token, clientId, clientName)
|
4993
4996
|
.then((response: ApiMezonOauthClient) => {
|
4994
4997
|
return Promise.resolve(response);
|
4995
4998
|
});
|
package/dist/api.gen.d.ts
CHANGED
@@ -1021,7 +1021,7 @@ export interface ApiMessageRef {
|
|
1021
1021
|
export interface ApiNotification {
|
1022
1022
|
avatar_url?: string;
|
1023
1023
|
channel_id?: string;
|
1024
|
-
channel_type?:
|
1024
|
+
channel_type?: number;
|
1025
1025
|
clan_id?: string;
|
1026
1026
|
code?: number;
|
1027
1027
|
content?: string;
|
@@ -1030,6 +1030,9 @@ export interface ApiNotification {
|
|
1030
1030
|
persistent?: boolean;
|
1031
1031
|
sender_id?: string;
|
1032
1032
|
subject?: string;
|
1033
|
+
category?: number;
|
1034
|
+
topic_id?: string;
|
1035
|
+
channel?: ApiChannelDescription;
|
1033
1036
|
}
|
1034
1037
|
/** */
|
1035
1038
|
export interface ApiNotificationChannel {
|
@@ -2010,9 +2013,9 @@ export declare class MezonApi {
|
|
2010
2013
|
/** set mute notification user channel. */
|
2011
2014
|
setMuteNotificationChannel(bearerToken: string, body: ApiSetMuteNotificationRequest, options?: any): Promise<any>;
|
2012
2015
|
/** Delete one or more notifications for the current user. */
|
2013
|
-
deleteNotifications(bearerToken: string, ids?: Array<string>, options?: any): Promise<any>;
|
2016
|
+
deleteNotifications(bearerToken: string, ids?: Array<string>, category?: number, options?: any): Promise<any>;
|
2014
2017
|
/** Fetch list of notifications. */
|
2015
|
-
listNotifications(bearerToken: string, limit?: number, clanId?: string, notificationId?: string,
|
2018
|
+
listNotifications(bearerToken: string, limit?: number, clanId?: string, notificationId?: string, category?: number, direction?: number, options?: any): Promise<ApiNotificationList>;
|
2016
2019
|
/** set notification user channel. */
|
2017
2020
|
setNotificationChannelSetting(bearerToken: string, body: ApiSetNotificationRequest, options?: any): Promise<any>;
|
2018
2021
|
/** set notification user channel. */
|
@@ -2179,7 +2182,7 @@ export declare class MezonApi {
|
|
2179
2182
|
/** Handle participant meet state */
|
2180
2183
|
handleParticipantMeetState(bearerToken: string, body: ApiHandleParticipantMeetStateRequest, options?: any): Promise<any>;
|
2181
2184
|
/** Create mezon OAuth client */
|
2182
|
-
getMezonOauthClient(bearerToken: string, clientId?: string, options?: any): Promise<ApiMezonOauthClient>;
|
2185
|
+
getMezonOauthClient(bearerToken: string, clientId?: string, clientName?: string, options?: any): Promise<ApiMezonOauthClient>;
|
2183
2186
|
/** update mezon OAuth */
|
2184
2187
|
updateMezonOauthClient(bearerToken: string, body: ApiMezonOauthClient, options?: any): Promise<ApiMezonOauthClient>;
|
2185
2188
|
/** */
|
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, ApiAccountMezon, 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, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiChannelCanvasListResponse, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiWithdrawTokenRequest, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiWalletLedgerList, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic, MezonUpdateEventBody, ApiTransactionDetail, MezonapiCreateRoomChannelApps, ApiGenerateMeetTokenRequest, ApiGenerateMeetTokenResponse, ApiHandleParticipantMeetStateRequest, ApiMezonOauthClientList, ApiMezonOauthClient, ApiCreateHashChannelAppsResponse } from "./api.gen";
|
16
|
+
import { ApiAccount, ApiAccountMezon, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiNotificationList, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiChannelCanvasListResponse, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiWithdrawTokenRequest, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiWalletLedgerList, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic, MezonUpdateEventBody, ApiTransactionDetail, MezonapiCreateRoomChannelApps, ApiGenerateMeetTokenRequest, ApiGenerateMeetTokenResponse, ApiHandleParticipantMeetStateRequest, ApiMezonOauthClientList, ApiMezonOauthClient, ApiCreateHashChannelAppsResponse } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -400,7 +400,7 @@ export declare class Client {
|
|
400
400
|
/** Delete a category by ID. */
|
401
401
|
deleteCategoryDesc(session: Session, categoryId: string, clanId: string, categoryLabel?: string): Promise<boolean>;
|
402
402
|
/** Delete one or more notifications */
|
403
|
-
deleteNotifications(session: Session, ids?: Array<string
|
403
|
+
deleteNotifications(session: Session, ids?: Array<string>, category?: number): Promise<boolean>;
|
404
404
|
/** Delete a role by ID. */
|
405
405
|
deleteRole(session: Session, roleId: string, clanId: string, roleLabel?: string): Promise<boolean>;
|
406
406
|
/** Delete a event by ID. */
|
@@ -472,7 +472,7 @@ export declare class Client {
|
|
472
472
|
/** List all friends for the current user. */
|
473
473
|
listFriends(session: Session, state?: number, limit?: number, cursor?: string): Promise<Friends>;
|
474
474
|
/** Fetch list of notifications. */
|
475
|
-
listNotifications(session: Session, clanId: string, limit?: number, notificationId?: string,
|
475
|
+
listNotifications(session: Session, clanId: string, limit?: number, notificationId?: string, category?: number, direction?: number): Promise<ApiNotificationList>;
|
476
476
|
/** Execute an RPC function on the server. */
|
477
477
|
rpc(session: Session, basicAuthUsername: string, basicAuthPassword: string, id: string, input: object): Promise<RpcResponse>;
|
478
478
|
/** Execute an RPC function on the server. */
|
@@ -645,7 +645,7 @@ export declare class Client {
|
|
645
645
|
/** Handle participant meet state */
|
646
646
|
handleParticipantMeetState(session: Session, body: ApiHandleParticipantMeetStateRequest): Promise<any>;
|
647
647
|
listMezonOauthClient(session: Session): Promise<ApiMezonOauthClientList>;
|
648
|
-
getMezonOauthClient(session: Session, clientId?: string): Promise<ApiMezonOauthClient>;
|
648
|
+
getMezonOauthClient(session: Session, clientId?: string, clientName?: string): Promise<ApiMezonOauthClient>;
|
649
649
|
updateMezonOauthClient(session: Session, body: ApiMezonOauthClient): Promise<ApiMezonOauthClient>;
|
650
650
|
searchThread(session: Session, clanId?: string, channelId?: string, label?: string): Promise<ApiChannelDescList>;
|
651
651
|
generateHashChannelApps(session: Session, appId?: string): Promise<ApiCreateHashChannelAppsResponse>;
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -4440,10 +4440,11 @@ var MezonApi = class {
|
|
4440
4440
|
]);
|
4441
4441
|
}
|
4442
4442
|
/** Delete one or more notifications for the current user. */
|
4443
|
-
deleteNotifications(bearerToken, ids, options = {}) {
|
4443
|
+
deleteNotifications(bearerToken, ids, category, options = {}) {
|
4444
4444
|
const urlPath = "/v2/notification";
|
4445
4445
|
const queryParams = /* @__PURE__ */ new Map();
|
4446
4446
|
queryParams.set("ids", ids);
|
4447
|
+
queryParams.set("category", category);
|
4447
4448
|
let bodyJson = "";
|
4448
4449
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4449
4450
|
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
@@ -4466,13 +4467,13 @@ var MezonApi = class {
|
|
4466
4467
|
]);
|
4467
4468
|
}
|
4468
4469
|
/** Fetch list of notifications. */
|
4469
|
-
listNotifications(bearerToken, limit, clanId, notificationId,
|
4470
|
+
listNotifications(bearerToken, limit, clanId, notificationId, category, direction, options = {}) {
|
4470
4471
|
const urlPath = "/v2/notification";
|
4471
4472
|
const queryParams = /* @__PURE__ */ new Map();
|
4472
4473
|
queryParams.set("limit", limit);
|
4473
4474
|
queryParams.set("clan_id", clanId);
|
4474
4475
|
queryParams.set("notification_id", notificationId);
|
4475
|
-
queryParams.set("
|
4476
|
+
queryParams.set("category", category);
|
4476
4477
|
queryParams.set("direction", direction);
|
4477
4478
|
let bodyJson = "";
|
4478
4479
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
@@ -7092,10 +7093,11 @@ var MezonApi = class {
|
|
7092
7093
|
]);
|
7093
7094
|
}
|
7094
7095
|
/** Create mezon OAuth client */
|
7095
|
-
getMezonOauthClient(bearerToken, clientId, options = {}) {
|
7096
|
+
getMezonOauthClient(bearerToken, clientId, clientName, options = {}) {
|
7096
7097
|
const urlPath = "/v2/mznoauthclient";
|
7097
7098
|
const queryParams = /* @__PURE__ */ new Map();
|
7098
7099
|
queryParams.set("client_id", clientId);
|
7100
|
+
queryParams.set("client_name", clientName);
|
7099
7101
|
let bodyJson = "";
|
7100
7102
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
7101
7103
|
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
@@ -7584,6 +7586,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7584
7586
|
this.onuserstatusevent(message.user_status_event);
|
7585
7587
|
} else if (message.join_channel_app_data) {
|
7586
7588
|
this.onJoinChannelAppEvent(message.join_channel_app_data);
|
7589
|
+
} else if (message.unpin_message_event) {
|
7590
|
+
this.onUnpinMessageEvent(message.unpin_message_event);
|
7587
7591
|
} else {
|
7588
7592
|
if (this.verbose && window && window.console) {
|
7589
7593
|
console.log("Unrecognized message received: %o", message);
|
@@ -7926,6 +7930,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7926
7930
|
console.log(join_channel_app_data);
|
7927
7931
|
}
|
7928
7932
|
}
|
7933
|
+
onUnpinMessageEvent(unpin_message_event) {
|
7934
|
+
if (this.verbose && window && window.console) {
|
7935
|
+
console.log(unpin_message_event);
|
7936
|
+
}
|
7937
|
+
}
|
7929
7938
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
7930
7939
|
const untypedMessage = message;
|
7931
7940
|
return new Promise((resolve, reject) => {
|
@@ -8715,12 +8724,12 @@ var Client = class {
|
|
8715
8724
|
});
|
8716
8725
|
}
|
8717
8726
|
/** Delete one or more notifications */
|
8718
|
-
deleteNotifications(session, ids) {
|
8727
|
+
deleteNotifications(session, ids, category) {
|
8719
8728
|
return __async(this, null, function* () {
|
8720
8729
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
8721
8730
|
yield this.sessionRefresh(session);
|
8722
8731
|
}
|
8723
|
-
return this.apiClient.deleteNotifications(session.token, ids).then((response) => {
|
8732
|
+
return this.apiClient.deleteNotifications(session.token, ids, category).then((response) => {
|
8724
8733
|
return Promise.resolve(response != void 0);
|
8725
8734
|
});
|
8726
8735
|
});
|
@@ -9406,7 +9415,7 @@ var Client = class {
|
|
9406
9415
|
});
|
9407
9416
|
}
|
9408
9417
|
/** Fetch list of notifications. */
|
9409
|
-
listNotifications(session, clanId, limit, notificationId,
|
9418
|
+
listNotifications(session, clanId, limit, notificationId, category, direction) {
|
9410
9419
|
return __async(this, null, function* () {
|
9411
9420
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
9412
9421
|
yield this.sessionRefresh(session);
|
@@ -9416,7 +9425,7 @@ var Client = class {
|
|
9416
9425
|
limit,
|
9417
9426
|
clanId,
|
9418
9427
|
notificationId,
|
9419
|
-
|
9428
|
+
category,
|
9420
9429
|
direction
|
9421
9430
|
).then((response) => {
|
9422
9431
|
var result = {
|
@@ -9428,13 +9437,14 @@ var Client = class {
|
|
9428
9437
|
}
|
9429
9438
|
response.notifications.forEach((n) => {
|
9430
9439
|
result.notifications.push({
|
9440
|
+
id: n.id,
|
9441
|
+
subject: n.subject,
|
9442
|
+
content: n.content ? safeJSONParse(n.content) : void 0,
|
9431
9443
|
code: n.code ? Number(n.code) : 0,
|
9444
|
+
sender_id: n.sender_id,
|
9432
9445
|
create_time: n.create_time,
|
9433
|
-
id: n.id,
|
9434
9446
|
persistent: n.persistent,
|
9435
|
-
|
9436
|
-
subject: n.subject,
|
9437
|
-
content: n.content ? safeJSONParse(n.content) : void 0
|
9447
|
+
category: n.category
|
9438
9448
|
});
|
9439
9449
|
});
|
9440
9450
|
return Promise.resolve(result);
|
@@ -10952,12 +10962,12 @@ var Client = class {
|
|
10952
10962
|
});
|
10953
10963
|
});
|
10954
10964
|
}
|
10955
|
-
getMezonOauthClient(session, clientId) {
|
10965
|
+
getMezonOauthClient(session, clientId, clientName) {
|
10956
10966
|
return __async(this, null, function* () {
|
10957
10967
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
10958
10968
|
yield this.sessionRefresh(session);
|
10959
10969
|
}
|
10960
|
-
return this.apiClient.getMezonOauthClient(session.token, clientId).then((response) => {
|
10970
|
+
return this.apiClient.getMezonOauthClient(session.token, clientId, clientName).then((response) => {
|
10961
10971
|
return Promise.resolve(response);
|
10962
10972
|
});
|
10963
10973
|
});
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -4406,10 +4406,11 @@ var MezonApi = class {
|
|
4406
4406
|
]);
|
4407
4407
|
}
|
4408
4408
|
/** Delete one or more notifications for the current user. */
|
4409
|
-
deleteNotifications(bearerToken, ids, options = {}) {
|
4409
|
+
deleteNotifications(bearerToken, ids, category, options = {}) {
|
4410
4410
|
const urlPath = "/v2/notification";
|
4411
4411
|
const queryParams = /* @__PURE__ */ new Map();
|
4412
4412
|
queryParams.set("ids", ids);
|
4413
|
+
queryParams.set("category", category);
|
4413
4414
|
let bodyJson = "";
|
4414
4415
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4415
4416
|
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
@@ -4432,13 +4433,13 @@ var MezonApi = class {
|
|
4432
4433
|
]);
|
4433
4434
|
}
|
4434
4435
|
/** Fetch list of notifications. */
|
4435
|
-
listNotifications(bearerToken, limit, clanId, notificationId,
|
4436
|
+
listNotifications(bearerToken, limit, clanId, notificationId, category, direction, options = {}) {
|
4436
4437
|
const urlPath = "/v2/notification";
|
4437
4438
|
const queryParams = /* @__PURE__ */ new Map();
|
4438
4439
|
queryParams.set("limit", limit);
|
4439
4440
|
queryParams.set("clan_id", clanId);
|
4440
4441
|
queryParams.set("notification_id", notificationId);
|
4441
|
-
queryParams.set("
|
4442
|
+
queryParams.set("category", category);
|
4442
4443
|
queryParams.set("direction", direction);
|
4443
4444
|
let bodyJson = "";
|
4444
4445
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
@@ -7058,10 +7059,11 @@ var MezonApi = class {
|
|
7058
7059
|
]);
|
7059
7060
|
}
|
7060
7061
|
/** Create mezon OAuth client */
|
7061
|
-
getMezonOauthClient(bearerToken, clientId, options = {}) {
|
7062
|
+
getMezonOauthClient(bearerToken, clientId, clientName, options = {}) {
|
7062
7063
|
const urlPath = "/v2/mznoauthclient";
|
7063
7064
|
const queryParams = /* @__PURE__ */ new Map();
|
7064
7065
|
queryParams.set("client_id", clientId);
|
7066
|
+
queryParams.set("client_name", clientName);
|
7065
7067
|
let bodyJson = "";
|
7066
7068
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
7067
7069
|
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
@@ -7550,6 +7552,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7550
7552
|
this.onuserstatusevent(message.user_status_event);
|
7551
7553
|
} else if (message.join_channel_app_data) {
|
7552
7554
|
this.onJoinChannelAppEvent(message.join_channel_app_data);
|
7555
|
+
} else if (message.unpin_message_event) {
|
7556
|
+
this.onUnpinMessageEvent(message.unpin_message_event);
|
7553
7557
|
} else {
|
7554
7558
|
if (this.verbose && window && window.console) {
|
7555
7559
|
console.log("Unrecognized message received: %o", message);
|
@@ -7892,6 +7896,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7892
7896
|
console.log(join_channel_app_data);
|
7893
7897
|
}
|
7894
7898
|
}
|
7899
|
+
onUnpinMessageEvent(unpin_message_event) {
|
7900
|
+
if (this.verbose && window && window.console) {
|
7901
|
+
console.log(unpin_message_event);
|
7902
|
+
}
|
7903
|
+
}
|
7895
7904
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
7896
7905
|
const untypedMessage = message;
|
7897
7906
|
return new Promise((resolve, reject) => {
|
@@ -8681,12 +8690,12 @@ var Client = class {
|
|
8681
8690
|
});
|
8682
8691
|
}
|
8683
8692
|
/** Delete one or more notifications */
|
8684
|
-
deleteNotifications(session, ids) {
|
8693
|
+
deleteNotifications(session, ids, category) {
|
8685
8694
|
return __async(this, null, function* () {
|
8686
8695
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
8687
8696
|
yield this.sessionRefresh(session);
|
8688
8697
|
}
|
8689
|
-
return this.apiClient.deleteNotifications(session.token, ids).then((response) => {
|
8698
|
+
return this.apiClient.deleteNotifications(session.token, ids, category).then((response) => {
|
8690
8699
|
return Promise.resolve(response != void 0);
|
8691
8700
|
});
|
8692
8701
|
});
|
@@ -9372,7 +9381,7 @@ var Client = class {
|
|
9372
9381
|
});
|
9373
9382
|
}
|
9374
9383
|
/** Fetch list of notifications. */
|
9375
|
-
listNotifications(session, clanId, limit, notificationId,
|
9384
|
+
listNotifications(session, clanId, limit, notificationId, category, direction) {
|
9376
9385
|
return __async(this, null, function* () {
|
9377
9386
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
9378
9387
|
yield this.sessionRefresh(session);
|
@@ -9382,7 +9391,7 @@ var Client = class {
|
|
9382
9391
|
limit,
|
9383
9392
|
clanId,
|
9384
9393
|
notificationId,
|
9385
|
-
|
9394
|
+
category,
|
9386
9395
|
direction
|
9387
9396
|
).then((response) => {
|
9388
9397
|
var result = {
|
@@ -9394,13 +9403,14 @@ var Client = class {
|
|
9394
9403
|
}
|
9395
9404
|
response.notifications.forEach((n) => {
|
9396
9405
|
result.notifications.push({
|
9406
|
+
id: n.id,
|
9407
|
+
subject: n.subject,
|
9408
|
+
content: n.content ? safeJSONParse(n.content) : void 0,
|
9397
9409
|
code: n.code ? Number(n.code) : 0,
|
9410
|
+
sender_id: n.sender_id,
|
9398
9411
|
create_time: n.create_time,
|
9399
|
-
id: n.id,
|
9400
9412
|
persistent: n.persistent,
|
9401
|
-
|
9402
|
-
subject: n.subject,
|
9403
|
-
content: n.content ? safeJSONParse(n.content) : void 0
|
9413
|
+
category: n.category
|
9404
9414
|
});
|
9405
9415
|
});
|
9406
9416
|
return Promise.resolve(result);
|
@@ -10918,12 +10928,12 @@ var Client = class {
|
|
10918
10928
|
});
|
10919
10929
|
});
|
10920
10930
|
}
|
10921
|
-
getMezonOauthClient(session, clientId) {
|
10931
|
+
getMezonOauthClient(session, clientId, clientName) {
|
10922
10932
|
return __async(this, null, function* () {
|
10923
10933
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
10924
10934
|
yield this.sessionRefresh(session);
|
10925
10935
|
}
|
10926
|
-
return this.apiClient.getMezonOauthClient(session.token, clientId).then((response) => {
|
10936
|
+
return this.apiClient.getMezonOauthClient(session.token, clientId, clientName).then((response) => {
|
10927
10937
|
return Promise.resolve(response);
|
10928
10938
|
});
|
10929
10939
|
});
|
package/dist/socket.d.ts
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { ApiChannelDescription, ApiChannelMessage, ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotificationUserChannel, ApiPermissionUpdate, ApiRole, ApiRpc, ApiTokenSentEvent, ApiUserActivity, ApiWebhook } from "./api.gen";
|
16
|
+
import { ApiChannelDescription, ApiChannelMessage, ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiNotificationUserChannel, ApiPermissionUpdate, ApiRole, ApiRpc, ApiTokenSentEvent, ApiUserActivity, ApiWebhook } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { ChannelMessage } from "./client";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -312,6 +312,12 @@ export interface CustomStatusEvent {
|
|
312
312
|
/** no clear */
|
313
313
|
no_clear: boolean;
|
314
314
|
}
|
315
|
+
export interface UnpinMessageEvent {
|
316
|
+
id: string;
|
317
|
+
message_id: string;
|
318
|
+
channel_id: string;
|
319
|
+
clan_id: string;
|
320
|
+
}
|
315
321
|
export interface ChannelUpdatedEvent {
|
316
322
|
clan_id: string;
|
317
323
|
category_id: string;
|
@@ -768,7 +774,7 @@ export interface Socket {
|
|
768
774
|
/** Handle error events received from the socket. */
|
769
775
|
onerror: (evt: Event) => void;
|
770
776
|
/** Receive notifications from the socket. */
|
771
|
-
onnotification: (notification:
|
777
|
+
onnotification: (notification: ApiNotification) => void;
|
772
778
|
/** Receive status presence updates. */
|
773
779
|
onstatuspresence: (statusPresence: StatusPresenceEvent) => void;
|
774
780
|
/** Receive stream presence updates. */
|
@@ -843,6 +849,7 @@ export interface Socket {
|
|
843
849
|
onchannelappevent: (event: ChannelAppEvent) => void;
|
844
850
|
onuserstatusevent: (user_status_event: UserStatusEvent) => void;
|
845
851
|
onJoinChannelAppEvent: (join_channel_app_data: JoinChannelAppData) => void;
|
852
|
+
onUnpinMessageEvent: (unpin_message_event: UnpinMessageEvent) => void;
|
846
853
|
}
|
847
854
|
/** Reports an error received from a socket message. */
|
848
855
|
export interface SocketError {
|
@@ -884,7 +891,7 @@ export declare class DefaultSocket implements Socket {
|
|
884
891
|
onuserchannelremoved(user: UserChannelRemovedEvent): void;
|
885
892
|
onremovefriend(user: RemoveFriend): void;
|
886
893
|
onuserclanremoved(user: UserClanRemovedEvent): void;
|
887
|
-
onnotification(notification:
|
894
|
+
onnotification(notification: ApiNotification): void;
|
888
895
|
onstatuspresence(statusPresence: StatusPresenceEvent): void;
|
889
896
|
onpinmessage(pin: LastPinMessageEvent): void;
|
890
897
|
onvoiceended(voice: VoiceEndedEvent): void;
|
@@ -930,6 +937,7 @@ export declare class DefaultSocket implements Socket {
|
|
930
937
|
onchannelappevent(event: ChannelAppEvent): void;
|
931
938
|
onuserstatusevent(user_status_event: UserStatusEvent): void;
|
932
939
|
onJoinChannelAppEvent(join_channel_app_data: JoinChannelAppData): void;
|
940
|
+
onUnpinMessageEvent(unpin_message_event: UnpinMessageEvent): void;
|
933
941
|
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping | WebrtcSignalingFwd | IncomingCallPush | MessageButtonClicked | DropdownBoxSelected | ChannelAppEvent, sendTimeout?: number): Promise<any>;
|
934
942
|
followUsers(userIds: string[]): Promise<Status>;
|
935
943
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -454,6 +454,13 @@ export interface CustomStatusEvent {
|
|
454
454
|
no_clear: boolean;
|
455
455
|
}
|
456
456
|
|
457
|
+
export interface UnpinMessageEvent {
|
458
|
+
id: string;
|
459
|
+
message_id: string;
|
460
|
+
channel_id: string;
|
461
|
+
clan_id: string;
|
462
|
+
}
|
463
|
+
|
457
464
|
export interface ChannelUpdatedEvent {
|
458
465
|
// clan id
|
459
466
|
clan_id: string;
|
@@ -1235,7 +1242,7 @@ export interface Socket {
|
|
1235
1242
|
onerror: (evt: Event) => void;
|
1236
1243
|
|
1237
1244
|
/** Receive notifications from the socket. */
|
1238
|
-
onnotification: (notification:
|
1245
|
+
onnotification: (notification: ApiNotification) => void;
|
1239
1246
|
|
1240
1247
|
/** Receive status presence updates. */
|
1241
1248
|
onstatuspresence: (statusPresence: StatusPresenceEvent) => void;
|
@@ -1388,6 +1395,7 @@ export interface Socket {
|
|
1388
1395
|
|
1389
1396
|
onJoinChannelAppEvent: (join_channel_app_data: JoinChannelAppData) => void;
|
1390
1397
|
|
1398
|
+
onUnpinMessageEvent: (unpin_message_event: UnpinMessageEvent)=> void;
|
1391
1399
|
}
|
1392
1400
|
|
1393
1401
|
/** Reports an error received from a socket message. */
|
@@ -1671,6 +1679,8 @@ export class DefaultSocket implements Socket {
|
|
1671
1679
|
this.onuserstatusevent(<UserStatusEvent>message.user_status_event);
|
1672
1680
|
} else if (message.join_channel_app_data) {
|
1673
1681
|
this.onJoinChannelAppEvent(<JoinChannelAppData>message.join_channel_app_data);
|
1682
|
+
} else if (message.unpin_message_event) {
|
1683
|
+
this.onUnpinMessageEvent(<UnpinMessageEvent>message.unpin_message_event);
|
1674
1684
|
} else {
|
1675
1685
|
if (this.verbose && window && window.console) {
|
1676
1686
|
console.log("Unrecognized message received: %o", message);
|
@@ -1804,7 +1814,7 @@ export class DefaultSocket implements Socket {
|
|
1804
1814
|
}
|
1805
1815
|
}
|
1806
1816
|
|
1807
|
-
onnotification(notification:
|
1817
|
+
onnotification(notification: ApiNotification) {
|
1808
1818
|
if (this.verbose && window && window.console) {
|
1809
1819
|
console.log(notification);
|
1810
1820
|
}
|
@@ -2080,6 +2090,12 @@ export class DefaultSocket implements Socket {
|
|
2080
2090
|
}
|
2081
2091
|
}
|
2082
2092
|
|
2093
|
+
onUnpinMessageEvent(unpin_message_event: UnpinMessageEvent) {
|
2094
|
+
if (this.verbose && window && window.console) {
|
2095
|
+
console.log(unpin_message_event);
|
2096
|
+
}
|
2097
|
+
}
|
2098
|
+
|
2083
2099
|
send(
|
2084
2100
|
message:
|
2085
2101
|
| ChannelJoin
|