mezon-js 2.8.88 → 2.8.89
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +52 -0
- package/client.ts +19 -0
- package/dist/api.gen.d.ts +11 -0
- package/dist/client.d.ts +2 -1
- package/dist/mezon-js.cjs.js +49 -15
- package/dist/mezon-js.esm.mjs +49 -15
- package/dist/socket.d.ts +9 -11
- package/package.json +1 -1
- package/socket.ts +17 -21
package/api.gen.ts
CHANGED
@@ -940,6 +940,22 @@ export interface ApiFriendList {
|
|
940
940
|
friends?: Array<ApiFriend>;
|
941
941
|
}
|
942
942
|
|
943
|
+
/** */
|
944
|
+
export interface ApiGiveCoffeeEvent {
|
945
|
+
//
|
946
|
+
channel_id?: string;
|
947
|
+
//
|
948
|
+
clan_id?: string;
|
949
|
+
//
|
950
|
+
message_ref_id?: string;
|
951
|
+
//
|
952
|
+
receiver_id?: string;
|
953
|
+
//
|
954
|
+
sender_id?: string;
|
955
|
+
//
|
956
|
+
token_count?: number;
|
957
|
+
}
|
958
|
+
|
943
959
|
/** Add link invite users to. */
|
944
960
|
export interface ApiInviteUserRes {
|
945
961
|
//id channel to add link to.
|
@@ -4961,6 +4977,42 @@ export class MezonApi {
|
|
4961
4977
|
]);
|
4962
4978
|
}
|
4963
4979
|
|
4980
|
+
/** Give a coffee */
|
4981
|
+
giveMeACoffee(bearerToken: string,
|
4982
|
+
body:ApiGiveCoffeeEvent,
|
4983
|
+
options: any = {}): Promise<any> {
|
4984
|
+
|
4985
|
+
if (body === null || body === undefined) {
|
4986
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
4987
|
+
}
|
4988
|
+
const urlPath = "/v2/givecoffee";
|
4989
|
+
const queryParams = new Map<string, any>();
|
4990
|
+
|
4991
|
+
let bodyJson : string = "";
|
4992
|
+
bodyJson = JSON.stringify(body || {});
|
4993
|
+
|
4994
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4995
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
4996
|
+
if (bearerToken) {
|
4997
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4998
|
+
}
|
4999
|
+
|
5000
|
+
return Promise.race([
|
5001
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
5002
|
+
if (response.status == 204) {
|
5003
|
+
return response;
|
5004
|
+
} else if (response.status >= 200 && response.status < 300) {
|
5005
|
+
return response.json();
|
5006
|
+
} else {
|
5007
|
+
throw response;
|
5008
|
+
}
|
5009
|
+
}),
|
5010
|
+
new Promise((_, reject) =>
|
5011
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
5012
|
+
),
|
5013
|
+
]);
|
5014
|
+
}
|
5015
|
+
|
4964
5016
|
/** Add users to a channel. */
|
4965
5017
|
createLinkInviteUser(bearerToken: string,
|
4966
5018
|
body:ApiLinkInviteUserRequest,
|
package/client.ts
CHANGED
@@ -101,6 +101,7 @@ import {
|
|
101
101
|
ApiSystemMessageRequest,
|
102
102
|
MezonUpdateSystemMessageBody,
|
103
103
|
ApiUpdateCategoryOrderRequest,
|
104
|
+
ApiGiveCoffeeEvent,
|
104
105
|
} from "./api.gen";
|
105
106
|
|
106
107
|
import { Session } from "./session";
|
@@ -3412,6 +3413,7 @@ export class Client {
|
|
3412
3413
|
return Promise.resolve(response);
|
3413
3414
|
});
|
3414
3415
|
}
|
3416
|
+
|
3415
3417
|
async updateCategoryOrder(
|
3416
3418
|
session: Session,
|
3417
3419
|
request: ApiUpdateCategoryOrderRequest
|
@@ -3430,6 +3432,7 @@ export class Client {
|
|
3430
3432
|
return Promise.resolve(response);
|
3431
3433
|
});
|
3432
3434
|
}
|
3435
|
+
|
3433
3436
|
async deleteCategoryOrder(session: Session, clanId: string): Promise<any> {
|
3434
3437
|
if (
|
3435
3438
|
this.autoRefreshSession &&
|
@@ -3445,4 +3448,20 @@ export class Client {
|
|
3445
3448
|
return Promise.resolve(response);
|
3446
3449
|
});
|
3447
3450
|
}
|
3451
|
+
|
3452
|
+
async givecoffee(session: Session, request: ApiGiveCoffeeEvent) {
|
3453
|
+
if (
|
3454
|
+
this.autoRefreshSession &&
|
3455
|
+
session.refresh_token &&
|
3456
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
3457
|
+
) {
|
3458
|
+
await this.sessionRefresh(session);
|
3459
|
+
}
|
3460
|
+
|
3461
|
+
return this.apiClient
|
3462
|
+
.giveMeACoffee(session.token, request)
|
3463
|
+
.then((response: ApiAppList) => {
|
3464
|
+
return response !== undefined;
|
3465
|
+
});
|
3466
|
+
}
|
3448
3467
|
}
|
package/dist/api.gen.d.ts
CHANGED
@@ -539,6 +539,15 @@ export interface ApiFriendList {
|
|
539
539
|
cursor?: string;
|
540
540
|
friends?: Array<ApiFriend>;
|
541
541
|
}
|
542
|
+
/** */
|
543
|
+
export interface ApiGiveCoffeeEvent {
|
544
|
+
channel_id?: string;
|
545
|
+
clan_id?: string;
|
546
|
+
message_ref_id?: string;
|
547
|
+
receiver_id?: string;
|
548
|
+
sender_id?: string;
|
549
|
+
token_count?: number;
|
550
|
+
}
|
542
551
|
/** Add link invite users to. */
|
543
552
|
export interface ApiInviteUserRes {
|
544
553
|
channel_id?: string;
|
@@ -1176,6 +1185,8 @@ export declare class MezonApi {
|
|
1176
1185
|
importSteamFriends(bearerToken: string, account: ApiAccountSteam, reset?: boolean, options?: any): Promise<any>;
|
1177
1186
|
/** */
|
1178
1187
|
getUserProfileOnClan(bearerToken: string, clanId: string, options?: any): Promise<ApiClanProfile>;
|
1188
|
+
/** Give a coffee */
|
1189
|
+
giveMeACoffee(bearerToken: string, body: ApiGiveCoffeeEvent, options?: any): Promise<any>;
|
1179
1190
|
/** Add users to a channel. */
|
1180
1191
|
createLinkInviteUser(bearerToken: string, body: ApiLinkInviteUserRequest, options?: any): Promise<ApiLinkInviteUser>;
|
1181
1192
|
/** Add users to a channel. */
|
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, 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, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest } from "./api.gen";
|
16
|
+
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, 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, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -550,4 +550,5 @@ export declare class Client {
|
|
550
550
|
deleteSystemMessage(session: Session, clanId: string): Promise<any>;
|
551
551
|
updateCategoryOrder(session: Session, request: ApiUpdateCategoryOrderRequest): Promise<any>;
|
552
552
|
deleteCategoryOrder(session: Session, clanId: string): Promise<any>;
|
553
|
+
givecoffee(session: Session, request: ApiGiveCoffeeEvent): Promise<boolean>;
|
553
554
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -3206,6 +3206,35 @@ var MezonApi = class {
|
|
3206
3206
|
)
|
3207
3207
|
]);
|
3208
3208
|
}
|
3209
|
+
/** Give a coffee */
|
3210
|
+
giveMeACoffee(bearerToken, body, options = {}) {
|
3211
|
+
if (body === null || body === void 0) {
|
3212
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
3213
|
+
}
|
3214
|
+
const urlPath = "/v2/givecoffee";
|
3215
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3216
|
+
let bodyJson = "";
|
3217
|
+
bodyJson = JSON.stringify(body || {});
|
3218
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3219
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
3220
|
+
if (bearerToken) {
|
3221
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3222
|
+
}
|
3223
|
+
return Promise.race([
|
3224
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3225
|
+
if (response.status == 204) {
|
3226
|
+
return response;
|
3227
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3228
|
+
return response.json();
|
3229
|
+
} else {
|
3230
|
+
throw response;
|
3231
|
+
}
|
3232
|
+
}),
|
3233
|
+
new Promise(
|
3234
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3235
|
+
)
|
3236
|
+
]);
|
3237
|
+
}
|
3209
3238
|
/** Add users to a channel. */
|
3210
3239
|
createLinkInviteUser(bearerToken, body, options = {}) {
|
3211
3240
|
if (body === null || body === void 0) {
|
@@ -4962,6 +4991,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4962
4991
|
this.onuserclanremoved(message.user_clan_removed_event);
|
4963
4992
|
} else if (message.clan_event_created) {
|
4964
4993
|
this.oneventcreated(message.clan_event_created);
|
4994
|
+
} else if (message.give_coffee_event) {
|
4995
|
+
this.oncoffeegiven(message.give_coffee_event);
|
4965
4996
|
} else {
|
4966
4997
|
if (this.verbose && window && window.console) {
|
4967
4998
|
console.log("Unrecognized message received: %o", message);
|
@@ -5159,6 +5190,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5159
5190
|
console.log(clan_event_created);
|
5160
5191
|
}
|
5161
5192
|
}
|
5193
|
+
oncoffeegiven(give_coffee_event) {
|
5194
|
+
if (this.verbose && window && window.console) {
|
5195
|
+
console.log(give_coffee_event);
|
5196
|
+
}
|
5197
|
+
}
|
5162
5198
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
5163
5199
|
const untypedMessage = message;
|
5164
5200
|
return new Promise((resolve, reject) => {
|
@@ -5332,13 +5368,13 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5332
5368
|
return response.role_list_event;
|
5333
5369
|
});
|
5334
5370
|
}
|
5335
|
-
|
5371
|
+
listChannelByUserId() {
|
5336
5372
|
return __async(this, null, function* () {
|
5337
5373
|
const response = yield this.send({ channel_desc_list_event: {} });
|
5338
5374
|
return response.channel_desc_list_event;
|
5339
5375
|
});
|
5340
5376
|
}
|
5341
|
-
|
5377
|
+
listUserClansByUserId() {
|
5342
5378
|
return __async(this, null, function* () {
|
5343
5379
|
const response = yield this.send({ all_user_clans: {} });
|
5344
5380
|
return response.all_user_clans;
|
@@ -5350,7 +5386,7 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5350
5386
|
return response.hashtag_dm_list_event;
|
5351
5387
|
});
|
5352
5388
|
}
|
5353
|
-
|
5389
|
+
getPermissionByRoleIdChannelId(role_id, channel_id) {
|
5354
5390
|
return __async(this, null, function* () {
|
5355
5391
|
const response = yield this.send({ permission_role_channel_list_event: { role_id, channel_id } });
|
5356
5392
|
return response.permission_role_channel_list_event;
|
@@ -5392,18 +5428,6 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5392
5428
|
return response.notification_channel_category_setting_event;
|
5393
5429
|
});
|
5394
5430
|
}
|
5395
|
-
addUserEmojiUsage(add_user_emoji_usage_event) {
|
5396
|
-
return __async(this, null, function* () {
|
5397
|
-
const response = yield this.send({ add_user_emoji_usage_event: { add_user_emoji_usage_event } });
|
5398
|
-
return response.add_user_emoji_usage_event;
|
5399
|
-
});
|
5400
|
-
}
|
5401
|
-
getUserEmojiUsage(clanId) {
|
5402
|
-
return __async(this, null, function* () {
|
5403
|
-
const response = yield this.send({ get_user_emoji_usage_event: { clanId } });
|
5404
|
-
return response.get_user_emoji_usage_event;
|
5405
|
-
});
|
5406
|
-
}
|
5407
5431
|
pingPong() {
|
5408
5432
|
return __async(this, null, function* () {
|
5409
5433
|
if (!this.adapter.isOpen()) {
|
@@ -7246,4 +7270,14 @@ var Client = class {
|
|
7246
7270
|
});
|
7247
7271
|
});
|
7248
7272
|
}
|
7273
|
+
givecoffee(session, request) {
|
7274
|
+
return __async(this, null, function* () {
|
7275
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7276
|
+
yield this.sessionRefresh(session);
|
7277
|
+
}
|
7278
|
+
return this.apiClient.giveMeACoffee(session.token, request).then((response) => {
|
7279
|
+
return response !== void 0;
|
7280
|
+
});
|
7281
|
+
});
|
7282
|
+
}
|
7249
7283
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -3177,6 +3177,35 @@ var MezonApi = class {
|
|
3177
3177
|
)
|
3178
3178
|
]);
|
3179
3179
|
}
|
3180
|
+
/** Give a coffee */
|
3181
|
+
giveMeACoffee(bearerToken, body, options = {}) {
|
3182
|
+
if (body === null || body === void 0) {
|
3183
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
3184
|
+
}
|
3185
|
+
const urlPath = "/v2/givecoffee";
|
3186
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3187
|
+
let bodyJson = "";
|
3188
|
+
bodyJson = JSON.stringify(body || {});
|
3189
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3190
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
3191
|
+
if (bearerToken) {
|
3192
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3193
|
+
}
|
3194
|
+
return Promise.race([
|
3195
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3196
|
+
if (response.status == 204) {
|
3197
|
+
return response;
|
3198
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3199
|
+
return response.json();
|
3200
|
+
} else {
|
3201
|
+
throw response;
|
3202
|
+
}
|
3203
|
+
}),
|
3204
|
+
new Promise(
|
3205
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3206
|
+
)
|
3207
|
+
]);
|
3208
|
+
}
|
3180
3209
|
/** Add users to a channel. */
|
3181
3210
|
createLinkInviteUser(bearerToken, body, options = {}) {
|
3182
3211
|
if (body === null || body === void 0) {
|
@@ -4933,6 +4962,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4933
4962
|
this.onuserclanremoved(message.user_clan_removed_event);
|
4934
4963
|
} else if (message.clan_event_created) {
|
4935
4964
|
this.oneventcreated(message.clan_event_created);
|
4965
|
+
} else if (message.give_coffee_event) {
|
4966
|
+
this.oncoffeegiven(message.give_coffee_event);
|
4936
4967
|
} else {
|
4937
4968
|
if (this.verbose && window && window.console) {
|
4938
4969
|
console.log("Unrecognized message received: %o", message);
|
@@ -5130,6 +5161,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5130
5161
|
console.log(clan_event_created);
|
5131
5162
|
}
|
5132
5163
|
}
|
5164
|
+
oncoffeegiven(give_coffee_event) {
|
5165
|
+
if (this.verbose && window && window.console) {
|
5166
|
+
console.log(give_coffee_event);
|
5167
|
+
}
|
5168
|
+
}
|
5133
5169
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
5134
5170
|
const untypedMessage = message;
|
5135
5171
|
return new Promise((resolve, reject) => {
|
@@ -5303,13 +5339,13 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5303
5339
|
return response.role_list_event;
|
5304
5340
|
});
|
5305
5341
|
}
|
5306
|
-
|
5342
|
+
listChannelByUserId() {
|
5307
5343
|
return __async(this, null, function* () {
|
5308
5344
|
const response = yield this.send({ channel_desc_list_event: {} });
|
5309
5345
|
return response.channel_desc_list_event;
|
5310
5346
|
});
|
5311
5347
|
}
|
5312
|
-
|
5348
|
+
listUserClansByUserId() {
|
5313
5349
|
return __async(this, null, function* () {
|
5314
5350
|
const response = yield this.send({ all_user_clans: {} });
|
5315
5351
|
return response.all_user_clans;
|
@@ -5321,7 +5357,7 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5321
5357
|
return response.hashtag_dm_list_event;
|
5322
5358
|
});
|
5323
5359
|
}
|
5324
|
-
|
5360
|
+
getPermissionByRoleIdChannelId(role_id, channel_id) {
|
5325
5361
|
return __async(this, null, function* () {
|
5326
5362
|
const response = yield this.send({ permission_role_channel_list_event: { role_id, channel_id } });
|
5327
5363
|
return response.permission_role_channel_list_event;
|
@@ -5363,18 +5399,6 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5363
5399
|
return response.notification_channel_category_setting_event;
|
5364
5400
|
});
|
5365
5401
|
}
|
5366
|
-
addUserEmojiUsage(add_user_emoji_usage_event) {
|
5367
|
-
return __async(this, null, function* () {
|
5368
|
-
const response = yield this.send({ add_user_emoji_usage_event: { add_user_emoji_usage_event } });
|
5369
|
-
return response.add_user_emoji_usage_event;
|
5370
|
-
});
|
5371
|
-
}
|
5372
|
-
getUserEmojiUsage(clanId) {
|
5373
|
-
return __async(this, null, function* () {
|
5374
|
-
const response = yield this.send({ get_user_emoji_usage_event: { clanId } });
|
5375
|
-
return response.get_user_emoji_usage_event;
|
5376
|
-
});
|
5377
|
-
}
|
5378
5402
|
pingPong() {
|
5379
5403
|
return __async(this, null, function* () {
|
5380
5404
|
if (!this.adapter.isOpen()) {
|
@@ -7217,6 +7241,16 @@ var Client = class {
|
|
7217
7241
|
});
|
7218
7242
|
});
|
7219
7243
|
}
|
7244
|
+
givecoffee(session, request) {
|
7245
|
+
return __async(this, null, function* () {
|
7246
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7247
|
+
yield this.sessionRefresh(session);
|
7248
|
+
}
|
7249
|
+
return this.apiClient.giveMeACoffee(session.token, request).then((response) => {
|
7250
|
+
return response !== void 0;
|
7251
|
+
});
|
7252
|
+
});
|
7253
|
+
}
|
7220
7254
|
};
|
7221
7255
|
export {
|
7222
7256
|
ChannelStreamMode,
|
package/dist/socket.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 { ApiChannelMessageHeader, ApiCreateEventRequest, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiPermissionList, ApiRoleList, ApiRpc, ApiUser } from "./api.gen";
|
16
|
+
import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiPermissionList, ApiRoleList, ApiRpc, ApiUser } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { ChannelMessage, Notification } from "./client";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -640,18 +640,17 @@ export interface Socket {
|
|
640
640
|
listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
|
641
641
|
listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
|
642
642
|
listStickersByUserId(): Promise<StrickerListedEvent>;
|
643
|
-
|
644
|
-
|
643
|
+
listChannelByUserId(): Promise<ChannelDescListEvent>;
|
644
|
+
listUserClansByUserId(): Promise<AllUserClans>;
|
645
645
|
hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
|
646
646
|
getNotificationChannelSetting(channel_id: string): Promise<NotificationChannelSettingEvent>;
|
647
647
|
getNotificationCategorySetting(category_id: string): Promise<NotificationCategorySettingEvent>;
|
648
648
|
getNotificationClanSetting(clan_id: string): Promise<NotificationClanSettingEvent>;
|
649
649
|
getNotificationReactMessage(channel_id_req: string): Promise<NotifiReactMessageEvent>;
|
650
|
-
|
650
|
+
getPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent>;
|
651
651
|
getNotificationChannelCategorySetting(clan_id: string): Promise<NotificationChannelCategorySettingEvent>;
|
652
652
|
oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
|
653
|
-
|
654
|
-
getUserEmojiUsage(clanId: string): Promise<GetUserEmojiUsageEvent>;
|
653
|
+
oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
|
655
654
|
}
|
656
655
|
/** Reports an error received from a socket message. */
|
657
656
|
export interface SocketError {
|
@@ -710,6 +709,7 @@ export declare class DefaultSocket implements Socket {
|
|
710
709
|
onheartbeattimeout(): void;
|
711
710
|
oncustomstatus(statusEvent: CustomStatusEvent): void;
|
712
711
|
oneventcreated(clan_event_created: ApiCreateEventRequest): void;
|
712
|
+
oncoffeegiven(give_coffee_event: ApiGiveCoffeeEvent): void;
|
713
713
|
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout?: number): Promise<any>;
|
714
714
|
followUsers(userIds: string[]): Promise<Status>;
|
715
715
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
@@ -732,18 +732,16 @@ export declare class DefaultSocket implements Socket {
|
|
732
732
|
listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
|
733
733
|
listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
|
734
734
|
listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
|
735
|
-
|
736
|
-
|
735
|
+
listChannelByUserId(): Promise<ChannelDescListEvent>;
|
736
|
+
listUserClansByUserId(): Promise<AllUserClans>;
|
737
737
|
hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
|
738
|
-
|
738
|
+
getPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent>;
|
739
739
|
listStickersByUserId(): Promise<StrickerListedEvent>;
|
740
740
|
getNotificationChannelSetting(channel_id: string): Promise<NotificationChannelSettingEvent>;
|
741
741
|
getNotificationCategorySetting(category_id: string): Promise<NotificationCategorySettingEvent>;
|
742
742
|
getNotificationClanSetting(clan_id: string): Promise<NotificationClanSettingEvent>;
|
743
743
|
getNotificationReactMessage(channel_id: string): Promise<NotifiReactMessageEvent>;
|
744
744
|
getNotificationChannelCategorySetting(clan_id: string): Promise<NotificationChannelCategorySettingEvent>;
|
745
|
-
addUserEmojiUsage(add_user_emoji_usage_event: AddUserEmojiUsageEvent): Promise<any>;
|
746
|
-
getUserEmojiUsage(clanId: string): Promise<GetUserEmojiUsageEvent>;
|
747
745
|
private pingPong;
|
748
746
|
}
|
749
747
|
export {};
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiPermissionList, ApiRoleList, ApiRpc, ApiUser} from "./api.gen";
|
17
|
+
import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiPermissionList, ApiRoleList, ApiRpc, ApiUser} from "./api.gen";
|
18
18
|
import {Session} from "./session";
|
19
19
|
import {ChannelMessage, Notification} from "./client";
|
20
20
|
import {WebSocketAdapter, WebSocketAdapterText} from "./web_socket_adapter"
|
@@ -973,9 +973,9 @@ export interface Socket {
|
|
973
973
|
|
974
974
|
listStickersByUserId(): Promise<StrickerListedEvent>;
|
975
975
|
|
976
|
-
|
976
|
+
listChannelByUserId(): Promise<ChannelDescListEvent>;
|
977
977
|
|
978
|
-
|
978
|
+
listUserClansByUserId(): Promise<AllUserClans>;
|
979
979
|
|
980
980
|
hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
|
981
981
|
|
@@ -987,15 +987,13 @@ export interface Socket {
|
|
987
987
|
|
988
988
|
getNotificationReactMessage(channel_id_req: string): Promise<NotifiReactMessageEvent>;
|
989
989
|
|
990
|
-
|
990
|
+
getPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent>;
|
991
991
|
|
992
992
|
getNotificationChannelCategorySetting(clan_id : string): Promise<NotificationChannelCategorySettingEvent>;
|
993
993
|
|
994
994
|
oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
|
995
995
|
|
996
|
-
|
997
|
-
|
998
|
-
getUserEmojiUsage(clanId: string): Promise<GetUserEmojiUsageEvent>
|
996
|
+
oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
|
999
997
|
|
1000
998
|
}
|
1001
999
|
|
@@ -1170,7 +1168,9 @@ export class DefaultSocket implements Socket {
|
|
1170
1168
|
this.onuserclanremoved(<UserClanRemovedEvent>message.user_clan_removed_event);
|
1171
1169
|
} else if(message.clan_event_created){
|
1172
1170
|
this.oneventcreated(message.clan_event_created);
|
1173
|
-
}else {
|
1171
|
+
} else if(message.give_coffee_event){
|
1172
|
+
this.oncoffeegiven(<ApiGiveCoffeeEvent>message.give_coffee_event);
|
1173
|
+
} else {
|
1174
1174
|
if (this.verbose && window && window.console) {
|
1175
1175
|
console.log("Unrecognized message received: %o", message);
|
1176
1176
|
}
|
@@ -1404,6 +1404,12 @@ export class DefaultSocket implements Socket {
|
|
1404
1404
|
console.log(clan_event_created);
|
1405
1405
|
}
|
1406
1406
|
}
|
1407
|
+
|
1408
|
+
oncoffeegiven(give_coffee_event: ApiGiveCoffeeEvent) {
|
1409
|
+
if (this.verbose && window && window.console) {
|
1410
|
+
console.log(give_coffee_event);
|
1411
|
+
}
|
1412
|
+
}
|
1407
1413
|
|
1408
1414
|
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent |
|
1409
1415
|
ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout = DefaultSocket.DefaultSendTimeoutMs): Promise<any> {
|
@@ -1574,12 +1580,12 @@ export class DefaultSocket implements Socket {
|
|
1574
1580
|
return response.role_list_event
|
1575
1581
|
}
|
1576
1582
|
|
1577
|
-
async
|
1583
|
+
async listChannelByUserId(): Promise<ChannelDescListEvent> {
|
1578
1584
|
const response = await this.send({channel_desc_list_event: {}});
|
1579
1585
|
return response.channel_desc_list_event
|
1580
1586
|
}
|
1581
1587
|
|
1582
|
-
async
|
1588
|
+
async listUserClansByUserId(): Promise<AllUserClans> {
|
1583
1589
|
const response = await this.send({all_user_clans: {}});
|
1584
1590
|
return response.all_user_clans
|
1585
1591
|
}
|
@@ -1589,7 +1595,7 @@ export class DefaultSocket implements Socket {
|
|
1589
1595
|
return response.hashtag_dm_list_event
|
1590
1596
|
}
|
1591
1597
|
|
1592
|
-
async
|
1598
|
+
async getPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent> {
|
1593
1599
|
const response = await this.send({permission_role_channel_list_event: {role_id: role_id, channel_id: channel_id }});
|
1594
1600
|
return response.permission_role_channel_list_event
|
1595
1601
|
}
|
@@ -1624,16 +1630,6 @@ export class DefaultSocket implements Socket {
|
|
1624
1630
|
return response.notification_channel_category_setting_event
|
1625
1631
|
}
|
1626
1632
|
|
1627
|
-
async addUserEmojiUsage(add_user_emoji_usage_event: AddUserEmojiUsageEvent) {
|
1628
|
-
const response = await this.send({add_user_emoji_usage_event: {add_user_emoji_usage_event: add_user_emoji_usage_event}})
|
1629
|
-
return response.add_user_emoji_usage_event
|
1630
|
-
}
|
1631
|
-
|
1632
|
-
async getUserEmojiUsage(clanId: string): Promise<GetUserEmojiUsageEvent> {
|
1633
|
-
const response = await this.send({get_user_emoji_usage_event: {clanId: clanId}})
|
1634
|
-
return response.get_user_emoji_usage_event
|
1635
|
-
}
|
1636
|
-
|
1637
1633
|
private async pingPong(): Promise<void> {
|
1638
1634
|
if (!this.adapter.isOpen()) {
|
1639
1635
|
return;
|