@livechat/developer-studio-api 2.0.25 → 2.0.27
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/dist/index.d.mts +34 -34
- package/dist/index.d.ts +34 -34
- package/dist/index.js +79 -79
- package/dist/index.mjs +79 -79
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -388,6 +388,35 @@ declare function getSentryClientConfig(options?: SentryClientInstanceOptions): A
|
|
|
388
388
|
declare function initSentryClientInstance(token?: string): void;
|
|
389
389
|
declare function updateSentryClientInstance(token: string | undefined): void;
|
|
390
390
|
|
|
391
|
+
interface UptimeDto {
|
|
392
|
+
[k: string]: {
|
|
393
|
+
[k: string]: number;
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
interface GetAppUptimeReportsPayload {
|
|
398
|
+
from: string;
|
|
399
|
+
to: string;
|
|
400
|
+
resolution: 'hourly' | 'daily' | 'monthly';
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
interface TextClientInstanceAuthorization {
|
|
404
|
+
token?: string;
|
|
405
|
+
tokenType?: "Basic" | "Bearer";
|
|
406
|
+
}
|
|
407
|
+
interface TextClientInstanceOptions {
|
|
408
|
+
token?: string;
|
|
409
|
+
tokenType?: "Basic" | "Bearer";
|
|
410
|
+
}
|
|
411
|
+
declare const textClientInstance: axios.AxiosInstance;
|
|
412
|
+
declare function getTextClientAuthorization(req: {
|
|
413
|
+
headers: {
|
|
414
|
+
[key: string]: string | string[] | undefined;
|
|
415
|
+
};
|
|
416
|
+
}): TextClientInstanceAuthorization;
|
|
417
|
+
declare function getTextClientConfig(option?: TextClientInstanceOptions): AxiosRequestConfig;
|
|
418
|
+
declare function initTextClientInstance(baseUrl?: string, token?: string): void;
|
|
419
|
+
|
|
391
420
|
interface VercelPagination {
|
|
392
421
|
count: number;
|
|
393
422
|
next: number;
|
|
@@ -1651,35 +1680,6 @@ declare function getPlatformDpsAdminClientAuthorization(): PlatformDpsClientInst
|
|
|
1651
1680
|
declare function getPlatformDpsClientConfig(options?: PlatformDpsClientInstanceOptions): AxiosRequestConfig;
|
|
1652
1681
|
declare function initPlatformDpsClientInstance(baseUrl?: string, token?: string): void;
|
|
1653
1682
|
|
|
1654
|
-
interface UptimeDto {
|
|
1655
|
-
[k: string]: {
|
|
1656
|
-
[k: string]: number;
|
|
1657
|
-
};
|
|
1658
|
-
}
|
|
1659
|
-
|
|
1660
|
-
interface GetAppUptimeReportsPayload {
|
|
1661
|
-
from: string;
|
|
1662
|
-
to: string;
|
|
1663
|
-
resolution: 'hourly' | 'daily' | 'monthly';
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
interface TextClientInstanceAuthorization {
|
|
1667
|
-
token?: string;
|
|
1668
|
-
tokenType?: "Basic" | "Bearer";
|
|
1669
|
-
}
|
|
1670
|
-
interface TextClientInstanceOptions {
|
|
1671
|
-
token?: string;
|
|
1672
|
-
tokenType?: "Basic" | "Bearer";
|
|
1673
|
-
}
|
|
1674
|
-
declare const textClientInstance: axios.AxiosInstance;
|
|
1675
|
-
declare function getTextClientAuthorization(req: {
|
|
1676
|
-
headers: {
|
|
1677
|
-
[key: string]: string | string[] | undefined;
|
|
1678
|
-
};
|
|
1679
|
-
}): TextClientInstanceAuthorization;
|
|
1680
|
-
declare function getTextClientConfig(option?: TextClientInstanceOptions): AxiosRequestConfig;
|
|
1681
|
-
declare function initTextClientInstance(baseUrl?: string, token?: string): void;
|
|
1682
|
-
|
|
1683
1683
|
interface AgentDto {
|
|
1684
1684
|
login: string;
|
|
1685
1685
|
groups: {
|
|
@@ -2089,11 +2089,6 @@ declare const api: {
|
|
|
2089
2089
|
};
|
|
2090
2090
|
};
|
|
2091
2091
|
};
|
|
2092
|
-
text: {
|
|
2093
|
-
uptime: {
|
|
2094
|
-
getAppUptimeReports(appId: string, payload: GetAppUptimeReportsPayload, authorization?: TextClientInstanceAuthorization | undefined): Promise<UptimeDto>;
|
|
2095
|
-
};
|
|
2096
|
-
};
|
|
2097
2092
|
};
|
|
2098
2093
|
products: {
|
|
2099
2094
|
livechat: {
|
|
@@ -2270,6 +2265,11 @@ declare const api: {
|
|
|
2270
2265
|
createProject(organizationSlug: string, appName: string, authorization?: SentryClientInstanceAuthorization | undefined): Promise<SentryProject>;
|
|
2271
2266
|
deleteProject(projectFullName: string, authorization?: SentryClientInstanceAuthorization | undefined): Promise<any>;
|
|
2272
2267
|
};
|
|
2268
|
+
text: {
|
|
2269
|
+
uptime: {
|
|
2270
|
+
getAppUptimeReports(appId: string, payload: GetAppUptimeReportsPayload, authorization?: TextClientInstanceAuthorization | undefined): Promise<UptimeDto>;
|
|
2271
|
+
};
|
|
2272
|
+
};
|
|
2273
2273
|
};
|
|
2274
2274
|
isInitialized: boolean;
|
|
2275
2275
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -388,6 +388,35 @@ declare function getSentryClientConfig(options?: SentryClientInstanceOptions): A
|
|
|
388
388
|
declare function initSentryClientInstance(token?: string): void;
|
|
389
389
|
declare function updateSentryClientInstance(token: string | undefined): void;
|
|
390
390
|
|
|
391
|
+
interface UptimeDto {
|
|
392
|
+
[k: string]: {
|
|
393
|
+
[k: string]: number;
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
interface GetAppUptimeReportsPayload {
|
|
398
|
+
from: string;
|
|
399
|
+
to: string;
|
|
400
|
+
resolution: 'hourly' | 'daily' | 'monthly';
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
interface TextClientInstanceAuthorization {
|
|
404
|
+
token?: string;
|
|
405
|
+
tokenType?: "Basic" | "Bearer";
|
|
406
|
+
}
|
|
407
|
+
interface TextClientInstanceOptions {
|
|
408
|
+
token?: string;
|
|
409
|
+
tokenType?: "Basic" | "Bearer";
|
|
410
|
+
}
|
|
411
|
+
declare const textClientInstance: axios.AxiosInstance;
|
|
412
|
+
declare function getTextClientAuthorization(req: {
|
|
413
|
+
headers: {
|
|
414
|
+
[key: string]: string | string[] | undefined;
|
|
415
|
+
};
|
|
416
|
+
}): TextClientInstanceAuthorization;
|
|
417
|
+
declare function getTextClientConfig(option?: TextClientInstanceOptions): AxiosRequestConfig;
|
|
418
|
+
declare function initTextClientInstance(baseUrl?: string, token?: string): void;
|
|
419
|
+
|
|
391
420
|
interface VercelPagination {
|
|
392
421
|
count: number;
|
|
393
422
|
next: number;
|
|
@@ -1651,35 +1680,6 @@ declare function getPlatformDpsAdminClientAuthorization(): PlatformDpsClientInst
|
|
|
1651
1680
|
declare function getPlatformDpsClientConfig(options?: PlatformDpsClientInstanceOptions): AxiosRequestConfig;
|
|
1652
1681
|
declare function initPlatformDpsClientInstance(baseUrl?: string, token?: string): void;
|
|
1653
1682
|
|
|
1654
|
-
interface UptimeDto {
|
|
1655
|
-
[k: string]: {
|
|
1656
|
-
[k: string]: number;
|
|
1657
|
-
};
|
|
1658
|
-
}
|
|
1659
|
-
|
|
1660
|
-
interface GetAppUptimeReportsPayload {
|
|
1661
|
-
from: string;
|
|
1662
|
-
to: string;
|
|
1663
|
-
resolution: 'hourly' | 'daily' | 'monthly';
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
interface TextClientInstanceAuthorization {
|
|
1667
|
-
token?: string;
|
|
1668
|
-
tokenType?: "Basic" | "Bearer";
|
|
1669
|
-
}
|
|
1670
|
-
interface TextClientInstanceOptions {
|
|
1671
|
-
token?: string;
|
|
1672
|
-
tokenType?: "Basic" | "Bearer";
|
|
1673
|
-
}
|
|
1674
|
-
declare const textClientInstance: axios.AxiosInstance;
|
|
1675
|
-
declare function getTextClientAuthorization(req: {
|
|
1676
|
-
headers: {
|
|
1677
|
-
[key: string]: string | string[] | undefined;
|
|
1678
|
-
};
|
|
1679
|
-
}): TextClientInstanceAuthorization;
|
|
1680
|
-
declare function getTextClientConfig(option?: TextClientInstanceOptions): AxiosRequestConfig;
|
|
1681
|
-
declare function initTextClientInstance(baseUrl?: string, token?: string): void;
|
|
1682
|
-
|
|
1683
1683
|
interface AgentDto {
|
|
1684
1684
|
login: string;
|
|
1685
1685
|
groups: {
|
|
@@ -2089,11 +2089,6 @@ declare const api: {
|
|
|
2089
2089
|
};
|
|
2090
2090
|
};
|
|
2091
2091
|
};
|
|
2092
|
-
text: {
|
|
2093
|
-
uptime: {
|
|
2094
|
-
getAppUptimeReports(appId: string, payload: GetAppUptimeReportsPayload, authorization?: TextClientInstanceAuthorization | undefined): Promise<UptimeDto>;
|
|
2095
|
-
};
|
|
2096
|
-
};
|
|
2097
2092
|
};
|
|
2098
2093
|
products: {
|
|
2099
2094
|
livechat: {
|
|
@@ -2270,6 +2265,11 @@ declare const api: {
|
|
|
2270
2265
|
createProject(organizationSlug: string, appName: string, authorization?: SentryClientInstanceAuthorization | undefined): Promise<SentryProject>;
|
|
2271
2266
|
deleteProject(projectFullName: string, authorization?: SentryClientInstanceAuthorization | undefined): Promise<any>;
|
|
2272
2267
|
};
|
|
2268
|
+
text: {
|
|
2269
|
+
uptime: {
|
|
2270
|
+
getAppUptimeReports(appId: string, payload: GetAppUptimeReportsPayload, authorization?: TextClientInstanceAuthorization | undefined): Promise<UptimeDto>;
|
|
2271
|
+
};
|
|
2272
|
+
};
|
|
2273
2273
|
};
|
|
2274
2274
|
isInitialized: boolean;
|
|
2275
2275
|
};
|
package/dist/index.js
CHANGED
|
@@ -1698,19 +1698,81 @@ var sentryApi = {
|
|
|
1698
1698
|
}
|
|
1699
1699
|
};
|
|
1700
1700
|
|
|
1701
|
+
// src/apis/integrations/text/instance.ts
|
|
1702
|
+
var import_axios7 = __toESM(require("axios"));
|
|
1703
|
+
var textClientInstance = import_axios7.default.create({
|
|
1704
|
+
baseURL: "https://api.labs.text.com"
|
|
1705
|
+
});
|
|
1706
|
+
function getTextClientAuthorization(req) {
|
|
1707
|
+
return {
|
|
1708
|
+
token: req.headers["text-token"],
|
|
1709
|
+
tokenType: "Bearer"
|
|
1710
|
+
};
|
|
1711
|
+
}
|
|
1712
|
+
function getTextClientConfig(option = {}) {
|
|
1713
|
+
const defaultAuthorization = textClientInstance.defaults.headers["Authorization"];
|
|
1714
|
+
const headers = {
|
|
1715
|
+
authorization: defaultAuthorization != null ? defaultAuthorization : option.token ? `Bearer ${option.token}` : void 0
|
|
1716
|
+
};
|
|
1717
|
+
return {
|
|
1718
|
+
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
1719
|
+
};
|
|
1720
|
+
}
|
|
1721
|
+
function initTextClientInstance(baseUrl, token) {
|
|
1722
|
+
if (baseUrl) {
|
|
1723
|
+
textClientInstance.interceptors.request.use(
|
|
1724
|
+
(config) => __async(this, null, function* () {
|
|
1725
|
+
config.baseURL = baseUrl;
|
|
1726
|
+
return config;
|
|
1727
|
+
}),
|
|
1728
|
+
(error) => Promise.reject(error)
|
|
1729
|
+
);
|
|
1730
|
+
}
|
|
1731
|
+
if (token) {
|
|
1732
|
+
textClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
|
|
1733
|
+
} else {
|
|
1734
|
+
delete textClientInstance.defaults.headers["Authorization"];
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
// src/apis/integrations/text/uptime/api.ts
|
|
1739
|
+
var textUptimeApi = {
|
|
1740
|
+
getAppUptimeReports(appId, payload, authorization) {
|
|
1741
|
+
return __async(this, null, function* () {
|
|
1742
|
+
try {
|
|
1743
|
+
const response = yield textClientInstance.get(
|
|
1744
|
+
`/app_monitoring/${appId}/reports/uptime?from=${payload.from}&to=${payload.to}&resolution=${payload.resolution}`,
|
|
1745
|
+
getTextClientConfig(authorization)
|
|
1746
|
+
);
|
|
1747
|
+
return response.data;
|
|
1748
|
+
} catch (error) {
|
|
1749
|
+
if (error instanceof Error) {
|
|
1750
|
+
throw new Error(`Couldn't load uptime reports. [${error.message}]`);
|
|
1751
|
+
}
|
|
1752
|
+
throw error;
|
|
1753
|
+
}
|
|
1754
|
+
});
|
|
1755
|
+
}
|
|
1756
|
+
};
|
|
1757
|
+
|
|
1758
|
+
// src/apis/integrations/text/api.ts
|
|
1759
|
+
var textApi = {
|
|
1760
|
+
uptime: textUptimeApi
|
|
1761
|
+
};
|
|
1762
|
+
|
|
1701
1763
|
// src/apis/integrations/vercel/api.ts
|
|
1702
|
-
var
|
|
1764
|
+
var import_axios9 = __toESM(require("axios"));
|
|
1703
1765
|
|
|
1704
1766
|
// src/apis/integrations/vercel/instance.ts
|
|
1705
|
-
var
|
|
1706
|
-
var vercelClientInstance =
|
|
1767
|
+
var import_axios8 = __toESM(require("axios"));
|
|
1768
|
+
var vercelClientInstance = import_axios8.default.create({
|
|
1707
1769
|
baseURL: "https://api.vercel.com"
|
|
1708
1770
|
});
|
|
1709
1771
|
vercelClientInstance.interceptors.response.use(
|
|
1710
1772
|
(r) => r,
|
|
1711
1773
|
(error) => {
|
|
1712
1774
|
var _a;
|
|
1713
|
-
if (
|
|
1775
|
+
if (import_axios8.default.isAxiosError(error)) {
|
|
1714
1776
|
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
1715
1777
|
error = new UnauthorizeApiError("vercel");
|
|
1716
1778
|
}
|
|
@@ -1988,7 +2050,7 @@ var vercelApi = {
|
|
|
1988
2050
|
client_secret: clientSecret,
|
|
1989
2051
|
redirect_uri: redirectUrl
|
|
1990
2052
|
});
|
|
1991
|
-
const response = yield
|
|
2053
|
+
const response = yield import_axios9.default.post(
|
|
1992
2054
|
"https://api.vercel.com/v2/oauth/access_token",
|
|
1993
2055
|
data,
|
|
1994
2056
|
{
|
|
@@ -2013,11 +2075,12 @@ var integrationsApi = {
|
|
|
2013
2075
|
netlify: netlifyApi,
|
|
2014
2076
|
vercel: vercelApi,
|
|
2015
2077
|
planetscale: planetscaleApi,
|
|
2016
|
-
sentry: sentryApi
|
|
2078
|
+
sentry: sentryApi,
|
|
2079
|
+
text: textApi
|
|
2017
2080
|
};
|
|
2018
2081
|
|
|
2019
2082
|
// src/apis/products/livechat/instance.ts
|
|
2020
|
-
var
|
|
2083
|
+
var import_axios10 = __toESM(require("axios"));
|
|
2021
2084
|
var REGION = {
|
|
2022
2085
|
FRA: "fra",
|
|
2023
2086
|
DAL: "dal",
|
|
@@ -2032,7 +2095,7 @@ var getRegion = (token) => {
|
|
|
2032
2095
|
}
|
|
2033
2096
|
return void 0;
|
|
2034
2097
|
};
|
|
2035
|
-
var livechatClientInstance =
|
|
2098
|
+
var livechatClientInstance = import_axios10.default.create({
|
|
2036
2099
|
baseURL: "https://api.labs.livechatinc.com"
|
|
2037
2100
|
});
|
|
2038
2101
|
function getLiveChatClientAuthorization(req) {
|
|
@@ -2498,8 +2561,8 @@ var productsApi = {
|
|
|
2498
2561
|
};
|
|
2499
2562
|
|
|
2500
2563
|
// src/apis/platform/accounts/instance.ts
|
|
2501
|
-
var
|
|
2502
|
-
var platformAccountsClientInstance =
|
|
2564
|
+
var import_axios11 = __toESM(require("axios"));
|
|
2565
|
+
var platformAccountsClientInstance = import_axios11.default.create({
|
|
2503
2566
|
baseURL: "https://accounts.labs.livechatinc.com"
|
|
2504
2567
|
});
|
|
2505
2568
|
function getPlatformAccountsClientAuthorization(req) {
|
|
@@ -2829,8 +2892,8 @@ var platformAccountsApi = {
|
|
|
2829
2892
|
};
|
|
2830
2893
|
|
|
2831
2894
|
// src/apis/platform/dps/instance.ts
|
|
2832
|
-
var
|
|
2833
|
-
var platformDpsClientInstance =
|
|
2895
|
+
var import_axios12 = __toESM(require("axios"));
|
|
2896
|
+
var platformDpsClientInstance = import_axios12.default.create({
|
|
2834
2897
|
baseURL: "https://dev-platform.labs.livechatinc.com"
|
|
2835
2898
|
});
|
|
2836
2899
|
function getPlatformDpsClientAuthorization(req) {
|
|
@@ -4440,7 +4503,7 @@ var platformDpsApi = {
|
|
|
4440
4503
|
};
|
|
4441
4504
|
|
|
4442
4505
|
// src/apis/platform/adapter/instance.ts
|
|
4443
|
-
var
|
|
4506
|
+
var import_axios13 = __toESM(require("axios"));
|
|
4444
4507
|
function getPlatformAdapterClientAuthorization(req) {
|
|
4445
4508
|
return {
|
|
4446
4509
|
platform: {
|
|
@@ -4456,7 +4519,7 @@ function getPlatformAdapterClientAuthorization(req) {
|
|
|
4456
4519
|
sentry: req.headers["sentry-token"]
|
|
4457
4520
|
};
|
|
4458
4521
|
}
|
|
4459
|
-
var platformAdapterClientInstance =
|
|
4522
|
+
var platformAdapterClientInstance = import_axios13.default.create({
|
|
4460
4523
|
baseURL: "https://platform.labs.text.com/console-adapter/api",
|
|
4461
4524
|
headers: {
|
|
4462
4525
|
"Content-Type": "application/json"
|
|
@@ -4466,7 +4529,7 @@ platformAdapterClientInstance.interceptors.response.use(
|
|
|
4466
4529
|
(r) => r,
|
|
4467
4530
|
(error) => {
|
|
4468
4531
|
var _a;
|
|
4469
|
-
if (
|
|
4532
|
+
if (import_axios13.default.isAxiosError(error)) {
|
|
4470
4533
|
if (((_a = error.response) == null ? void 0 : _a.status) === 401 && error.response.data.error.source) {
|
|
4471
4534
|
error = new UnauthorizeApiError(error.response.data.error.source);
|
|
4472
4535
|
}
|
|
@@ -4880,74 +4943,11 @@ var platformAdapterApi = {
|
|
|
4880
4943
|
app: platformAdapterAppApi
|
|
4881
4944
|
};
|
|
4882
4945
|
|
|
4883
|
-
// src/apis/platform/text/instance.ts
|
|
4884
|
-
var import_axios13 = __toESM(require("axios"));
|
|
4885
|
-
var textClientInstance = import_axios13.default.create({
|
|
4886
|
-
baseURL: "https://api.labs.text.com"
|
|
4887
|
-
});
|
|
4888
|
-
function getTextClientAuthorization(req) {
|
|
4889
|
-
return {
|
|
4890
|
-
token: req.headers["text-token"],
|
|
4891
|
-
tokenType: "Bearer"
|
|
4892
|
-
};
|
|
4893
|
-
}
|
|
4894
|
-
function getTextClientConfig(option = {}) {
|
|
4895
|
-
const defaultAuthorization = textClientInstance.defaults.headers["Authorization"];
|
|
4896
|
-
const headers = {
|
|
4897
|
-
authorization: defaultAuthorization != null ? defaultAuthorization : option.token ? `Bearer ${option.token}` : void 0
|
|
4898
|
-
};
|
|
4899
|
-
return {
|
|
4900
|
-
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
4901
|
-
};
|
|
4902
|
-
}
|
|
4903
|
-
function initTextClientInstance(baseUrl, token) {
|
|
4904
|
-
if (baseUrl) {
|
|
4905
|
-
textClientInstance.interceptors.request.use(
|
|
4906
|
-
(config) => __async(this, null, function* () {
|
|
4907
|
-
config.baseURL = baseUrl;
|
|
4908
|
-
return config;
|
|
4909
|
-
}),
|
|
4910
|
-
(error) => Promise.reject(error)
|
|
4911
|
-
);
|
|
4912
|
-
}
|
|
4913
|
-
if (token) {
|
|
4914
|
-
textClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
|
|
4915
|
-
} else {
|
|
4916
|
-
delete textClientInstance.defaults.headers["Authorization"];
|
|
4917
|
-
}
|
|
4918
|
-
}
|
|
4919
|
-
|
|
4920
|
-
// src/apis/platform/text/uptime/api.ts
|
|
4921
|
-
var textUptimeApi = {
|
|
4922
|
-
getAppUptimeReports(appId, payload, authorization) {
|
|
4923
|
-
return __async(this, null, function* () {
|
|
4924
|
-
try {
|
|
4925
|
-
const response = yield textClientInstance.get(
|
|
4926
|
-
`/app_monitoring/${appId}/reports/uptime?from=${payload.from}&to=${payload.to}&resolution=${payload.resolution}`,
|
|
4927
|
-
getTextClientConfig(authorization)
|
|
4928
|
-
);
|
|
4929
|
-
return response.data;
|
|
4930
|
-
} catch (error) {
|
|
4931
|
-
if (error instanceof Error) {
|
|
4932
|
-
throw new Error(`Couldn't get app uptime reports. [${error.message}]`);
|
|
4933
|
-
}
|
|
4934
|
-
throw error;
|
|
4935
|
-
}
|
|
4936
|
-
});
|
|
4937
|
-
}
|
|
4938
|
-
};
|
|
4939
|
-
|
|
4940
|
-
// src/apis/platform/text/api.ts
|
|
4941
|
-
var textApi = {
|
|
4942
|
-
uptime: textUptimeApi
|
|
4943
|
-
};
|
|
4944
|
-
|
|
4945
4946
|
// src/apis/platform/api.ts
|
|
4946
4947
|
var platformApi = {
|
|
4947
4948
|
accounts: platformAccountsApi,
|
|
4948
4949
|
adapter: platformAdapterApi,
|
|
4949
|
-
dps: platformDpsApi
|
|
4950
|
-
text: textApi
|
|
4950
|
+
dps: platformDpsApi
|
|
4951
4951
|
};
|
|
4952
4952
|
|
|
4953
4953
|
// src/apis/platform/dps/applications/application/reporting/_contracts/dtos/events/error.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1610,19 +1610,81 @@ var sentryApi = {
|
|
|
1610
1610
|
}
|
|
1611
1611
|
};
|
|
1612
1612
|
|
|
1613
|
+
// src/apis/integrations/text/instance.ts
|
|
1614
|
+
import axios7 from "axios";
|
|
1615
|
+
var textClientInstance = axios7.create({
|
|
1616
|
+
baseURL: "https://api.labs.text.com"
|
|
1617
|
+
});
|
|
1618
|
+
function getTextClientAuthorization(req) {
|
|
1619
|
+
return {
|
|
1620
|
+
token: req.headers["text-token"],
|
|
1621
|
+
tokenType: "Bearer"
|
|
1622
|
+
};
|
|
1623
|
+
}
|
|
1624
|
+
function getTextClientConfig(option = {}) {
|
|
1625
|
+
const defaultAuthorization = textClientInstance.defaults.headers["Authorization"];
|
|
1626
|
+
const headers = {
|
|
1627
|
+
authorization: defaultAuthorization != null ? defaultAuthorization : option.token ? `Bearer ${option.token}` : void 0
|
|
1628
|
+
};
|
|
1629
|
+
return {
|
|
1630
|
+
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
1631
|
+
};
|
|
1632
|
+
}
|
|
1633
|
+
function initTextClientInstance(baseUrl, token) {
|
|
1634
|
+
if (baseUrl) {
|
|
1635
|
+
textClientInstance.interceptors.request.use(
|
|
1636
|
+
(config) => __async(this, null, function* () {
|
|
1637
|
+
config.baseURL = baseUrl;
|
|
1638
|
+
return config;
|
|
1639
|
+
}),
|
|
1640
|
+
(error) => Promise.reject(error)
|
|
1641
|
+
);
|
|
1642
|
+
}
|
|
1643
|
+
if (token) {
|
|
1644
|
+
textClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
|
|
1645
|
+
} else {
|
|
1646
|
+
delete textClientInstance.defaults.headers["Authorization"];
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
// src/apis/integrations/text/uptime/api.ts
|
|
1651
|
+
var textUptimeApi = {
|
|
1652
|
+
getAppUptimeReports(appId, payload, authorization) {
|
|
1653
|
+
return __async(this, null, function* () {
|
|
1654
|
+
try {
|
|
1655
|
+
const response = yield textClientInstance.get(
|
|
1656
|
+
`/app_monitoring/${appId}/reports/uptime?from=${payload.from}&to=${payload.to}&resolution=${payload.resolution}`,
|
|
1657
|
+
getTextClientConfig(authorization)
|
|
1658
|
+
);
|
|
1659
|
+
return response.data;
|
|
1660
|
+
} catch (error) {
|
|
1661
|
+
if (error instanceof Error) {
|
|
1662
|
+
throw new Error(`Couldn't load uptime reports. [${error.message}]`);
|
|
1663
|
+
}
|
|
1664
|
+
throw error;
|
|
1665
|
+
}
|
|
1666
|
+
});
|
|
1667
|
+
}
|
|
1668
|
+
};
|
|
1669
|
+
|
|
1670
|
+
// src/apis/integrations/text/api.ts
|
|
1671
|
+
var textApi = {
|
|
1672
|
+
uptime: textUptimeApi
|
|
1673
|
+
};
|
|
1674
|
+
|
|
1613
1675
|
// src/apis/integrations/vercel/api.ts
|
|
1614
|
-
import
|
|
1676
|
+
import axios9 from "axios";
|
|
1615
1677
|
|
|
1616
1678
|
// src/apis/integrations/vercel/instance.ts
|
|
1617
|
-
import
|
|
1618
|
-
var vercelClientInstance =
|
|
1679
|
+
import axios8 from "axios";
|
|
1680
|
+
var vercelClientInstance = axios8.create({
|
|
1619
1681
|
baseURL: "https://api.vercel.com"
|
|
1620
1682
|
});
|
|
1621
1683
|
vercelClientInstance.interceptors.response.use(
|
|
1622
1684
|
(r) => r,
|
|
1623
1685
|
(error) => {
|
|
1624
1686
|
var _a;
|
|
1625
|
-
if (
|
|
1687
|
+
if (axios8.isAxiosError(error)) {
|
|
1626
1688
|
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
1627
1689
|
error = new UnauthorizeApiError("vercel");
|
|
1628
1690
|
}
|
|
@@ -1900,7 +1962,7 @@ var vercelApi = {
|
|
|
1900
1962
|
client_secret: clientSecret,
|
|
1901
1963
|
redirect_uri: redirectUrl
|
|
1902
1964
|
});
|
|
1903
|
-
const response = yield
|
|
1965
|
+
const response = yield axios9.post(
|
|
1904
1966
|
"https://api.vercel.com/v2/oauth/access_token",
|
|
1905
1967
|
data,
|
|
1906
1968
|
{
|
|
@@ -1925,11 +1987,12 @@ var integrationsApi = {
|
|
|
1925
1987
|
netlify: netlifyApi,
|
|
1926
1988
|
vercel: vercelApi,
|
|
1927
1989
|
planetscale: planetscaleApi,
|
|
1928
|
-
sentry: sentryApi
|
|
1990
|
+
sentry: sentryApi,
|
|
1991
|
+
text: textApi
|
|
1929
1992
|
};
|
|
1930
1993
|
|
|
1931
1994
|
// src/apis/products/livechat/instance.ts
|
|
1932
|
-
import
|
|
1995
|
+
import axios10 from "axios";
|
|
1933
1996
|
var REGION = {
|
|
1934
1997
|
FRA: "fra",
|
|
1935
1998
|
DAL: "dal",
|
|
@@ -1944,7 +2007,7 @@ var getRegion = (token) => {
|
|
|
1944
2007
|
}
|
|
1945
2008
|
return void 0;
|
|
1946
2009
|
};
|
|
1947
|
-
var livechatClientInstance =
|
|
2010
|
+
var livechatClientInstance = axios10.create({
|
|
1948
2011
|
baseURL: "https://api.labs.livechatinc.com"
|
|
1949
2012
|
});
|
|
1950
2013
|
function getLiveChatClientAuthorization(req) {
|
|
@@ -2410,8 +2473,8 @@ var productsApi = {
|
|
|
2410
2473
|
};
|
|
2411
2474
|
|
|
2412
2475
|
// src/apis/platform/accounts/instance.ts
|
|
2413
|
-
import
|
|
2414
|
-
var platformAccountsClientInstance =
|
|
2476
|
+
import axios11 from "axios";
|
|
2477
|
+
var platformAccountsClientInstance = axios11.create({
|
|
2415
2478
|
baseURL: "https://accounts.labs.livechatinc.com"
|
|
2416
2479
|
});
|
|
2417
2480
|
function getPlatformAccountsClientAuthorization(req) {
|
|
@@ -2741,8 +2804,8 @@ var platformAccountsApi = {
|
|
|
2741
2804
|
};
|
|
2742
2805
|
|
|
2743
2806
|
// src/apis/platform/dps/instance.ts
|
|
2744
|
-
import
|
|
2745
|
-
var platformDpsClientInstance =
|
|
2807
|
+
import axios12 from "axios";
|
|
2808
|
+
var platformDpsClientInstance = axios12.create({
|
|
2746
2809
|
baseURL: "https://dev-platform.labs.livechatinc.com"
|
|
2747
2810
|
});
|
|
2748
2811
|
function getPlatformDpsClientAuthorization(req) {
|
|
@@ -4352,7 +4415,7 @@ var platformDpsApi = {
|
|
|
4352
4415
|
};
|
|
4353
4416
|
|
|
4354
4417
|
// src/apis/platform/adapter/instance.ts
|
|
4355
|
-
import
|
|
4418
|
+
import axios13 from "axios";
|
|
4356
4419
|
function getPlatformAdapterClientAuthorization(req) {
|
|
4357
4420
|
return {
|
|
4358
4421
|
platform: {
|
|
@@ -4368,7 +4431,7 @@ function getPlatformAdapterClientAuthorization(req) {
|
|
|
4368
4431
|
sentry: req.headers["sentry-token"]
|
|
4369
4432
|
};
|
|
4370
4433
|
}
|
|
4371
|
-
var platformAdapterClientInstance =
|
|
4434
|
+
var platformAdapterClientInstance = axios13.create({
|
|
4372
4435
|
baseURL: "https://platform.labs.text.com/console-adapter/api",
|
|
4373
4436
|
headers: {
|
|
4374
4437
|
"Content-Type": "application/json"
|
|
@@ -4378,7 +4441,7 @@ platformAdapterClientInstance.interceptors.response.use(
|
|
|
4378
4441
|
(r) => r,
|
|
4379
4442
|
(error) => {
|
|
4380
4443
|
var _a;
|
|
4381
|
-
if (
|
|
4444
|
+
if (axios13.isAxiosError(error)) {
|
|
4382
4445
|
if (((_a = error.response) == null ? void 0 : _a.status) === 401 && error.response.data.error.source) {
|
|
4383
4446
|
error = new UnauthorizeApiError(error.response.data.error.source);
|
|
4384
4447
|
}
|
|
@@ -4792,74 +4855,11 @@ var platformAdapterApi = {
|
|
|
4792
4855
|
app: platformAdapterAppApi
|
|
4793
4856
|
};
|
|
4794
4857
|
|
|
4795
|
-
// src/apis/platform/text/instance.ts
|
|
4796
|
-
import axios13 from "axios";
|
|
4797
|
-
var textClientInstance = axios13.create({
|
|
4798
|
-
baseURL: "https://api.labs.text.com"
|
|
4799
|
-
});
|
|
4800
|
-
function getTextClientAuthorization(req) {
|
|
4801
|
-
return {
|
|
4802
|
-
token: req.headers["text-token"],
|
|
4803
|
-
tokenType: "Bearer"
|
|
4804
|
-
};
|
|
4805
|
-
}
|
|
4806
|
-
function getTextClientConfig(option = {}) {
|
|
4807
|
-
const defaultAuthorization = textClientInstance.defaults.headers["Authorization"];
|
|
4808
|
-
const headers = {
|
|
4809
|
-
authorization: defaultAuthorization != null ? defaultAuthorization : option.token ? `Bearer ${option.token}` : void 0
|
|
4810
|
-
};
|
|
4811
|
-
return {
|
|
4812
|
-
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
4813
|
-
};
|
|
4814
|
-
}
|
|
4815
|
-
function initTextClientInstance(baseUrl, token) {
|
|
4816
|
-
if (baseUrl) {
|
|
4817
|
-
textClientInstance.interceptors.request.use(
|
|
4818
|
-
(config) => __async(this, null, function* () {
|
|
4819
|
-
config.baseURL = baseUrl;
|
|
4820
|
-
return config;
|
|
4821
|
-
}),
|
|
4822
|
-
(error) => Promise.reject(error)
|
|
4823
|
-
);
|
|
4824
|
-
}
|
|
4825
|
-
if (token) {
|
|
4826
|
-
textClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
|
|
4827
|
-
} else {
|
|
4828
|
-
delete textClientInstance.defaults.headers["Authorization"];
|
|
4829
|
-
}
|
|
4830
|
-
}
|
|
4831
|
-
|
|
4832
|
-
// src/apis/platform/text/uptime/api.ts
|
|
4833
|
-
var textUptimeApi = {
|
|
4834
|
-
getAppUptimeReports(appId, payload, authorization) {
|
|
4835
|
-
return __async(this, null, function* () {
|
|
4836
|
-
try {
|
|
4837
|
-
const response = yield textClientInstance.get(
|
|
4838
|
-
`/app_monitoring/${appId}/reports/uptime?from=${payload.from}&to=${payload.to}&resolution=${payload.resolution}`,
|
|
4839
|
-
getTextClientConfig(authorization)
|
|
4840
|
-
);
|
|
4841
|
-
return response.data;
|
|
4842
|
-
} catch (error) {
|
|
4843
|
-
if (error instanceof Error) {
|
|
4844
|
-
throw new Error(`Couldn't get app uptime reports. [${error.message}]`);
|
|
4845
|
-
}
|
|
4846
|
-
throw error;
|
|
4847
|
-
}
|
|
4848
|
-
});
|
|
4849
|
-
}
|
|
4850
|
-
};
|
|
4851
|
-
|
|
4852
|
-
// src/apis/platform/text/api.ts
|
|
4853
|
-
var textApi = {
|
|
4854
|
-
uptime: textUptimeApi
|
|
4855
|
-
};
|
|
4856
|
-
|
|
4857
4858
|
// src/apis/platform/api.ts
|
|
4858
4859
|
var platformApi = {
|
|
4859
4860
|
accounts: platformAccountsApi,
|
|
4860
4861
|
adapter: platformAdapterApi,
|
|
4861
|
-
dps: platformDpsApi
|
|
4862
|
-
text: textApi
|
|
4862
|
+
dps: platformDpsApi
|
|
4863
4863
|
};
|
|
4864
4864
|
|
|
4865
4865
|
// src/apis/platform/dps/applications/application/reporting/_contracts/dtos/events/error.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livechat/developer-studio-api",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.27",
|
|
4
4
|
"description": "This project is API for LiveChat Developer Studio.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"@types/node": "^17.0.12",
|
|
18
18
|
"tsup": "^7.1.0",
|
|
19
19
|
"typescript": "^5.1.6",
|
|
20
|
+
"tsconfig": "0.0.0",
|
|
20
21
|
"config": "0.0.0",
|
|
21
22
|
"types": "0.0.1",
|
|
22
|
-
"eslint-config-custom-lib": "0.0.1"
|
|
23
|
-
"tsconfig": "0.0.0"
|
|
23
|
+
"eslint-config-custom-lib": "0.0.1"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|