mezon-js 2.11.12 → 2.11.14
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 +99 -43
- package/client.ts +43 -11
- package/dist/api.gen.d.ts +18 -4
- package/dist/client.d.ts +3 -2
- package/dist/mezon-js.cjs.js +72 -21
- package/dist/mezon-js.esm.mjs +72 -21
- package/dist/session.d.ts +4 -3
- package/dist/socket.d.ts +2 -2
- package/package.json +1 -1
- package/session.ts +9 -5
- package/socket.ts +5 -2
package/api.gen.ts
CHANGED
@@ -1073,6 +1073,8 @@ export interface ApiClanUserList {
|
|
1073
1073
|
|
1074
1074
|
/** */
|
1075
1075
|
export interface ApiConfirmLoginRequest {
|
1076
|
+
//Whether to enable "Remember Me" for extended session duration.
|
1077
|
+
is_remember?: boolean;
|
1076
1078
|
//
|
1077
1079
|
login_id?: string;
|
1078
1080
|
}
|
@@ -1300,6 +1302,16 @@ export interface ApiEmojiListedResponse {
|
|
1300
1302
|
emoji_list?: Array<ApiClanEmoji>;
|
1301
1303
|
}
|
1302
1304
|
|
1305
|
+
/** */
|
1306
|
+
export interface ApiEmojiRecent {
|
1307
|
+
//ID of the emoji.
|
1308
|
+
emoji_recents_id?: string;
|
1309
|
+
//
|
1310
|
+
emoji_id?: string;
|
1311
|
+
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the emoji was created.
|
1312
|
+
update_time?: string;
|
1313
|
+
}
|
1314
|
+
|
1303
1315
|
/** */
|
1304
1316
|
export interface ApiEventList {
|
1305
1317
|
//A list of event.
|
@@ -1630,6 +1642,8 @@ export interface ApiMessageReaction {
|
|
1630
1642
|
message_id: string;
|
1631
1643
|
//
|
1632
1644
|
topic_id?: string;
|
1645
|
+
//
|
1646
|
+
emoji_recent_id?: string;
|
1633
1647
|
}
|
1634
1648
|
|
1635
1649
|
export interface ApiListChannelAppsResponse {
|
@@ -2261,6 +2275,8 @@ export interface ApiSession {
|
|
2261
2275
|
refresh_token?: string;
|
2262
2276
|
//Authentication credentials.
|
2263
2277
|
token?: string;
|
2278
|
+
// Whether to enable "Remember Me" for extended session duration.
|
2279
|
+
is_remember?: boolean;
|
2264
2280
|
}
|
2265
2281
|
|
2266
2282
|
/** Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user. */
|
@@ -2277,6 +2293,8 @@ export interface ApiSessionLogoutRequest {
|
|
2277
2293
|
|
2278
2294
|
/** Authenticate against the server with a refresh token. */
|
2279
2295
|
export interface ApiSessionRefreshRequest {
|
2296
|
+
//Whether to enable "Remember Me" for extended session duration.
|
2297
|
+
is_remember?: boolean;
|
2280
2298
|
//Refresh token.
|
2281
2299
|
token?: string;
|
2282
2300
|
//Extra information that will be bundled in the session token.
|
@@ -2732,6 +2750,13 @@ export interface ApiWithdrawTokenRequest {
|
|
2732
2750
|
amount?: number;
|
2733
2751
|
}
|
2734
2752
|
|
2753
|
+
/** A collection of zero or more notifications. */
|
2754
|
+
export interface MezonapiEmojiRecentList {
|
2755
|
+
//Collection of emojiRecents.
|
2756
|
+
emoji_recents?: Array<ApiEmojiRecent>;
|
2757
|
+
}
|
2758
|
+
|
2759
|
+
|
2735
2760
|
/** Represents an event to be passed through the server to registered event handlers. */
|
2736
2761
|
export interface MezonapiEvent {
|
2737
2762
|
//True if the event came directly from a client call, false otherwise.
|
@@ -3083,11 +3108,7 @@ export interface ApiMezonOauthClient {
|
|
3083
3108
|
/** */
|
3084
3109
|
export interface ApiCreateHashChannelAppsResponse {
|
3085
3110
|
//
|
3086
|
-
|
3087
|
-
//
|
3088
|
-
user_id?: string;
|
3089
|
-
//
|
3090
|
-
auth_date?: string;
|
3111
|
+
web_app_data?: string;
|
3091
3112
|
}
|
3092
3113
|
|
3093
3114
|
export class MezonApi {
|
@@ -3660,44 +3681,48 @@ export class MezonApi {
|
|
3660
3681
|
}
|
3661
3682
|
|
3662
3683
|
/** Authenticate a user with Mezon against the server. */
|
3663
|
-
|
3664
|
-
|
3665
|
-
|
3666
|
-
|
3667
|
-
|
3668
|
-
|
3669
|
-
|
3670
|
-
|
3671
|
-
|
3672
|
-
|
3673
|
-
|
3674
|
-
|
3675
|
-
|
3676
|
-
|
3677
|
-
|
3678
|
-
|
3679
|
-
|
3680
|
-
|
3681
|
-
|
3682
|
-
|
3683
|
-
|
3684
|
-
|
3685
|
-
|
3686
|
-
|
3687
|
-
|
3688
|
-
|
3689
|
-
|
3690
|
-
|
3691
|
-
|
3692
|
-
|
3693
|
-
|
3694
|
-
|
3695
|
-
|
3696
|
-
|
3697
|
-
|
3698
|
-
|
3699
|
-
|
3700
|
-
|
3684
|
+
authenticateMezon(
|
3685
|
+
basicAuthUsername: string,
|
3686
|
+
basicAuthPassword: string,
|
3687
|
+
account:ApiAccountMezon,
|
3688
|
+
create?:boolean,
|
3689
|
+
username?:string,
|
3690
|
+
isRemember?:boolean,
|
3691
|
+
options: any = {}
|
3692
|
+
): Promise<ApiSession> {
|
3693
|
+
|
3694
|
+
if (account === null || account === undefined) {
|
3695
|
+
throw new Error("'account' is a required parameter but is null or undefined.");
|
3696
|
+
}
|
3697
|
+
const urlPath = "/v2/account/authenticate/mezon";
|
3698
|
+
const queryParams = new Map<string, any>();
|
3699
|
+
queryParams.set("create", create);
|
3700
|
+
queryParams.set("username", username);
|
3701
|
+
queryParams.set("is_remember", isRemember);
|
3702
|
+
|
3703
|
+
let bodyJson : string = "";
|
3704
|
+
bodyJson = JSON.stringify(account || {});
|
3705
|
+
|
3706
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3707
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
3708
|
+
if (basicAuthUsername) {
|
3709
|
+
fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
|
3710
|
+
}
|
3711
|
+
|
3712
|
+
return Promise.race([
|
3713
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3714
|
+
if (response.status == 204) {
|
3715
|
+
return response;
|
3716
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3717
|
+
return response.json();
|
3718
|
+
} else {
|
3719
|
+
throw response;
|
3720
|
+
}
|
3721
|
+
}),
|
3722
|
+
new Promise((_, reject) =>
|
3723
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3724
|
+
),
|
3725
|
+
]);
|
3701
3726
|
}
|
3702
3727
|
|
3703
3728
|
/** Authenticate a user with Steam against the server. */
|
@@ -6674,6 +6699,37 @@ export class MezonApi {
|
|
6674
6699
|
]);
|
6675
6700
|
}
|
6676
6701
|
|
6702
|
+
/** get list emoji recent by user id */
|
6703
|
+
emojiRecentList(bearerToken: string,
|
6704
|
+
options: any = {}): Promise<MezonapiEmojiRecentList> {
|
6705
|
+
|
6706
|
+
const urlPath = "/v2/emojirecents";
|
6707
|
+
const queryParams = new Map<string, any>();
|
6708
|
+
|
6709
|
+
let bodyJson : string = "";
|
6710
|
+
|
6711
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6712
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
6713
|
+
if (bearerToken) {
|
6714
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6715
|
+
}
|
6716
|
+
|
6717
|
+
return Promise.race([
|
6718
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6719
|
+
if (response.status == 204) {
|
6720
|
+
return response;
|
6721
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6722
|
+
return response.json();
|
6723
|
+
} else {
|
6724
|
+
throw response;
|
6725
|
+
}
|
6726
|
+
}),
|
6727
|
+
new Promise((_, reject) =>
|
6728
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6729
|
+
),
|
6730
|
+
]);
|
6731
|
+
}
|
6732
|
+
|
6677
6733
|
/** get list emoji by user id */
|
6678
6734
|
getListEmojisByUserId(
|
6679
6735
|
bearerToken: string,
|
package/client.ts
CHANGED
@@ -165,6 +165,7 @@ import {
|
|
165
165
|
ApiMezonOauthClientList,
|
166
166
|
ApiMezonOauthClient,
|
167
167
|
ApiCreateHashChannelAppsResponse,
|
168
|
+
MezonapiEmojiRecentList,
|
168
169
|
} from "./api.gen";
|
169
170
|
|
170
171
|
import { Session } from "./session";
|
@@ -635,7 +636,8 @@ export class Client {
|
|
635
636
|
return new Session(
|
636
637
|
apiSession.token || "",
|
637
638
|
apiSession.refresh_token || "",
|
638
|
-
apiSession.created || false
|
639
|
+
apiSession.created || false,
|
640
|
+
false
|
639
641
|
);
|
640
642
|
});
|
641
643
|
}
|
@@ -645,6 +647,7 @@ export class Client {
|
|
645
647
|
token: string,
|
646
648
|
create?: boolean,
|
647
649
|
username?: string,
|
650
|
+
isRemember?:boolean,
|
648
651
|
vars: Record<string, string> = {},
|
649
652
|
options: any = {}
|
650
653
|
): Promise<Session> {
|
@@ -659,13 +662,15 @@ export class Client {
|
|
659
662
|
request,
|
660
663
|
create,
|
661
664
|
username,
|
665
|
+
isRemember,
|
662
666
|
options
|
663
667
|
)
|
664
668
|
.then((apiSession: ApiSession) => {
|
665
669
|
return new Session(
|
666
670
|
apiSession.token || "",
|
667
671
|
apiSession.refresh_token || "",
|
668
|
-
apiSession.created || false
|
672
|
+
apiSession.created || false,
|
673
|
+
false
|
669
674
|
);
|
670
675
|
});
|
671
676
|
}
|
@@ -688,7 +693,8 @@ export class Client {
|
|
688
693
|
return new Session(
|
689
694
|
apiSession.token || "",
|
690
695
|
apiSession.refresh_token || "",
|
691
|
-
apiSession.created || false
|
696
|
+
apiSession.created || false,
|
697
|
+
false
|
692
698
|
);
|
693
699
|
});
|
694
700
|
}
|
@@ -712,7 +718,8 @@ export class Client {
|
|
712
718
|
return new Session(
|
713
719
|
apiSession.token || "",
|
714
720
|
apiSession.refresh_token || "",
|
715
|
-
apiSession.created || false
|
721
|
+
apiSession.created || false,
|
722
|
+
false
|
716
723
|
);
|
717
724
|
});
|
718
725
|
}
|
@@ -743,7 +750,8 @@ export class Client {
|
|
743
750
|
return new Session(
|
744
751
|
apiSession.token || "",
|
745
752
|
apiSession.refresh_token || "",
|
746
|
-
apiSession.created || false
|
753
|
+
apiSession.created || false,
|
754
|
+
false
|
747
755
|
);
|
748
756
|
});
|
749
757
|
}
|
@@ -776,7 +784,8 @@ export class Client {
|
|
776
784
|
return new Session(
|
777
785
|
apiSession.token || "",
|
778
786
|
apiSession.refresh_token || "",
|
779
|
-
apiSession.created || false
|
787
|
+
apiSession.created || false,
|
788
|
+
false
|
780
789
|
);
|
781
790
|
});
|
782
791
|
}
|
@@ -806,7 +815,8 @@ export class Client {
|
|
806
815
|
return new Session(
|
807
816
|
apiSession.token || "",
|
808
817
|
apiSession.refresh_token || "",
|
809
|
-
apiSession.created || false
|
818
|
+
apiSession.created || false,
|
819
|
+
false
|
810
820
|
);
|
811
821
|
}
|
812
822
|
|
@@ -845,7 +855,8 @@ export class Client {
|
|
845
855
|
return new Session(
|
846
856
|
apiSession.token || "",
|
847
857
|
apiSession.refresh_token || "",
|
848
|
-
apiSession.created || false
|
858
|
+
apiSession.created || false,
|
859
|
+
false
|
849
860
|
);
|
850
861
|
}
|
851
862
|
|
@@ -869,7 +880,8 @@ export class Client {
|
|
869
880
|
return new Session(
|
870
881
|
apiSession.token || "",
|
871
882
|
apiSession.refresh_token || "",
|
872
|
-
apiSession.created || false
|
883
|
+
apiSession.created || false,
|
884
|
+
false
|
873
885
|
);
|
874
886
|
});
|
875
887
|
}
|
@@ -2421,9 +2433,10 @@ export class Client {
|
|
2421
2433
|
{
|
2422
2434
|
token: session.refresh_token,
|
2423
2435
|
vars: vars,
|
2436
|
+
is_remember:session.is_remember
|
2424
2437
|
}
|
2425
2438
|
);
|
2426
|
-
session.update(apiSession.token!, apiSession.refresh_token
|
2439
|
+
session.update(apiSession.token!, apiSession.refresh_token!, apiSession.is_remember || false);
|
2427
2440
|
resolve(session);
|
2428
2441
|
} catch (error) {
|
2429
2442
|
console.error("Session refresh failed:", error);
|
@@ -3955,6 +3968,24 @@ export class Client {
|
|
3955
3968
|
});
|
3956
3969
|
}
|
3957
3970
|
|
3971
|
+
async emojiRecentList(
|
3972
|
+
session: Session
|
3973
|
+
): Promise<MezonapiEmojiRecentList> {
|
3974
|
+
if (
|
3975
|
+
this.autoRefreshSession &&
|
3976
|
+
session.refresh_token &&
|
3977
|
+
session.isexpired(Date.now() / 1000)
|
3978
|
+
) {
|
3979
|
+
await this.sessionRefresh(session);
|
3980
|
+
}
|
3981
|
+
|
3982
|
+
return this.apiClient
|
3983
|
+
.emojiRecentList(session.token)
|
3984
|
+
.then((response: any) => {
|
3985
|
+
return Promise.resolve(response);
|
3986
|
+
});
|
3987
|
+
}
|
3988
|
+
|
3958
3989
|
async getListStickersByUserId(
|
3959
3990
|
session: Session
|
3960
3991
|
): Promise<ApiStickerListedResponse> {
|
@@ -4401,7 +4432,8 @@ export class Client {
|
|
4401
4432
|
return new Session(
|
4402
4433
|
apiSession.token || "",
|
4403
4434
|
apiSession.refresh_token || "",
|
4404
|
-
apiSession.created || false
|
4435
|
+
apiSession.created || false,
|
4436
|
+
apiSession.is_remember || false
|
4405
4437
|
);
|
4406
4438
|
}
|
4407
4439
|
|
package/dist/api.gen.d.ts
CHANGED
@@ -613,6 +613,7 @@ export interface ApiClanUserList {
|
|
613
613
|
}
|
614
614
|
/** */
|
615
615
|
export interface ApiConfirmLoginRequest {
|
616
|
+
is_remember?: boolean;
|
616
617
|
login_id?: string;
|
617
618
|
}
|
618
619
|
/** */
|
@@ -744,6 +745,12 @@ export interface ApiEmojiListedResponse {
|
|
744
745
|
emoji_list?: Array<ApiClanEmoji>;
|
745
746
|
}
|
746
747
|
/** */
|
748
|
+
export interface ApiEmojiRecent {
|
749
|
+
emoji_recents_id?: string;
|
750
|
+
emoji_id?: string;
|
751
|
+
update_time?: string;
|
752
|
+
}
|
753
|
+
/** */
|
747
754
|
export interface ApiEventList {
|
748
755
|
events?: Array<ApiEventManagement>;
|
749
756
|
}
|
@@ -940,6 +947,7 @@ export interface ApiMessageReaction {
|
|
940
947
|
/** The message that user react */
|
941
948
|
message_id: string;
|
942
949
|
topic_id?: string;
|
950
|
+
emoji_recent_id?: string;
|
943
951
|
}
|
944
952
|
export interface ApiListChannelAppsResponse {
|
945
953
|
channel_apps?: Array<ApiChannelAppResponse>;
|
@@ -1298,6 +1306,7 @@ export interface ApiSession {
|
|
1298
1306
|
created?: boolean;
|
1299
1307
|
refresh_token?: string;
|
1300
1308
|
token?: string;
|
1309
|
+
is_remember?: boolean;
|
1301
1310
|
}
|
1302
1311
|
/** Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user. */
|
1303
1312
|
export interface ApiSessionLogoutRequest {
|
@@ -1308,6 +1317,7 @@ export interface ApiSessionLogoutRequest {
|
|
1308
1317
|
}
|
1309
1318
|
/** Authenticate against the server with a refresh token. */
|
1310
1319
|
export interface ApiSessionRefreshRequest {
|
1320
|
+
is_remember?: boolean;
|
1311
1321
|
token?: string;
|
1312
1322
|
vars?: Record<string, string>;
|
1313
1323
|
}
|
@@ -1571,6 +1581,10 @@ export interface ApiWebhookListResponse {
|
|
1571
1581
|
export interface ApiWithdrawTokenRequest {
|
1572
1582
|
amount?: number;
|
1573
1583
|
}
|
1584
|
+
/** A collection of zero or more notifications. */
|
1585
|
+
export interface MezonapiEmojiRecentList {
|
1586
|
+
emoji_recents?: Array<ApiEmojiRecent>;
|
1587
|
+
}
|
1574
1588
|
/** Represents an event to be passed through the server to registered event handlers. */
|
1575
1589
|
export interface MezonapiEvent {
|
1576
1590
|
external?: boolean;
|
@@ -1770,9 +1784,7 @@ export interface ApiMezonOauthClient {
|
|
1770
1784
|
}
|
1771
1785
|
/** */
|
1772
1786
|
export interface ApiCreateHashChannelAppsResponse {
|
1773
|
-
|
1774
|
-
user_id?: string;
|
1775
|
-
auth_date?: string;
|
1787
|
+
web_app_data?: string;
|
1776
1788
|
}
|
1777
1789
|
export declare class MezonApi {
|
1778
1790
|
readonly serverKey: string;
|
@@ -1808,7 +1820,7 @@ export declare class MezonApi {
|
|
1808
1820
|
/** Authenticate a user with Google against the server. */
|
1809
1821
|
authenticateGoogle(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountGoogle, create?: boolean, username?: string, options?: any): Promise<ApiSession>;
|
1810
1822
|
/** Authenticate a user with Mezon against the server. */
|
1811
|
-
authenticateMezon(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountMezon, create?: boolean, username?: string, options?: any): Promise<ApiSession>;
|
1823
|
+
authenticateMezon(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountMezon, create?: boolean, username?: string, isRemember?: boolean, options?: any): Promise<ApiSession>;
|
1812
1824
|
/** Authenticate a user with Steam against the server. */
|
1813
1825
|
authenticateSteam(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountSteam, create?: boolean, username?: string, sync?: boolean, options?: any): Promise<ApiSession>;
|
1814
1826
|
/** Add an Apple ID to the social profiles on the current user's account. */
|
@@ -1953,6 +1965,8 @@ export declare class MezonApi {
|
|
1953
1965
|
deleteClanEmojiById(bearerToken: string, id: string, clanId?: string, emojiLabel?: string, options?: any): Promise<any>;
|
1954
1966
|
/** Update ClanEmoj By id */
|
1955
1967
|
updateClanEmojiById(bearerToken: string, id: string, body: MezonUpdateClanEmojiByIdBody, options?: any): Promise<any>;
|
1968
|
+
/** get list emoji recent by user id */
|
1969
|
+
emojiRecentList(bearerToken: string, options?: any): Promise<MezonapiEmojiRecentList>;
|
1956
1970
|
/** get list emoji by user id */
|
1957
1971
|
getListEmojisByUserId(bearerToken: string, options?: any): Promise<ApiEmojiListedResponse>;
|
1958
1972
|
/** Search message from elasticsearch service. */
|
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, 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";
|
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, MezonapiEmojiRecentList } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -355,7 +355,7 @@ export declare class Client {
|
|
355
355
|
/** Authenticate a user with an Apple ID against the server. */
|
356
356
|
authenticateApple(token: string, create?: boolean, username?: string, vars?: Record<string, string>, options?: any): Promise<Session>;
|
357
357
|
/** Authenticate a user with a custom id against the server. */
|
358
|
-
authenticateMezon(token: string, create?: boolean, username?: string, vars?: Record<string, string>, options?: any): Promise<Session>;
|
358
|
+
authenticateMezon(token: string, create?: boolean, username?: string, isRemember?: boolean, vars?: Record<string, string>, options?: any): Promise<Session>;
|
359
359
|
/** Authenticate a user with a device id against the server. */
|
360
360
|
authenticateDevice(id: string, create?: boolean, username?: string, vars?: Record<string, string>): Promise<Session>;
|
361
361
|
/** Authenticate a user with an email+password against the server. */
|
@@ -591,6 +591,7 @@ export declare class Client {
|
|
591
591
|
listChannelByUserId(session: Session): Promise<ApiChannelDescList>;
|
592
592
|
listChannelUsersUC(session: Session, channel_id: string, limit: number): Promise<ApiAllUsersAddChannelResponse>;
|
593
593
|
getListEmojisByUserId(session: Session): Promise<ApiEmojiListedResponse>;
|
594
|
+
emojiRecentList(session: Session): Promise<MezonapiEmojiRecentList>;
|
594
595
|
getListStickersByUserId(session: Session): Promise<ApiStickerListedResponse>;
|
595
596
|
listUserClansByUserId(session: Session): Promise<ApiAllUserClans>;
|
596
597
|
listRoles(session: Session, clanId?: string, limit?: string, state?: string, cursor?: string): Promise<ApiRoleListEventResponse>;
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -1164,7 +1164,7 @@ var MezonApi = class {
|
|
1164
1164
|
]);
|
1165
1165
|
}
|
1166
1166
|
/** Authenticate a user with Mezon against the server. */
|
1167
|
-
authenticateMezon(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
|
1167
|
+
authenticateMezon(basicAuthUsername, basicAuthPassword, account, create, username, isRemember, options = {}) {
|
1168
1168
|
if (account === null || account === void 0) {
|
1169
1169
|
throw new Error("'account' is a required parameter but is null or undefined.");
|
1170
1170
|
}
|
@@ -1172,6 +1172,7 @@ var MezonApi = class {
|
|
1172
1172
|
const queryParams = /* @__PURE__ */ new Map();
|
1173
1173
|
queryParams.set("create", create);
|
1174
1174
|
queryParams.set("username", username);
|
1175
|
+
queryParams.set("is_remember", isRemember);
|
1175
1176
|
let bodyJson = "";
|
1176
1177
|
bodyJson = JSON.stringify(account || {});
|
1177
1178
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
@@ -3529,6 +3530,31 @@ var MezonApi = class {
|
|
3529
3530
|
)
|
3530
3531
|
]);
|
3531
3532
|
}
|
3533
|
+
/** get list emoji recent by user id */
|
3534
|
+
emojiRecentList(bearerToken, options = {}) {
|
3535
|
+
const urlPath = "/v2/emojirecents";
|
3536
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3537
|
+
let bodyJson = "";
|
3538
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3539
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
3540
|
+
if (bearerToken) {
|
3541
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3542
|
+
}
|
3543
|
+
return Promise.race([
|
3544
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3545
|
+
if (response.status == 204) {
|
3546
|
+
return response;
|
3547
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3548
|
+
return response.json();
|
3549
|
+
} else {
|
3550
|
+
throw response;
|
3551
|
+
}
|
3552
|
+
}),
|
3553
|
+
new Promise(
|
3554
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3555
|
+
)
|
3556
|
+
]);
|
3557
|
+
}
|
3532
3558
|
/** get list emoji by user id */
|
3533
3559
|
getListEmojisByUserId(bearerToken, options = {}) {
|
3534
3560
|
const urlPath = "/v2/emojis";
|
@@ -7178,12 +7204,13 @@ var MezonApi = class {
|
|
7178
7204
|
|
7179
7205
|
// session.ts
|
7180
7206
|
var Session = class _Session {
|
7181
|
-
constructor(token, refresh_token, created) {
|
7207
|
+
constructor(token, refresh_token, created, is_remember) {
|
7182
7208
|
this.created = created;
|
7183
7209
|
this.token = token;
|
7184
7210
|
this.refresh_token = refresh_token;
|
7185
7211
|
this.created_at = Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3);
|
7186
|
-
this.
|
7212
|
+
this.is_remember = is_remember;
|
7213
|
+
this.update(token, refresh_token, is_remember);
|
7187
7214
|
}
|
7188
7215
|
isexpired(currenttime) {
|
7189
7216
|
return this.expires_at - currenttime < 0;
|
@@ -7191,7 +7218,7 @@ var Session = class _Session {
|
|
7191
7218
|
isrefreshexpired(currenttime) {
|
7192
7219
|
return this.refresh_expires_at - currenttime < 0;
|
7193
7220
|
}
|
7194
|
-
update(token, refreshToken) {
|
7221
|
+
update(token, refreshToken, isRemember) {
|
7195
7222
|
const tokenParts = token.split(".");
|
7196
7223
|
if (tokenParts.length != 3) {
|
7197
7224
|
throw "jwt is not valid.";
|
@@ -7207,6 +7234,7 @@ var Session = class _Session {
|
|
7207
7234
|
const refreshTokenExpiresAt = Math.floor(parseInt(refreshTokenDecoded["exp"]));
|
7208
7235
|
this.refresh_expires_at = refreshTokenExpiresAt;
|
7209
7236
|
this.refresh_token = refreshToken;
|
7237
|
+
this.is_remember = isRemember;
|
7210
7238
|
}
|
7211
7239
|
this.token = token;
|
7212
7240
|
this.expires_at = tokenExpiresAt;
|
@@ -7214,8 +7242,8 @@ var Session = class _Session {
|
|
7214
7242
|
this.user_id = tokenDecoded["uid"];
|
7215
7243
|
this.vars = tokenDecoded["vrs"];
|
7216
7244
|
}
|
7217
|
-
static restore(token, refreshToken) {
|
7218
|
-
return new _Session(token, refreshToken, false);
|
7245
|
+
static restore(token, refreshToken, isRemember) {
|
7246
|
+
return new _Session(token, refreshToken, false, isRemember);
|
7219
7247
|
}
|
7220
7248
|
};
|
7221
7249
|
|
@@ -8089,7 +8117,7 @@ var _DefaultSocket = class _DefaultSocket {
|
|
8089
8117
|
return response.channel_message_ack;
|
8090
8118
|
});
|
8091
8119
|
}
|
8092
|
-
writeMessageReaction(id, clan_id, channel_id, mode, is_public, message_id, emoji_id, emoji, count, message_sender_id, action_delete, topic_id) {
|
8120
|
+
writeMessageReaction(id, clan_id, channel_id, mode, is_public, message_id, emoji_id, emoji, count, message_sender_id, action_delete, topic_id, emoji_recent_id) {
|
8093
8121
|
return __async(this, null, function* () {
|
8094
8122
|
const response = yield this.send({
|
8095
8123
|
message_reaction_event: {
|
@@ -8104,7 +8132,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
8104
8132
|
count,
|
8105
8133
|
message_sender_id,
|
8106
8134
|
action: action_delete,
|
8107
|
-
topic_id
|
8135
|
+
topic_id,
|
8136
|
+
emoji_recent_id
|
8108
8137
|
}
|
8109
8138
|
});
|
8110
8139
|
return response.message_reaction_event;
|
@@ -8403,13 +8432,14 @@ var Client = class {
|
|
8403
8432
|
return new Session(
|
8404
8433
|
apiSession.token || "",
|
8405
8434
|
apiSession.refresh_token || "",
|
8406
|
-
apiSession.created || false
|
8435
|
+
apiSession.created || false,
|
8436
|
+
false
|
8407
8437
|
);
|
8408
8438
|
});
|
8409
8439
|
});
|
8410
8440
|
}
|
8411
8441
|
/** Authenticate a user with a custom id against the server. */
|
8412
|
-
authenticateMezon(token, create, username, vars = {}, options = {}) {
|
8442
|
+
authenticateMezon(token, create, username, isRemember, vars = {}, options = {}) {
|
8413
8443
|
const request = {
|
8414
8444
|
token,
|
8415
8445
|
vars
|
@@ -8420,12 +8450,14 @@ var Client = class {
|
|
8420
8450
|
request,
|
8421
8451
|
create,
|
8422
8452
|
username,
|
8453
|
+
isRemember,
|
8423
8454
|
options
|
8424
8455
|
).then((apiSession) => {
|
8425
8456
|
return new Session(
|
8426
8457
|
apiSession.token || "",
|
8427
8458
|
apiSession.refresh_token || "",
|
8428
|
-
apiSession.created || false
|
8459
|
+
apiSession.created || false,
|
8460
|
+
false
|
8429
8461
|
);
|
8430
8462
|
});
|
8431
8463
|
}
|
@@ -8439,7 +8471,8 @@ var Client = class {
|
|
8439
8471
|
return new Session(
|
8440
8472
|
apiSession.token || "",
|
8441
8473
|
apiSession.refresh_token || "",
|
8442
|
-
apiSession.created || false
|
8474
|
+
apiSession.created || false,
|
8475
|
+
false
|
8443
8476
|
);
|
8444
8477
|
});
|
8445
8478
|
}
|
@@ -8454,7 +8487,8 @@ var Client = class {
|
|
8454
8487
|
return new Session(
|
8455
8488
|
apiSession.token || "",
|
8456
8489
|
apiSession.refresh_token || "",
|
8457
|
-
apiSession.created || false
|
8490
|
+
apiSession.created || false,
|
8491
|
+
false
|
8458
8492
|
);
|
8459
8493
|
});
|
8460
8494
|
}
|
@@ -8475,7 +8509,8 @@ var Client = class {
|
|
8475
8509
|
return new Session(
|
8476
8510
|
apiSession.token || "",
|
8477
8511
|
apiSession.refresh_token || "",
|
8478
|
-
apiSession.created || false
|
8512
|
+
apiSession.created || false,
|
8513
|
+
false
|
8479
8514
|
);
|
8480
8515
|
});
|
8481
8516
|
}
|
@@ -8497,7 +8532,8 @@ var Client = class {
|
|
8497
8532
|
return new Session(
|
8498
8533
|
apiSession.token || "",
|
8499
8534
|
apiSession.refresh_token || "",
|
8500
|
-
apiSession.created || false
|
8535
|
+
apiSession.created || false,
|
8536
|
+
false
|
8501
8537
|
);
|
8502
8538
|
});
|
8503
8539
|
}
|
@@ -8519,7 +8555,8 @@ var Client = class {
|
|
8519
8555
|
return new Session(
|
8520
8556
|
apiSession.token || "",
|
8521
8557
|
apiSession.refresh_token || "",
|
8522
|
-
apiSession.created || false
|
8558
|
+
apiSession.created || false,
|
8559
|
+
false
|
8523
8560
|
);
|
8524
8561
|
});
|
8525
8562
|
}
|
@@ -8546,7 +8583,8 @@ var Client = class {
|
|
8546
8583
|
return new Session(
|
8547
8584
|
apiSession.token || "",
|
8548
8585
|
apiSession.refresh_token || "",
|
8549
|
-
apiSession.created || false
|
8586
|
+
apiSession.created || false,
|
8587
|
+
false
|
8550
8588
|
);
|
8551
8589
|
});
|
8552
8590
|
}
|
@@ -8562,7 +8600,8 @@ var Client = class {
|
|
8562
8600
|
return new Session(
|
8563
8601
|
apiSession.token || "",
|
8564
8602
|
apiSession.refresh_token || "",
|
8565
|
-
apiSession.created || false
|
8603
|
+
apiSession.created || false,
|
8604
|
+
false
|
8566
8605
|
);
|
8567
8606
|
});
|
8568
8607
|
});
|
@@ -9533,10 +9572,11 @@ var Client = class {
|
|
9533
9572
|
"",
|
9534
9573
|
{
|
9535
9574
|
token: session.refresh_token,
|
9536
|
-
vars
|
9575
|
+
vars,
|
9576
|
+
is_remember: session.is_remember
|
9537
9577
|
}
|
9538
9578
|
);
|
9539
|
-
session.update(apiSession.token, apiSession.refresh_token);
|
9579
|
+
session.update(apiSession.token, apiSession.refresh_token, apiSession.is_remember || false);
|
9540
9580
|
resolve(session);
|
9541
9581
|
} catch (error) {
|
9542
9582
|
console.error("Session refresh failed:", error);
|
@@ -10392,6 +10432,16 @@ var Client = class {
|
|
10392
10432
|
});
|
10393
10433
|
});
|
10394
10434
|
}
|
10435
|
+
emojiRecentList(session) {
|
10436
|
+
return __async(this, null, function* () {
|
10437
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
10438
|
+
yield this.sessionRefresh(session);
|
10439
|
+
}
|
10440
|
+
return this.apiClient.emojiRecentList(session.token).then((response) => {
|
10441
|
+
return Promise.resolve(response);
|
10442
|
+
});
|
10443
|
+
});
|
10444
|
+
}
|
10395
10445
|
getListStickersByUserId(session) {
|
10396
10446
|
return __async(this, null, function* () {
|
10397
10447
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
@@ -10657,7 +10707,8 @@ var Client = class {
|
|
10657
10707
|
return new Session(
|
10658
10708
|
apiSession.token || "",
|
10659
10709
|
apiSession.refresh_token || "",
|
10660
|
-
apiSession.created || false
|
10710
|
+
apiSession.created || false,
|
10711
|
+
apiSession.is_remember || false
|
10661
10712
|
);
|
10662
10713
|
});
|
10663
10714
|
}
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -1130,7 +1130,7 @@ var MezonApi = class {
|
|
1130
1130
|
]);
|
1131
1131
|
}
|
1132
1132
|
/** Authenticate a user with Mezon against the server. */
|
1133
|
-
authenticateMezon(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
|
1133
|
+
authenticateMezon(basicAuthUsername, basicAuthPassword, account, create, username, isRemember, options = {}) {
|
1134
1134
|
if (account === null || account === void 0) {
|
1135
1135
|
throw new Error("'account' is a required parameter but is null or undefined.");
|
1136
1136
|
}
|
@@ -1138,6 +1138,7 @@ var MezonApi = class {
|
|
1138
1138
|
const queryParams = /* @__PURE__ */ new Map();
|
1139
1139
|
queryParams.set("create", create);
|
1140
1140
|
queryParams.set("username", username);
|
1141
|
+
queryParams.set("is_remember", isRemember);
|
1141
1142
|
let bodyJson = "";
|
1142
1143
|
bodyJson = JSON.stringify(account || {});
|
1143
1144
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
@@ -3495,6 +3496,31 @@ var MezonApi = class {
|
|
3495
3496
|
)
|
3496
3497
|
]);
|
3497
3498
|
}
|
3499
|
+
/** get list emoji recent by user id */
|
3500
|
+
emojiRecentList(bearerToken, options = {}) {
|
3501
|
+
const urlPath = "/v2/emojirecents";
|
3502
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3503
|
+
let bodyJson = "";
|
3504
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3505
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
3506
|
+
if (bearerToken) {
|
3507
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3508
|
+
}
|
3509
|
+
return Promise.race([
|
3510
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3511
|
+
if (response.status == 204) {
|
3512
|
+
return response;
|
3513
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3514
|
+
return response.json();
|
3515
|
+
} else {
|
3516
|
+
throw response;
|
3517
|
+
}
|
3518
|
+
}),
|
3519
|
+
new Promise(
|
3520
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3521
|
+
)
|
3522
|
+
]);
|
3523
|
+
}
|
3498
3524
|
/** get list emoji by user id */
|
3499
3525
|
getListEmojisByUserId(bearerToken, options = {}) {
|
3500
3526
|
const urlPath = "/v2/emojis";
|
@@ -7144,12 +7170,13 @@ var MezonApi = class {
|
|
7144
7170
|
|
7145
7171
|
// session.ts
|
7146
7172
|
var Session = class _Session {
|
7147
|
-
constructor(token, refresh_token, created) {
|
7173
|
+
constructor(token, refresh_token, created, is_remember) {
|
7148
7174
|
this.created = created;
|
7149
7175
|
this.token = token;
|
7150
7176
|
this.refresh_token = refresh_token;
|
7151
7177
|
this.created_at = Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3);
|
7152
|
-
this.
|
7178
|
+
this.is_remember = is_remember;
|
7179
|
+
this.update(token, refresh_token, is_remember);
|
7153
7180
|
}
|
7154
7181
|
isexpired(currenttime) {
|
7155
7182
|
return this.expires_at - currenttime < 0;
|
@@ -7157,7 +7184,7 @@ var Session = class _Session {
|
|
7157
7184
|
isrefreshexpired(currenttime) {
|
7158
7185
|
return this.refresh_expires_at - currenttime < 0;
|
7159
7186
|
}
|
7160
|
-
update(token, refreshToken) {
|
7187
|
+
update(token, refreshToken, isRemember) {
|
7161
7188
|
const tokenParts = token.split(".");
|
7162
7189
|
if (tokenParts.length != 3) {
|
7163
7190
|
throw "jwt is not valid.";
|
@@ -7173,6 +7200,7 @@ var Session = class _Session {
|
|
7173
7200
|
const refreshTokenExpiresAt = Math.floor(parseInt(refreshTokenDecoded["exp"]));
|
7174
7201
|
this.refresh_expires_at = refreshTokenExpiresAt;
|
7175
7202
|
this.refresh_token = refreshToken;
|
7203
|
+
this.is_remember = isRemember;
|
7176
7204
|
}
|
7177
7205
|
this.token = token;
|
7178
7206
|
this.expires_at = tokenExpiresAt;
|
@@ -7180,8 +7208,8 @@ var Session = class _Session {
|
|
7180
7208
|
this.user_id = tokenDecoded["uid"];
|
7181
7209
|
this.vars = tokenDecoded["vrs"];
|
7182
7210
|
}
|
7183
|
-
static restore(token, refreshToken) {
|
7184
|
-
return new _Session(token, refreshToken, false);
|
7211
|
+
static restore(token, refreshToken, isRemember) {
|
7212
|
+
return new _Session(token, refreshToken, false, isRemember);
|
7185
7213
|
}
|
7186
7214
|
};
|
7187
7215
|
|
@@ -8055,7 +8083,7 @@ var _DefaultSocket = class _DefaultSocket {
|
|
8055
8083
|
return response.channel_message_ack;
|
8056
8084
|
});
|
8057
8085
|
}
|
8058
|
-
writeMessageReaction(id, clan_id, channel_id, mode, is_public, message_id, emoji_id, emoji, count, message_sender_id, action_delete, topic_id) {
|
8086
|
+
writeMessageReaction(id, clan_id, channel_id, mode, is_public, message_id, emoji_id, emoji, count, message_sender_id, action_delete, topic_id, emoji_recent_id) {
|
8059
8087
|
return __async(this, null, function* () {
|
8060
8088
|
const response = yield this.send({
|
8061
8089
|
message_reaction_event: {
|
@@ -8070,7 +8098,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
8070
8098
|
count,
|
8071
8099
|
message_sender_id,
|
8072
8100
|
action: action_delete,
|
8073
|
-
topic_id
|
8101
|
+
topic_id,
|
8102
|
+
emoji_recent_id
|
8074
8103
|
}
|
8075
8104
|
});
|
8076
8105
|
return response.message_reaction_event;
|
@@ -8369,13 +8398,14 @@ var Client = class {
|
|
8369
8398
|
return new Session(
|
8370
8399
|
apiSession.token || "",
|
8371
8400
|
apiSession.refresh_token || "",
|
8372
|
-
apiSession.created || false
|
8401
|
+
apiSession.created || false,
|
8402
|
+
false
|
8373
8403
|
);
|
8374
8404
|
});
|
8375
8405
|
});
|
8376
8406
|
}
|
8377
8407
|
/** Authenticate a user with a custom id against the server. */
|
8378
|
-
authenticateMezon(token, create, username, vars = {}, options = {}) {
|
8408
|
+
authenticateMezon(token, create, username, isRemember, vars = {}, options = {}) {
|
8379
8409
|
const request = {
|
8380
8410
|
token,
|
8381
8411
|
vars
|
@@ -8386,12 +8416,14 @@ var Client = class {
|
|
8386
8416
|
request,
|
8387
8417
|
create,
|
8388
8418
|
username,
|
8419
|
+
isRemember,
|
8389
8420
|
options
|
8390
8421
|
).then((apiSession) => {
|
8391
8422
|
return new Session(
|
8392
8423
|
apiSession.token || "",
|
8393
8424
|
apiSession.refresh_token || "",
|
8394
|
-
apiSession.created || false
|
8425
|
+
apiSession.created || false,
|
8426
|
+
false
|
8395
8427
|
);
|
8396
8428
|
});
|
8397
8429
|
}
|
@@ -8405,7 +8437,8 @@ var Client = class {
|
|
8405
8437
|
return new Session(
|
8406
8438
|
apiSession.token || "",
|
8407
8439
|
apiSession.refresh_token || "",
|
8408
|
-
apiSession.created || false
|
8440
|
+
apiSession.created || false,
|
8441
|
+
false
|
8409
8442
|
);
|
8410
8443
|
});
|
8411
8444
|
}
|
@@ -8420,7 +8453,8 @@ var Client = class {
|
|
8420
8453
|
return new Session(
|
8421
8454
|
apiSession.token || "",
|
8422
8455
|
apiSession.refresh_token || "",
|
8423
|
-
apiSession.created || false
|
8456
|
+
apiSession.created || false,
|
8457
|
+
false
|
8424
8458
|
);
|
8425
8459
|
});
|
8426
8460
|
}
|
@@ -8441,7 +8475,8 @@ var Client = class {
|
|
8441
8475
|
return new Session(
|
8442
8476
|
apiSession.token || "",
|
8443
8477
|
apiSession.refresh_token || "",
|
8444
|
-
apiSession.created || false
|
8478
|
+
apiSession.created || false,
|
8479
|
+
false
|
8445
8480
|
);
|
8446
8481
|
});
|
8447
8482
|
}
|
@@ -8463,7 +8498,8 @@ var Client = class {
|
|
8463
8498
|
return new Session(
|
8464
8499
|
apiSession.token || "",
|
8465
8500
|
apiSession.refresh_token || "",
|
8466
|
-
apiSession.created || false
|
8501
|
+
apiSession.created || false,
|
8502
|
+
false
|
8467
8503
|
);
|
8468
8504
|
});
|
8469
8505
|
}
|
@@ -8485,7 +8521,8 @@ var Client = class {
|
|
8485
8521
|
return new Session(
|
8486
8522
|
apiSession.token || "",
|
8487
8523
|
apiSession.refresh_token || "",
|
8488
|
-
apiSession.created || false
|
8524
|
+
apiSession.created || false,
|
8525
|
+
false
|
8489
8526
|
);
|
8490
8527
|
});
|
8491
8528
|
}
|
@@ -8512,7 +8549,8 @@ var Client = class {
|
|
8512
8549
|
return new Session(
|
8513
8550
|
apiSession.token || "",
|
8514
8551
|
apiSession.refresh_token || "",
|
8515
|
-
apiSession.created || false
|
8552
|
+
apiSession.created || false,
|
8553
|
+
false
|
8516
8554
|
);
|
8517
8555
|
});
|
8518
8556
|
}
|
@@ -8528,7 +8566,8 @@ var Client = class {
|
|
8528
8566
|
return new Session(
|
8529
8567
|
apiSession.token || "",
|
8530
8568
|
apiSession.refresh_token || "",
|
8531
|
-
apiSession.created || false
|
8569
|
+
apiSession.created || false,
|
8570
|
+
false
|
8532
8571
|
);
|
8533
8572
|
});
|
8534
8573
|
});
|
@@ -9499,10 +9538,11 @@ var Client = class {
|
|
9499
9538
|
"",
|
9500
9539
|
{
|
9501
9540
|
token: session.refresh_token,
|
9502
|
-
vars
|
9541
|
+
vars,
|
9542
|
+
is_remember: session.is_remember
|
9503
9543
|
}
|
9504
9544
|
);
|
9505
|
-
session.update(apiSession.token, apiSession.refresh_token);
|
9545
|
+
session.update(apiSession.token, apiSession.refresh_token, apiSession.is_remember || false);
|
9506
9546
|
resolve(session);
|
9507
9547
|
} catch (error) {
|
9508
9548
|
console.error("Session refresh failed:", error);
|
@@ -10358,6 +10398,16 @@ var Client = class {
|
|
10358
10398
|
});
|
10359
10399
|
});
|
10360
10400
|
}
|
10401
|
+
emojiRecentList(session) {
|
10402
|
+
return __async(this, null, function* () {
|
10403
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
10404
|
+
yield this.sessionRefresh(session);
|
10405
|
+
}
|
10406
|
+
return this.apiClient.emojiRecentList(session.token).then((response) => {
|
10407
|
+
return Promise.resolve(response);
|
10408
|
+
});
|
10409
|
+
});
|
10410
|
+
}
|
10361
10411
|
getListStickersByUserId(session) {
|
10362
10412
|
return __async(this, null, function* () {
|
10363
10413
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
@@ -10623,7 +10673,8 @@ var Client = class {
|
|
10623
10673
|
return new Session(
|
10624
10674
|
apiSession.token || "",
|
10625
10675
|
apiSession.refresh_token || "",
|
10626
|
-
apiSession.created || false
|
10676
|
+
apiSession.created || false,
|
10677
|
+
apiSession.is_remember || false
|
10627
10678
|
);
|
10628
10679
|
});
|
10629
10680
|
}
|
package/dist/session.d.ts
CHANGED
@@ -50,9 +50,10 @@ export declare class Session implements ISession {
|
|
50
50
|
username?: string;
|
51
51
|
user_id?: string;
|
52
52
|
vars?: object;
|
53
|
-
|
53
|
+
is_remember?: boolean;
|
54
|
+
constructor(token: string, refresh_token: string, created: boolean, is_remember: boolean);
|
54
55
|
isexpired(currenttime: number): boolean;
|
55
56
|
isrefreshexpired(currenttime: number): boolean;
|
56
|
-
update(token: string, refreshToken: string): void;
|
57
|
-
static restore(token: string, refreshToken: string): Session;
|
57
|
+
update(token: string, refreshToken: string, isRemember: boolean): void;
|
58
|
+
static restore(token: string, refreshToken: string, isRemember: boolean): Session;
|
58
59
|
}
|
package/dist/socket.d.ts
CHANGED
@@ -750,7 +750,7 @@ export interface Socket {
|
|
750
750
|
/** Send message typing */
|
751
751
|
writeMessageTyping(clan_id: string, channel_id: string, mode: number, is_public: boolean): Promise<MessageTypingEvent>;
|
752
752
|
/** Send message reaction */
|
753
|
-
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, topic_id?: string): Promise<ApiMessageReaction>;
|
753
|
+
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, topic_id?: string, emoji_recent_id?: string): Promise<ApiMessageReaction>;
|
754
754
|
/** Send last seen message */
|
755
755
|
writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp_seconds: number): Promise<LastSeenMessageEvent>;
|
756
756
|
/** Send last pin message */
|
@@ -951,7 +951,7 @@ export declare class DefaultSocket implements Socket {
|
|
951
951
|
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, topic_id?: string, is_update_msg_topic?: boolean): Promise<ChannelMessageAck>;
|
952
952
|
updateStatus(status?: string): Promise<void>;
|
953
953
|
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>;
|
954
|
-
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, topic_id?: string): Promise<ApiMessageReaction>;
|
954
|
+
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, topic_id?: string, emoji_recent_id?: string): Promise<ApiMessageReaction>;
|
955
955
|
writeMessageTyping(clan_id: string, channel_id: string, mode: number, is_public: boolean): Promise<MessageTypingEvent>;
|
956
956
|
writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp_seconds: number): Promise<LastSeenMessageEvent>;
|
957
957
|
writeLastPinMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, timestamp_seconds: number, operation: number): Promise<LastPinMessageEvent>;
|
package/package.json
CHANGED
package/session.ts
CHANGED
@@ -56,15 +56,18 @@ export class Session implements ISession {
|
|
56
56
|
username?: string;
|
57
57
|
user_id?: string;
|
58
58
|
vars?: object;
|
59
|
+
is_remember?: boolean;
|
59
60
|
|
60
61
|
constructor(
|
61
62
|
token: string,
|
62
63
|
refresh_token: string,
|
63
|
-
readonly created: boolean
|
64
|
+
readonly created: boolean,
|
65
|
+
is_remember: boolean) {
|
64
66
|
this.token = token;
|
65
67
|
this.refresh_token = refresh_token;
|
66
68
|
this.created_at = Math.floor(new Date().getTime() / 1000);
|
67
|
-
this.
|
69
|
+
this.is_remember = is_remember;
|
70
|
+
this.update(token, refresh_token, is_remember);
|
68
71
|
}
|
69
72
|
|
70
73
|
isexpired(currenttime: number): boolean {
|
@@ -75,7 +78,7 @@ export class Session implements ISession {
|
|
75
78
|
return (this.refresh_expires_at! - currenttime) < 0;
|
76
79
|
}
|
77
80
|
|
78
|
-
update(token: string, refreshToken: string) {
|
81
|
+
update(token: string, refreshToken: string, isRemember: boolean) {
|
79
82
|
|
80
83
|
const tokenParts = token.split('.');
|
81
84
|
if (tokenParts.length != 3) {
|
@@ -99,6 +102,7 @@ export class Session implements ISession {
|
|
99
102
|
const refreshTokenExpiresAt = Math.floor(parseInt(refreshTokenDecoded['exp']));
|
100
103
|
this.refresh_expires_at = refreshTokenExpiresAt;
|
101
104
|
this.refresh_token = refreshToken;
|
105
|
+
this.is_remember = isRemember;
|
102
106
|
}
|
103
107
|
|
104
108
|
this.token = token;
|
@@ -108,7 +112,7 @@ export class Session implements ISession {
|
|
108
112
|
this.vars = tokenDecoded['vrs'];
|
109
113
|
}
|
110
114
|
|
111
|
-
static restore(token: string, refreshToken: string): Session {
|
112
|
-
return new Session(token, refreshToken, false);
|
115
|
+
static restore(token: string, refreshToken: string, isRemember: boolean): Session {
|
116
|
+
return new Session(token, refreshToken, false, isRemember);
|
113
117
|
}
|
114
118
|
}
|
package/socket.ts
CHANGED
@@ -1128,7 +1128,8 @@ export interface Socket {
|
|
1128
1128
|
count: number,
|
1129
1129
|
message_sender_id: string,
|
1130
1130
|
action_delete: boolean,
|
1131
|
-
topic_id?: string
|
1131
|
+
topic_id?: string,
|
1132
|
+
emoji_recent_id?: string
|
1132
1133
|
): Promise<ApiMessageReaction>;
|
1133
1134
|
|
1134
1135
|
/** Send last seen message */
|
@@ -2334,7 +2335,8 @@ export class DefaultSocket implements Socket {
|
|
2334
2335
|
count: number,
|
2335
2336
|
message_sender_id: string,
|
2336
2337
|
action_delete: boolean,
|
2337
|
-
topic_id?: string
|
2338
|
+
topic_id?: string,
|
2339
|
+
emoji_recent_id?: string
|
2338
2340
|
): Promise<ApiMessageReaction> {
|
2339
2341
|
const response = await this.send({
|
2340
2342
|
message_reaction_event: {
|
@@ -2350,6 +2352,7 @@ export class DefaultSocket implements Socket {
|
|
2350
2352
|
message_sender_id: message_sender_id,
|
2351
2353
|
action: action_delete,
|
2352
2354
|
topic_id: topic_id,
|
2355
|
+
emoji_recent_id: emoji_recent_id
|
2353
2356
|
},
|
2354
2357
|
});
|
2355
2358
|
return response.message_reaction_event;
|