@livechat/developer-studio-api 2.3.29 → 2.3.31
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 +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +34 -1
- package/dist/index.mjs +34 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -2102,6 +2102,9 @@ declare const api: {
|
|
|
2102
2102
|
sessions: {
|
|
2103
2103
|
readonly deleteSessions: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<void>>;
|
|
2104
2104
|
};
|
|
2105
|
+
token: {
|
|
2106
|
+
exchangeCode(code: string, clientId: string, clientSecret: string, redirectUrl: string): Promise<axios.AxiosResponse<AuthorizeData>>;
|
|
2107
|
+
};
|
|
2105
2108
|
};
|
|
2106
2109
|
billing: {
|
|
2107
2110
|
account: {
|
package/dist/index.d.ts
CHANGED
|
@@ -2102,6 +2102,9 @@ declare const api: {
|
|
|
2102
2102
|
sessions: {
|
|
2103
2103
|
readonly deleteSessions: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<void>>;
|
|
2104
2104
|
};
|
|
2105
|
+
token: {
|
|
2106
|
+
exchangeCode(code: string, clientId: string, clientSecret: string, redirectUrl: string): Promise<axios.AxiosResponse<AuthorizeData>>;
|
|
2107
|
+
};
|
|
2105
2108
|
};
|
|
2106
2109
|
billing: {
|
|
2107
2110
|
account: {
|
package/dist/index.js
CHANGED
|
@@ -3376,6 +3376,38 @@ var platformAccountsSessionsApi = {
|
|
|
3376
3376
|
}
|
|
3377
3377
|
};
|
|
3378
3378
|
|
|
3379
|
+
// src/apis/platform/accounts/token/api.ts
|
|
3380
|
+
var platformAccountsTokenApi = {
|
|
3381
|
+
exchangeCode(code, clientId, clientSecret, redirectUrl) {
|
|
3382
|
+
return __async(this, null, function* () {
|
|
3383
|
+
const data = new URLSearchParams({
|
|
3384
|
+
grant_type: "authorization_code",
|
|
3385
|
+
code,
|
|
3386
|
+
client_id: clientId,
|
|
3387
|
+
client_secret: clientSecret,
|
|
3388
|
+
redirect_uri: redirectUrl
|
|
3389
|
+
});
|
|
3390
|
+
try {
|
|
3391
|
+
return yield platformAccountsClientInstance.post(
|
|
3392
|
+
`/v2/token`,
|
|
3393
|
+
data,
|
|
3394
|
+
{
|
|
3395
|
+
headers: {
|
|
3396
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
3397
|
+
}
|
|
3398
|
+
}
|
|
3399
|
+
);
|
|
3400
|
+
} catch (error) {
|
|
3401
|
+
if (error instanceof Error) {
|
|
3402
|
+
throw new Error(`Couldn't exchange code for token. [${error.message}]`);
|
|
3403
|
+
} else {
|
|
3404
|
+
throw error;
|
|
3405
|
+
}
|
|
3406
|
+
}
|
|
3407
|
+
});
|
|
3408
|
+
}
|
|
3409
|
+
};
|
|
3410
|
+
|
|
3379
3411
|
// src/apis/platform/accounts/api.ts
|
|
3380
3412
|
var platformAccountsApi = {
|
|
3381
3413
|
account: platformAccountsAccountApi,
|
|
@@ -3384,7 +3416,8 @@ var platformAccountsApi = {
|
|
|
3384
3416
|
organization: platformAccountsOrganizationApi,
|
|
3385
3417
|
products: platformAccountsProductsApi,
|
|
3386
3418
|
scopes: platformAccountsScopesApi,
|
|
3387
|
-
sessions: platformAccountsSessionsApi
|
|
3419
|
+
sessions: platformAccountsSessionsApi,
|
|
3420
|
+
token: platformAccountsTokenApi
|
|
3388
3421
|
};
|
|
3389
3422
|
|
|
3390
3423
|
// src/apis/platform/dps/instance.ts
|
package/dist/index.mjs
CHANGED
|
@@ -3285,6 +3285,38 @@ var platformAccountsSessionsApi = {
|
|
|
3285
3285
|
}
|
|
3286
3286
|
};
|
|
3287
3287
|
|
|
3288
|
+
// src/apis/platform/accounts/token/api.ts
|
|
3289
|
+
var platformAccountsTokenApi = {
|
|
3290
|
+
exchangeCode(code, clientId, clientSecret, redirectUrl) {
|
|
3291
|
+
return __async(this, null, function* () {
|
|
3292
|
+
const data = new URLSearchParams({
|
|
3293
|
+
grant_type: "authorization_code",
|
|
3294
|
+
code,
|
|
3295
|
+
client_id: clientId,
|
|
3296
|
+
client_secret: clientSecret,
|
|
3297
|
+
redirect_uri: redirectUrl
|
|
3298
|
+
});
|
|
3299
|
+
try {
|
|
3300
|
+
return yield platformAccountsClientInstance.post(
|
|
3301
|
+
`/v2/token`,
|
|
3302
|
+
data,
|
|
3303
|
+
{
|
|
3304
|
+
headers: {
|
|
3305
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3308
|
+
);
|
|
3309
|
+
} catch (error) {
|
|
3310
|
+
if (error instanceof Error) {
|
|
3311
|
+
throw new Error(`Couldn't exchange code for token. [${error.message}]`);
|
|
3312
|
+
} else {
|
|
3313
|
+
throw error;
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3316
|
+
});
|
|
3317
|
+
}
|
|
3318
|
+
};
|
|
3319
|
+
|
|
3288
3320
|
// src/apis/platform/accounts/api.ts
|
|
3289
3321
|
var platformAccountsApi = {
|
|
3290
3322
|
account: platformAccountsAccountApi,
|
|
@@ -3293,7 +3325,8 @@ var platformAccountsApi = {
|
|
|
3293
3325
|
organization: platformAccountsOrganizationApi,
|
|
3294
3326
|
products: platformAccountsProductsApi,
|
|
3295
3327
|
scopes: platformAccountsScopesApi,
|
|
3296
|
-
sessions: platformAccountsSessionsApi
|
|
3328
|
+
sessions: platformAccountsSessionsApi,
|
|
3329
|
+
token: platformAccountsTokenApi
|
|
3297
3330
|
};
|
|
3298
3331
|
|
|
3299
3332
|
// src/apis/platform/dps/instance.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livechat/developer-studio-api",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.31",
|
|
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,9 +17,9 @@
|
|
|
17
17
|
"@types/node": "^17.0.12",
|
|
18
18
|
"tsup": "^7.1.0",
|
|
19
19
|
"typescript": "^5.1.6",
|
|
20
|
-
"config": "0.0.1",
|
|
21
20
|
"eslint-config-custom": "0.0.2",
|
|
22
|
-
"tsconfig": "0.0.1"
|
|
21
|
+
"tsconfig": "0.0.1",
|
|
22
|
+
"config": "0.0.1"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|