mezon-js 2.7.52 → 2.7.54
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +51 -0
- package/client.ts +14 -0
- package/dist/api.gen.d.ts +9 -0
- package/dist/client.d.ts +3 -1
- package/dist/mezon-js.cjs.js +40 -0
- package/dist/mezon-js.esm.mjs +40 -0
- package/dist/socket.d.ts +1 -0
- package/package.json +1 -1
- package/socket.ts +2 -0
package/api.gen.ts
CHANGED
@@ -386,6 +386,16 @@ export interface ApiClanUserList {
|
|
386
386
|
cursor?: string;
|
387
387
|
}
|
388
388
|
|
389
|
+
/** A collection of zero or more friends of the user. */
|
390
|
+
export interface ApiCommonToUsersList {
|
391
|
+
//The Clan objects.
|
392
|
+
clandesc?: Array<ApiClanDesc>;
|
393
|
+
//Cursor for the next page of results, if any.
|
394
|
+
cursor?: string;
|
395
|
+
//The Friend objects.
|
396
|
+
friends?: Array<ApiFriend>;
|
397
|
+
}
|
398
|
+
|
389
399
|
/** */
|
390
400
|
export interface ApiCreateCategoryDescRequest {
|
391
401
|
//
|
@@ -1201,6 +1211,8 @@ export interface ApiUser {
|
|
1201
1211
|
google_id?: string;
|
1202
1212
|
//The id of the user's account.
|
1203
1213
|
id?: string;
|
1214
|
+
//
|
1215
|
+
join_time?: string;
|
1204
1216
|
//The language expected to be a tag which follows the BCP-47 spec.
|
1205
1217
|
lang_tag?: string;
|
1206
1218
|
//The location set by the user.
|
@@ -3272,6 +3284,45 @@ export class MezonApi {
|
|
3272
3284
|
]);
|
3273
3285
|
}
|
3274
3286
|
|
3287
|
+
/** List common friends for the current user. */
|
3288
|
+
listCommonToUsers(bearerToken: string,
|
3289
|
+
limit?:number,
|
3290
|
+
state?:number,
|
3291
|
+
cursor?:string,
|
3292
|
+
friendId?:string,
|
3293
|
+
options: any = {}): Promise<ApiCommonToUsersList> {
|
3294
|
+
|
3295
|
+
const urlPath = "/v2/commonfriend";
|
3296
|
+
const queryParams = new Map<string, any>();
|
3297
|
+
queryParams.set("limit", limit);
|
3298
|
+
queryParams.set("state", state);
|
3299
|
+
queryParams.set("cursor", cursor);
|
3300
|
+
queryParams.set("friend_id", friendId);
|
3301
|
+
|
3302
|
+
let bodyJson : string = "";
|
3303
|
+
|
3304
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3305
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
3306
|
+
if (bearerToken) {
|
3307
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3308
|
+
}
|
3309
|
+
|
3310
|
+
return Promise.race([
|
3311
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3312
|
+
if (response.status == 204) {
|
3313
|
+
return response;
|
3314
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3315
|
+
return response.json();
|
3316
|
+
} else {
|
3317
|
+
throw response;
|
3318
|
+
}
|
3319
|
+
}),
|
3320
|
+
new Promise((_, reject) =>
|
3321
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3322
|
+
),
|
3323
|
+
]);
|
3324
|
+
}
|
3325
|
+
|
3275
3326
|
/** */
|
3276
3327
|
createCategoryDesc(bearerToken: string,
|
3277
3328
|
body:ApiCreateCategoryDescRequest,
|
package/client.ts
CHANGED
@@ -94,6 +94,7 @@ import {
|
|
94
94
|
ApiWebhookResponse,
|
95
95
|
ApiDeleteChannelDescRequest,
|
96
96
|
ApiChangeChannelPrivateRequest,
|
97
|
+
ApiCommonToUsersList,
|
97
98
|
} from "./api.gen";
|
98
99
|
|
99
100
|
import { Session } from "./session";
|
@@ -1960,6 +1961,19 @@ export class Client {
|
|
1960
1961
|
|
1961
1962
|
});
|
1962
1963
|
}
|
1964
|
+
|
1965
|
+
/** */
|
1966
|
+
async listCommonToUsers(session: Session, userId?: string, state?: number, limit?: number, cursor?: string): Promise<ApiCommonToUsersList> {
|
1967
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
1968
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
1969
|
+
await this.sessionRefresh(session);
|
1970
|
+
}
|
1971
|
+
|
1972
|
+
return this.apiClient.listCommonToUsers(session.token, limit, state, cursor, userId).then((response: ApiCommonToUsersList) => {
|
1973
|
+
return Promise.resolve(response);
|
1974
|
+
|
1975
|
+
});
|
1976
|
+
}
|
1963
1977
|
|
1964
1978
|
/** Get permission of user in the clan */
|
1965
1979
|
async GetPermissionOfUserInTheClan(session: Session, clanId:string): Promise<ApiPermissionList> {
|
package/dist/api.gen.d.ts
CHANGED
@@ -220,6 +220,12 @@ export interface ApiClanUserList {
|
|
220
220
|
clan_users?: Array<ClanUserListClanUser>;
|
221
221
|
cursor?: string;
|
222
222
|
}
|
223
|
+
/** A collection of zero or more friends of the user. */
|
224
|
+
export interface ApiCommonToUsersList {
|
225
|
+
clandesc?: Array<ApiClanDesc>;
|
226
|
+
cursor?: string;
|
227
|
+
friends?: Array<ApiFriend>;
|
228
|
+
}
|
223
229
|
/** */
|
224
230
|
export interface ApiCreateCategoryDescRequest {
|
225
231
|
category_name?: string;
|
@@ -694,6 +700,7 @@ export interface ApiUser {
|
|
694
700
|
gamecenter_id?: string;
|
695
701
|
google_id?: string;
|
696
702
|
id?: string;
|
703
|
+
join_time?: string;
|
697
704
|
lang_tag?: string;
|
698
705
|
location?: string;
|
699
706
|
metadata?: string;
|
@@ -857,6 +864,8 @@ export declare class MezonApi {
|
|
857
864
|
getClanDescProfile(bearerToken: string, clanId: string, options?: any): Promise<ApiClanDescProfile>;
|
858
865
|
/** Update fields in a given clan profile. */
|
859
866
|
updateClanDescProfile(bearerToken: string, clanId: string, body: {}, options?: any): Promise<any>;
|
867
|
+
/** List common friends for the current user. */
|
868
|
+
listCommonToUsers(bearerToken: string, limit?: number, state?: number, cursor?: string, friendId?: string, options?: any): Promise<ApiCommonToUsersList>;
|
860
869
|
/** */
|
861
870
|
createCategoryDesc(bearerToken: string, body: ApiCreateCategoryDescRequest, options?: any): Promise<ApiCategoryDesc>;
|
862
871
|
/** */
|
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, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiCreateWebhookRequest, ApiWebhookResponse, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest } from "./api.gen";
|
16
|
+
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiCreateWebhookRequest, ApiWebhookResponse, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiCommonToUsersList } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -541,6 +541,8 @@ export declare class Client {
|
|
541
541
|
createLinkInviteUser(session: Session, request: ApiLinkInviteUserRequest): Promise<ApiLinkInviteUser>;
|
542
542
|
/** Get link invite user */
|
543
543
|
getLinkInvite(session: Session, inviteId: string): Promise<ApiInviteUserRes>;
|
544
|
+
/** */
|
545
|
+
listCommonToUsers(session: Session, userId?: string, state?: number, limit?: number, cursor?: string): Promise<ApiCommonToUsersList>;
|
544
546
|
/** Get permission of user in the clan */
|
545
547
|
GetPermissionOfUserInTheClan(session: Session, clanId: string): Promise<ApiPermissionList>;
|
546
548
|
/** invite user */
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -2189,6 +2189,35 @@ var MezonApi = class {
|
|
2189
2189
|
)
|
2190
2190
|
]);
|
2191
2191
|
}
|
2192
|
+
/** List common friends for the current user. */
|
2193
|
+
listCommonToUsers(bearerToken, limit, state, cursor, friendId, options = {}) {
|
2194
|
+
const urlPath = "/v2/commonfriend";
|
2195
|
+
const queryParams = /* @__PURE__ */ new Map();
|
2196
|
+
queryParams.set("limit", limit);
|
2197
|
+
queryParams.set("state", state);
|
2198
|
+
queryParams.set("cursor", cursor);
|
2199
|
+
queryParams.set("friend_id", friendId);
|
2200
|
+
let bodyJson = "";
|
2201
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2202
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
2203
|
+
if (bearerToken) {
|
2204
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2205
|
+
}
|
2206
|
+
return Promise.race([
|
2207
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2208
|
+
if (response.status == 204) {
|
2209
|
+
return response;
|
2210
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2211
|
+
return response.json();
|
2212
|
+
} else {
|
2213
|
+
throw response;
|
2214
|
+
}
|
2215
|
+
}),
|
2216
|
+
new Promise(
|
2217
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2218
|
+
)
|
2219
|
+
]);
|
2220
|
+
}
|
2192
2221
|
/** */
|
2193
2222
|
createCategoryDesc(bearerToken, body, options = {}) {
|
2194
2223
|
if (body === null || body === void 0) {
|
@@ -6004,6 +6033,17 @@ var Client = class {
|
|
6004
6033
|
});
|
6005
6034
|
});
|
6006
6035
|
}
|
6036
|
+
/** */
|
6037
|
+
listCommonToUsers(session, userId, state, limit, cursor) {
|
6038
|
+
return __async(this, null, function* () {
|
6039
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6040
|
+
yield this.sessionRefresh(session);
|
6041
|
+
}
|
6042
|
+
return this.apiClient.listCommonToUsers(session.token, limit, state, cursor, userId).then((response) => {
|
6043
|
+
return Promise.resolve(response);
|
6044
|
+
});
|
6045
|
+
});
|
6046
|
+
}
|
6007
6047
|
/** Get permission of user in the clan */
|
6008
6048
|
GetPermissionOfUserInTheClan(session, clanId) {
|
6009
6049
|
return __async(this, null, function* () {
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -2160,6 +2160,35 @@ var MezonApi = class {
|
|
2160
2160
|
)
|
2161
2161
|
]);
|
2162
2162
|
}
|
2163
|
+
/** List common friends for the current user. */
|
2164
|
+
listCommonToUsers(bearerToken, limit, state, cursor, friendId, options = {}) {
|
2165
|
+
const urlPath = "/v2/commonfriend";
|
2166
|
+
const queryParams = /* @__PURE__ */ new Map();
|
2167
|
+
queryParams.set("limit", limit);
|
2168
|
+
queryParams.set("state", state);
|
2169
|
+
queryParams.set("cursor", cursor);
|
2170
|
+
queryParams.set("friend_id", friendId);
|
2171
|
+
let bodyJson = "";
|
2172
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2173
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
2174
|
+
if (bearerToken) {
|
2175
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2176
|
+
}
|
2177
|
+
return Promise.race([
|
2178
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2179
|
+
if (response.status == 204) {
|
2180
|
+
return response;
|
2181
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2182
|
+
return response.json();
|
2183
|
+
} else {
|
2184
|
+
throw response;
|
2185
|
+
}
|
2186
|
+
}),
|
2187
|
+
new Promise(
|
2188
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2189
|
+
)
|
2190
|
+
]);
|
2191
|
+
}
|
2163
2192
|
/** */
|
2164
2193
|
createCategoryDesc(bearerToken, body, options = {}) {
|
2165
2194
|
if (body === null || body === void 0) {
|
@@ -5975,6 +6004,17 @@ var Client = class {
|
|
5975
6004
|
});
|
5976
6005
|
});
|
5977
6006
|
}
|
6007
|
+
/** */
|
6008
|
+
listCommonToUsers(session, userId, state, limit, cursor) {
|
6009
|
+
return __async(this, null, function* () {
|
6010
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6011
|
+
yield this.sessionRefresh(session);
|
6012
|
+
}
|
6013
|
+
return this.apiClient.listCommonToUsers(session.token, limit, state, cursor, userId).then((response) => {
|
6014
|
+
return Promise.resolve(response);
|
6015
|
+
});
|
6016
|
+
});
|
6017
|
+
}
|
5978
6018
|
/** Get permission of user in the clan */
|
5979
6019
|
GetPermissionOfUserInTheClan(session, clanId) {
|
5980
6020
|
return __async(this, null, function* () {
|
package/dist/socket.d.ts
CHANGED
package/package.json
CHANGED