@livechat/developer-studio-api 3.0.57 → 3.1.0-beta.1
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 +130 -24
- package/dist/index.d.ts +130 -24
- package/dist/index.js +221 -148
- package/dist/index.mjs +221 -147
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -44,7 +44,7 @@ import axios2 from "axios";
|
|
|
44
44
|
// src/apis/integrations/github/instance.ts
|
|
45
45
|
import axios from "axios";
|
|
46
46
|
|
|
47
|
-
// src/types/errors
|
|
47
|
+
// src/types/api/errors.ts
|
|
48
48
|
var ApiErrorBase = class extends Error {
|
|
49
49
|
constructor(message, data, code) {
|
|
50
50
|
super(message);
|
|
@@ -56,6 +56,9 @@ var ApiErrorBase = class extends Error {
|
|
|
56
56
|
withCustomMessage(message) {
|
|
57
57
|
return new this.constructor(message, this.data, this.code);
|
|
58
58
|
}
|
|
59
|
+
unauthorized(message) {
|
|
60
|
+
return new UnauthorizeApiError(this.source, message);
|
|
61
|
+
}
|
|
59
62
|
};
|
|
60
63
|
var UnauthorizeApiError = class extends Error {
|
|
61
64
|
constructor(source, message = "Unauthorized API call") {
|
|
@@ -2390,6 +2393,7 @@ import axios11 from "axios";
|
|
|
2390
2393
|
var MailchimpApiError = class extends ApiErrorBase {
|
|
2391
2394
|
constructor() {
|
|
2392
2395
|
super(...arguments);
|
|
2396
|
+
this.source = "mailchimp";
|
|
2393
2397
|
this.name = "mailchimp";
|
|
2394
2398
|
}
|
|
2395
2399
|
};
|
|
@@ -2565,6 +2569,7 @@ import axios13 from "axios";
|
|
|
2565
2569
|
var ShopifyApiError = class extends ApiErrorBase {
|
|
2566
2570
|
constructor() {
|
|
2567
2571
|
super(...arguments);
|
|
2572
|
+
this.source = "shopify";
|
|
2568
2573
|
this.name = "shopify";
|
|
2569
2574
|
}
|
|
2570
2575
|
};
|
|
@@ -2736,6 +2741,7 @@ var getRegion = (token) => {
|
|
|
2736
2741
|
var LivechatApiError = class extends ApiErrorBase {
|
|
2737
2742
|
constructor() {
|
|
2738
2743
|
super(...arguments);
|
|
2744
|
+
this.source = "accounts";
|
|
2739
2745
|
this.name = "livechat";
|
|
2740
2746
|
}
|
|
2741
2747
|
};
|
|
@@ -3303,33 +3309,109 @@ var productsApi = {
|
|
|
3303
3309
|
livechat: livechatApi
|
|
3304
3310
|
};
|
|
3305
3311
|
|
|
3312
|
+
// src/types/api/client.ts
|
|
3313
|
+
var ApiClient = class {
|
|
3314
|
+
constructor(config, authorization) {
|
|
3315
|
+
this.config = config;
|
|
3316
|
+
this.authorization = authorization;
|
|
3317
|
+
}
|
|
3318
|
+
updateConfig(config) {
|
|
3319
|
+
this.config = __spreadValues(__spreadValues({}, this.config), config);
|
|
3320
|
+
}
|
|
3321
|
+
updateAuthorization(authorization) {
|
|
3322
|
+
this.authorization = __spreadValues(__spreadValues({}, this.authorization), authorization);
|
|
3323
|
+
}
|
|
3324
|
+
fetch(url, customConfig, customOptions) {
|
|
3325
|
+
return __async(this, null, function* () {
|
|
3326
|
+
var _a, _b, _c;
|
|
3327
|
+
const authorization = (_a = customConfig == null ? void 0 : customConfig.authorization) != null ? _a : this.authorization;
|
|
3328
|
+
const options = __spreadValues(__spreadValues({}, this.options), customOptions);
|
|
3329
|
+
const response = yield fetch(`${this.config.baseURL}${url}`, __spreadProps(__spreadValues({}, options), {
|
|
3330
|
+
headers: __spreadValues(__spreadValues({}, options.headers), authorization ? {
|
|
3331
|
+
Authorization: `${(_b = authorization.tokenType) != null ? _b : "Bearer"} ${authorization.token}`
|
|
3332
|
+
} : void 0)
|
|
3333
|
+
}));
|
|
3334
|
+
if (!response.ok) {
|
|
3335
|
+
const errorData = yield response.json();
|
|
3336
|
+
const error = new this.Error(
|
|
3337
|
+
(_c = customConfig == null ? void 0 : customConfig.customErrorMessage) != null ? _c : response.statusText,
|
|
3338
|
+
errorData,
|
|
3339
|
+
response.status
|
|
3340
|
+
);
|
|
3341
|
+
if (response.status === 401) {
|
|
3342
|
+
throw error.unauthorized();
|
|
3343
|
+
}
|
|
3344
|
+
throw error;
|
|
3345
|
+
}
|
|
3346
|
+
const data = yield response.json();
|
|
3347
|
+
return __spreadProps(__spreadValues({}, response), {
|
|
3348
|
+
data
|
|
3349
|
+
});
|
|
3350
|
+
});
|
|
3351
|
+
}
|
|
3352
|
+
get(url, config, options) {
|
|
3353
|
+
return __async(this, null, function* () {
|
|
3354
|
+
return this.fetch(url, config, __spreadProps(__spreadValues({}, options), {
|
|
3355
|
+
method: "GET"
|
|
3356
|
+
}));
|
|
3357
|
+
});
|
|
3358
|
+
}
|
|
3359
|
+
post(url, body, customConfig, customOptions) {
|
|
3360
|
+
return __async(this, null, function* () {
|
|
3361
|
+
return this.fetch(url, customConfig, __spreadProps(__spreadValues({}, customOptions), {
|
|
3362
|
+
method: "POST",
|
|
3363
|
+
body: JSON.stringify(body)
|
|
3364
|
+
}));
|
|
3365
|
+
});
|
|
3366
|
+
}
|
|
3367
|
+
patch(url, body, customConfig, customOptions) {
|
|
3368
|
+
return __async(this, null, function* () {
|
|
3369
|
+
return this.fetch(url, customConfig, __spreadProps(__spreadValues({}, customOptions), {
|
|
3370
|
+
method: "PATCH",
|
|
3371
|
+
body: JSON.stringify(body)
|
|
3372
|
+
}));
|
|
3373
|
+
});
|
|
3374
|
+
}
|
|
3375
|
+
put(url, body, customConfig, customOptions) {
|
|
3376
|
+
return __async(this, null, function* () {
|
|
3377
|
+
return this.fetch(url, customConfig, __spreadProps(__spreadValues({}, customOptions), {
|
|
3378
|
+
method: "PUT",
|
|
3379
|
+
body: JSON.stringify(body)
|
|
3380
|
+
}));
|
|
3381
|
+
});
|
|
3382
|
+
}
|
|
3383
|
+
delete(url, body, config, options) {
|
|
3384
|
+
return __async(this, null, function* () {
|
|
3385
|
+
return this.fetch(url, config, __spreadProps(__spreadValues({}, options), {
|
|
3386
|
+
method: "DELETE",
|
|
3387
|
+
body: JSON.stringify(body)
|
|
3388
|
+
}));
|
|
3389
|
+
});
|
|
3390
|
+
}
|
|
3391
|
+
};
|
|
3392
|
+
|
|
3306
3393
|
// src/apis/platform/accounts/instance.ts
|
|
3307
|
-
import axios16 from "axios";
|
|
3308
3394
|
var AccountsApiError = class extends ApiErrorBase {
|
|
3309
3395
|
constructor() {
|
|
3310
3396
|
super(...arguments);
|
|
3397
|
+
this.source = "accounts";
|
|
3311
3398
|
this.name = "accounts";
|
|
3312
3399
|
}
|
|
3313
3400
|
};
|
|
3314
|
-
var
|
|
3401
|
+
var AccountApiClient = class extends ApiClient {
|
|
3402
|
+
constructor() {
|
|
3403
|
+
super(...arguments);
|
|
3404
|
+
this.Error = AccountsApiError;
|
|
3405
|
+
this.options = {
|
|
3406
|
+
headers: {
|
|
3407
|
+
"Content-Type": "application/json"
|
|
3408
|
+
}
|
|
3409
|
+
};
|
|
3410
|
+
}
|
|
3411
|
+
};
|
|
3412
|
+
var platformAccountsClientInstance = new AccountApiClient({
|
|
3315
3413
|
baseURL: "https://accounts.labs.livechatinc.com"
|
|
3316
3414
|
});
|
|
3317
|
-
platformAccountsClientInstance.interceptors.response.use(
|
|
3318
|
-
(response) => response,
|
|
3319
|
-
(error) => {
|
|
3320
|
-
var _a, _b, _c, _d;
|
|
3321
|
-
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
3322
|
-
return Promise.reject(new UnauthorizeApiError("accounts"));
|
|
3323
|
-
}
|
|
3324
|
-
return Promise.reject(
|
|
3325
|
-
new AccountsApiError(
|
|
3326
|
-
error.message,
|
|
3327
|
-
(_b = error.response) == null ? void 0 : _b.data,
|
|
3328
|
-
(_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
|
|
3329
|
-
)
|
|
3330
|
-
);
|
|
3331
|
-
}
|
|
3332
|
-
);
|
|
3333
3415
|
function getPlatformAccountsClientAuthorization(req) {
|
|
3334
3416
|
if (req.headers instanceof Headers) {
|
|
3335
3417
|
return {
|
|
@@ -3340,42 +3422,24 @@ function getPlatformAccountsClientAuthorization(req) {
|
|
|
3340
3422
|
token: req.headers["x-adapter-platform-token"]
|
|
3341
3423
|
};
|
|
3342
3424
|
}
|
|
3343
|
-
function getPlatformAccountsClientConfig(options = {}) {
|
|
3344
|
-
var _a;
|
|
3345
|
-
const defaultAuthorization = platformAccountsClientInstance.defaults.headers.Authorization;
|
|
3346
|
-
const headers = {
|
|
3347
|
-
authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : defaultAuthorization
|
|
3348
|
-
};
|
|
3349
|
-
return {
|
|
3350
|
-
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
3351
|
-
};
|
|
3352
|
-
}
|
|
3353
3425
|
function initPlatformAccountsClient(baseUrl, token) {
|
|
3354
3426
|
if (baseUrl) {
|
|
3355
|
-
platformAccountsClientInstance.
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
return config;
|
|
3359
|
-
},
|
|
3360
|
-
(error) => Promise.reject(error)
|
|
3361
|
-
);
|
|
3362
|
-
}
|
|
3363
|
-
if (token) {
|
|
3364
|
-
platformAccountsClientInstance.defaults.headers.Authorization = `Bearer ${token}`;
|
|
3365
|
-
} else {
|
|
3366
|
-
delete platformAccountsClientInstance.defaults.headers.Authorization;
|
|
3427
|
+
platformAccountsClientInstance.updateConfig({
|
|
3428
|
+
baseURL: baseUrl
|
|
3429
|
+
});
|
|
3367
3430
|
}
|
|
3431
|
+
platformAccountsClientInstance.updateAuthorization({
|
|
3432
|
+
token
|
|
3433
|
+
});
|
|
3368
3434
|
}
|
|
3369
3435
|
|
|
3370
3436
|
// src/apis/platform/accounts/accounts/api.ts
|
|
3371
3437
|
var platformAccountsAccountApi = {
|
|
3372
3438
|
getAccounts(authorization) {
|
|
3373
3439
|
return __async(this, null, function* () {
|
|
3374
|
-
return platformAccountsClientInstance.get(
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
).catch((error) => {
|
|
3378
|
-
throw error.withCustomMessage("Accounts couldn't be fetched.");
|
|
3440
|
+
return platformAccountsClientInstance.get(`/v2/accounts`, {
|
|
3441
|
+
authorization,
|
|
3442
|
+
customErrorMessage: "Accounts couldn't be fetched."
|
|
3379
3443
|
});
|
|
3380
3444
|
});
|
|
3381
3445
|
},
|
|
@@ -3383,20 +3447,22 @@ var platformAccountsAccountApi = {
|
|
|
3383
3447
|
return __async(this, null, function* () {
|
|
3384
3448
|
return platformAccountsClientInstance.get(
|
|
3385
3449
|
`/v2/accounts/${accountId}`,
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3450
|
+
{
|
|
3451
|
+
authorization,
|
|
3452
|
+
customErrorMessage: "Account couldn't be fetched."
|
|
3453
|
+
}
|
|
3454
|
+
);
|
|
3390
3455
|
});
|
|
3391
3456
|
},
|
|
3392
3457
|
getMeAccount(authorization) {
|
|
3393
3458
|
return __async(this, null, function* () {
|
|
3394
3459
|
return platformAccountsClientInstance.get(
|
|
3395
3460
|
`/v2/accounts/me`,
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3461
|
+
{
|
|
3462
|
+
authorization,
|
|
3463
|
+
customErrorMessage: "Me account couldn't be fetched."
|
|
3464
|
+
}
|
|
3465
|
+
);
|
|
3400
3466
|
});
|
|
3401
3467
|
}
|
|
3402
3468
|
};
|
|
@@ -3407,30 +3473,29 @@ var platformAccountsClientApi = {
|
|
|
3407
3473
|
return __async(this, null, function* () {
|
|
3408
3474
|
return platformAccountsClientInstance.get(
|
|
3409
3475
|
`/v2/clients`,
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3476
|
+
{
|
|
3477
|
+
authorization,
|
|
3478
|
+
customErrorMessage: "Clients couldn't be fetched."
|
|
3479
|
+
}
|
|
3480
|
+
);
|
|
3414
3481
|
});
|
|
3415
3482
|
},
|
|
3416
3483
|
getClient(clientId, authorization) {
|
|
3417
3484
|
return __async(this, null, function* () {
|
|
3418
3485
|
return platformAccountsClientInstance.get(
|
|
3419
3486
|
`/v2/clients/${clientId}`,
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3487
|
+
{
|
|
3488
|
+
authorization,
|
|
3489
|
+
customErrorMessage: "Client couldn't be fetched."
|
|
3490
|
+
}
|
|
3491
|
+
);
|
|
3424
3492
|
});
|
|
3425
3493
|
},
|
|
3426
3494
|
createClient(payload, authorization) {
|
|
3427
3495
|
return __async(this, null, function* () {
|
|
3428
|
-
return platformAccountsClientInstance.post(
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
getPlatformAccountsClientConfig(authorization)
|
|
3432
|
-
).catch((error) => {
|
|
3433
|
-
throw error.withCustomMessage("Client couldn't be created.");
|
|
3496
|
+
return platformAccountsClientInstance.post(`/v2/clients`, payload, {
|
|
3497
|
+
authorization,
|
|
3498
|
+
customErrorMessage: "Client couldn't be created."
|
|
3434
3499
|
});
|
|
3435
3500
|
});
|
|
3436
3501
|
},
|
|
@@ -3439,20 +3504,23 @@ var platformAccountsClientApi = {
|
|
|
3439
3504
|
return platformAccountsClientInstance.patch(
|
|
3440
3505
|
`/v2/clients/${clientId}`,
|
|
3441
3506
|
payload,
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3507
|
+
{
|
|
3508
|
+
authorization,
|
|
3509
|
+
customErrorMessage: "Client couldn't be updated."
|
|
3510
|
+
}
|
|
3511
|
+
);
|
|
3446
3512
|
});
|
|
3447
3513
|
},
|
|
3448
3514
|
deleteClient(clientId, authorization) {
|
|
3449
3515
|
return __async(this, null, function* () {
|
|
3450
3516
|
return platformAccountsClientInstance.delete(
|
|
3451
3517
|
`/v2/clients/${clientId}`,
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3518
|
+
void 0,
|
|
3519
|
+
{
|
|
3520
|
+
authorization,
|
|
3521
|
+
customErrorMessage: "Clients couldn't be deleted."
|
|
3522
|
+
}
|
|
3523
|
+
);
|
|
3456
3524
|
});
|
|
3457
3525
|
},
|
|
3458
3526
|
updateClientScopes(clientId, scopes, authorization) {
|
|
@@ -3463,31 +3531,35 @@ var platformAccountsClientApi = {
|
|
|
3463
3531
|
scope: scope.scope,
|
|
3464
3532
|
required: scope.required
|
|
3465
3533
|
})),
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3534
|
+
{
|
|
3535
|
+
authorization,
|
|
3536
|
+
customErrorMessage: "Client scopes couldn't be updated."
|
|
3537
|
+
}
|
|
3538
|
+
);
|
|
3470
3539
|
});
|
|
3471
3540
|
},
|
|
3472
3541
|
deleteClientScopes(clientId, scopes, authorization) {
|
|
3473
3542
|
return __async(this, null, function* () {
|
|
3474
|
-
return platformAccountsClientInstance.delete(
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3543
|
+
return platformAccountsClientInstance.delete(
|
|
3544
|
+
`/v2/clients/${clientId}/scopes`,
|
|
3545
|
+
{
|
|
3546
|
+
data: scopes.map((scope) => ({
|
|
3547
|
+
scope: scope.scope,
|
|
3548
|
+
required: scope.required
|
|
3549
|
+
}))
|
|
3550
|
+
},
|
|
3551
|
+
{
|
|
3552
|
+
authorization,
|
|
3553
|
+
customErrorMessage: "Client scopes couldn't be deleted."
|
|
3554
|
+
}
|
|
3555
|
+
);
|
|
3482
3556
|
});
|
|
3483
3557
|
},
|
|
3484
3558
|
getInfo(authorization) {
|
|
3485
3559
|
return __async(this, null, function* () {
|
|
3486
|
-
return platformAccountsClientInstance.get(
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
).catch((error) => {
|
|
3490
|
-
throw error.withCustomMessage("Client info couldn't be fetched.");
|
|
3560
|
+
return platformAccountsClientInstance.get(`/v2/info`, {
|
|
3561
|
+
authorization,
|
|
3562
|
+
customErrorMessage: "Client info couldn't be fetched."
|
|
3491
3563
|
});
|
|
3492
3564
|
});
|
|
3493
3565
|
}
|
|
@@ -3499,20 +3571,22 @@ var platformAccountsOrganizationApi = {
|
|
|
3499
3571
|
return __async(this, null, function* () {
|
|
3500
3572
|
return platformAccountsClientInstance.get(
|
|
3501
3573
|
`/v2/organizations`,
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3574
|
+
{
|
|
3575
|
+
authorization,
|
|
3576
|
+
customErrorMessage: "Organizations couldn't be fetched."
|
|
3577
|
+
}
|
|
3578
|
+
);
|
|
3506
3579
|
});
|
|
3507
3580
|
},
|
|
3508
3581
|
getMyOrganization(authorization) {
|
|
3509
3582
|
return __async(this, null, function* () {
|
|
3510
3583
|
return platformAccountsClientInstance.get(
|
|
3511
3584
|
`/v2/organizations/my`,
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3585
|
+
{
|
|
3586
|
+
authorization,
|
|
3587
|
+
customErrorMessage: "My organization couldn't be fetched."
|
|
3588
|
+
}
|
|
3589
|
+
);
|
|
3516
3590
|
});
|
|
3517
3591
|
}
|
|
3518
3592
|
};
|
|
@@ -3521,10 +3595,9 @@ var platformAccountsOrganizationApi = {
|
|
|
3521
3595
|
var platformAccountsPersonalAccessTokenApi = {
|
|
3522
3596
|
getPersonalAccessTokens(authorization) {
|
|
3523
3597
|
return __async(this, null, function* () {
|
|
3524
|
-
return platformAccountsClientInstance.get(`/v2/personal_token`,
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
);
|
|
3598
|
+
return platformAccountsClientInstance.get(`/v2/personal_token`, {
|
|
3599
|
+
authorization,
|
|
3600
|
+
customErrorMessage: "Personal Access Tokens couldn't be fetched."
|
|
3528
3601
|
});
|
|
3529
3602
|
});
|
|
3530
3603
|
},
|
|
@@ -3536,24 +3609,23 @@ var platformAccountsPersonalAccessTokenApi = {
|
|
|
3536
3609
|
name,
|
|
3537
3610
|
scope: scopes.map((item) => item.name).filter((el) => el).join(",")
|
|
3538
3611
|
},
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
});
|
|
3612
|
+
{
|
|
3613
|
+
authorization,
|
|
3614
|
+
customErrorMessage: "Personal Access Token couldn't be created."
|
|
3615
|
+
}
|
|
3616
|
+
);
|
|
3545
3617
|
});
|
|
3546
3618
|
},
|
|
3547
3619
|
deletePersonalAccessToken(id, authorization) {
|
|
3548
3620
|
return __async(this, null, function* () {
|
|
3549
3621
|
return platformAccountsClientInstance.delete(
|
|
3550
3622
|
`/v2/personal_token/${id}`,
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
"Personal Access Tokens couldn't be deleted."
|
|
3555
|
-
|
|
3556
|
-
|
|
3623
|
+
void 0,
|
|
3624
|
+
{
|
|
3625
|
+
authorization,
|
|
3626
|
+
customErrorMessage: "Personal Access Tokens couldn't be deleted."
|
|
3627
|
+
}
|
|
3628
|
+
);
|
|
3557
3629
|
});
|
|
3558
3630
|
}
|
|
3559
3631
|
};
|
|
@@ -3564,10 +3636,8 @@ var platformAccountsProductsApi = {
|
|
|
3564
3636
|
return __async(this, null, function* () {
|
|
3565
3637
|
return platformAccountsClientInstance.get(
|
|
3566
3638
|
`/v2/organizations/my/products`,
|
|
3567
|
-
|
|
3568
|
-
)
|
|
3569
|
-
throw error.withCustomMessage("Products couldn't be fetched.");
|
|
3570
|
-
});
|
|
3639
|
+
{ authorization, customErrorMessage: "Products couldn't be fetched." }
|
|
3640
|
+
);
|
|
3571
3641
|
});
|
|
3572
3642
|
},
|
|
3573
3643
|
updateOrganizationProducts(payload, authorization) {
|
|
@@ -3575,10 +3645,8 @@ var platformAccountsProductsApi = {
|
|
|
3575
3645
|
return platformAccountsClientInstance.post(
|
|
3576
3646
|
`/v2/organizations/my/products`,
|
|
3577
3647
|
payload,
|
|
3578
|
-
|
|
3579
|
-
)
|
|
3580
|
-
throw error.withCustomMessage("Products couldn't be updated.");
|
|
3581
|
-
});
|
|
3648
|
+
{ authorization, customErrorMessage: "Products couldn't be updated." }
|
|
3649
|
+
);
|
|
3582
3650
|
});
|
|
3583
3651
|
}
|
|
3584
3652
|
};
|
|
@@ -3587,11 +3655,9 @@ var platformAccountsProductsApi = {
|
|
|
3587
3655
|
var platformAccountsScopesApi = {
|
|
3588
3656
|
getScopes(authorization) {
|
|
3589
3657
|
return __async(this, null, function* () {
|
|
3590
|
-
return platformAccountsClientInstance.get(
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
).catch((error) => {
|
|
3594
|
-
throw error.withCustomMessage("Scopes couldn't be fetched.");
|
|
3658
|
+
return platformAccountsClientInstance.get(`/v2/scopes`, {
|
|
3659
|
+
authorization,
|
|
3660
|
+
customErrorMessage: "Scopes couldn't be fetched."
|
|
3595
3661
|
});
|
|
3596
3662
|
});
|
|
3597
3663
|
}
|
|
@@ -3603,10 +3669,12 @@ var platformAccountsSessionsApi = {
|
|
|
3603
3669
|
return __async(this, null, function* () {
|
|
3604
3670
|
return platformAccountsClientInstance.delete(
|
|
3605
3671
|
`/v2/sessions`,
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3672
|
+
void 0,
|
|
3673
|
+
{
|
|
3674
|
+
authorization,
|
|
3675
|
+
customErrorMessage: "Sessions couldn't be fetched."
|
|
3676
|
+
}
|
|
3677
|
+
);
|
|
3610
3678
|
});
|
|
3611
3679
|
}
|
|
3612
3680
|
};
|
|
@@ -3622,13 +3690,18 @@ var platformAccountsTokenApi = {
|
|
|
3622
3690
|
client_secret: clientSecret,
|
|
3623
3691
|
redirect_uri: redirectUrl
|
|
3624
3692
|
});
|
|
3625
|
-
return platformAccountsClientInstance.post(
|
|
3626
|
-
|
|
3627
|
-
|
|
3693
|
+
return platformAccountsClientInstance.post(
|
|
3694
|
+
`/v2/token`,
|
|
3695
|
+
data,
|
|
3696
|
+
{
|
|
3697
|
+
customErrorMessage: "Couldn't exchange code for token."
|
|
3698
|
+
},
|
|
3699
|
+
{
|
|
3700
|
+
headers: {
|
|
3701
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
3702
|
+
}
|
|
3628
3703
|
}
|
|
3629
|
-
|
|
3630
|
-
throw error.withCustomMessage("Couldn't exchange code for token.");
|
|
3631
|
-
});
|
|
3704
|
+
);
|
|
3632
3705
|
});
|
|
3633
3706
|
}
|
|
3634
3707
|
};
|
|
@@ -3646,14 +3719,15 @@ var platformAccountsApi = {
|
|
|
3646
3719
|
};
|
|
3647
3720
|
|
|
3648
3721
|
// src/apis/platform/dps/instance.ts
|
|
3649
|
-
import
|
|
3722
|
+
import axios16 from "axios";
|
|
3650
3723
|
var DpsApiError = class extends ApiErrorBase {
|
|
3651
3724
|
constructor() {
|
|
3652
3725
|
super(...arguments);
|
|
3726
|
+
this.source = "accounts";
|
|
3653
3727
|
this.name = "dps";
|
|
3654
3728
|
}
|
|
3655
3729
|
};
|
|
3656
|
-
var platformDpsClientInstance =
|
|
3730
|
+
var platformDpsClientInstance = axios16.create({
|
|
3657
3731
|
baseURL: "https://dev-platform.labs.livechatinc.com"
|
|
3658
3732
|
});
|
|
3659
3733
|
platformDpsClientInstance.interceptors.response.use(
|
|
@@ -5218,7 +5292,7 @@ var platformDpsApi = {
|
|
|
5218
5292
|
};
|
|
5219
5293
|
|
|
5220
5294
|
// src/apis/platform/adapter/instance.ts
|
|
5221
|
-
import
|
|
5295
|
+
import axios17 from "axios";
|
|
5222
5296
|
var REGION2 = {
|
|
5223
5297
|
FRA: "fra",
|
|
5224
5298
|
DAL: "dal",
|
|
@@ -5235,10 +5309,11 @@ var getRegion2 = (token) => {
|
|
|
5235
5309
|
var AdapterApiError = class extends ApiErrorBase {
|
|
5236
5310
|
constructor() {
|
|
5237
5311
|
super(...arguments);
|
|
5312
|
+
this.source = "accounts";
|
|
5238
5313
|
this.name = "adapter";
|
|
5239
5314
|
}
|
|
5240
5315
|
};
|
|
5241
|
-
var platformAdapterClientInstance =
|
|
5316
|
+
var platformAdapterClientInstance = axios17.create({
|
|
5242
5317
|
baseURL: "https://platform.labs.text.com/console-adapter/api",
|
|
5243
5318
|
headers: {
|
|
5244
5319
|
"Content-Type": "application/json"
|
|
@@ -5931,8 +6006,8 @@ var WorkflowDefinitionTaskType = {
|
|
|
5931
6006
|
};
|
|
5932
6007
|
|
|
5933
6008
|
// src/apis/platform/billing/instance.ts
|
|
5934
|
-
import
|
|
5935
|
-
var platformBillingClientInstance =
|
|
6009
|
+
import axios18 from "axios";
|
|
6010
|
+
var platformBillingClientInstance = axios18.create({
|
|
5936
6011
|
baseURL: "https://billing.labs.livechatinc.com"
|
|
5937
6012
|
});
|
|
5938
6013
|
function getPlatformBillingClientAuthorization(req) {
|
|
@@ -6457,7 +6532,6 @@ export {
|
|
|
6457
6532
|
getPlanetScaleClientAuthorization,
|
|
6458
6533
|
getPlanetScaleClientConfig,
|
|
6459
6534
|
getPlatformAccountsClientAuthorization,
|
|
6460
|
-
getPlatformAccountsClientConfig,
|
|
6461
6535
|
getPlatformAdapterClientAuthorization,
|
|
6462
6536
|
getPlatformAdapterClientConfig,
|
|
6463
6537
|
getPlatformAdapterClientDefaultConfig,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livechat/developer-studio-api",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.1.0-beta.1",
|
|
4
4
|
"description": "This project is API for LiveChat Developer Studio.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"@types/node": "^17.0.12",
|
|
21
21
|
"tsup": "^7.1.0",
|
|
22
22
|
"typescript": "^5.1.6",
|
|
23
|
-
"
|
|
23
|
+
"utils": "0.0.4",
|
|
24
24
|
"tsconfig": "0.0.1",
|
|
25
|
-
"
|
|
25
|
+
"eslint-config-custom": "0.0.8"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsup",
|