mezon-js 2.8.23 → 2.8.24
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +3 -197
- package/client.ts +2 -106
- package/dist/api.gen.d.ts +1 -11
- package/dist/api1.gen.d.ts +1157 -0
- package/dist/client.d.ts +1 -9
- package/dist/mezon-js.cjs.js +6 -246
- package/dist/mezon-js.esm.mjs +6 -246
- package/dist/socket.d.ts +4 -2
- package/package.json +1 -1
- package/socket.ts +5 -3
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,
|
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, ApiEvent, 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, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiHashtagDmVoiceList, ApiPermissionRoleChannelList, ApiUpdateRoleChannelRequest } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -420,8 +420,6 @@ export declare class Client {
|
|
420
420
|
deleteCategoryDesc(session: Session, creatorId: string): Promise<boolean>;
|
421
421
|
/** Delete one or more notifications */
|
422
422
|
deleteNotifications(session: Session, ids?: Array<string>): Promise<boolean>;
|
423
|
-
/** Delete one or more storage objects */
|
424
|
-
deleteStorageObjects(session: Session, request: ApiDeleteStorageObjectsRequest): Promise<boolean>;
|
425
423
|
/** Delete a role by ID. */
|
426
424
|
deleteRole(session: Session, roleId: string): Promise<boolean>;
|
427
425
|
/** Delete a event by ID. */
|
@@ -498,10 +496,6 @@ export declare class Client {
|
|
498
496
|
listFriends(session: Session, state?: number, limit?: number, cursor?: string): Promise<Friends>;
|
499
497
|
/** Fetch list of notifications. */
|
500
498
|
listNotifications(session: Session, clanId: string, limit?: number, cacheableCursor?: string): Promise<NotificationList>;
|
501
|
-
/** List storage objects. */
|
502
|
-
listStorageObjects(session: Session, collection: string, userId?: string, limit?: number, cursor?: string): Promise<StorageObjectList>;
|
503
|
-
/** Fetch storage objects. */
|
504
|
-
readStorageObjects(session: Session, request: ApiReadStorageObjectsRequest): Promise<StorageObjects>;
|
505
499
|
/** Execute an RPC function on the server. */
|
506
500
|
rpc(session: Session, basicAuthUsername: string, basicAuthPassword: string, id: string, input: object): Promise<RpcResponse>;
|
507
501
|
/** Execute an RPC function on the server. */
|
@@ -551,8 +545,6 @@ export declare class Client {
|
|
551
545
|
getPermissionOfUserInTheClan(session: Session, clanId: string): Promise<ApiPermissionList>;
|
552
546
|
/** invite user */
|
553
547
|
inviteUser(session: Session, inviteId: string): Promise<ApiInviteUserRes>;
|
554
|
-
/** Write storage objects. */
|
555
|
-
writeStorageObjects(session: Session, objects: Array<WriteStorageObject>): Promise<ApiStorageObjectAcks>;
|
556
548
|
/** Set default notification clan*/
|
557
549
|
setNotificationClan(session: Session, request: ApiSetDefaultNotificationRequest): Promise<boolean>;
|
558
550
|
/** get default notification clan */
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -2418,14 +2418,15 @@ var MezonApi = class {
|
|
2418
2418
|
]);
|
2419
2419
|
}
|
2420
2420
|
/** Delete a emoji by ID. */
|
2421
|
-
|
2421
|
+
deleteClanEmojiById(bearerToken, id, clanId, options = {}) {
|
2422
2422
|
if (id === null || id === void 0) {
|
2423
2423
|
throw new Error("'id' is a required parameter but is null or undefined.");
|
2424
2424
|
}
|
2425
2425
|
const urlPath = "/v2/emoji/{id}".replace("{id}", encodeURIComponent(String(id)));
|
2426
2426
|
const queryParams = /* @__PURE__ */ new Map();
|
2427
2427
|
queryParams.set("clan_id", clanId);
|
2428
|
-
|
2428
|
+
const body = { clan_id: clanId };
|
2429
|
+
let bodyJson = JSON.stringify(body || {});
|
2429
2430
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2430
2431
|
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
2431
2432
|
if (bearerToken) {
|
@@ -4073,157 +4074,6 @@ var MezonApi = class {
|
|
4073
4074
|
)
|
4074
4075
|
]);
|
4075
4076
|
}
|
4076
|
-
/** Get storage objects. */
|
4077
|
-
readStorageObjects(bearerToken, body, options = {}) {
|
4078
|
-
if (body === null || body === void 0) {
|
4079
|
-
throw new Error("'body' is a required parameter but is null or undefined.");
|
4080
|
-
}
|
4081
|
-
const urlPath = "/v2/storage";
|
4082
|
-
const queryParams = /* @__PURE__ */ new Map();
|
4083
|
-
let bodyJson = "";
|
4084
|
-
bodyJson = JSON.stringify(body || {});
|
4085
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4086
|
-
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
4087
|
-
if (bearerToken) {
|
4088
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4089
|
-
}
|
4090
|
-
return Promise.race([
|
4091
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
4092
|
-
if (response.status == 204) {
|
4093
|
-
return response;
|
4094
|
-
} else if (response.status >= 200 && response.status < 300) {
|
4095
|
-
return response.json();
|
4096
|
-
} else {
|
4097
|
-
throw response;
|
4098
|
-
}
|
4099
|
-
}),
|
4100
|
-
new Promise(
|
4101
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4102
|
-
)
|
4103
|
-
]);
|
4104
|
-
}
|
4105
|
-
/** Write objects into the storage engine. */
|
4106
|
-
writeStorageObjects(bearerToken, body, options = {}) {
|
4107
|
-
if (body === null || body === void 0) {
|
4108
|
-
throw new Error("'body' is a required parameter but is null or undefined.");
|
4109
|
-
}
|
4110
|
-
const urlPath = "/v2/storage";
|
4111
|
-
const queryParams = /* @__PURE__ */ new Map();
|
4112
|
-
let bodyJson = "";
|
4113
|
-
bodyJson = JSON.stringify(body || {});
|
4114
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4115
|
-
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
4116
|
-
if (bearerToken) {
|
4117
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4118
|
-
}
|
4119
|
-
return Promise.race([
|
4120
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
4121
|
-
if (response.status == 204) {
|
4122
|
-
return response;
|
4123
|
-
} else if (response.status >= 200 && response.status < 300) {
|
4124
|
-
return response.json();
|
4125
|
-
} else {
|
4126
|
-
throw response;
|
4127
|
-
}
|
4128
|
-
}),
|
4129
|
-
new Promise(
|
4130
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4131
|
-
)
|
4132
|
-
]);
|
4133
|
-
}
|
4134
|
-
/** Delete one or more objects by ID or username. */
|
4135
|
-
deleteStorageObjects(bearerToken, body, options = {}) {
|
4136
|
-
if (body === null || body === void 0) {
|
4137
|
-
throw new Error("'body' is a required parameter but is null or undefined.");
|
4138
|
-
}
|
4139
|
-
const urlPath = "/v2/storage/delete";
|
4140
|
-
const queryParams = /* @__PURE__ */ new Map();
|
4141
|
-
let bodyJson = "";
|
4142
|
-
bodyJson = JSON.stringify(body || {});
|
4143
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4144
|
-
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
4145
|
-
if (bearerToken) {
|
4146
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4147
|
-
}
|
4148
|
-
return Promise.race([
|
4149
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
4150
|
-
if (response.status == 204) {
|
4151
|
-
return response;
|
4152
|
-
} else if (response.status >= 200 && response.status < 300) {
|
4153
|
-
return response.json();
|
4154
|
-
} else {
|
4155
|
-
throw response;
|
4156
|
-
}
|
4157
|
-
}),
|
4158
|
-
new Promise(
|
4159
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4160
|
-
)
|
4161
|
-
]);
|
4162
|
-
}
|
4163
|
-
/** List publicly readable storage objects in a given collection. */
|
4164
|
-
listStorageObjects(bearerToken, collection, userId, limit, cursor, options = {}) {
|
4165
|
-
if (collection === null || collection === void 0) {
|
4166
|
-
throw new Error("'collection' is a required parameter but is null or undefined.");
|
4167
|
-
}
|
4168
|
-
const urlPath = "/v2/storage/{collection}".replace("{collection}", encodeURIComponent(String(collection)));
|
4169
|
-
const queryParams = /* @__PURE__ */ new Map();
|
4170
|
-
queryParams.set("user_id", userId);
|
4171
|
-
queryParams.set("limit", limit);
|
4172
|
-
queryParams.set("cursor", cursor);
|
4173
|
-
let bodyJson = "";
|
4174
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4175
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
4176
|
-
if (bearerToken) {
|
4177
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4178
|
-
}
|
4179
|
-
return Promise.race([
|
4180
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
4181
|
-
if (response.status == 204) {
|
4182
|
-
return response;
|
4183
|
-
} else if (response.status >= 200 && response.status < 300) {
|
4184
|
-
return response.json();
|
4185
|
-
} else {
|
4186
|
-
throw response;
|
4187
|
-
}
|
4188
|
-
}),
|
4189
|
-
new Promise(
|
4190
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4191
|
-
)
|
4192
|
-
]);
|
4193
|
-
}
|
4194
|
-
/** List publicly readable storage objects in a given collection. */
|
4195
|
-
listStorageObjects2(bearerToken, collection, userId, limit, cursor, options = {}) {
|
4196
|
-
if (collection === null || collection === void 0) {
|
4197
|
-
throw new Error("'collection' is a required parameter but is null or undefined.");
|
4198
|
-
}
|
4199
|
-
if (userId === null || userId === void 0) {
|
4200
|
-
throw new Error("'userId' is a required parameter but is null or undefined.");
|
4201
|
-
}
|
4202
|
-
const urlPath = "/v2/storage/{collection}/{userId}".replace("{collection}", encodeURIComponent(String(collection))).replace("{userId}", encodeURIComponent(String(userId)));
|
4203
|
-
const queryParams = /* @__PURE__ */ new Map();
|
4204
|
-
queryParams.set("limit", limit);
|
4205
|
-
queryParams.set("cursor", cursor);
|
4206
|
-
let bodyJson = "";
|
4207
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4208
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
4209
|
-
if (bearerToken) {
|
4210
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4211
|
-
}
|
4212
|
-
return Promise.race([
|
4213
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
4214
|
-
if (response.status == 204) {
|
4215
|
-
return response;
|
4216
|
-
} else if (response.status >= 200 && response.status < 300) {
|
4217
|
-
return response.json();
|
4218
|
-
} else {
|
4219
|
-
throw response;
|
4220
|
-
}
|
4221
|
-
}),
|
4222
|
-
new Promise(
|
4223
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4224
|
-
)
|
4225
|
-
]);
|
4226
|
-
}
|
4227
4077
|
/** Update fields in a given category. */
|
4228
4078
|
updateCategory(bearerToken, body, options = {}) {
|
4229
4079
|
if (body === null || body === void 0) {
|
@@ -5093,9 +4943,9 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5093
4943
|
unfollowUsers(user_ids) {
|
5094
4944
|
return this.send({ status_unfollow: { user_ids } });
|
5095
4945
|
}
|
5096
|
-
updateChatMessage(clan_id, channel_id, mode, message_id, content, mentions) {
|
4946
|
+
updateChatMessage(clan_id, channel_id, mode, message_id, content, mentions, attachments) {
|
5097
4947
|
return __async(this, null, function* () {
|
5098
|
-
const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, mode } });
|
4948
|
+
const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, attachments, mode } });
|
5099
4949
|
return response.channel_message_ack;
|
5100
4950
|
});
|
5101
4951
|
}
|
@@ -5546,17 +5396,6 @@ var Client = class {
|
|
5546
5396
|
});
|
5547
5397
|
});
|
5548
5398
|
}
|
5549
|
-
/** Delete one or more storage objects */
|
5550
|
-
deleteStorageObjects(session, request) {
|
5551
|
-
return __async(this, null, function* () {
|
5552
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5553
|
-
yield this.sessionRefresh(session);
|
5554
|
-
}
|
5555
|
-
return this.apiClient.deleteStorageObjects(session.token, request).then((response) => {
|
5556
|
-
return Promise.resolve(response != void 0);
|
5557
|
-
});
|
5558
|
-
});
|
5559
|
-
}
|
5560
5399
|
/** Delete a role by ID. */
|
5561
5400
|
deleteRole(session, roleId) {
|
5562
5401
|
return __async(this, null, function* () {
|
@@ -6248,65 +6087,6 @@ var Client = class {
|
|
6248
6087
|
});
|
6249
6088
|
});
|
6250
6089
|
}
|
6251
|
-
/** List storage objects. */
|
6252
|
-
listStorageObjects(session, collection, userId, limit, cursor) {
|
6253
|
-
return __async(this, null, function* () {
|
6254
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6255
|
-
yield this.sessionRefresh(session);
|
6256
|
-
}
|
6257
|
-
return this.apiClient.listStorageObjects(session.token, collection, userId, limit, cursor).then((response) => {
|
6258
|
-
var result = {
|
6259
|
-
objects: [],
|
6260
|
-
cursor: response.cursor
|
6261
|
-
};
|
6262
|
-
if (response.objects == null) {
|
6263
|
-
return Promise.resolve(result);
|
6264
|
-
}
|
6265
|
-
response.objects.forEach((o) => {
|
6266
|
-
result.objects.push({
|
6267
|
-
collection: o.collection,
|
6268
|
-
key: o.key,
|
6269
|
-
permission_read: o.permission_read ? Number(o.permission_read) : 0,
|
6270
|
-
permission_write: o.permission_write ? Number(o.permission_write) : 0,
|
6271
|
-
value: o.value ? JSON.parse(o.value) : void 0,
|
6272
|
-
version: o.version,
|
6273
|
-
user_id: o.user_id,
|
6274
|
-
create_time: o.create_time,
|
6275
|
-
update_time: o.update_time
|
6276
|
-
});
|
6277
|
-
});
|
6278
|
-
return Promise.resolve(result);
|
6279
|
-
});
|
6280
|
-
});
|
6281
|
-
}
|
6282
|
-
/** Fetch storage objects. */
|
6283
|
-
readStorageObjects(session, request) {
|
6284
|
-
return __async(this, null, function* () {
|
6285
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6286
|
-
yield this.sessionRefresh(session);
|
6287
|
-
}
|
6288
|
-
return this.apiClient.readStorageObjects(session.token, request).then((response) => {
|
6289
|
-
var result = { objects: [] };
|
6290
|
-
if (response.objects == null) {
|
6291
|
-
return Promise.resolve(result);
|
6292
|
-
}
|
6293
|
-
response.objects.forEach((o) => {
|
6294
|
-
result.objects.push({
|
6295
|
-
collection: o.collection,
|
6296
|
-
key: o.key,
|
6297
|
-
permission_read: o.permission_read ? Number(o.permission_read) : 0,
|
6298
|
-
permission_write: o.permission_write ? Number(o.permission_write) : 0,
|
6299
|
-
value: o.value ? JSON.parse(o.value) : void 0,
|
6300
|
-
version: o.version,
|
6301
|
-
user_id: o.user_id,
|
6302
|
-
create_time: o.create_time,
|
6303
|
-
update_time: o.update_time
|
6304
|
-
});
|
6305
|
-
});
|
6306
|
-
return Promise.resolve(result);
|
6307
|
-
});
|
6308
|
-
});
|
6309
|
-
}
|
6310
6090
|
/** Execute an RPC function on the server. */
|
6311
6091
|
rpc(session, basicAuthUsername, basicAuthPassword, id, input) {
|
6312
6092
|
return __async(this, null, function* () {
|
@@ -6593,26 +6373,6 @@ var Client = class {
|
|
6593
6373
|
});
|
6594
6374
|
});
|
6595
6375
|
}
|
6596
|
-
/** Write storage objects. */
|
6597
|
-
writeStorageObjects(session, objects) {
|
6598
|
-
return __async(this, null, function* () {
|
6599
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6600
|
-
yield this.sessionRefresh(session);
|
6601
|
-
}
|
6602
|
-
var request = { objects: [] };
|
6603
|
-
objects.forEach((o) => {
|
6604
|
-
request.objects.push({
|
6605
|
-
collection: o.collection,
|
6606
|
-
key: o.key,
|
6607
|
-
permission_read: o.permission_read,
|
6608
|
-
permission_write: o.permission_write,
|
6609
|
-
value: JSON.stringify(o.value),
|
6610
|
-
version: o.version
|
6611
|
-
});
|
6612
|
-
});
|
6613
|
-
return this.apiClient.writeStorageObjects(session.token, request);
|
6614
|
-
});
|
6615
|
-
}
|
6616
6376
|
/** Set default notification clan*/
|
6617
6377
|
setNotificationClan(session, request) {
|
6618
6378
|
return __async(this, null, function* () {
|
@@ -6845,7 +6605,7 @@ var Client = class {
|
|
6845
6605
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6846
6606
|
yield this.sessionRefresh(session);
|
6847
6607
|
}
|
6848
|
-
return this.apiClient.
|
6608
|
+
return this.apiClient.deleteClanEmojiById(session.token, id, clan_id).then((response) => {
|
6849
6609
|
return response !== void 0;
|
6850
6610
|
});
|
6851
6611
|
});
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -2389,14 +2389,15 @@ var MezonApi = class {
|
|
2389
2389
|
]);
|
2390
2390
|
}
|
2391
2391
|
/** Delete a emoji by ID. */
|
2392
|
-
|
2392
|
+
deleteClanEmojiById(bearerToken, id, clanId, options = {}) {
|
2393
2393
|
if (id === null || id === void 0) {
|
2394
2394
|
throw new Error("'id' is a required parameter but is null or undefined.");
|
2395
2395
|
}
|
2396
2396
|
const urlPath = "/v2/emoji/{id}".replace("{id}", encodeURIComponent(String(id)));
|
2397
2397
|
const queryParams = /* @__PURE__ */ new Map();
|
2398
2398
|
queryParams.set("clan_id", clanId);
|
2399
|
-
|
2399
|
+
const body = { clan_id: clanId };
|
2400
|
+
let bodyJson = JSON.stringify(body || {});
|
2400
2401
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2401
2402
|
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
2402
2403
|
if (bearerToken) {
|
@@ -4044,157 +4045,6 @@ var MezonApi = class {
|
|
4044
4045
|
)
|
4045
4046
|
]);
|
4046
4047
|
}
|
4047
|
-
/** Get storage objects. */
|
4048
|
-
readStorageObjects(bearerToken, body, options = {}) {
|
4049
|
-
if (body === null || body === void 0) {
|
4050
|
-
throw new Error("'body' is a required parameter but is null or undefined.");
|
4051
|
-
}
|
4052
|
-
const urlPath = "/v2/storage";
|
4053
|
-
const queryParams = /* @__PURE__ */ new Map();
|
4054
|
-
let bodyJson = "";
|
4055
|
-
bodyJson = JSON.stringify(body || {});
|
4056
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4057
|
-
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
4058
|
-
if (bearerToken) {
|
4059
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4060
|
-
}
|
4061
|
-
return Promise.race([
|
4062
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
4063
|
-
if (response.status == 204) {
|
4064
|
-
return response;
|
4065
|
-
} else if (response.status >= 200 && response.status < 300) {
|
4066
|
-
return response.json();
|
4067
|
-
} else {
|
4068
|
-
throw response;
|
4069
|
-
}
|
4070
|
-
}),
|
4071
|
-
new Promise(
|
4072
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4073
|
-
)
|
4074
|
-
]);
|
4075
|
-
}
|
4076
|
-
/** Write objects into the storage engine. */
|
4077
|
-
writeStorageObjects(bearerToken, body, options = {}) {
|
4078
|
-
if (body === null || body === void 0) {
|
4079
|
-
throw new Error("'body' is a required parameter but is null or undefined.");
|
4080
|
-
}
|
4081
|
-
const urlPath = "/v2/storage";
|
4082
|
-
const queryParams = /* @__PURE__ */ new Map();
|
4083
|
-
let bodyJson = "";
|
4084
|
-
bodyJson = JSON.stringify(body || {});
|
4085
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4086
|
-
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
4087
|
-
if (bearerToken) {
|
4088
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4089
|
-
}
|
4090
|
-
return Promise.race([
|
4091
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
4092
|
-
if (response.status == 204) {
|
4093
|
-
return response;
|
4094
|
-
} else if (response.status >= 200 && response.status < 300) {
|
4095
|
-
return response.json();
|
4096
|
-
} else {
|
4097
|
-
throw response;
|
4098
|
-
}
|
4099
|
-
}),
|
4100
|
-
new Promise(
|
4101
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4102
|
-
)
|
4103
|
-
]);
|
4104
|
-
}
|
4105
|
-
/** Delete one or more objects by ID or username. */
|
4106
|
-
deleteStorageObjects(bearerToken, body, options = {}) {
|
4107
|
-
if (body === null || body === void 0) {
|
4108
|
-
throw new Error("'body' is a required parameter but is null or undefined.");
|
4109
|
-
}
|
4110
|
-
const urlPath = "/v2/storage/delete";
|
4111
|
-
const queryParams = /* @__PURE__ */ new Map();
|
4112
|
-
let bodyJson = "";
|
4113
|
-
bodyJson = JSON.stringify(body || {});
|
4114
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4115
|
-
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
4116
|
-
if (bearerToken) {
|
4117
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4118
|
-
}
|
4119
|
-
return Promise.race([
|
4120
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
4121
|
-
if (response.status == 204) {
|
4122
|
-
return response;
|
4123
|
-
} else if (response.status >= 200 && response.status < 300) {
|
4124
|
-
return response.json();
|
4125
|
-
} else {
|
4126
|
-
throw response;
|
4127
|
-
}
|
4128
|
-
}),
|
4129
|
-
new Promise(
|
4130
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4131
|
-
)
|
4132
|
-
]);
|
4133
|
-
}
|
4134
|
-
/** List publicly readable storage objects in a given collection. */
|
4135
|
-
listStorageObjects(bearerToken, collection, userId, limit, cursor, options = {}) {
|
4136
|
-
if (collection === null || collection === void 0) {
|
4137
|
-
throw new Error("'collection' is a required parameter but is null or undefined.");
|
4138
|
-
}
|
4139
|
-
const urlPath = "/v2/storage/{collection}".replace("{collection}", encodeURIComponent(String(collection)));
|
4140
|
-
const queryParams = /* @__PURE__ */ new Map();
|
4141
|
-
queryParams.set("user_id", userId);
|
4142
|
-
queryParams.set("limit", limit);
|
4143
|
-
queryParams.set("cursor", cursor);
|
4144
|
-
let bodyJson = "";
|
4145
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4146
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
4147
|
-
if (bearerToken) {
|
4148
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4149
|
-
}
|
4150
|
-
return Promise.race([
|
4151
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
4152
|
-
if (response.status == 204) {
|
4153
|
-
return response;
|
4154
|
-
} else if (response.status >= 200 && response.status < 300) {
|
4155
|
-
return response.json();
|
4156
|
-
} else {
|
4157
|
-
throw response;
|
4158
|
-
}
|
4159
|
-
}),
|
4160
|
-
new Promise(
|
4161
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4162
|
-
)
|
4163
|
-
]);
|
4164
|
-
}
|
4165
|
-
/** List publicly readable storage objects in a given collection. */
|
4166
|
-
listStorageObjects2(bearerToken, collection, userId, limit, cursor, options = {}) {
|
4167
|
-
if (collection === null || collection === void 0) {
|
4168
|
-
throw new Error("'collection' is a required parameter but is null or undefined.");
|
4169
|
-
}
|
4170
|
-
if (userId === null || userId === void 0) {
|
4171
|
-
throw new Error("'userId' is a required parameter but is null or undefined.");
|
4172
|
-
}
|
4173
|
-
const urlPath = "/v2/storage/{collection}/{userId}".replace("{collection}", encodeURIComponent(String(collection))).replace("{userId}", encodeURIComponent(String(userId)));
|
4174
|
-
const queryParams = /* @__PURE__ */ new Map();
|
4175
|
-
queryParams.set("limit", limit);
|
4176
|
-
queryParams.set("cursor", cursor);
|
4177
|
-
let bodyJson = "";
|
4178
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4179
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
4180
|
-
if (bearerToken) {
|
4181
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4182
|
-
}
|
4183
|
-
return Promise.race([
|
4184
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
4185
|
-
if (response.status == 204) {
|
4186
|
-
return response;
|
4187
|
-
} else if (response.status >= 200 && response.status < 300) {
|
4188
|
-
return response.json();
|
4189
|
-
} else {
|
4190
|
-
throw response;
|
4191
|
-
}
|
4192
|
-
}),
|
4193
|
-
new Promise(
|
4194
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4195
|
-
)
|
4196
|
-
]);
|
4197
|
-
}
|
4198
4048
|
/** Update fields in a given category. */
|
4199
4049
|
updateCategory(bearerToken, body, options = {}) {
|
4200
4050
|
if (body === null || body === void 0) {
|
@@ -5064,9 +4914,9 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5064
4914
|
unfollowUsers(user_ids) {
|
5065
4915
|
return this.send({ status_unfollow: { user_ids } });
|
5066
4916
|
}
|
5067
|
-
updateChatMessage(clan_id, channel_id, mode, message_id, content, mentions) {
|
4917
|
+
updateChatMessage(clan_id, channel_id, mode, message_id, content, mentions, attachments) {
|
5068
4918
|
return __async(this, null, function* () {
|
5069
|
-
const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, mode } });
|
4919
|
+
const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, attachments, mode } });
|
5070
4920
|
return response.channel_message_ack;
|
5071
4921
|
});
|
5072
4922
|
}
|
@@ -5517,17 +5367,6 @@ var Client = class {
|
|
5517
5367
|
});
|
5518
5368
|
});
|
5519
5369
|
}
|
5520
|
-
/** Delete one or more storage objects */
|
5521
|
-
deleteStorageObjects(session, request) {
|
5522
|
-
return __async(this, null, function* () {
|
5523
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5524
|
-
yield this.sessionRefresh(session);
|
5525
|
-
}
|
5526
|
-
return this.apiClient.deleteStorageObjects(session.token, request).then((response) => {
|
5527
|
-
return Promise.resolve(response != void 0);
|
5528
|
-
});
|
5529
|
-
});
|
5530
|
-
}
|
5531
5370
|
/** Delete a role by ID. */
|
5532
5371
|
deleteRole(session, roleId) {
|
5533
5372
|
return __async(this, null, function* () {
|
@@ -6219,65 +6058,6 @@ var Client = class {
|
|
6219
6058
|
});
|
6220
6059
|
});
|
6221
6060
|
}
|
6222
|
-
/** List storage objects. */
|
6223
|
-
listStorageObjects(session, collection, userId, limit, cursor) {
|
6224
|
-
return __async(this, null, function* () {
|
6225
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6226
|
-
yield this.sessionRefresh(session);
|
6227
|
-
}
|
6228
|
-
return this.apiClient.listStorageObjects(session.token, collection, userId, limit, cursor).then((response) => {
|
6229
|
-
var result = {
|
6230
|
-
objects: [],
|
6231
|
-
cursor: response.cursor
|
6232
|
-
};
|
6233
|
-
if (response.objects == null) {
|
6234
|
-
return Promise.resolve(result);
|
6235
|
-
}
|
6236
|
-
response.objects.forEach((o) => {
|
6237
|
-
result.objects.push({
|
6238
|
-
collection: o.collection,
|
6239
|
-
key: o.key,
|
6240
|
-
permission_read: o.permission_read ? Number(o.permission_read) : 0,
|
6241
|
-
permission_write: o.permission_write ? Number(o.permission_write) : 0,
|
6242
|
-
value: o.value ? JSON.parse(o.value) : void 0,
|
6243
|
-
version: o.version,
|
6244
|
-
user_id: o.user_id,
|
6245
|
-
create_time: o.create_time,
|
6246
|
-
update_time: o.update_time
|
6247
|
-
});
|
6248
|
-
});
|
6249
|
-
return Promise.resolve(result);
|
6250
|
-
});
|
6251
|
-
});
|
6252
|
-
}
|
6253
|
-
/** Fetch storage objects. */
|
6254
|
-
readStorageObjects(session, request) {
|
6255
|
-
return __async(this, null, function* () {
|
6256
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6257
|
-
yield this.sessionRefresh(session);
|
6258
|
-
}
|
6259
|
-
return this.apiClient.readStorageObjects(session.token, request).then((response) => {
|
6260
|
-
var result = { objects: [] };
|
6261
|
-
if (response.objects == null) {
|
6262
|
-
return Promise.resolve(result);
|
6263
|
-
}
|
6264
|
-
response.objects.forEach((o) => {
|
6265
|
-
result.objects.push({
|
6266
|
-
collection: o.collection,
|
6267
|
-
key: o.key,
|
6268
|
-
permission_read: o.permission_read ? Number(o.permission_read) : 0,
|
6269
|
-
permission_write: o.permission_write ? Number(o.permission_write) : 0,
|
6270
|
-
value: o.value ? JSON.parse(o.value) : void 0,
|
6271
|
-
version: o.version,
|
6272
|
-
user_id: o.user_id,
|
6273
|
-
create_time: o.create_time,
|
6274
|
-
update_time: o.update_time
|
6275
|
-
});
|
6276
|
-
});
|
6277
|
-
return Promise.resolve(result);
|
6278
|
-
});
|
6279
|
-
});
|
6280
|
-
}
|
6281
6061
|
/** Execute an RPC function on the server. */
|
6282
6062
|
rpc(session, basicAuthUsername, basicAuthPassword, id, input) {
|
6283
6063
|
return __async(this, null, function* () {
|
@@ -6564,26 +6344,6 @@ var Client = class {
|
|
6564
6344
|
});
|
6565
6345
|
});
|
6566
6346
|
}
|
6567
|
-
/** Write storage objects. */
|
6568
|
-
writeStorageObjects(session, objects) {
|
6569
|
-
return __async(this, null, function* () {
|
6570
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6571
|
-
yield this.sessionRefresh(session);
|
6572
|
-
}
|
6573
|
-
var request = { objects: [] };
|
6574
|
-
objects.forEach((o) => {
|
6575
|
-
request.objects.push({
|
6576
|
-
collection: o.collection,
|
6577
|
-
key: o.key,
|
6578
|
-
permission_read: o.permission_read,
|
6579
|
-
permission_write: o.permission_write,
|
6580
|
-
value: JSON.stringify(o.value),
|
6581
|
-
version: o.version
|
6582
|
-
});
|
6583
|
-
});
|
6584
|
-
return this.apiClient.writeStorageObjects(session.token, request);
|
6585
|
-
});
|
6586
|
-
}
|
6587
6347
|
/** Set default notification clan*/
|
6588
6348
|
setNotificationClan(session, request) {
|
6589
6349
|
return __async(this, null, function* () {
|
@@ -6816,7 +6576,7 @@ var Client = class {
|
|
6816
6576
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6817
6577
|
yield this.sessionRefresh(session);
|
6818
6578
|
}
|
6819
|
-
return this.apiClient.
|
6579
|
+
return this.apiClient.deleteClanEmojiById(session.token, id, clan_id).then((response) => {
|
6820
6580
|
return response !== void 0;
|
6821
6581
|
});
|
6822
6582
|
});
|
package/dist/socket.d.ts
CHANGED
@@ -270,6 +270,8 @@ interface ChannelMessageUpdate {
|
|
270
270
|
content: any;
|
271
271
|
/** mentions */
|
272
272
|
mentions?: Array<MessageMentionEvent>;
|
273
|
+
/** attachments */
|
274
|
+
attachments?: Array<MessageAttachmentEvent>;
|
273
275
|
/** The mode payload. */
|
274
276
|
mode: number;
|
275
277
|
};
|
@@ -492,7 +494,7 @@ export interface Socket {
|
|
492
494
|
/** Unfollow one or more users from their status updates. */
|
493
495
|
unfollowUsers(user_ids: string[]): Promise<void>;
|
494
496
|
/** Update a chat message on a chat channel in the server. */
|
495
|
-
updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string, content: any, mentions?: Array<ApiMessageMention>): Promise<ChannelMessageAck>;
|
497
|
+
updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>): Promise<ChannelMessageAck>;
|
496
498
|
/** Update the status for the current user online. */
|
497
499
|
updateStatus(status?: string): Promise<void>;
|
498
500
|
/** Send a chat message to a chat channel on the server. */
|
@@ -628,7 +630,7 @@ export declare class DefaultSocket implements Socket {
|
|
628
630
|
rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc>;
|
629
631
|
sendPartyData(party_id: string, op_code: number, data: string | Uint8Array): Promise<void>;
|
630
632
|
unfollowUsers(user_ids: string[]): Promise<void>;
|
631
|
-
updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string, content: any, mentions?: Array<ApiMessageMention>): Promise<ChannelMessageAck>;
|
633
|
+
updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>): Promise<ChannelMessageAck>;
|
632
634
|
updateStatus(status?: string): Promise<void>;
|
633
635
|
writeChatMessage(clan_id: string, channel_id: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean, notifi_content?: any): Promise<ChannelMessageAck>;
|
634
636
|
writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<MessageReactionEvent>;
|