mezon-js 2.12.79 → 2.12.81
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 +55 -17
- package/client.ts +24 -16
- package/dist/api.gen.d.ts +13 -9
- package/dist/client.d.ts +3 -2
- package/dist/mezon-js.cjs.js +40 -13
- package/dist/mezon-js.esm.mjs +40 -13
- package/package.json +1 -1
package/api.gen.ts
CHANGED
|
@@ -374,8 +374,6 @@ export interface ApiAccount {
|
|
|
374
374
|
verify_time?: string;
|
|
375
375
|
//The user's wallet data.
|
|
376
376
|
wallet?: number;
|
|
377
|
-
// MMN information
|
|
378
|
-
mmn_encrypt_private_key: string;
|
|
379
377
|
}
|
|
380
378
|
|
|
381
379
|
/** Send a app token to the server. Used with authenticate/link/unlink. */
|
|
@@ -396,13 +394,15 @@ export interface ApiAccountEmail {
|
|
|
396
394
|
email?: string;
|
|
397
395
|
//A password for the user account. Ignored with unlink operations.
|
|
398
396
|
password?: string;
|
|
397
|
+
// Old email
|
|
398
|
+
prev_email?: string;
|
|
399
399
|
//Extra information that will be bundled in the session token.
|
|
400
400
|
vars?: Record<string, string>;
|
|
401
401
|
}
|
|
402
402
|
|
|
403
403
|
/** Send a Mezon token to the server. Used with authenticate/link/unlink. */
|
|
404
404
|
export interface ApiAccountMezon {
|
|
405
|
-
//The
|
|
405
|
+
//The phone number
|
|
406
406
|
token?: string;
|
|
407
407
|
//Extra information that will be bundled in the session token.
|
|
408
408
|
vars?: Record<string, string>;
|
|
@@ -2148,6 +2148,8 @@ export interface ApiRegistrationEmailRequest {
|
|
|
2148
2148
|
email?: string;
|
|
2149
2149
|
//A password for the user account.
|
|
2150
2150
|
password?: string;
|
|
2151
|
+
//A old password for the user account.
|
|
2152
|
+
old_password?: string;
|
|
2151
2153
|
//Set the username on the account at register. Must be unique.
|
|
2152
2154
|
username?: string;
|
|
2153
2155
|
//Extra information that will be bundled in the session token.
|
|
@@ -2642,8 +2644,6 @@ export interface ApiUploadAttachmentRequest {
|
|
|
2642
2644
|
export interface ApiUser {
|
|
2643
2645
|
//
|
|
2644
2646
|
about_me?: string;
|
|
2645
|
-
//The Apple Sign In ID in the user's account.
|
|
2646
|
-
apple_id?: string;
|
|
2647
2647
|
//A URL for an avatar image.
|
|
2648
2648
|
avatar_url?: string;
|
|
2649
2649
|
//
|
|
@@ -2654,12 +2654,6 @@ export interface ApiUser {
|
|
|
2654
2654
|
display_name?: string;
|
|
2655
2655
|
//Number of related edges to this user.
|
|
2656
2656
|
edge_count?: number;
|
|
2657
|
-
//The Facebook id in the user's account.
|
|
2658
|
-
facebook_id?: string;
|
|
2659
|
-
//The Apple Game Center in of the user's account.
|
|
2660
|
-
gamecenter_id?: string;
|
|
2661
|
-
//The Google id in the user's account.
|
|
2662
|
-
google_id?: string;
|
|
2663
2657
|
//The id of the user's account.
|
|
2664
2658
|
id?: string;
|
|
2665
2659
|
//
|
|
@@ -2674,18 +2668,16 @@ export interface ApiUser {
|
|
|
2674
2668
|
metadata?: string;
|
|
2675
2669
|
//Indicates whether the user is currently online.
|
|
2676
2670
|
online?: boolean;
|
|
2677
|
-
//The Steam id in the user's account.
|
|
2678
|
-
steam_id?: string;
|
|
2679
2671
|
//The timezone set by the user.
|
|
2680
2672
|
timezone?: string;
|
|
2681
2673
|
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user was last updated.
|
|
2682
2674
|
update_time?: string;
|
|
2683
2675
|
//The username of the user's account.
|
|
2684
2676
|
username?: string;
|
|
2677
|
+
// mezon_id
|
|
2678
|
+
mezon_id?: string;
|
|
2685
2679
|
// list nick name
|
|
2686
2680
|
list_nick_names?: Array<string>;
|
|
2687
|
-
// MMN address
|
|
2688
|
-
wallet_address?: string
|
|
2689
2681
|
}
|
|
2690
2682
|
|
|
2691
2683
|
/** */
|
|
@@ -3333,6 +3325,16 @@ export interface ApiIsFollowerRequest {
|
|
|
3333
3325
|
follow_id?: string;
|
|
3334
3326
|
}
|
|
3335
3327
|
|
|
3328
|
+
/** */
|
|
3329
|
+
export interface ApiLinkAccountConfirmRequest {
|
|
3330
|
+
//
|
|
3331
|
+
otp_code?: string;
|
|
3332
|
+
//
|
|
3333
|
+
req_id?: string;
|
|
3334
|
+
//
|
|
3335
|
+
status?: number;
|
|
3336
|
+
}
|
|
3337
|
+
|
|
3336
3338
|
/** */
|
|
3337
3339
|
export interface ApiIsFollowerResponse {
|
|
3338
3340
|
//
|
|
@@ -3700,7 +3702,7 @@ export class MezonApi {
|
|
|
3700
3702
|
bearerToken: string,
|
|
3701
3703
|
body: ApiAccountEmail,
|
|
3702
3704
|
options: any = {}
|
|
3703
|
-
): Promise<
|
|
3705
|
+
): Promise<ApiLinkAccountConfirmRequest> {
|
|
3704
3706
|
if (body === null || body === undefined) {
|
|
3705
3707
|
throw new Error(
|
|
3706
3708
|
"'body' is a required parameter but is null or undefined."
|
|
@@ -3737,7 +3739,7 @@ export class MezonApi {
|
|
|
3737
3739
|
/** Add a mezon ID to the social profiles on the current user's account. */
|
|
3738
3740
|
linkMezon(bearerToken: string,
|
|
3739
3741
|
body:ApiAccountMezon,
|
|
3740
|
-
options: any = {}): Promise<
|
|
3742
|
+
options: any = {}): Promise<ApiLinkAccountConfirmRequest> {
|
|
3741
3743
|
|
|
3742
3744
|
if (body === null || body === undefined) {
|
|
3743
3745
|
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
@@ -3770,6 +3772,42 @@ export class MezonApi {
|
|
|
3770
3772
|
]);
|
|
3771
3773
|
}
|
|
3772
3774
|
|
|
3775
|
+
/** */
|
|
3776
|
+
confirmLinkMezonOTP(bearerToken: string,
|
|
3777
|
+
body:ApiLinkAccountConfirmRequest,
|
|
3778
|
+
options: any = {}): Promise<any> {
|
|
3779
|
+
|
|
3780
|
+
if (body === null || body === undefined) {
|
|
3781
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
3782
|
+
}
|
|
3783
|
+
const urlPath = "/v2/account/link/confirm";
|
|
3784
|
+
const queryParams = new Map<string, any>();
|
|
3785
|
+
|
|
3786
|
+
let bodyJson : string = "";
|
|
3787
|
+
bodyJson = JSON.stringify(body || {});
|
|
3788
|
+
|
|
3789
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3790
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
3791
|
+
if (bearerToken) {
|
|
3792
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3793
|
+
}
|
|
3794
|
+
|
|
3795
|
+
return Promise.race([
|
|
3796
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3797
|
+
if (response.status == 204) {
|
|
3798
|
+
return response;
|
|
3799
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
3800
|
+
return response.json();
|
|
3801
|
+
} else {
|
|
3802
|
+
throw response;
|
|
3803
|
+
}
|
|
3804
|
+
}),
|
|
3805
|
+
new Promise((_, reject) =>
|
|
3806
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3807
|
+
),
|
|
3808
|
+
]);
|
|
3809
|
+
}
|
|
3810
|
+
|
|
3773
3811
|
/** Authenticate a user with an email+password against the server. */
|
|
3774
3812
|
registrationEmail(
|
|
3775
3813
|
bearerToken: string,
|
package/client.ts
CHANGED
|
@@ -173,6 +173,7 @@ import {
|
|
|
173
173
|
ApiTransferOwnershipRequest,
|
|
174
174
|
ApiMeetParticipantRequest,
|
|
175
175
|
ApiStoreWalletKeyRequest,
|
|
176
|
+
ApiLinkAccountConfirmRequest,
|
|
176
177
|
} from "./api.gen";
|
|
177
178
|
|
|
178
179
|
import { Session } from "./session";
|
|
@@ -1170,14 +1171,10 @@ export class Client {
|
|
|
1170
1171
|
create_time: u.create_time,
|
|
1171
1172
|
display_name: u.display_name,
|
|
1172
1173
|
edge_count: u.edge_count ? Number(u.edge_count) : 0,
|
|
1173
|
-
facebook_id: u.facebook_id,
|
|
1174
|
-
gamecenter_id: u.gamecenter_id,
|
|
1175
|
-
google_id: u.google_id,
|
|
1176
1174
|
id: u.id,
|
|
1177
1175
|
lang_tag: u.lang_tag,
|
|
1178
1176
|
location: u.location,
|
|
1179
1177
|
online: u.online,
|
|
1180
|
-
steam_id: u.steam_id,
|
|
1181
1178
|
timezone: u.timezone,
|
|
1182
1179
|
update_time: u.update_time,
|
|
1183
1180
|
username: u.username,
|
|
@@ -1519,15 +1516,11 @@ export class Client {
|
|
|
1519
1516
|
create_time: gu.user!.create_time,
|
|
1520
1517
|
display_name: gu.user!.display_name,
|
|
1521
1518
|
edge_count: gu.user!.edge_count ? Number(gu.user!.edge_count) : 0,
|
|
1522
|
-
facebook_id: gu.user!.facebook_id,
|
|
1523
|
-
gamecenter_id: gu.user!.gamecenter_id,
|
|
1524
|
-
google_id: gu.user!.google_id,
|
|
1525
1519
|
id: gu.user!.id,
|
|
1526
1520
|
lang_tag: gu.user!.lang_tag,
|
|
1527
1521
|
location: gu.user!.location,
|
|
1528
1522
|
online: gu.user!.online,
|
|
1529
1523
|
is_mobile: gu.user?.is_mobile,
|
|
1530
|
-
steam_id: gu.user!.steam_id,
|
|
1531
1524
|
timezone: gu.user!.timezone,
|
|
1532
1525
|
update_time: gu.user!.update_time,
|
|
1533
1526
|
username: gu.user!.username,
|
|
@@ -1805,11 +1798,30 @@ export class Client {
|
|
|
1805
1798
|
});
|
|
1806
1799
|
}
|
|
1807
1800
|
|
|
1801
|
+
async confirmLinkMezonOTP(
|
|
1802
|
+
session: Session,
|
|
1803
|
+
request: ApiLinkAccountConfirmRequest,
|
|
1804
|
+
): Promise<any> {
|
|
1805
|
+
if (
|
|
1806
|
+
this.autoRefreshSession &&
|
|
1807
|
+
session.refresh_token &&
|
|
1808
|
+
session.isexpired(Date.now() / 1000)
|
|
1809
|
+
) {
|
|
1810
|
+
await this.sessionRefresh(session);
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
return this.apiClient
|
|
1814
|
+
.confirmLinkMezonOTP(session.token, request)
|
|
1815
|
+
.then((response: any) => {
|
|
1816
|
+
return response !== undefined;
|
|
1817
|
+
});
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1808
1820
|
/** Add a custom ID to the social profiles on the current user's account. */
|
|
1809
1821
|
async linkMezon(
|
|
1810
1822
|
session: Session,
|
|
1811
1823
|
request: ApiAccountMezon
|
|
1812
|
-
): Promise<
|
|
1824
|
+
): Promise<ApiLinkAccountConfirmRequest> {
|
|
1813
1825
|
if (
|
|
1814
1826
|
this.autoRefreshSession &&
|
|
1815
1827
|
session.refresh_token &&
|
|
@@ -1820,8 +1832,8 @@ export class Client {
|
|
|
1820
1832
|
|
|
1821
1833
|
return this.apiClient
|
|
1822
1834
|
.linkMezon(session.token, request)
|
|
1823
|
-
.then((response:
|
|
1824
|
-
return response
|
|
1835
|
+
.then((response: ApiLinkAccountConfirmRequest) => {
|
|
1836
|
+
return Promise.resolve(response);
|
|
1825
1837
|
});
|
|
1826
1838
|
}
|
|
1827
1839
|
|
|
@@ -1878,15 +1890,11 @@ export class Client {
|
|
|
1878
1890
|
avatar_url: f.user!.avatar_url,
|
|
1879
1891
|
create_time: f.user!.create_time,
|
|
1880
1892
|
display_name: f.user!.display_name,
|
|
1881
|
-
edge_count: f.user!.edge_count ? Number(f.user!.edge_count) : 0,
|
|
1882
|
-
facebook_id: f.user!.facebook_id,
|
|
1883
|
-
gamecenter_id: f.user!.gamecenter_id,
|
|
1884
|
-
google_id: f.user!.google_id,
|
|
1893
|
+
edge_count: f.user!.edge_count ? Number(f.user!.edge_count) : 0,
|
|
1885
1894
|
id: f.user!.id,
|
|
1886
1895
|
lang_tag: f.user!.lang_tag,
|
|
1887
1896
|
location: f.user!.location,
|
|
1888
1897
|
online: f.user!.online,
|
|
1889
|
-
steam_id: f.user!.steam_id,
|
|
1890
1898
|
timezone: f.user!.timezone,
|
|
1891
1899
|
update_time: f.user!.update_time,
|
|
1892
1900
|
username: f.user!.username,
|
package/dist/api.gen.d.ts
CHANGED
|
@@ -213,7 +213,6 @@ export interface ApiAccount {
|
|
|
213
213
|
user?: ApiUser;
|
|
214
214
|
verify_time?: string;
|
|
215
215
|
wallet?: number;
|
|
216
|
-
mmn_encrypt_private_key: string;
|
|
217
216
|
}
|
|
218
217
|
/** Send a app token to the server. Used with authenticate/link/unlink. */
|
|
219
218
|
export interface ApiAccountApp {
|
|
@@ -226,6 +225,7 @@ export interface ApiAccountApp {
|
|
|
226
225
|
export interface ApiAccountEmail {
|
|
227
226
|
email?: string;
|
|
228
227
|
password?: string;
|
|
228
|
+
prev_email?: string;
|
|
229
229
|
vars?: Record<string, string>;
|
|
230
230
|
}
|
|
231
231
|
/** Send a Mezon token to the server. Used with authenticate/link/unlink. */
|
|
@@ -1227,6 +1227,7 @@ export interface ApiRegistrationEmailRequest {
|
|
|
1227
1227
|
dob?: string;
|
|
1228
1228
|
email?: string;
|
|
1229
1229
|
password?: string;
|
|
1230
|
+
old_password?: string;
|
|
1230
1231
|
username?: string;
|
|
1231
1232
|
vars?: Record<string, string>;
|
|
1232
1233
|
}
|
|
@@ -1512,15 +1513,11 @@ export interface ApiUploadAttachmentRequest {
|
|
|
1512
1513
|
/** A user in the server. */
|
|
1513
1514
|
export interface ApiUser {
|
|
1514
1515
|
about_me?: string;
|
|
1515
|
-
apple_id?: string;
|
|
1516
1516
|
avatar_url?: string;
|
|
1517
1517
|
dob?: string;
|
|
1518
1518
|
create_time?: string;
|
|
1519
1519
|
display_name?: string;
|
|
1520
1520
|
edge_count?: number;
|
|
1521
|
-
facebook_id?: string;
|
|
1522
|
-
gamecenter_id?: string;
|
|
1523
|
-
google_id?: string;
|
|
1524
1521
|
id?: string;
|
|
1525
1522
|
is_mobile?: boolean;
|
|
1526
1523
|
join_time?: string;
|
|
@@ -1528,12 +1525,11 @@ export interface ApiUser {
|
|
|
1528
1525
|
location?: string;
|
|
1529
1526
|
metadata?: string;
|
|
1530
1527
|
online?: boolean;
|
|
1531
|
-
steam_id?: string;
|
|
1532
1528
|
timezone?: string;
|
|
1533
1529
|
update_time?: string;
|
|
1534
1530
|
username?: string;
|
|
1531
|
+
mezon_id?: string;
|
|
1535
1532
|
list_nick_names?: Array<string>;
|
|
1536
|
-
wallet_address?: string;
|
|
1537
1533
|
}
|
|
1538
1534
|
/** */
|
|
1539
1535
|
export interface ApiUserActivity {
|
|
@@ -1909,6 +1905,12 @@ export interface ApiIsFollowerRequest {
|
|
|
1909
1905
|
follow_id?: string;
|
|
1910
1906
|
}
|
|
1911
1907
|
/** */
|
|
1908
|
+
export interface ApiLinkAccountConfirmRequest {
|
|
1909
|
+
otp_code?: string;
|
|
1910
|
+
req_id?: string;
|
|
1911
|
+
status?: number;
|
|
1912
|
+
}
|
|
1913
|
+
/** */
|
|
1912
1914
|
export interface ApiIsFollowerResponse {
|
|
1913
1915
|
is_follower?: boolean;
|
|
1914
1916
|
follow_id?: string;
|
|
@@ -1943,9 +1945,11 @@ export declare class MezonApi {
|
|
|
1943
1945
|
/** Authenticate a user with Mezon against the server. */
|
|
1944
1946
|
authenticateMezon(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountMezon, create?: boolean, username?: string, isRemember?: boolean, options?: any): Promise<ApiSession>;
|
|
1945
1947
|
/** Add an email+password to the social profiles on the current user's account. */
|
|
1946
|
-
linkEmail(bearerToken: string, body: ApiAccountEmail, options?: any): Promise<
|
|
1948
|
+
linkEmail(bearerToken: string, body: ApiAccountEmail, options?: any): Promise<ApiLinkAccountConfirmRequest>;
|
|
1947
1949
|
/** Add a mezon ID to the social profiles on the current user's account. */
|
|
1948
|
-
linkMezon(bearerToken: string, body: ApiAccountMezon, options?: any): Promise<
|
|
1950
|
+
linkMezon(bearerToken: string, body: ApiAccountMezon, options?: any): Promise<ApiLinkAccountConfirmRequest>;
|
|
1951
|
+
/** */
|
|
1952
|
+
confirmLinkMezonOTP(bearerToken: string, body: ApiLinkAccountConfirmRequest, options?: any): Promise<any>;
|
|
1949
1953
|
/** Authenticate a user with an email+password against the server. */
|
|
1950
1954
|
registrationEmail(bearerToken: string, body: ApiRegistrationEmailRequest, options?: any): Promise<ApiSession>;
|
|
1951
1955
|
/** Refresh a user's session using a refresh token retrieved from a previous authentication request. */
|
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, ApiAccountEmail, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiNotificationList, ApiUpdateAccountRequest, ApiSession, 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, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiWalletLedgerList, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic, MezonUpdateEventBody, ApiTransactionDetail, MezonapiCreateRoomChannelApps, ApiGenerateMeetTokenRequest, ApiGenerateMeetTokenResponse, ApiMezonOauthClientList, ApiMezonOauthClient, ApiCreateHashChannelAppsResponse, ApiEmojiRecentList, ApiUserEventRequest, ApiUpdateRoleOrderRequest, ApiGenerateMezonMeetResponse, ApiGenerateMeetTokenExternalResponse, ApiUpdateClanOrderRequest, ApiMessage2InboxRequest, ApiListClanDiscover, ApiClanDiscoverRequest, ApiQuickMenuAccessList, ApiQuickMenuAccessRequest, ApiUnlockedItemRequest, ApiForSaleItemList, ApiUnlockedItemResponse, ApiIsFollowerResponse, ApiIsFollowerRequest, ApiTransferOwnershipRequest, ApiMeetParticipantRequest, ApiStoreWalletKeyRequest } from "./api.gen";
|
|
16
|
+
import { ApiAccount, ApiAccountMezon, ApiAccountEmail, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiNotificationList, ApiUpdateAccountRequest, ApiSession, 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, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiWalletLedgerList, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic, MezonUpdateEventBody, ApiTransactionDetail, MezonapiCreateRoomChannelApps, ApiGenerateMeetTokenRequest, ApiGenerateMeetTokenResponse, ApiMezonOauthClientList, ApiMezonOauthClient, ApiCreateHashChannelAppsResponse, ApiEmojiRecentList, ApiUserEventRequest, ApiUpdateRoleOrderRequest, ApiGenerateMezonMeetResponse, ApiGenerateMeetTokenExternalResponse, ApiUpdateClanOrderRequest, ApiMessage2InboxRequest, ApiListClanDiscover, ApiClanDiscoverRequest, ApiQuickMenuAccessList, ApiQuickMenuAccessRequest, ApiUnlockedItemRequest, ApiForSaleItemList, ApiUnlockedItemResponse, ApiIsFollowerResponse, ApiIsFollowerRequest, ApiTransferOwnershipRequest, ApiMeetParticipantRequest, ApiStoreWalletKeyRequest, ApiLinkAccountConfirmRequest } from "./api.gen";
|
|
17
17
|
import { Session } from "./session";
|
|
18
18
|
import { Socket } from "./socket";
|
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
|
@@ -430,8 +430,9 @@ export declare class Client {
|
|
|
430
430
|
getUserProfileOnClan(session: Session, clanId: string): Promise<ApiClanProfile>;
|
|
431
431
|
closeDirectMess(session: Session, request: ApiDeleteChannelDescRequest): Promise<boolean>;
|
|
432
432
|
openDirectMess(session: Session, request: ApiDeleteChannelDescRequest): Promise<boolean>;
|
|
433
|
+
confirmLinkMezonOTP(session: Session, request: ApiLinkAccountConfirmRequest): Promise<any>;
|
|
433
434
|
/** Add a custom ID to the social profiles on the current user's account. */
|
|
434
|
-
linkMezon(session: Session, request: ApiAccountMezon): Promise<
|
|
435
|
+
linkMezon(session: Session, request: ApiAccountMezon): Promise<ApiLinkAccountConfirmRequest>;
|
|
435
436
|
/** Add an email+password to the social profiles on the current user's account. */
|
|
436
437
|
linkEmail(session: Session, request: ApiAccountEmail): Promise<boolean>;
|
|
437
438
|
/** List all friends for the current user. */
|
package/dist/mezon-js.cjs.js
CHANGED
|
@@ -1055,6 +1055,35 @@ var MezonApi = class {
|
|
|
1055
1055
|
)
|
|
1056
1056
|
]);
|
|
1057
1057
|
}
|
|
1058
|
+
/** */
|
|
1059
|
+
confirmLinkMezonOTP(bearerToken, body, options = {}) {
|
|
1060
|
+
if (body === null || body === void 0) {
|
|
1061
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
1062
|
+
}
|
|
1063
|
+
const urlPath = "/v2/account/link/confirm";
|
|
1064
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
1065
|
+
let bodyJson = "";
|
|
1066
|
+
bodyJson = JSON.stringify(body || {});
|
|
1067
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
1068
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
1069
|
+
if (bearerToken) {
|
|
1070
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
1071
|
+
}
|
|
1072
|
+
return Promise.race([
|
|
1073
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
1074
|
+
if (response.status == 204) {
|
|
1075
|
+
return response;
|
|
1076
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
1077
|
+
return response.json();
|
|
1078
|
+
} else {
|
|
1079
|
+
throw response;
|
|
1080
|
+
}
|
|
1081
|
+
}),
|
|
1082
|
+
new Promise(
|
|
1083
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
1084
|
+
)
|
|
1085
|
+
]);
|
|
1086
|
+
}
|
|
1058
1087
|
/** Authenticate a user with an email+password against the server. */
|
|
1059
1088
|
registrationEmail(bearerToken, body, options = {}) {
|
|
1060
1089
|
if (body === null || body === void 0) {
|
|
@@ -8600,14 +8629,10 @@ var Client = class {
|
|
|
8600
8629
|
create_time: u.create_time,
|
|
8601
8630
|
display_name: u.display_name,
|
|
8602
8631
|
edge_count: u.edge_count ? Number(u.edge_count) : 0,
|
|
8603
|
-
facebook_id: u.facebook_id,
|
|
8604
|
-
gamecenter_id: u.gamecenter_id,
|
|
8605
|
-
google_id: u.google_id,
|
|
8606
8632
|
id: u.id,
|
|
8607
8633
|
lang_tag: u.lang_tag,
|
|
8608
8634
|
location: u.location,
|
|
8609
8635
|
online: u.online,
|
|
8610
|
-
steam_id: u.steam_id,
|
|
8611
8636
|
timezone: u.timezone,
|
|
8612
8637
|
update_time: u.update_time,
|
|
8613
8638
|
username: u.username,
|
|
@@ -8855,15 +8880,11 @@ var Client = class {
|
|
|
8855
8880
|
create_time: gu.user.create_time,
|
|
8856
8881
|
display_name: gu.user.display_name,
|
|
8857
8882
|
edge_count: gu.user.edge_count ? Number(gu.user.edge_count) : 0,
|
|
8858
|
-
facebook_id: gu.user.facebook_id,
|
|
8859
|
-
gamecenter_id: gu.user.gamecenter_id,
|
|
8860
|
-
google_id: gu.user.google_id,
|
|
8861
8883
|
id: gu.user.id,
|
|
8862
8884
|
lang_tag: gu.user.lang_tag,
|
|
8863
8885
|
location: gu.user.location,
|
|
8864
8886
|
online: gu.user.online,
|
|
8865
8887
|
is_mobile: (_a = gu.user) == null ? void 0 : _a.is_mobile,
|
|
8866
|
-
steam_id: gu.user.steam_id,
|
|
8867
8888
|
timezone: gu.user.timezone,
|
|
8868
8889
|
update_time: gu.user.update_time,
|
|
8869
8890
|
username: gu.user.username,
|
|
@@ -9028,6 +9049,16 @@ var Client = class {
|
|
|
9028
9049
|
});
|
|
9029
9050
|
});
|
|
9030
9051
|
}
|
|
9052
|
+
confirmLinkMezonOTP(session, request) {
|
|
9053
|
+
return __async(this, null, function* () {
|
|
9054
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
9055
|
+
yield this.sessionRefresh(session);
|
|
9056
|
+
}
|
|
9057
|
+
return this.apiClient.confirmLinkMezonOTP(session.token, request).then((response) => {
|
|
9058
|
+
return response !== void 0;
|
|
9059
|
+
});
|
|
9060
|
+
});
|
|
9061
|
+
}
|
|
9031
9062
|
/** Add a custom ID to the social profiles on the current user's account. */
|
|
9032
9063
|
linkMezon(session, request) {
|
|
9033
9064
|
return __async(this, null, function* () {
|
|
@@ -9035,7 +9066,7 @@ var Client = class {
|
|
|
9035
9066
|
yield this.sessionRefresh(session);
|
|
9036
9067
|
}
|
|
9037
9068
|
return this.apiClient.linkMezon(session.token, request).then((response) => {
|
|
9038
|
-
return response
|
|
9069
|
+
return Promise.resolve(response);
|
|
9039
9070
|
});
|
|
9040
9071
|
});
|
|
9041
9072
|
}
|
|
@@ -9072,14 +9103,10 @@ var Client = class {
|
|
|
9072
9103
|
create_time: f.user.create_time,
|
|
9073
9104
|
display_name: f.user.display_name,
|
|
9074
9105
|
edge_count: f.user.edge_count ? Number(f.user.edge_count) : 0,
|
|
9075
|
-
facebook_id: f.user.facebook_id,
|
|
9076
|
-
gamecenter_id: f.user.gamecenter_id,
|
|
9077
|
-
google_id: f.user.google_id,
|
|
9078
9106
|
id: f.user.id,
|
|
9079
9107
|
lang_tag: f.user.lang_tag,
|
|
9080
9108
|
location: f.user.location,
|
|
9081
9109
|
online: f.user.online,
|
|
9082
|
-
steam_id: f.user.steam_id,
|
|
9083
9110
|
timezone: f.user.timezone,
|
|
9084
9111
|
update_time: f.user.update_time,
|
|
9085
9112
|
username: f.user.username,
|
package/dist/mezon-js.esm.mjs
CHANGED
|
@@ -1021,6 +1021,35 @@ var MezonApi = class {
|
|
|
1021
1021
|
)
|
|
1022
1022
|
]);
|
|
1023
1023
|
}
|
|
1024
|
+
/** */
|
|
1025
|
+
confirmLinkMezonOTP(bearerToken, body, options = {}) {
|
|
1026
|
+
if (body === null || body === void 0) {
|
|
1027
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
1028
|
+
}
|
|
1029
|
+
const urlPath = "/v2/account/link/confirm";
|
|
1030
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
1031
|
+
let bodyJson = "";
|
|
1032
|
+
bodyJson = JSON.stringify(body || {});
|
|
1033
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
1034
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
1035
|
+
if (bearerToken) {
|
|
1036
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
1037
|
+
}
|
|
1038
|
+
return Promise.race([
|
|
1039
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
1040
|
+
if (response.status == 204) {
|
|
1041
|
+
return response;
|
|
1042
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
1043
|
+
return response.json();
|
|
1044
|
+
} else {
|
|
1045
|
+
throw response;
|
|
1046
|
+
}
|
|
1047
|
+
}),
|
|
1048
|
+
new Promise(
|
|
1049
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
1050
|
+
)
|
|
1051
|
+
]);
|
|
1052
|
+
}
|
|
1024
1053
|
/** Authenticate a user with an email+password against the server. */
|
|
1025
1054
|
registrationEmail(bearerToken, body, options = {}) {
|
|
1026
1055
|
if (body === null || body === void 0) {
|
|
@@ -8566,14 +8595,10 @@ var Client = class {
|
|
|
8566
8595
|
create_time: u.create_time,
|
|
8567
8596
|
display_name: u.display_name,
|
|
8568
8597
|
edge_count: u.edge_count ? Number(u.edge_count) : 0,
|
|
8569
|
-
facebook_id: u.facebook_id,
|
|
8570
|
-
gamecenter_id: u.gamecenter_id,
|
|
8571
|
-
google_id: u.google_id,
|
|
8572
8598
|
id: u.id,
|
|
8573
8599
|
lang_tag: u.lang_tag,
|
|
8574
8600
|
location: u.location,
|
|
8575
8601
|
online: u.online,
|
|
8576
|
-
steam_id: u.steam_id,
|
|
8577
8602
|
timezone: u.timezone,
|
|
8578
8603
|
update_time: u.update_time,
|
|
8579
8604
|
username: u.username,
|
|
@@ -8821,15 +8846,11 @@ var Client = class {
|
|
|
8821
8846
|
create_time: gu.user.create_time,
|
|
8822
8847
|
display_name: gu.user.display_name,
|
|
8823
8848
|
edge_count: gu.user.edge_count ? Number(gu.user.edge_count) : 0,
|
|
8824
|
-
facebook_id: gu.user.facebook_id,
|
|
8825
|
-
gamecenter_id: gu.user.gamecenter_id,
|
|
8826
|
-
google_id: gu.user.google_id,
|
|
8827
8849
|
id: gu.user.id,
|
|
8828
8850
|
lang_tag: gu.user.lang_tag,
|
|
8829
8851
|
location: gu.user.location,
|
|
8830
8852
|
online: gu.user.online,
|
|
8831
8853
|
is_mobile: (_a = gu.user) == null ? void 0 : _a.is_mobile,
|
|
8832
|
-
steam_id: gu.user.steam_id,
|
|
8833
8854
|
timezone: gu.user.timezone,
|
|
8834
8855
|
update_time: gu.user.update_time,
|
|
8835
8856
|
username: gu.user.username,
|
|
@@ -8994,6 +9015,16 @@ var Client = class {
|
|
|
8994
9015
|
});
|
|
8995
9016
|
});
|
|
8996
9017
|
}
|
|
9018
|
+
confirmLinkMezonOTP(session, request) {
|
|
9019
|
+
return __async(this, null, function* () {
|
|
9020
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
9021
|
+
yield this.sessionRefresh(session);
|
|
9022
|
+
}
|
|
9023
|
+
return this.apiClient.confirmLinkMezonOTP(session.token, request).then((response) => {
|
|
9024
|
+
return response !== void 0;
|
|
9025
|
+
});
|
|
9026
|
+
});
|
|
9027
|
+
}
|
|
8997
9028
|
/** Add a custom ID to the social profiles on the current user's account. */
|
|
8998
9029
|
linkMezon(session, request) {
|
|
8999
9030
|
return __async(this, null, function* () {
|
|
@@ -9001,7 +9032,7 @@ var Client = class {
|
|
|
9001
9032
|
yield this.sessionRefresh(session);
|
|
9002
9033
|
}
|
|
9003
9034
|
return this.apiClient.linkMezon(session.token, request).then((response) => {
|
|
9004
|
-
return response
|
|
9035
|
+
return Promise.resolve(response);
|
|
9005
9036
|
});
|
|
9006
9037
|
});
|
|
9007
9038
|
}
|
|
@@ -9038,14 +9069,10 @@ var Client = class {
|
|
|
9038
9069
|
create_time: f.user.create_time,
|
|
9039
9070
|
display_name: f.user.display_name,
|
|
9040
9071
|
edge_count: f.user.edge_count ? Number(f.user.edge_count) : 0,
|
|
9041
|
-
facebook_id: f.user.facebook_id,
|
|
9042
|
-
gamecenter_id: f.user.gamecenter_id,
|
|
9043
|
-
google_id: f.user.google_id,
|
|
9044
9072
|
id: f.user.id,
|
|
9045
9073
|
lang_tag: f.user.lang_tag,
|
|
9046
9074
|
location: f.user.location,
|
|
9047
9075
|
online: f.user.online,
|
|
9048
|
-
steam_id: f.user.steam_id,
|
|
9049
9076
|
timezone: f.user.timezone,
|
|
9050
9077
|
update_time: f.user.update_time,
|
|
9051
9078
|
username: f.user.username,
|