mezon-js 2.7.48 → 2.7.50
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 +35 -0
- package/client.ts +11 -0
- package/dist/api.gen.d.ts +2 -0
- package/dist/client.d.ts +1 -0
- package/dist/mezon-js.cjs.js +40 -0
- package/dist/mezon-js.esm.mjs +40 -0
- package/dist/socket.d.ts +2 -2
- package/package.json +1 -1
- package/socket.ts +2 -2
package/api.gen.ts
CHANGED
|
@@ -3336,6 +3336,41 @@ export class MezonApi {
|
|
|
3336
3336
|
]);
|
|
3337
3337
|
}
|
|
3338
3338
|
|
|
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
|
+
}
|
|
3339
3374
|
/** regist fcm device token */
|
|
3340
3375
|
registFCMDeviceToken(bearerToken: string,
|
|
3341
3376
|
token?:string,
|
package/client.ts
CHANGED
|
@@ -1419,6 +1419,17 @@ export class Client {
|
|
|
1419
1419
|
return response !== undefined;
|
|
1420
1420
|
});
|
|
1421
1421
|
}
|
|
1422
|
+
//
|
|
1423
|
+
async openDirectMess(session: Session, request: ApiDeleteChannelDescRequest): Promise<boolean> {
|
|
1424
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
|
1425
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
1426
|
+
await this.sessionRefresh(session);
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
return this.apiClient.openDirectMess(session.token, request).then((response: any) => {
|
|
1430
|
+
return response !== undefined;
|
|
1431
|
+
});
|
|
1432
|
+
}
|
|
1422
1433
|
|
|
1423
1434
|
/** Add a custom ID to the social profiles on the current user's account. */
|
|
1424
1435
|
async linkCustom(session: Session, request: ApiAccountCustom): Promise<boolean> {
|
package/dist/api.gen.d.ts
CHANGED
|
@@ -856,6 +856,8 @@ export declare class MezonApi {
|
|
|
856
856
|
createCategoryDesc(bearerToken: string, body: ApiCreateCategoryDescRequest, options?: any): Promise<ApiCategoryDesc>;
|
|
857
857
|
/** */
|
|
858
858
|
deleteCategoryDesc(bearerToken: string, creatorId: string, options?: any): Promise<any>;
|
|
859
|
+
/** open direct message. */
|
|
860
|
+
openDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
|
|
859
861
|
/** regist fcm device token */
|
|
860
862
|
registFCMDeviceToken(bearerToken: string, token?: string, deviceId?: string, platform?: string, options?: any): Promise<any>;
|
|
861
863
|
/** close direct message. */
|
package/dist/client.d.ts
CHANGED
|
@@ -471,6 +471,7 @@ export declare class Client {
|
|
|
471
471
|
/** Add an Apple ID to the social profiles on the current user's account. */
|
|
472
472
|
linkApple(session: Session, request: ApiAccountApple): Promise<boolean>;
|
|
473
473
|
closeDirectMess(session: Session, request: ApiDeleteChannelDescRequest): Promise<boolean>;
|
|
474
|
+
openDirectMess(session: Session, request: ApiDeleteChannelDescRequest): Promise<boolean>;
|
|
474
475
|
/** Add a custom ID to the social profiles on the current user's account. */
|
|
475
476
|
linkCustom(session: Session, request: ApiAccountCustom): Promise<boolean>;
|
|
476
477
|
/** Add a device ID to the social profiles on the current user's account. */
|
package/dist/mezon-js.cjs.js
CHANGED
|
@@ -2263,6 +2263,35 @@ var MezonApi = class {
|
|
|
2263
2263
|
)
|
|
2264
2264
|
]);
|
|
2265
2265
|
}
|
|
2266
|
+
/** open direct message. */
|
|
2267
|
+
openDirectMess(bearerToken, body, options = {}) {
|
|
2268
|
+
if (body === null || body === void 0) {
|
|
2269
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
2270
|
+
}
|
|
2271
|
+
const urlPath = "/v2/direct/open";
|
|
2272
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2273
|
+
let bodyJson = "";
|
|
2274
|
+
bodyJson = JSON.stringify(body || {});
|
|
2275
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2276
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
|
2277
|
+
if (bearerToken) {
|
|
2278
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2279
|
+
}
|
|
2280
|
+
return Promise.race([
|
|
2281
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2282
|
+
if (response.status == 204) {
|
|
2283
|
+
return response;
|
|
2284
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2285
|
+
return response.json();
|
|
2286
|
+
} else {
|
|
2287
|
+
throw response;
|
|
2288
|
+
}
|
|
2289
|
+
}),
|
|
2290
|
+
new Promise(
|
|
2291
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2292
|
+
)
|
|
2293
|
+
]);
|
|
2294
|
+
}
|
|
2266
2295
|
/** regist fcm device token */
|
|
2267
2296
|
registFCMDeviceToken(bearerToken, token, deviceId, platform, options = {}) {
|
|
2268
2297
|
const urlPath = "/v2/devicetoken";
|
|
@@ -5572,6 +5601,17 @@ var Client = class {
|
|
|
5572
5601
|
});
|
|
5573
5602
|
});
|
|
5574
5603
|
}
|
|
5604
|
+
//
|
|
5605
|
+
openDirectMess(session, request) {
|
|
5606
|
+
return __async(this, null, function* () {
|
|
5607
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
5608
|
+
yield this.sessionRefresh(session);
|
|
5609
|
+
}
|
|
5610
|
+
return this.apiClient.openDirectMess(session.token, request).then((response) => {
|
|
5611
|
+
return response !== void 0;
|
|
5612
|
+
});
|
|
5613
|
+
});
|
|
5614
|
+
}
|
|
5575
5615
|
/** Add a custom ID to the social profiles on the current user's account. */
|
|
5576
5616
|
linkCustom(session, request) {
|
|
5577
5617
|
return __async(this, null, function* () {
|
package/dist/mezon-js.esm.mjs
CHANGED
|
@@ -2234,6 +2234,35 @@ var MezonApi = class {
|
|
|
2234
2234
|
)
|
|
2235
2235
|
]);
|
|
2236
2236
|
}
|
|
2237
|
+
/** open direct message. */
|
|
2238
|
+
openDirectMess(bearerToken, body, options = {}) {
|
|
2239
|
+
if (body === null || body === void 0) {
|
|
2240
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
2241
|
+
}
|
|
2242
|
+
const urlPath = "/v2/direct/open";
|
|
2243
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2244
|
+
let bodyJson = "";
|
|
2245
|
+
bodyJson = JSON.stringify(body || {});
|
|
2246
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2247
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
|
2248
|
+
if (bearerToken) {
|
|
2249
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2250
|
+
}
|
|
2251
|
+
return Promise.race([
|
|
2252
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2253
|
+
if (response.status == 204) {
|
|
2254
|
+
return response;
|
|
2255
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2256
|
+
return response.json();
|
|
2257
|
+
} else {
|
|
2258
|
+
throw response;
|
|
2259
|
+
}
|
|
2260
|
+
}),
|
|
2261
|
+
new Promise(
|
|
2262
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2263
|
+
)
|
|
2264
|
+
]);
|
|
2265
|
+
}
|
|
2237
2266
|
/** regist fcm device token */
|
|
2238
2267
|
registFCMDeviceToken(bearerToken, token, deviceId, platform, options = {}) {
|
|
2239
2268
|
const urlPath = "/v2/devicetoken";
|
|
@@ -5543,6 +5572,17 @@ var Client = class {
|
|
|
5543
5572
|
});
|
|
5544
5573
|
});
|
|
5545
5574
|
}
|
|
5575
|
+
//
|
|
5576
|
+
openDirectMess(session, request) {
|
|
5577
|
+
return __async(this, null, function* () {
|
|
5578
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
5579
|
+
yield this.sessionRefresh(session);
|
|
5580
|
+
}
|
|
5581
|
+
return this.apiClient.openDirectMess(session.token, request).then((response) => {
|
|
5582
|
+
return response !== void 0;
|
|
5583
|
+
});
|
|
5584
|
+
});
|
|
5585
|
+
}
|
|
5546
5586
|
/** Add a custom ID to the social profiles on the current user's account. */
|
|
5547
5587
|
linkCustom(session, request) {
|
|
5548
5588
|
return __async(this, null, function* () {
|
package/dist/socket.d.ts
CHANGED
|
@@ -49,9 +49,9 @@ export interface ClanJoin {
|
|
|
49
49
|
interface ChannelJoin {
|
|
50
50
|
channel_join: {
|
|
51
51
|
/** The id of the channel to join. */
|
|
52
|
-
|
|
52
|
+
channel_id: string;
|
|
53
53
|
/** The name of the channel to join. */
|
|
54
|
-
|
|
54
|
+
channel_label: string;
|
|
55
55
|
/** The channel type: 1 = Channel, 2 = Direct Message, 3 = Group. */
|
|
56
56
|
type: number;
|
|
57
57
|
/** Whether channel messages are persisted in the database. */
|
package/package.json
CHANGED
package/socket.ts
CHANGED
|
@@ -64,9 +64,9 @@ export interface ClanJoin {
|
|
|
64
64
|
interface ChannelJoin {
|
|
65
65
|
channel_join: {
|
|
66
66
|
/** The id of the channel to join. */
|
|
67
|
-
|
|
67
|
+
channel_id: string;
|
|
68
68
|
/** The name of the channel to join. */
|
|
69
|
-
|
|
69
|
+
channel_label: string;
|
|
70
70
|
/** The channel type: 1 = Channel, 2 = Direct Message, 3 = Group. */
|
|
71
71
|
type: number;
|
|
72
72
|
/** Whether channel messages are persisted in the database. */
|