mezon-js 2.7.51 → 2.7.52
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 +80 -35
- package/client.ts +13 -0
- package/dist/api.gen.d.ts +9 -2
- package/dist/client.d.ts +3 -1
- package/dist/mezon-js.cjs.js +58 -18
- package/dist/mezon-js.esm.mjs +58 -18
- package/package.json +1 -1
package/api.gen.ts
CHANGED
@@ -172,6 +172,14 @@ export interface ApiCategoryDescList {
|
|
172
172
|
categorydesc?: Array<ApiCategoryDesc>;
|
173
173
|
}
|
174
174
|
|
175
|
+
/** Update fields in a given channel. */
|
176
|
+
export interface ApiChangeChannelPrivateRequest {
|
177
|
+
//The ID of the channel to update.
|
178
|
+
channel_id?: string;
|
179
|
+
//
|
180
|
+
channel_private?: number;
|
181
|
+
}
|
182
|
+
|
175
183
|
/** */
|
176
184
|
export interface ApiChannelAttachment {
|
177
185
|
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the group was created.
|
@@ -3336,41 +3344,6 @@ export class MezonApi {
|
|
3336
3344
|
]);
|
3337
3345
|
}
|
3338
3346
|
|
3339
|
-
/** open direct message. */
|
3340
|
-
openDirectMess(bearerToken: string,
|
3341
|
-
body:ApiDeleteChannelDescRequest,
|
3342
|
-
options: any = {}): Promise<any> {
|
3343
|
-
|
3344
|
-
if (body === null || body === undefined) {
|
3345
|
-
throw new Error("'body' is a required parameter but is null or undefined.");
|
3346
|
-
}
|
3347
|
-
const urlPath = "/v2/direct/open";
|
3348
|
-
const queryParams = new Map<string, any>();
|
3349
|
-
|
3350
|
-
let bodyJson : string = "";
|
3351
|
-
bodyJson = JSON.stringify(body || {});
|
3352
|
-
|
3353
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3354
|
-
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
3355
|
-
if (bearerToken) {
|
3356
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3357
|
-
}
|
3358
|
-
|
3359
|
-
return Promise.race([
|
3360
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
3361
|
-
if (response.status == 204) {
|
3362
|
-
return response;
|
3363
|
-
} else if (response.status >= 200 && response.status < 300) {
|
3364
|
-
return response.json();
|
3365
|
-
} else {
|
3366
|
-
throw response;
|
3367
|
-
}
|
3368
|
-
}),
|
3369
|
-
new Promise((_, reject) =>
|
3370
|
-
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3371
|
-
),
|
3372
|
-
]);
|
3373
|
-
}
|
3374
3347
|
/** regist fcm device token */
|
3375
3348
|
registFCMDeviceToken(bearerToken: string,
|
3376
3349
|
token?:string,
|
@@ -3444,6 +3417,42 @@ export class MezonApi {
|
|
3444
3417
|
]);
|
3445
3418
|
}
|
3446
3419
|
|
3420
|
+
/** open direct message. */
|
3421
|
+
openDirectMess(bearerToken: string,
|
3422
|
+
body:ApiDeleteChannelDescRequest,
|
3423
|
+
options: any = {}): Promise<any> {
|
3424
|
+
|
3425
|
+
if (body === null || body === undefined) {
|
3426
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
3427
|
+
}
|
3428
|
+
const urlPath = "/v2/direct/open";
|
3429
|
+
const queryParams = new Map<string, any>();
|
3430
|
+
|
3431
|
+
let bodyJson : string = "";
|
3432
|
+
bodyJson = JSON.stringify(body || {});
|
3433
|
+
|
3434
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3435
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
3436
|
+
if (bearerToken) {
|
3437
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3438
|
+
}
|
3439
|
+
|
3440
|
+
return Promise.race([
|
3441
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3442
|
+
if (response.status == 204) {
|
3443
|
+
return response;
|
3444
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3445
|
+
return response.json();
|
3446
|
+
} else {
|
3447
|
+
throw response;
|
3448
|
+
}
|
3449
|
+
}),
|
3450
|
+
new Promise((_, reject) =>
|
3451
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3452
|
+
),
|
3453
|
+
]);
|
3454
|
+
}
|
3455
|
+
|
3447
3456
|
/** Search message from elasticsearch service. */
|
3448
3457
|
searchMessage(bearerToken: string,
|
3449
3458
|
body:ApiSearchMessageRequest,
|
@@ -5442,6 +5451,42 @@ export class MezonApi {
|
|
5442
5451
|
]);
|
5443
5452
|
}
|
5444
5453
|
|
5454
|
+
/** Update channel private. */
|
5455
|
+
updateChannelPrivate(bearerToken: string,
|
5456
|
+
body:ApiChangeChannelPrivateRequest,
|
5457
|
+
options: any = {}): Promise<any> {
|
5458
|
+
|
5459
|
+
if (body === null || body === undefined) {
|
5460
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
5461
|
+
}
|
5462
|
+
const urlPath = "/v2/updatechannelprivate";
|
5463
|
+
const queryParams = new Map<string, any>();
|
5464
|
+
|
5465
|
+
let bodyJson : string = "";
|
5466
|
+
bodyJson = JSON.stringify(body || {});
|
5467
|
+
|
5468
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
5469
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
5470
|
+
if (bearerToken) {
|
5471
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
5472
|
+
}
|
5473
|
+
|
5474
|
+
return Promise.race([
|
5475
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
5476
|
+
if (response.status == 204) {
|
5477
|
+
return response;
|
5478
|
+
} else if (response.status >= 200 && response.status < 300) {
|
5479
|
+
return response.json();
|
5480
|
+
} else {
|
5481
|
+
throw response;
|
5482
|
+
}
|
5483
|
+
}),
|
5484
|
+
new Promise((_, reject) =>
|
5485
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
5486
|
+
),
|
5487
|
+
]);
|
5488
|
+
}
|
5489
|
+
|
5445
5490
|
/** */
|
5446
5491
|
updateUserProfileByClan(bearerToken: string,
|
5447
5492
|
clanId:string,
|
package/client.ts
CHANGED
@@ -93,6 +93,7 @@ import {
|
|
93
93
|
ApiCreateWebhookRequest,
|
94
94
|
ApiWebhookResponse,
|
95
95
|
ApiDeleteChannelDescRequest,
|
96
|
+
ApiChangeChannelPrivateRequest,
|
96
97
|
} from "./api.gen";
|
97
98
|
|
98
99
|
import { Session } from "./session";
|
@@ -2055,6 +2056,18 @@ async setMuteNotificationChannel(session: Session, request: ApiSetMuteNotificati
|
|
2055
2056
|
});
|
2056
2057
|
}
|
2057
2058
|
|
2059
|
+
/** update channel private*/
|
2060
|
+
async updateChannelPrivate(session: Session, request: ApiChangeChannelPrivateRequest): Promise<boolean> {
|
2061
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
2062
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2063
|
+
await this.sessionRefresh(session);
|
2064
|
+
}
|
2065
|
+
|
2066
|
+
return this.apiClient.updateChannelPrivate(session.token, request).then((response: any) => {
|
2067
|
+
return response !== undefined;
|
2068
|
+
});
|
2069
|
+
}
|
2070
|
+
|
2058
2071
|
/** get default notification clan */
|
2059
2072
|
async getNotificationChannel(session: Session, channelId: string): Promise<ApiNotificationUserChannel> {
|
2060
2073
|
if (this.autoRefreshSession && session.refresh_token &&
|
package/dist/api.gen.d.ts
CHANGED
@@ -99,6 +99,11 @@ export interface ApiCategoryDesc {
|
|
99
99
|
export interface ApiCategoryDescList {
|
100
100
|
categorydesc?: Array<ApiCategoryDesc>;
|
101
101
|
}
|
102
|
+
/** Update fields in a given channel. */
|
103
|
+
export interface ApiChangeChannelPrivateRequest {
|
104
|
+
channel_id?: string;
|
105
|
+
channel_private?: number;
|
106
|
+
}
|
102
107
|
/** */
|
103
108
|
export interface ApiChannelAttachment {
|
104
109
|
create_time?: string;
|
@@ -856,12 +861,12 @@ export declare class MezonApi {
|
|
856
861
|
createCategoryDesc(bearerToken: string, body: ApiCreateCategoryDescRequest, options?: any): Promise<ApiCategoryDesc>;
|
857
862
|
/** */
|
858
863
|
deleteCategoryDesc(bearerToken: string, creatorId: string, options?: any): Promise<any>;
|
859
|
-
/** open direct message. */
|
860
|
-
openDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
|
861
864
|
/** regist fcm device token */
|
862
865
|
registFCMDeviceToken(bearerToken: string, token?: string, deviceId?: string, platform?: string, options?: any): Promise<any>;
|
863
866
|
/** close direct message. */
|
864
867
|
closeDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
|
868
|
+
/** open direct message. */
|
869
|
+
openDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
|
865
870
|
/** Search message from elasticsearch service. */
|
866
871
|
searchMessage(bearerToken: string, body: ApiSearchMessageRequest, options?: any): Promise<ApiSearchMessageResponse>;
|
867
872
|
/** Submit an event for processing in the server's registered runtime custom events handler. */
|
@@ -972,6 +977,8 @@ export declare class MezonApi {
|
|
972
977
|
listStorageObjects2(bearerToken: string, collection: string, userId: string, limit?: number, cursor?: string, options?: any): Promise<ApiStorageObjectList>;
|
973
978
|
/** Update fields in a given category. */
|
974
979
|
updateCategory(bearerToken: string, body: ApiUpdateCategoryDescRequest, options?: any): Promise<any>;
|
980
|
+
/** Update channel private. */
|
981
|
+
updateChannelPrivate(bearerToken: string, body: ApiChangeChannelPrivateRequest, options?: any): Promise<any>;
|
975
982
|
/** */
|
976
983
|
updateUserProfileByClan(bearerToken: string, clanId: string, body: {}, options?: any): Promise<any>;
|
977
984
|
/** Upload attachment */
|
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 } 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 } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -555,6 +555,8 @@ export declare class Client {
|
|
555
555
|
setNotificationChannel(session: Session, request: ApiSetNotificationRequest): Promise<boolean>;
|
556
556
|
/** Set notification channel*/
|
557
557
|
setMuteNotificationChannel(session: Session, request: ApiSetMuteNotificationRequest): Promise<boolean>;
|
558
|
+
/** update channel private*/
|
559
|
+
updateChannelPrivate(session: Session, request: ApiChangeChannelPrivateRequest): Promise<boolean>;
|
558
560
|
/** get default notification clan */
|
559
561
|
getNotificationChannel(session: Session, channelId: string): Promise<ApiNotificationUserChannel>;
|
560
562
|
/** Set default notification category*/
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -2246,17 +2246,16 @@ var MezonApi = class {
|
|
2246
2246
|
)
|
2247
2247
|
]);
|
2248
2248
|
}
|
2249
|
-
/**
|
2250
|
-
|
2251
|
-
|
2252
|
-
throw new Error("'body' is a required parameter but is null or undefined.");
|
2253
|
-
}
|
2254
|
-
const urlPath = "/v2/direct/open";
|
2249
|
+
/** regist fcm device token */
|
2250
|
+
registFCMDeviceToken(bearerToken, token, deviceId, platform, options = {}) {
|
2251
|
+
const urlPath = "/v2/devicetoken";
|
2255
2252
|
const queryParams = /* @__PURE__ */ new Map();
|
2253
|
+
queryParams.set("token", token);
|
2254
|
+
queryParams.set("device_id", deviceId);
|
2255
|
+
queryParams.set("platform", platform);
|
2256
2256
|
let bodyJson = "";
|
2257
|
-
bodyJson = JSON.stringify(body || {});
|
2258
2257
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2259
|
-
const fetchOptions = buildFetchOptions("
|
2258
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
2260
2259
|
if (bearerToken) {
|
2261
2260
|
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2262
2261
|
}
|
@@ -2275,16 +2274,17 @@ var MezonApi = class {
|
|
2275
2274
|
)
|
2276
2275
|
]);
|
2277
2276
|
}
|
2278
|
-
/**
|
2279
|
-
|
2280
|
-
|
2277
|
+
/** close direct message. */
|
2278
|
+
closeDirectMess(bearerToken, body, options = {}) {
|
2279
|
+
if (body === null || body === void 0) {
|
2280
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
2281
|
+
}
|
2282
|
+
const urlPath = "/v2/direct/close";
|
2281
2283
|
const queryParams = /* @__PURE__ */ new Map();
|
2282
|
-
queryParams.set("token", token);
|
2283
|
-
queryParams.set("device_id", deviceId);
|
2284
|
-
queryParams.set("platform", platform);
|
2285
2284
|
let bodyJson = "";
|
2285
|
+
bodyJson = JSON.stringify(body || {});
|
2286
2286
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2287
|
-
const fetchOptions = buildFetchOptions("
|
2287
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
2288
2288
|
if (bearerToken) {
|
2289
2289
|
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2290
2290
|
}
|
@@ -2303,12 +2303,12 @@ var MezonApi = class {
|
|
2303
2303
|
)
|
2304
2304
|
]);
|
2305
2305
|
}
|
2306
|
-
/**
|
2307
|
-
|
2306
|
+
/** open direct message. */
|
2307
|
+
openDirectMess(bearerToken, body, options = {}) {
|
2308
2308
|
if (body === null || body === void 0) {
|
2309
2309
|
throw new Error("'body' is a required parameter but is null or undefined.");
|
2310
2310
|
}
|
2311
|
-
const urlPath = "/v2/direct/
|
2311
|
+
const urlPath = "/v2/direct/open";
|
2312
2312
|
const queryParams = /* @__PURE__ */ new Map();
|
2313
2313
|
let bodyJson = "";
|
2314
2314
|
bodyJson = JSON.stringify(body || {});
|
@@ -3901,6 +3901,35 @@ var MezonApi = class {
|
|
3901
3901
|
)
|
3902
3902
|
]);
|
3903
3903
|
}
|
3904
|
+
/** Update channel private. */
|
3905
|
+
updateChannelPrivate(bearerToken, body, options = {}) {
|
3906
|
+
if (body === null || body === void 0) {
|
3907
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
3908
|
+
}
|
3909
|
+
const urlPath = "/v2/updatechannelprivate";
|
3910
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3911
|
+
let bodyJson = "";
|
3912
|
+
bodyJson = JSON.stringify(body || {});
|
3913
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3914
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
3915
|
+
if (bearerToken) {
|
3916
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3917
|
+
}
|
3918
|
+
return Promise.race([
|
3919
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3920
|
+
if (response.status == 204) {
|
3921
|
+
return response;
|
3922
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3923
|
+
return response.json();
|
3924
|
+
} else {
|
3925
|
+
throw response;
|
3926
|
+
}
|
3927
|
+
}),
|
3928
|
+
new Promise(
|
3929
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3930
|
+
)
|
3931
|
+
]);
|
3932
|
+
}
|
3904
3933
|
/** */
|
3905
3934
|
updateUserProfileByClan(bearerToken, clanId, body, options = {}) {
|
3906
3935
|
if (clanId === null || clanId === void 0) {
|
@@ -6061,6 +6090,17 @@ var Client = class {
|
|
6061
6090
|
});
|
6062
6091
|
});
|
6063
6092
|
}
|
6093
|
+
/** update channel private*/
|
6094
|
+
updateChannelPrivate(session, request) {
|
6095
|
+
return __async(this, null, function* () {
|
6096
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6097
|
+
yield this.sessionRefresh(session);
|
6098
|
+
}
|
6099
|
+
return this.apiClient.updateChannelPrivate(session.token, request).then((response) => {
|
6100
|
+
return response !== void 0;
|
6101
|
+
});
|
6102
|
+
});
|
6103
|
+
}
|
6064
6104
|
/** get default notification clan */
|
6065
6105
|
getNotificationChannel(session, channelId) {
|
6066
6106
|
return __async(this, null, function* () {
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -2217,17 +2217,16 @@ var MezonApi = class {
|
|
2217
2217
|
)
|
2218
2218
|
]);
|
2219
2219
|
}
|
2220
|
-
/**
|
2221
|
-
|
2222
|
-
|
2223
|
-
throw new Error("'body' is a required parameter but is null or undefined.");
|
2224
|
-
}
|
2225
|
-
const urlPath = "/v2/direct/open";
|
2220
|
+
/** regist fcm device token */
|
2221
|
+
registFCMDeviceToken(bearerToken, token, deviceId, platform, options = {}) {
|
2222
|
+
const urlPath = "/v2/devicetoken";
|
2226
2223
|
const queryParams = /* @__PURE__ */ new Map();
|
2224
|
+
queryParams.set("token", token);
|
2225
|
+
queryParams.set("device_id", deviceId);
|
2226
|
+
queryParams.set("platform", platform);
|
2227
2227
|
let bodyJson = "";
|
2228
|
-
bodyJson = JSON.stringify(body || {});
|
2229
2228
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2230
|
-
const fetchOptions = buildFetchOptions("
|
2229
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
2231
2230
|
if (bearerToken) {
|
2232
2231
|
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2233
2232
|
}
|
@@ -2246,16 +2245,17 @@ var MezonApi = class {
|
|
2246
2245
|
)
|
2247
2246
|
]);
|
2248
2247
|
}
|
2249
|
-
/**
|
2250
|
-
|
2251
|
-
|
2248
|
+
/** close direct message. */
|
2249
|
+
closeDirectMess(bearerToken, body, options = {}) {
|
2250
|
+
if (body === null || body === void 0) {
|
2251
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
2252
|
+
}
|
2253
|
+
const urlPath = "/v2/direct/close";
|
2252
2254
|
const queryParams = /* @__PURE__ */ new Map();
|
2253
|
-
queryParams.set("token", token);
|
2254
|
-
queryParams.set("device_id", deviceId);
|
2255
|
-
queryParams.set("platform", platform);
|
2256
2255
|
let bodyJson = "";
|
2256
|
+
bodyJson = JSON.stringify(body || {});
|
2257
2257
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2258
|
-
const fetchOptions = buildFetchOptions("
|
2258
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
2259
2259
|
if (bearerToken) {
|
2260
2260
|
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2261
2261
|
}
|
@@ -2274,12 +2274,12 @@ var MezonApi = class {
|
|
2274
2274
|
)
|
2275
2275
|
]);
|
2276
2276
|
}
|
2277
|
-
/**
|
2278
|
-
|
2277
|
+
/** open direct message. */
|
2278
|
+
openDirectMess(bearerToken, body, options = {}) {
|
2279
2279
|
if (body === null || body === void 0) {
|
2280
2280
|
throw new Error("'body' is a required parameter but is null or undefined.");
|
2281
2281
|
}
|
2282
|
-
const urlPath = "/v2/direct/
|
2282
|
+
const urlPath = "/v2/direct/open";
|
2283
2283
|
const queryParams = /* @__PURE__ */ new Map();
|
2284
2284
|
let bodyJson = "";
|
2285
2285
|
bodyJson = JSON.stringify(body || {});
|
@@ -3872,6 +3872,35 @@ var MezonApi = class {
|
|
3872
3872
|
)
|
3873
3873
|
]);
|
3874
3874
|
}
|
3875
|
+
/** Update channel private. */
|
3876
|
+
updateChannelPrivate(bearerToken, body, options = {}) {
|
3877
|
+
if (body === null || body === void 0) {
|
3878
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
3879
|
+
}
|
3880
|
+
const urlPath = "/v2/updatechannelprivate";
|
3881
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3882
|
+
let bodyJson = "";
|
3883
|
+
bodyJson = JSON.stringify(body || {});
|
3884
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3885
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
3886
|
+
if (bearerToken) {
|
3887
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3888
|
+
}
|
3889
|
+
return Promise.race([
|
3890
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3891
|
+
if (response.status == 204) {
|
3892
|
+
return response;
|
3893
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3894
|
+
return response.json();
|
3895
|
+
} else {
|
3896
|
+
throw response;
|
3897
|
+
}
|
3898
|
+
}),
|
3899
|
+
new Promise(
|
3900
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3901
|
+
)
|
3902
|
+
]);
|
3903
|
+
}
|
3875
3904
|
/** */
|
3876
3905
|
updateUserProfileByClan(bearerToken, clanId, body, options = {}) {
|
3877
3906
|
if (clanId === null || clanId === void 0) {
|
@@ -6032,6 +6061,17 @@ var Client = class {
|
|
6032
6061
|
});
|
6033
6062
|
});
|
6034
6063
|
}
|
6064
|
+
/** update channel private*/
|
6065
|
+
updateChannelPrivate(session, request) {
|
6066
|
+
return __async(this, null, function* () {
|
6067
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6068
|
+
yield this.sessionRefresh(session);
|
6069
|
+
}
|
6070
|
+
return this.apiClient.updateChannelPrivate(session.token, request).then((response) => {
|
6071
|
+
return response !== void 0;
|
6072
|
+
});
|
6073
|
+
});
|
6074
|
+
}
|
6035
6075
|
/** get default notification clan */
|
6036
6076
|
getNotificationChannel(session, channelId) {
|
6037
6077
|
return __async(this, null, function* () {
|