mezon-js 2.13.14 → 2.13.16
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 +42 -1
- package/client.ts +19 -6
- package/dist/api.gen.d.ts +7 -1
- package/dist/client.d.ts +4 -2
- package/dist/mezon-js.cjs.js +39 -3
- package/dist/mezon-js.esm.mjs +39 -3
- package/package.json +1 -1
package/api.gen.ts
CHANGED
@@ -1359,6 +1359,11 @@ export interface ApiEmojiRecent {
|
|
1359
1359
|
update_time?: string;
|
1360
1360
|
}
|
1361
1361
|
|
1362
|
+
export interface ApiAddFriendsResponse {
|
1363
|
+
ids?: Array<string>;
|
1364
|
+
usernames?: Array<string>;
|
1365
|
+
}
|
1366
|
+
|
1362
1367
|
/** */
|
1363
1368
|
export interface ApiEventList {
|
1364
1369
|
//A list of event.
|
@@ -6636,7 +6641,7 @@ export class MezonApi {
|
|
6636
6641
|
ids?: Array<string>,
|
6637
6642
|
usernames?: Array<string>,
|
6638
6643
|
options: any = {}
|
6639
|
-
): Promise<
|
6644
|
+
): Promise<ApiAddFriendsResponse> {
|
6640
6645
|
const urlPath = "/v2/friend";
|
6641
6646
|
const queryParams = new Map<string, any>();
|
6642
6647
|
queryParams.set("ids", ids);
|
@@ -9501,6 +9506,42 @@ export class MezonApi {
|
|
9501
9506
|
]);
|
9502
9507
|
}
|
9503
9508
|
|
9509
|
+
/** Upload attachment */
|
9510
|
+
uploadOauthFile(bearerToken: string,
|
9511
|
+
body:ApiUploadAttachmentRequest,
|
9512
|
+
options: any = {}): Promise<ApiUploadAttachment> {
|
9513
|
+
|
9514
|
+
if (body === null || body === undefined) {
|
9515
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
9516
|
+
}
|
9517
|
+
const urlPath = "/v2/uploadoauthfile";
|
9518
|
+
const queryParams = new Map<string, any>();
|
9519
|
+
|
9520
|
+
let bodyJson : string = "";
|
9521
|
+
bodyJson = JSON.stringify(body || {});
|
9522
|
+
|
9523
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
9524
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
9525
|
+
if (bearerToken) {
|
9526
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
9527
|
+
}
|
9528
|
+
|
9529
|
+
return Promise.race([
|
9530
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
9531
|
+
if (response.status == 204) {
|
9532
|
+
return response;
|
9533
|
+
} else if (response.status >= 200 && response.status < 300) {
|
9534
|
+
return response.json();
|
9535
|
+
} else {
|
9536
|
+
throw response;
|
9537
|
+
}
|
9538
|
+
}),
|
9539
|
+
new Promise((_, reject) =>
|
9540
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
9541
|
+
),
|
9542
|
+
]);
|
9543
|
+
}
|
9544
|
+
|
9504
9545
|
/** Upload attachment */
|
9505
9546
|
uploadAttachmentFile(
|
9506
9547
|
bearerToken: string,
|
package/client.ts
CHANGED
@@ -177,6 +177,7 @@ import {
|
|
177
177
|
ApiUser,
|
178
178
|
ApiFriend,
|
179
179
|
ApiListClanUnreadMsgIndicatorResponse,
|
180
|
+
ApiAddFriendsResponse,
|
180
181
|
} from "./api.gen";
|
181
182
|
|
182
183
|
import { Session } from "./session";
|
@@ -641,7 +642,7 @@ export class Client {
|
|
641
642
|
session: Session,
|
642
643
|
ids?: Array<string>,
|
643
644
|
usernames?: Array<string>
|
644
|
-
): Promise<
|
645
|
+
): Promise<ApiAddFriendsResponse> {
|
645
646
|
if (
|
646
647
|
this.autoRefreshSession &&
|
647
648
|
session.refresh_token &&
|
@@ -650,11 +651,7 @@ export class Client {
|
|
650
651
|
await this.sessionRefresh(session);
|
651
652
|
}
|
652
653
|
|
653
|
-
return this.apiClient
|
654
|
-
.addFriends(session.token, ids, usernames)
|
655
|
-
.then((response: any) => {
|
656
|
-
return response !== undefined;
|
657
|
-
});
|
654
|
+
return this.apiClient.addFriends(session.token, ids, usernames);
|
658
655
|
}
|
659
656
|
|
660
657
|
/** Block one or more users by ID or username. */
|
@@ -699,6 +696,22 @@ export class Client {
|
|
699
696
|
});
|
700
697
|
}
|
701
698
|
|
699
|
+
/** Create a new group with the current user as the creator and superadmin. */
|
700
|
+
async uploadOauthFile(
|
701
|
+
session: Session,
|
702
|
+
request: ApiUploadAttachmentRequest
|
703
|
+
): Promise<ApiUploadAttachment> {
|
704
|
+
if (
|
705
|
+
this.autoRefreshSession &&
|
706
|
+
session.refresh_token &&
|
707
|
+
session.isexpired(Date.now() / 1000)
|
708
|
+
) {
|
709
|
+
await this.sessionRefresh(session);
|
710
|
+
}
|
711
|
+
|
712
|
+
return this.apiClient.uploadOauthFile(session.token, request);
|
713
|
+
}
|
714
|
+
|
702
715
|
/** Create a new group with the current user as the creator and superadmin. */
|
703
716
|
async uploadAttachmentFile(
|
704
717
|
session: Session,
|
package/dist/api.gen.d.ts
CHANGED
@@ -770,6 +770,10 @@ export interface ApiEmojiRecent {
|
|
770
770
|
emoji_id?: string;
|
771
771
|
update_time?: string;
|
772
772
|
}
|
773
|
+
export interface ApiAddFriendsResponse {
|
774
|
+
ids?: Array<string>;
|
775
|
+
usernames?: Array<string>;
|
776
|
+
}
|
773
777
|
/** */
|
774
778
|
export interface ApiEventList {
|
775
779
|
events?: Array<ApiEventManagement>;
|
@@ -2119,7 +2123,7 @@ export declare class MezonApi {
|
|
2119
2123
|
/** List all friends for the current user. */
|
2120
2124
|
listFriends(bearerToken: string, limit?: number, state?: number, cursor?: string, options?: any): Promise<ApiFriendList>;
|
2121
2125
|
/** Add friends by ID or username to a user's account. */
|
2122
|
-
addFriends(bearerToken: string, ids?: Array<string>, usernames?: Array<string>, options?: any): Promise<
|
2126
|
+
addFriends(bearerToken: string, ids?: Array<string>, usernames?: Array<string>, options?: any): Promise<ApiAddFriendsResponse>;
|
2123
2127
|
/** Block one or more users by ID or username. */
|
2124
2128
|
blockFriends(bearerToken: string, ids?: Array<string>, usernames?: Array<string>, options?: any): Promise<any>;
|
2125
2129
|
/** Block one or more users by ID or username. */
|
@@ -2265,6 +2269,8 @@ export declare class MezonApi {
|
|
2265
2269
|
/** */
|
2266
2270
|
updateUserProfileByClan(bearerToken: string, clanId: string, body: MezonUpdateUserProfileByClanBody, options?: any): Promise<any>;
|
2267
2271
|
/** Upload attachment */
|
2272
|
+
uploadOauthFile(bearerToken: string, body: ApiUploadAttachmentRequest, options?: any): Promise<ApiUploadAttachment>;
|
2273
|
+
/** Upload attachment */
|
2268
2274
|
uploadAttachmentFile(bearerToken: string, body: ApiUploadAttachmentRequest, options?: any): Promise<ApiUploadAttachment>;
|
2269
2275
|
/** */
|
2270
2276
|
updateUser(bearerToken: string, body: ApiUpdateUsersRequest, options?: any): Promise<any>;
|
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, ApiLinkAccountConfirmRequest, ApiLinkAccountMezon, ApiUser, ApiFriend, ApiListClanUnreadMsgIndicatorResponse } 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, ApiLinkAccountMezon, ApiUser, ApiFriend, ApiListClanUnreadMsgIndicatorResponse, ApiAddFriendsResponse } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -252,12 +252,14 @@ export declare class Client {
|
|
252
252
|
/** Add users to a channel, or accept their join requests. */
|
253
253
|
addChannelUsers(session: Session, channelId: string, ids?: Array<string>): Promise<boolean>;
|
254
254
|
/** Add friends by ID or username to a user's account. */
|
255
|
-
addFriends(session: Session, ids?: Array<string>, usernames?: Array<string>): Promise<
|
255
|
+
addFriends(session: Session, ids?: Array<string>, usernames?: Array<string>): Promise<ApiAddFriendsResponse>;
|
256
256
|
/** Block one or more users by ID or username. */
|
257
257
|
blockFriends(session: Session, ids?: Array<string>, usernames?: Array<string>): Promise<boolean>;
|
258
258
|
/** Block one or more users by ID or username. */
|
259
259
|
unblockFriends(session: Session, ids?: Array<string>, usernames?: Array<string>): Promise<boolean>;
|
260
260
|
/** Create a new group with the current user as the creator and superadmin. */
|
261
|
+
uploadOauthFile(session: Session, request: ApiUploadAttachmentRequest): Promise<ApiUploadAttachment>;
|
262
|
+
/** Create a new group with the current user as the creator and superadmin. */
|
261
263
|
uploadAttachmentFile(session: Session, request: ApiUploadAttachmentRequest): Promise<ApiUploadAttachment>;
|
262
264
|
/** Create a channel within clan */
|
263
265
|
createChannelDesc(session: Session, request: ApiCreateChannelDescRequest): Promise<ApiChannelDescription>;
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -5479,6 +5479,35 @@ var MezonApi = class {
|
|
5479
5479
|
]);
|
5480
5480
|
}
|
5481
5481
|
/** Upload attachment */
|
5482
|
+
uploadOauthFile(bearerToken, body, options = {}) {
|
5483
|
+
if (body === null || body === void 0) {
|
5484
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
5485
|
+
}
|
5486
|
+
const urlPath = "/v2/uploadoauthfile";
|
5487
|
+
const queryParams = /* @__PURE__ */ new Map();
|
5488
|
+
let bodyJson = "";
|
5489
|
+
bodyJson = JSON.stringify(body || {});
|
5490
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
5491
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
5492
|
+
if (bearerToken) {
|
5493
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
5494
|
+
}
|
5495
|
+
return Promise.race([
|
5496
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
5497
|
+
if (response.status == 204) {
|
5498
|
+
return response;
|
5499
|
+
} else if (response.status >= 200 && response.status < 300) {
|
5500
|
+
return response.json();
|
5501
|
+
} else {
|
5502
|
+
throw response;
|
5503
|
+
}
|
5504
|
+
}),
|
5505
|
+
new Promise(
|
5506
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
5507
|
+
)
|
5508
|
+
]);
|
5509
|
+
}
|
5510
|
+
/** Upload attachment */
|
5482
5511
|
uploadAttachmentFile(bearerToken, body, options = {}) {
|
5483
5512
|
if (body === null || body === void 0) {
|
5484
5513
|
throw new Error(
|
@@ -8484,9 +8513,7 @@ var Client = class {
|
|
8484
8513
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
8485
8514
|
yield this.sessionRefresh(session);
|
8486
8515
|
}
|
8487
|
-
return this.apiClient.addFriends(session.token, ids, usernames)
|
8488
|
-
return response !== void 0;
|
8489
|
-
});
|
8516
|
+
return this.apiClient.addFriends(session.token, ids, usernames);
|
8490
8517
|
});
|
8491
8518
|
}
|
8492
8519
|
/** Block one or more users by ID or username. */
|
@@ -8512,6 +8539,15 @@ var Client = class {
|
|
8512
8539
|
});
|
8513
8540
|
}
|
8514
8541
|
/** Create a new group with the current user as the creator and superadmin. */
|
8542
|
+
uploadOauthFile(session, request) {
|
8543
|
+
return __async(this, null, function* () {
|
8544
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
8545
|
+
yield this.sessionRefresh(session);
|
8546
|
+
}
|
8547
|
+
return this.apiClient.uploadOauthFile(session.token, request);
|
8548
|
+
});
|
8549
|
+
}
|
8550
|
+
/** Create a new group with the current user as the creator and superadmin. */
|
8515
8551
|
uploadAttachmentFile(session, request) {
|
8516
8552
|
return __async(this, null, function* () {
|
8517
8553
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -5445,6 +5445,35 @@ var MezonApi = class {
|
|
5445
5445
|
]);
|
5446
5446
|
}
|
5447
5447
|
/** Upload attachment */
|
5448
|
+
uploadOauthFile(bearerToken, body, options = {}) {
|
5449
|
+
if (body === null || body === void 0) {
|
5450
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
5451
|
+
}
|
5452
|
+
const urlPath = "/v2/uploadoauthfile";
|
5453
|
+
const queryParams = /* @__PURE__ */ new Map();
|
5454
|
+
let bodyJson = "";
|
5455
|
+
bodyJson = JSON.stringify(body || {});
|
5456
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
5457
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
5458
|
+
if (bearerToken) {
|
5459
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
5460
|
+
}
|
5461
|
+
return Promise.race([
|
5462
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
5463
|
+
if (response.status == 204) {
|
5464
|
+
return response;
|
5465
|
+
} else if (response.status >= 200 && response.status < 300) {
|
5466
|
+
return response.json();
|
5467
|
+
} else {
|
5468
|
+
throw response;
|
5469
|
+
}
|
5470
|
+
}),
|
5471
|
+
new Promise(
|
5472
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
5473
|
+
)
|
5474
|
+
]);
|
5475
|
+
}
|
5476
|
+
/** Upload attachment */
|
5448
5477
|
uploadAttachmentFile(bearerToken, body, options = {}) {
|
5449
5478
|
if (body === null || body === void 0) {
|
5450
5479
|
throw new Error(
|
@@ -8450,9 +8479,7 @@ var Client = class {
|
|
8450
8479
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
8451
8480
|
yield this.sessionRefresh(session);
|
8452
8481
|
}
|
8453
|
-
return this.apiClient.addFriends(session.token, ids, usernames)
|
8454
|
-
return response !== void 0;
|
8455
|
-
});
|
8482
|
+
return this.apiClient.addFriends(session.token, ids, usernames);
|
8456
8483
|
});
|
8457
8484
|
}
|
8458
8485
|
/** Block one or more users by ID or username. */
|
@@ -8478,6 +8505,15 @@ var Client = class {
|
|
8478
8505
|
});
|
8479
8506
|
}
|
8480
8507
|
/** Create a new group with the current user as the creator and superadmin. */
|
8508
|
+
uploadOauthFile(session, request) {
|
8509
|
+
return __async(this, null, function* () {
|
8510
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
8511
|
+
yield this.sessionRefresh(session);
|
8512
|
+
}
|
8513
|
+
return this.apiClient.uploadOauthFile(session.token, request);
|
8514
|
+
});
|
8515
|
+
}
|
8516
|
+
/** Create a new group with the current user as the creator and superadmin. */
|
8481
8517
|
uploadAttachmentFile(session, request) {
|
8482
8518
|
return __async(this, null, function* () {
|
8483
8519
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|