mezon-js 2.9.46 → 2.9.48
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +109 -1
- package/client.ts +39 -0
- package/dist/api.gen.d.ts +28 -0
- package/dist/client.d.ts +4 -1
- package/dist/mezon-js.cjs.js +75 -0
- package/dist/mezon-js.esm.mjs +75 -0
- package/dist/socket.d.ts +1 -0
- package/package.json +1 -1
- package/socket.ts +2 -0
package/api.gen.ts
CHANGED
@@ -952,6 +952,22 @@ export interface ApiClanUserList {
|
|
952
952
|
cursor?: string;
|
953
953
|
}
|
954
954
|
|
955
|
+
/** */
|
956
|
+
export interface ApiCreateActivityRequest {
|
957
|
+
//
|
958
|
+
activity_description?: string;
|
959
|
+
//
|
960
|
+
activity_name?: string;
|
961
|
+
//
|
962
|
+
activity_type?: number;
|
963
|
+
//
|
964
|
+
application_id?: string;
|
965
|
+
//
|
966
|
+
start_time?: string;
|
967
|
+
//
|
968
|
+
status?: number;
|
969
|
+
}
|
970
|
+
|
955
971
|
/** */
|
956
972
|
export interface ApiCreateCategoryDescRequest {
|
957
973
|
//
|
@@ -1349,6 +1365,11 @@ export interface ApiMessageDeleted {
|
|
1349
1365
|
//
|
1350
1366
|
message_id?: string;
|
1351
1367
|
}
|
1368
|
+
/** */
|
1369
|
+
export interface ApiListUserActivity {
|
1370
|
+
//
|
1371
|
+
activities?: Array<ApiUserActivity>;
|
1372
|
+
}
|
1352
1373
|
|
1353
1374
|
/** */
|
1354
1375
|
export interface ApiMarkAsReadRequest {
|
@@ -2136,6 +2157,26 @@ export interface ApiUser {
|
|
2136
2157
|
username?: string;
|
2137
2158
|
}
|
2138
2159
|
|
2160
|
+
/** */
|
2161
|
+
export interface ApiUserActivity {
|
2162
|
+
//
|
2163
|
+
activity_description?: string;
|
2164
|
+
//
|
2165
|
+
activity_name?: string;
|
2166
|
+
//
|
2167
|
+
activity_type?: number;
|
2168
|
+
//
|
2169
|
+
application_id?: string;
|
2170
|
+
//
|
2171
|
+
end_time?: string;
|
2172
|
+
//
|
2173
|
+
start_time?: string;
|
2174
|
+
//
|
2175
|
+
status?: number;
|
2176
|
+
//
|
2177
|
+
user_id?: string;
|
2178
|
+
}
|
2179
|
+
|
2139
2180
|
/** */
|
2140
2181
|
export interface ApiUserPermissionInChannelListResponse {
|
2141
2182
|
//
|
@@ -3549,7 +3590,74 @@ export class MezonApi {
|
|
3549
3590
|
const urlPath = "/v2/account/unlink/steam";
|
3550
3591
|
const queryParams = new Map<string, any>();
|
3551
3592
|
|
3552
|
-
let bodyJson: string = "";
|
3593
|
+
let bodyJson : string = "";
|
3594
|
+
bodyJson = JSON.stringify(body || {});
|
3595
|
+
|
3596
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3597
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
3598
|
+
if (bearerToken) {
|
3599
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3600
|
+
}
|
3601
|
+
|
3602
|
+
return Promise.race([
|
3603
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3604
|
+
if (response.status == 204) {
|
3605
|
+
return response;
|
3606
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3607
|
+
return response.json();
|
3608
|
+
} else {
|
3609
|
+
throw response;
|
3610
|
+
}
|
3611
|
+
}),
|
3612
|
+
new Promise((_, reject) =>
|
3613
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3614
|
+
),
|
3615
|
+
]);
|
3616
|
+
}
|
3617
|
+
|
3618
|
+
/** List activity */
|
3619
|
+
listActivity(bearerToken: string,
|
3620
|
+
options: any = {}): Promise<ApiListUserActivity> {
|
3621
|
+
|
3622
|
+
const urlPath = "/v2/activity";
|
3623
|
+
const queryParams = new Map<string, any>();
|
3624
|
+
|
3625
|
+
let bodyJson : string = "";
|
3626
|
+
|
3627
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3628
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
3629
|
+
if (bearerToken) {
|
3630
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3631
|
+
}
|
3632
|
+
|
3633
|
+
return Promise.race([
|
3634
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3635
|
+
if (response.status == 204) {
|
3636
|
+
return response;
|
3637
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3638
|
+
return response.json();
|
3639
|
+
} else {
|
3640
|
+
throw response;
|
3641
|
+
}
|
3642
|
+
}),
|
3643
|
+
new Promise((_, reject) =>
|
3644
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3645
|
+
),
|
3646
|
+
]);
|
3647
|
+
}
|
3648
|
+
|
3649
|
+
/** Create user activity */
|
3650
|
+
createActiviy(bearerToken: string,
|
3651
|
+
body:ApiCreateActivityRequest,
|
3652
|
+
options: any = {}): Promise<any> {
|
3653
|
+
|
3654
|
+
if (body === null || body === undefined) {
|
3655
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
3656
|
+
}
|
3657
|
+
const urlPath = "/v2/activity";
|
3658
|
+
const queryParams = new Map<string, any>();
|
3659
|
+
|
3660
|
+
let bodyJson : string = "";
|
3553
3661
|
bodyJson = JSON.stringify(body || {});
|
3554
3662
|
|
3555
3663
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
package/client.ts
CHANGED
@@ -126,6 +126,8 @@ import {
|
|
126
126
|
ApiChannelSettingListResponse,
|
127
127
|
ApiAddFavoriteChannelResponse,
|
128
128
|
ApiRegistFcmDeviceTokenResponse,
|
129
|
+
ApiListUserActivity,
|
130
|
+
ApiCreateActivityRequest,
|
129
131
|
} from "./api.gen";
|
130
132
|
|
131
133
|
import { Session } from "./session";
|
@@ -4170,4 +4172,41 @@ export class Client {
|
|
4170
4172
|
return response;
|
4171
4173
|
});
|
4172
4174
|
}
|
4175
|
+
/** List activity */
|
4176
|
+
async listActivity(
|
4177
|
+
session: Session
|
4178
|
+
): Promise<ApiListUserActivity> {
|
4179
|
+
if (
|
4180
|
+
this.autoRefreshSession &&
|
4181
|
+
session.refresh_token &&
|
4182
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
4183
|
+
) {
|
4184
|
+
await this.sessionRefresh(session);
|
4185
|
+
}
|
4186
|
+
|
4187
|
+
return this.apiClient
|
4188
|
+
.listActivity(session.token)
|
4189
|
+
.then((response: any) => {
|
4190
|
+
return response;
|
4191
|
+
});
|
4192
|
+
}
|
4193
|
+
|
4194
|
+
async createActiviy(
|
4195
|
+
session: Session,
|
4196
|
+
request: ApiCreateActivityRequest
|
4197
|
+
): Promise<any> {
|
4198
|
+
if (
|
4199
|
+
this.autoRefreshSession &&
|
4200
|
+
session.refresh_token &&
|
4201
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
4202
|
+
) {
|
4203
|
+
await this.sessionRefresh(session);
|
4204
|
+
}
|
4205
|
+
|
4206
|
+
return this.apiClient
|
4207
|
+
.createActiviy(session.token, request)
|
4208
|
+
.then((response: any) => {
|
4209
|
+
return response;
|
4210
|
+
});
|
4211
|
+
}
|
4173
4212
|
}
|
package/dist/api.gen.d.ts
CHANGED
@@ -549,6 +549,15 @@ export interface ApiClanUserList {
|
|
549
549
|
cursor?: string;
|
550
550
|
}
|
551
551
|
/** */
|
552
|
+
export interface ApiCreateActivityRequest {
|
553
|
+
activity_description?: string;
|
554
|
+
activity_name?: string;
|
555
|
+
activity_type?: number;
|
556
|
+
application_id?: string;
|
557
|
+
start_time?: string;
|
558
|
+
status?: number;
|
559
|
+
}
|
560
|
+
/** */
|
552
561
|
export interface ApiCreateCategoryDescRequest {
|
553
562
|
category_name?: string;
|
554
563
|
clan_id?: string;
|
@@ -782,6 +791,10 @@ export interface ApiMessageDeleted {
|
|
782
791
|
message_id?: string;
|
783
792
|
}
|
784
793
|
/** */
|
794
|
+
export interface ApiListUserActivity {
|
795
|
+
activities?: Array<ApiUserActivity>;
|
796
|
+
}
|
797
|
+
/** */
|
785
798
|
export interface ApiMarkAsReadRequest {
|
786
799
|
category_id?: string;
|
787
800
|
channel_id?: string;
|
@@ -1240,6 +1253,17 @@ export interface ApiUser {
|
|
1240
1253
|
username?: string;
|
1241
1254
|
}
|
1242
1255
|
/** */
|
1256
|
+
export interface ApiUserActivity {
|
1257
|
+
activity_description?: string;
|
1258
|
+
activity_name?: string;
|
1259
|
+
activity_type?: number;
|
1260
|
+
application_id?: string;
|
1261
|
+
end_time?: string;
|
1262
|
+
start_time?: string;
|
1263
|
+
status?: number;
|
1264
|
+
user_id?: string;
|
1265
|
+
}
|
1266
|
+
/** */
|
1243
1267
|
export interface ApiUserPermissionInChannelListResponse {
|
1244
1268
|
channel_id?: string;
|
1245
1269
|
clan_id?: string;
|
@@ -1378,6 +1402,10 @@ export declare class MezonApi {
|
|
1378
1402
|
unlinkGoogle(bearerToken: string, body: ApiAccountGoogle, options?: any): Promise<any>;
|
1379
1403
|
/** Remove Steam from the social profiles on the current user's account. */
|
1380
1404
|
unlinkSteam(bearerToken: string, body: ApiAccountSteam, options?: any): Promise<any>;
|
1405
|
+
/** List activity */
|
1406
|
+
listActivity(bearerToken: string, options?: any): Promise<ApiListUserActivity>;
|
1407
|
+
/** Create user activity */
|
1408
|
+
createActiviy(bearerToken: string, body: ApiCreateActivityRequest, options?: any): Promise<any>;
|
1381
1409
|
/** Add a new apps. */
|
1382
1410
|
addApp(bearerToken: string, body: ApiAddAppRequest, options?: any): Promise<any>;
|
1383
1411
|
/** List (and optionally filter) accounts. */
|
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, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse } 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, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -588,4 +588,7 @@ export declare class Client {
|
|
588
588
|
addFavoriteChannel(session: Session, channelId: string, clanId: string): Promise<ApiAddFavoriteChannelResponse>;
|
589
589
|
removeFavoriteChannel(session: Session, channelId: string): Promise<any>;
|
590
590
|
getListFavoriteChannel(session: Session, clanId: string): Promise<any>;
|
591
|
+
/** List activity */
|
592
|
+
listActivity(session: Session): Promise<ApiListUserActivity>;
|
593
|
+
createActiviy(session: Session, request: ApiCreateActivityRequest): Promise<any>;
|
591
594
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -1712,6 +1712,60 @@ var MezonApi = class {
|
|
1712
1712
|
)
|
1713
1713
|
]);
|
1714
1714
|
}
|
1715
|
+
/** List activity */
|
1716
|
+
listActivity(bearerToken, options = {}) {
|
1717
|
+
const urlPath = "/v2/activity";
|
1718
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1719
|
+
let bodyJson = "";
|
1720
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1721
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
1722
|
+
if (bearerToken) {
|
1723
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1724
|
+
}
|
1725
|
+
return Promise.race([
|
1726
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1727
|
+
if (response.status == 204) {
|
1728
|
+
return response;
|
1729
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1730
|
+
return response.json();
|
1731
|
+
} else {
|
1732
|
+
throw response;
|
1733
|
+
}
|
1734
|
+
}),
|
1735
|
+
new Promise(
|
1736
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1737
|
+
)
|
1738
|
+
]);
|
1739
|
+
}
|
1740
|
+
/** Create user activity */
|
1741
|
+
createActiviy(bearerToken, body, options = {}) {
|
1742
|
+
if (body === null || body === void 0) {
|
1743
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
1744
|
+
}
|
1745
|
+
const urlPath = "/v2/activity";
|
1746
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1747
|
+
let bodyJson = "";
|
1748
|
+
bodyJson = JSON.stringify(body || {});
|
1749
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1750
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1751
|
+
if (bearerToken) {
|
1752
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1753
|
+
}
|
1754
|
+
return Promise.race([
|
1755
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1756
|
+
if (response.status == 204) {
|
1757
|
+
return response;
|
1758
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1759
|
+
return response.json();
|
1760
|
+
} else {
|
1761
|
+
throw response;
|
1762
|
+
}
|
1763
|
+
}),
|
1764
|
+
new Promise(
|
1765
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1766
|
+
)
|
1767
|
+
]);
|
1768
|
+
}
|
1715
1769
|
/** Add a new apps. */
|
1716
1770
|
addApp(bearerToken, body, options = {}) {
|
1717
1771
|
if (body === null || body === void 0) {
|
@@ -8889,4 +8943,25 @@ var Client = class {
|
|
8889
8943
|
});
|
8890
8944
|
});
|
8891
8945
|
}
|
8946
|
+
/** List activity */
|
8947
|
+
listActivity(session) {
|
8948
|
+
return __async(this, null, function* () {
|
8949
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
8950
|
+
yield this.sessionRefresh(session);
|
8951
|
+
}
|
8952
|
+
return this.apiClient.listActivity(session.token).then((response) => {
|
8953
|
+
return response;
|
8954
|
+
});
|
8955
|
+
});
|
8956
|
+
}
|
8957
|
+
createActiviy(session, request) {
|
8958
|
+
return __async(this, null, function* () {
|
8959
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
8960
|
+
yield this.sessionRefresh(session);
|
8961
|
+
}
|
8962
|
+
return this.apiClient.createActiviy(session.token, request).then((response) => {
|
8963
|
+
return response;
|
8964
|
+
});
|
8965
|
+
});
|
8966
|
+
}
|
8892
8967
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -1683,6 +1683,60 @@ var MezonApi = class {
|
|
1683
1683
|
)
|
1684
1684
|
]);
|
1685
1685
|
}
|
1686
|
+
/** List activity */
|
1687
|
+
listActivity(bearerToken, options = {}) {
|
1688
|
+
const urlPath = "/v2/activity";
|
1689
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1690
|
+
let bodyJson = "";
|
1691
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1692
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
1693
|
+
if (bearerToken) {
|
1694
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1695
|
+
}
|
1696
|
+
return Promise.race([
|
1697
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1698
|
+
if (response.status == 204) {
|
1699
|
+
return response;
|
1700
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1701
|
+
return response.json();
|
1702
|
+
} else {
|
1703
|
+
throw response;
|
1704
|
+
}
|
1705
|
+
}),
|
1706
|
+
new Promise(
|
1707
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1708
|
+
)
|
1709
|
+
]);
|
1710
|
+
}
|
1711
|
+
/** Create user activity */
|
1712
|
+
createActiviy(bearerToken, body, options = {}) {
|
1713
|
+
if (body === null || body === void 0) {
|
1714
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
1715
|
+
}
|
1716
|
+
const urlPath = "/v2/activity";
|
1717
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1718
|
+
let bodyJson = "";
|
1719
|
+
bodyJson = JSON.stringify(body || {});
|
1720
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1721
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1722
|
+
if (bearerToken) {
|
1723
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1724
|
+
}
|
1725
|
+
return Promise.race([
|
1726
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1727
|
+
if (response.status == 204) {
|
1728
|
+
return response;
|
1729
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1730
|
+
return response.json();
|
1731
|
+
} else {
|
1732
|
+
throw response;
|
1733
|
+
}
|
1734
|
+
}),
|
1735
|
+
new Promise(
|
1736
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1737
|
+
)
|
1738
|
+
]);
|
1739
|
+
}
|
1686
1740
|
/** Add a new apps. */
|
1687
1741
|
addApp(bearerToken, body, options = {}) {
|
1688
1742
|
if (body === null || body === void 0) {
|
@@ -8860,6 +8914,27 @@ var Client = class {
|
|
8860
8914
|
});
|
8861
8915
|
});
|
8862
8916
|
}
|
8917
|
+
/** List activity */
|
8918
|
+
listActivity(session) {
|
8919
|
+
return __async(this, null, function* () {
|
8920
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
8921
|
+
yield this.sessionRefresh(session);
|
8922
|
+
}
|
8923
|
+
return this.apiClient.listActivity(session.token).then((response) => {
|
8924
|
+
return response;
|
8925
|
+
});
|
8926
|
+
});
|
8927
|
+
}
|
8928
|
+
createActiviy(session, request) {
|
8929
|
+
return __async(this, null, function* () {
|
8930
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
8931
|
+
yield this.sessionRefresh(session);
|
8932
|
+
}
|
8933
|
+
return this.apiClient.createActiviy(session.token, request).then((response) => {
|
8934
|
+
return response;
|
8935
|
+
});
|
8936
|
+
});
|
8937
|
+
}
|
8863
8938
|
};
|
8864
8939
|
export {
|
8865
8940
|
ChannelStreamMode,
|
package/dist/socket.d.ts
CHANGED
package/package.json
CHANGED