mezon-js 2.7.34 → 2.7.36
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +134 -0
- package/client.ts +40 -2
- package/dist/api.gen.d.ts +25 -0
- package/dist/client.d.ts +5 -1
- package/dist/mezon-js.cjs.js +115 -2
- package/dist/mezon-js.esm.mjs +115 -2
- package/package.json +1 -1
- package/dist/dist.zip +0 -0
package/api.gen.ts
CHANGED
@@ -799,6 +799,38 @@ export interface ApiPermissionList {
|
|
799
799
|
permissions?: Array<ApiPermission>;
|
800
800
|
}
|
801
801
|
|
802
|
+
/** */
|
803
|
+
export interface ApiPinMessage {
|
804
|
+
//
|
805
|
+
avatar?: string;
|
806
|
+
//
|
807
|
+
channel_id?: string;
|
808
|
+
//
|
809
|
+
content?: string;
|
810
|
+
//
|
811
|
+
id?: string;
|
812
|
+
//
|
813
|
+
message_id?: string;
|
814
|
+
//
|
815
|
+
sender_id?: string;
|
816
|
+
//
|
817
|
+
username?: string;
|
818
|
+
}
|
819
|
+
|
820
|
+
/** */
|
821
|
+
export interface ApiPinMessageRequest {
|
822
|
+
//
|
823
|
+
channel_id?: string;
|
824
|
+
//
|
825
|
+
message_id?: string;
|
826
|
+
}
|
827
|
+
|
828
|
+
/** */
|
829
|
+
export interface ApiPinMessagesList {
|
830
|
+
//
|
831
|
+
pin_messages_list?: Array<ApiPinMessage>;
|
832
|
+
}
|
833
|
+
|
802
834
|
/** Storage objects to get. */
|
803
835
|
export interface ApiReadStorageObjectId {
|
804
836
|
//The collection which stores the object.
|
@@ -4464,6 +4496,108 @@ export class MezonApi {
|
|
4464
4496
|
]);
|
4465
4497
|
}
|
4466
4498
|
|
4499
|
+
/** */
|
4500
|
+
deletePinMessage(bearerToken: string,
|
4501
|
+
messageId?:string,
|
4502
|
+
options: any = {}): Promise<any> {
|
4503
|
+
|
4504
|
+
const urlPath = "/v2/pinmessage/delete";
|
4505
|
+
const queryParams = new Map<string, any>();
|
4506
|
+
queryParams.set("message_id", messageId);
|
4507
|
+
|
4508
|
+
let bodyJson : string = "";
|
4509
|
+
|
4510
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4511
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
4512
|
+
if (bearerToken) {
|
4513
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4514
|
+
}
|
4515
|
+
|
4516
|
+
return Promise.race([
|
4517
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4518
|
+
if (response.status == 204) {
|
4519
|
+
return response;
|
4520
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4521
|
+
return response.json();
|
4522
|
+
} else {
|
4523
|
+
throw response;
|
4524
|
+
}
|
4525
|
+
}),
|
4526
|
+
new Promise((_, reject) =>
|
4527
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4528
|
+
),
|
4529
|
+
]);
|
4530
|
+
}
|
4531
|
+
|
4532
|
+
/** */
|
4533
|
+
getPinMessagesList(bearerToken: string,
|
4534
|
+
channelId?:string,
|
4535
|
+
options: any = {}): Promise<ApiPinMessagesList> {
|
4536
|
+
|
4537
|
+
const urlPath = "/v2/pinmessage/get";
|
4538
|
+
const queryParams = new Map<string, any>();
|
4539
|
+
queryParams.set("channel_id", channelId);
|
4540
|
+
|
4541
|
+
let bodyJson : string = "";
|
4542
|
+
|
4543
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4544
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
4545
|
+
if (bearerToken) {
|
4546
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4547
|
+
}
|
4548
|
+
|
4549
|
+
return Promise.race([
|
4550
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4551
|
+
if (response.status == 204) {
|
4552
|
+
return response;
|
4553
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4554
|
+
return response.json();
|
4555
|
+
} else {
|
4556
|
+
throw response;
|
4557
|
+
}
|
4558
|
+
}),
|
4559
|
+
new Promise((_, reject) =>
|
4560
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4561
|
+
),
|
4562
|
+
]);
|
4563
|
+
}
|
4564
|
+
|
4565
|
+
/** set notification user channel. */
|
4566
|
+
createPinMessage(bearerToken: string,
|
4567
|
+
body:ApiPinMessageRequest,
|
4568
|
+
options: any = {}): Promise<any> {
|
4569
|
+
|
4570
|
+
if (body === null || body === undefined) {
|
4571
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
4572
|
+
}
|
4573
|
+
const urlPath = "/v2/pinmessage/set";
|
4574
|
+
const queryParams = new Map<string, any>();
|
4575
|
+
|
4576
|
+
let bodyJson : string = "";
|
4577
|
+
bodyJson = JSON.stringify(body || {});
|
4578
|
+
|
4579
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4580
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
4581
|
+
if (bearerToken) {
|
4582
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4583
|
+
}
|
4584
|
+
|
4585
|
+
return Promise.race([
|
4586
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4587
|
+
if (response.status == 204) {
|
4588
|
+
return response;
|
4589
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4590
|
+
return response.json();
|
4591
|
+
} else {
|
4592
|
+
throw response;
|
4593
|
+
}
|
4594
|
+
}),
|
4595
|
+
new Promise((_, reject) =>
|
4596
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4597
|
+
),
|
4598
|
+
]);
|
4599
|
+
}
|
4600
|
+
|
4467
4601
|
/** */
|
4468
4602
|
addRolesChannelDesc(bearerToken: string,
|
4469
4603
|
body:ApiAddRoleChannelDescRequest,
|
package/client.ts
CHANGED
@@ -88,6 +88,8 @@ import {
|
|
88
88
|
ApiSetMuteNotificationRequest,
|
89
89
|
ApiSearchMessageRequest,
|
90
90
|
ApiSearchMessageResponse,
|
91
|
+
ApiPinMessageRequest,
|
92
|
+
ApiPinMessagesList,
|
91
93
|
} from "./api.gen";
|
92
94
|
|
93
95
|
import { Session } from "./session";
|
@@ -1138,11 +1140,11 @@ export class Client {
|
|
1138
1140
|
response.attachments!.forEach(at => {
|
1139
1141
|
result.attachments!.push({
|
1140
1142
|
filename: at.filename,
|
1141
|
-
filesize: at.
|
1143
|
+
filesize: at.filesize,
|
1142
1144
|
filetype: at.filetype,
|
1143
1145
|
id: at.id,
|
1144
1146
|
uploader: at.uploader,
|
1145
|
-
url: at.
|
1147
|
+
url: at.url
|
1146
1148
|
})
|
1147
1149
|
});
|
1148
1150
|
return Promise.resolve(result);
|
@@ -2117,6 +2119,42 @@ async searchMessage(session: Session, request: ApiSearchMessageRequest): Promise
|
|
2117
2119
|
return Promise.resolve(response);
|
2118
2120
|
});
|
2119
2121
|
}
|
2122
|
+
|
2123
|
+
/** */
|
2124
|
+
async createPinMessage(session: Session, request: ApiPinMessageRequest): Promise<boolean> {
|
2125
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
2126
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2127
|
+
await this.sessionRefresh(session);
|
2128
|
+
}
|
2129
|
+
|
2130
|
+
return this.apiClient.createPinMessage(session.token, request).then((response: any) => {
|
2131
|
+
return response !== undefined;
|
2132
|
+
});
|
2133
|
+
}
|
2134
|
+
|
2135
|
+
async getPinMessagesList(session: Session, channelId: string): Promise<ApiPinMessagesList> {
|
2136
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
2137
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2138
|
+
await this.sessionRefresh(session);
|
2139
|
+
}
|
2140
|
+
|
2141
|
+
return this.apiClient.getPinMessagesList(session.token, channelId).then((response: ApiPinMessagesList) => {
|
2142
|
+
return Promise.resolve(response);
|
2143
|
+
});
|
2144
|
+
}
|
2145
|
+
|
2146
|
+
//** */
|
2147
|
+
async deletePinMessage(session: Session, message_id: string): Promise<boolean> {
|
2148
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
2149
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2150
|
+
await this.sessionRefresh(session);
|
2151
|
+
}
|
2152
|
+
|
2153
|
+
return this.apiClient.deletePinMessage(session.token, message_id).then((response: any) => {
|
2154
|
+
return response !== undefined;
|
2155
|
+
});
|
2156
|
+
}
|
2157
|
+
|
2120
2158
|
};
|
2121
2159
|
|
2122
2160
|
|
package/dist/api.gen.d.ts
CHANGED
@@ -460,6 +460,25 @@ export interface ApiPermission {
|
|
460
460
|
export interface ApiPermissionList {
|
461
461
|
permissions?: Array<ApiPermission>;
|
462
462
|
}
|
463
|
+
/** */
|
464
|
+
export interface ApiPinMessage {
|
465
|
+
avatar?: string;
|
466
|
+
channel_id?: string;
|
467
|
+
content?: string;
|
468
|
+
id?: string;
|
469
|
+
message_id?: string;
|
470
|
+
sender_id?: string;
|
471
|
+
username?: string;
|
472
|
+
}
|
473
|
+
/** */
|
474
|
+
export interface ApiPinMessageRequest {
|
475
|
+
channel_id?: string;
|
476
|
+
message_id?: string;
|
477
|
+
}
|
478
|
+
/** */
|
479
|
+
export interface ApiPinMessagesList {
|
480
|
+
pin_messages_list?: Array<ApiPinMessage>;
|
481
|
+
}
|
463
482
|
/** Storage objects to get. */
|
464
483
|
export interface ApiReadStorageObjectId {
|
465
484
|
collection?: string;
|
@@ -886,6 +905,12 @@ export declare class MezonApi {
|
|
886
905
|
/** */
|
887
906
|
GetPermissionOfUserInTheClan(bearerToken: string, clanId: string, options?: any): Promise<ApiPermissionList>;
|
888
907
|
/** */
|
908
|
+
deletePinMessage(bearerToken: string, messageId?: string, options?: any): Promise<any>;
|
909
|
+
/** */
|
910
|
+
getPinMessagesList(bearerToken: string, channelId?: string, options?: any): Promise<ApiPinMessagesList>;
|
911
|
+
/** set notification user channel. */
|
912
|
+
createPinMessage(bearerToken: string, body: ApiPinMessageRequest, options?: any): Promise<any>;
|
913
|
+
/** */
|
889
914
|
addRolesChannelDesc(bearerToken: string, body: ApiAddRoleChannelDescRequest, options?: any): Promise<any>;
|
890
915
|
/** Update a role when Delete a role by ID. */
|
891
916
|
deleteRoleChannelDesc(bearerToken: string, body: ApiDeleteRoleRequest, 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, 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 } 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 } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -565,4 +565,8 @@ export declare class Client {
|
|
565
565
|
deleteNotiReactMessage(session: Session, channel_id: string): Promise<boolean>;
|
566
566
|
/** query message in elasticsearch */
|
567
567
|
searchMessage(session: Session, request: ApiSearchMessageRequest): Promise<ApiSearchMessageResponse>;
|
568
|
+
/** */
|
569
|
+
createPinMessage(session: Session, request: ApiPinMessageRequest): Promise<boolean>;
|
570
|
+
getPinMessagesList(session: Session, channelId: string): Promise<ApiPinMessagesList>;
|
571
|
+
deletePinMessage(session: Session, message_id: string): Promise<boolean>;
|
568
572
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -3206,6 +3206,87 @@ var MezonApi = class {
|
|
3206
3206
|
]);
|
3207
3207
|
}
|
3208
3208
|
/** */
|
3209
|
+
deletePinMessage(bearerToken, messageId, options = {}) {
|
3210
|
+
const urlPath = "/v2/pinmessage/delete";
|
3211
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3212
|
+
queryParams.set("message_id", messageId);
|
3213
|
+
let bodyJson = "";
|
3214
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3215
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
3216
|
+
if (bearerToken) {
|
3217
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3218
|
+
}
|
3219
|
+
return Promise.race([
|
3220
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3221
|
+
if (response.status == 204) {
|
3222
|
+
return response;
|
3223
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3224
|
+
return response.json();
|
3225
|
+
} else {
|
3226
|
+
throw response;
|
3227
|
+
}
|
3228
|
+
}),
|
3229
|
+
new Promise(
|
3230
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3231
|
+
)
|
3232
|
+
]);
|
3233
|
+
}
|
3234
|
+
/** */
|
3235
|
+
getPinMessagesList(bearerToken, channelId, options = {}) {
|
3236
|
+
const urlPath = "/v2/pinmessage/get";
|
3237
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3238
|
+
queryParams.set("channel_id", channelId);
|
3239
|
+
let bodyJson = "";
|
3240
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3241
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
3242
|
+
if (bearerToken) {
|
3243
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3244
|
+
}
|
3245
|
+
return Promise.race([
|
3246
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3247
|
+
if (response.status == 204) {
|
3248
|
+
return response;
|
3249
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3250
|
+
return response.json();
|
3251
|
+
} else {
|
3252
|
+
throw response;
|
3253
|
+
}
|
3254
|
+
}),
|
3255
|
+
new Promise(
|
3256
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3257
|
+
)
|
3258
|
+
]);
|
3259
|
+
}
|
3260
|
+
/** set notification user channel. */
|
3261
|
+
createPinMessage(bearerToken, body, options = {}) {
|
3262
|
+
if (body === null || body === void 0) {
|
3263
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
3264
|
+
}
|
3265
|
+
const urlPath = "/v2/pinmessage/set";
|
3266
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3267
|
+
let bodyJson = "";
|
3268
|
+
bodyJson = JSON.stringify(body || {});
|
3269
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3270
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
3271
|
+
if (bearerToken) {
|
3272
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3273
|
+
}
|
3274
|
+
return Promise.race([
|
3275
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3276
|
+
if (response.status == 204) {
|
3277
|
+
return response;
|
3278
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3279
|
+
return response.json();
|
3280
|
+
} else {
|
3281
|
+
throw response;
|
3282
|
+
}
|
3283
|
+
}),
|
3284
|
+
new Promise(
|
3285
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3286
|
+
)
|
3287
|
+
]);
|
3288
|
+
}
|
3289
|
+
/** */
|
3209
3290
|
addRolesChannelDesc(bearerToken, body, options = {}) {
|
3210
3291
|
if (body === null || body === void 0) {
|
3211
3292
|
throw new Error("'body' is a required parameter but is null or undefined.");
|
@@ -5128,11 +5209,11 @@ var Client = class {
|
|
5128
5209
|
response.attachments.forEach((at) => {
|
5129
5210
|
result.attachments.push({
|
5130
5211
|
filename: at.filename,
|
5131
|
-
filesize: at.
|
5212
|
+
filesize: at.filesize,
|
5132
5213
|
filetype: at.filetype,
|
5133
5214
|
id: at.id,
|
5134
5215
|
uploader: at.uploader,
|
5135
|
-
url: at.
|
5216
|
+
url: at.url
|
5136
5217
|
});
|
5137
5218
|
});
|
5138
5219
|
return Promise.resolve(result);
|
@@ -6020,4 +6101,36 @@ var Client = class {
|
|
6020
6101
|
});
|
6021
6102
|
});
|
6022
6103
|
}
|
6104
|
+
/** */
|
6105
|
+
createPinMessage(session, request) {
|
6106
|
+
return __async(this, null, function* () {
|
6107
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6108
|
+
yield this.sessionRefresh(session);
|
6109
|
+
}
|
6110
|
+
return this.apiClient.createPinMessage(session.token, request).then((response) => {
|
6111
|
+
return response !== void 0;
|
6112
|
+
});
|
6113
|
+
});
|
6114
|
+
}
|
6115
|
+
getPinMessagesList(session, channelId) {
|
6116
|
+
return __async(this, null, function* () {
|
6117
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6118
|
+
yield this.sessionRefresh(session);
|
6119
|
+
}
|
6120
|
+
return this.apiClient.getPinMessagesList(session.token, channelId).then((response) => {
|
6121
|
+
return Promise.resolve(response);
|
6122
|
+
});
|
6123
|
+
});
|
6124
|
+
}
|
6125
|
+
//** */
|
6126
|
+
deletePinMessage(session, message_id) {
|
6127
|
+
return __async(this, null, function* () {
|
6128
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6129
|
+
yield this.sessionRefresh(session);
|
6130
|
+
}
|
6131
|
+
return this.apiClient.deletePinMessage(session.token, message_id).then((response) => {
|
6132
|
+
return response !== void 0;
|
6133
|
+
});
|
6134
|
+
});
|
6135
|
+
}
|
6023
6136
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -3177,6 +3177,87 @@ var MezonApi = class {
|
|
3177
3177
|
]);
|
3178
3178
|
}
|
3179
3179
|
/** */
|
3180
|
+
deletePinMessage(bearerToken, messageId, options = {}) {
|
3181
|
+
const urlPath = "/v2/pinmessage/delete";
|
3182
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3183
|
+
queryParams.set("message_id", messageId);
|
3184
|
+
let bodyJson = "";
|
3185
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3186
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
3187
|
+
if (bearerToken) {
|
3188
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3189
|
+
}
|
3190
|
+
return Promise.race([
|
3191
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3192
|
+
if (response.status == 204) {
|
3193
|
+
return response;
|
3194
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3195
|
+
return response.json();
|
3196
|
+
} else {
|
3197
|
+
throw response;
|
3198
|
+
}
|
3199
|
+
}),
|
3200
|
+
new Promise(
|
3201
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3202
|
+
)
|
3203
|
+
]);
|
3204
|
+
}
|
3205
|
+
/** */
|
3206
|
+
getPinMessagesList(bearerToken, channelId, options = {}) {
|
3207
|
+
const urlPath = "/v2/pinmessage/get";
|
3208
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3209
|
+
queryParams.set("channel_id", channelId);
|
3210
|
+
let bodyJson = "";
|
3211
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3212
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
3213
|
+
if (bearerToken) {
|
3214
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3215
|
+
}
|
3216
|
+
return Promise.race([
|
3217
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3218
|
+
if (response.status == 204) {
|
3219
|
+
return response;
|
3220
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3221
|
+
return response.json();
|
3222
|
+
} else {
|
3223
|
+
throw response;
|
3224
|
+
}
|
3225
|
+
}),
|
3226
|
+
new Promise(
|
3227
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3228
|
+
)
|
3229
|
+
]);
|
3230
|
+
}
|
3231
|
+
/** set notification user channel. */
|
3232
|
+
createPinMessage(bearerToken, body, options = {}) {
|
3233
|
+
if (body === null || body === void 0) {
|
3234
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
3235
|
+
}
|
3236
|
+
const urlPath = "/v2/pinmessage/set";
|
3237
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3238
|
+
let bodyJson = "";
|
3239
|
+
bodyJson = JSON.stringify(body || {});
|
3240
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3241
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
3242
|
+
if (bearerToken) {
|
3243
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3244
|
+
}
|
3245
|
+
return Promise.race([
|
3246
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3247
|
+
if (response.status == 204) {
|
3248
|
+
return response;
|
3249
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3250
|
+
return response.json();
|
3251
|
+
} else {
|
3252
|
+
throw response;
|
3253
|
+
}
|
3254
|
+
}),
|
3255
|
+
new Promise(
|
3256
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3257
|
+
)
|
3258
|
+
]);
|
3259
|
+
}
|
3260
|
+
/** */
|
3180
3261
|
addRolesChannelDesc(bearerToken, body, options = {}) {
|
3181
3262
|
if (body === null || body === void 0) {
|
3182
3263
|
throw new Error("'body' is a required parameter but is null or undefined.");
|
@@ -5099,11 +5180,11 @@ var Client = class {
|
|
5099
5180
|
response.attachments.forEach((at) => {
|
5100
5181
|
result.attachments.push({
|
5101
5182
|
filename: at.filename,
|
5102
|
-
filesize: at.
|
5183
|
+
filesize: at.filesize,
|
5103
5184
|
filetype: at.filetype,
|
5104
5185
|
id: at.id,
|
5105
5186
|
uploader: at.uploader,
|
5106
|
-
url: at.
|
5187
|
+
url: at.url
|
5107
5188
|
});
|
5108
5189
|
});
|
5109
5190
|
return Promise.resolve(result);
|
@@ -5991,6 +6072,38 @@ var Client = class {
|
|
5991
6072
|
});
|
5992
6073
|
});
|
5993
6074
|
}
|
6075
|
+
/** */
|
6076
|
+
createPinMessage(session, request) {
|
6077
|
+
return __async(this, null, function* () {
|
6078
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6079
|
+
yield this.sessionRefresh(session);
|
6080
|
+
}
|
6081
|
+
return this.apiClient.createPinMessage(session.token, request).then((response) => {
|
6082
|
+
return response !== void 0;
|
6083
|
+
});
|
6084
|
+
});
|
6085
|
+
}
|
6086
|
+
getPinMessagesList(session, channelId) {
|
6087
|
+
return __async(this, null, function* () {
|
6088
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6089
|
+
yield this.sessionRefresh(session);
|
6090
|
+
}
|
6091
|
+
return this.apiClient.getPinMessagesList(session.token, channelId).then((response) => {
|
6092
|
+
return Promise.resolve(response);
|
6093
|
+
});
|
6094
|
+
});
|
6095
|
+
}
|
6096
|
+
//** */
|
6097
|
+
deletePinMessage(session, message_id) {
|
6098
|
+
return __async(this, null, function* () {
|
6099
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6100
|
+
yield this.sessionRefresh(session);
|
6101
|
+
}
|
6102
|
+
return this.apiClient.deletePinMessage(session.token, message_id).then((response) => {
|
6103
|
+
return response !== void 0;
|
6104
|
+
});
|
6105
|
+
});
|
6106
|
+
}
|
5994
6107
|
};
|
5995
6108
|
export {
|
5996
6109
|
ChannelStreamMode,
|
package/package.json
CHANGED
package/dist/dist.zip
DELETED
Binary file
|