btrz-api-client 5.192.0 → 5.194.0
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/lib/client-standalone-min.js +3 -3
- package/lib/client.js +31 -10
- package/lib/endpoints/inventory/financing-costs.js +2 -2
- package/lib/endpoints/ratality/auth.js +23 -0
- package/lib/endpoints/ratality/clients.js +40 -0
- package/lib/endpoints/ratality/integrations.js +53 -0
- package/package.json +1 -1
- package/src/client.js +16 -1
- package/src/endpoints/inventory/financing-costs.js +2 -2
- package/src/endpoints/ratality/auth.js +19 -0
- package/src/endpoints/ratality/clients.js +35 -0
- package/src/endpoints/ratality/integrations.js +44 -0
- package/test/endpoints/ratality/auth.test.js +23 -0
- package/test/endpoints/ratality/client.test.js +32 -0
- package/test/endpoints/ratality/integrations.test.js +90 -0
- package/types/client.d.ts +38 -0
- package/types/endpoints/ratality/auth.d.ts +9 -0
- package/types/endpoints/ratality/clients.d.ts +15 -0
- package/types/endpoints/ratality/integrations.d.ts +20 -0
- package/types/initializedClient.d.ts +38 -0
package/lib/client.js
CHANGED
|
@@ -502,6 +502,26 @@ function createGPS(_ref15) {
|
|
|
502
502
|
};
|
|
503
503
|
}
|
|
504
504
|
|
|
505
|
+
function createRatality(_ref16) {
|
|
506
|
+
var baseURL = _ref16.baseURL,
|
|
507
|
+
headers = _ref16.headers,
|
|
508
|
+
timeout = _ref16.timeout,
|
|
509
|
+
overrideFn = _ref16.overrideFn,
|
|
510
|
+
agents = _ref16.agents;
|
|
511
|
+
|
|
512
|
+
var client = clientFactory({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: overrideFn, agents: agents });
|
|
513
|
+
var version = "v2";
|
|
514
|
+
|
|
515
|
+
return {
|
|
516
|
+
auth: require("./endpoints/ratality/auth.js")({ client: client }),
|
|
517
|
+
clients: require("./endpoints/ratality/clients.js")({ client: client, version: version }),
|
|
518
|
+
integrations: require("./endpoints/ratality/integrations.js")({ client: client, version: version }),
|
|
519
|
+
__test: {
|
|
520
|
+
client: client
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
|
|
505
525
|
/**
|
|
506
526
|
* Returns the apiClient object with defaults set
|
|
507
527
|
*
|
|
@@ -516,15 +536,15 @@ function createGPS(_ref15) {
|
|
|
516
536
|
* @param {{httpAgent: import("http").Agent, httpsAgent: import("https").Agent}} options.agents - An object containg one or both http agents
|
|
517
537
|
*/
|
|
518
538
|
function createApiClient(options) {
|
|
519
|
-
var
|
|
520
|
-
baseURL =
|
|
521
|
-
|
|
522
|
-
baseURLOverride =
|
|
523
|
-
headers =
|
|
524
|
-
|
|
525
|
-
timeout =
|
|
526
|
-
internalAuthTokenProvider =
|
|
527
|
-
agents =
|
|
539
|
+
var _ref17 = options || productionOptions,
|
|
540
|
+
baseURL = _ref17.baseURL,
|
|
541
|
+
_ref17$baseURLOverrid = _ref17.baseURLOverride,
|
|
542
|
+
baseURLOverride = _ref17$baseURLOverrid === undefined ? {} : _ref17$baseURLOverrid,
|
|
543
|
+
headers = _ref17.headers,
|
|
544
|
+
_ref17$timeout = _ref17.timeout,
|
|
545
|
+
timeout = _ref17$timeout === undefined ? 0 : _ref17$timeout,
|
|
546
|
+
internalAuthTokenProvider = _ref17.internalAuthTokenProvider,
|
|
547
|
+
agents = _ref17.agents;
|
|
528
548
|
|
|
529
549
|
return {
|
|
530
550
|
constants: require("./constants.js"),
|
|
@@ -543,7 +563,8 @@ function createApiClient(options) {
|
|
|
543
563
|
seatmaps: createSeatmaps({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: baseURLOverride.seatmaps, internalAuthTokenProvider: internalAuthTokenProvider, agents: agents }),
|
|
544
564
|
btrzpay: createBtrzPay({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: baseURLOverride.btrzpay, internalAuthTokenProvider: internalAuthTokenProvider, agents: agents }),
|
|
545
565
|
invoices: createInvoices({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: baseURLOverride.invoices, internalAuthTokenProvider: internalAuthTokenProvider, agents: agents }),
|
|
546
|
-
gps: createGPS({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: baseURLOverride.invoices, internalAuthTokenProvider: internalAuthTokenProvider, agents: agents })
|
|
566
|
+
gps: createGPS({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: baseURLOverride.invoices, internalAuthTokenProvider: internalAuthTokenProvider, agents: agents }),
|
|
567
|
+
ratality: createRatality({ baseURL: baseURL, headers: headers, timeout: timeout, overrideFn: baseURLOverride.ratality, agents: agents })
|
|
547
568
|
};
|
|
548
569
|
}
|
|
549
570
|
|
|
@@ -42,7 +42,7 @@ function financingCostsFactory(_ref) {
|
|
|
42
42
|
method: "post",
|
|
43
43
|
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
44
44
|
data: {
|
|
45
|
-
|
|
45
|
+
financingcost: financingCost
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -72,7 +72,7 @@ function financingCostsFactory(_ref) {
|
|
|
72
72
|
method: "put",
|
|
73
73
|
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
74
74
|
data: {
|
|
75
|
-
|
|
75
|
+
financingcost: financingCost
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function authFactory(_ref) {
|
|
4
|
+
var client = _ref.client;
|
|
5
|
+
|
|
6
|
+
function create(_ref2) {
|
|
7
|
+
var data = _ref2.data,
|
|
8
|
+
headers = _ref2.headers;
|
|
9
|
+
|
|
10
|
+
return client({
|
|
11
|
+
url: "/authenticate",
|
|
12
|
+
method: "post",
|
|
13
|
+
headers: headers,
|
|
14
|
+
data: data
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
create: create
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = authFactory;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _require = require("./../endpoints_helpers.js"),
|
|
4
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
5
|
+
|
|
6
|
+
function clientsFactory(_ref) {
|
|
7
|
+
var client = _ref.client,
|
|
8
|
+
version = _ref.version;
|
|
9
|
+
|
|
10
|
+
function create(_ref2) {
|
|
11
|
+
var jwtToken = _ref2.jwtToken,
|
|
12
|
+
data = _ref2.data,
|
|
13
|
+
headers = _ref2.headers;
|
|
14
|
+
|
|
15
|
+
return client({
|
|
16
|
+
url: "/" + version + "/client",
|
|
17
|
+
method: "post",
|
|
18
|
+
headers: authorizationHeaders({ jwtToken: jwtToken, headers: headers }),
|
|
19
|
+
data: data
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function get(_ref3) {
|
|
24
|
+
var jwtToken = _ref3.jwtToken,
|
|
25
|
+
clientId = _ref3.clientId;
|
|
26
|
+
|
|
27
|
+
return client({
|
|
28
|
+
url: "/" + version + "/client",
|
|
29
|
+
method: "get",
|
|
30
|
+
headers: Object.assign({ clientId: clientId }, authorizationHeaders({ jwtToken: jwtToken }))
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
create: create,
|
|
36
|
+
get: get
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = clientsFactory;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _require = require("./../endpoints_helpers.js"),
|
|
4
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
5
|
+
|
|
6
|
+
function integrationsFactory(_ref) {
|
|
7
|
+
var client = _ref.client,
|
|
8
|
+
version = _ref.version;
|
|
9
|
+
|
|
10
|
+
function get(_ref2) {
|
|
11
|
+
var jwtToken = _ref2.jwtToken,
|
|
12
|
+
clientId = _ref2.clientId;
|
|
13
|
+
|
|
14
|
+
return client({
|
|
15
|
+
url: "/" + version + "/client/integrations",
|
|
16
|
+
method: "get",
|
|
17
|
+
headers: Object.assign({ clientId: clientId }, authorizationHeaders({ jwtToken: jwtToken }))
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function create(_ref3) {
|
|
22
|
+
var jwtToken = _ref3.jwtToken,
|
|
23
|
+
clientId = _ref3.clientId,
|
|
24
|
+
data = _ref3.data;
|
|
25
|
+
|
|
26
|
+
return client({
|
|
27
|
+
url: "/" + version + "/client/integrations",
|
|
28
|
+
method: "post",
|
|
29
|
+
headers: Object.assign({ clientId: clientId }, authorizationHeaders({ jwtToken: jwtToken })),
|
|
30
|
+
data: data
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function remove(_ref4) {
|
|
35
|
+
var jwtToken = _ref4.jwtToken,
|
|
36
|
+
clientId = _ref4.clientId,
|
|
37
|
+
integrationType = _ref4.integrationType;
|
|
38
|
+
|
|
39
|
+
return client({
|
|
40
|
+
url: "/" + version + "/client/integrations/" + integrationType,
|
|
41
|
+
method: "delete",
|
|
42
|
+
headers: Object.assign({ clientId: clientId }, authorizationHeaders({ jwtToken: jwtToken }))
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
get: get,
|
|
48
|
+
create: create,
|
|
49
|
+
remove: remove
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = integrationsFactory;
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -391,6 +391,20 @@ function createGPS({baseURL, headers, timeout, overrideFn, internalAuthTokenProv
|
|
|
391
391
|
};
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
+
function createRatality({baseURL, headers, timeout, overrideFn, agents}) {
|
|
395
|
+
const client = clientFactory({baseURL, headers, timeout, overrideFn, agents});
|
|
396
|
+
const version = "v2";
|
|
397
|
+
|
|
398
|
+
return {
|
|
399
|
+
auth: require("./endpoints/ratality/auth.js")({client}),
|
|
400
|
+
clients: require("./endpoints/ratality/clients.js")({client, version}),
|
|
401
|
+
integrations: require("./endpoints/ratality/integrations.js")({client, version}),
|
|
402
|
+
__test: {
|
|
403
|
+
client
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
|
|
394
408
|
/**
|
|
395
409
|
* Returns the apiClient object with defaults set
|
|
396
410
|
*
|
|
@@ -427,7 +441,8 @@ function createApiClient(options) {
|
|
|
427
441
|
seatmaps: createSeatmaps({baseURL, headers, timeout, overrideFn: baseURLOverride.seatmaps, internalAuthTokenProvider, agents}),
|
|
428
442
|
btrzpay: createBtrzPay({baseURL, headers, timeout, overrideFn: baseURLOverride.btrzpay, internalAuthTokenProvider, agents}),
|
|
429
443
|
invoices: createInvoices({baseURL, headers, timeout, overrideFn: baseURLOverride.invoices, internalAuthTokenProvider, agents}),
|
|
430
|
-
gps: createGPS({baseURL, headers, timeout, overrideFn: baseURLOverride.invoices, internalAuthTokenProvider, agents})
|
|
444
|
+
gps: createGPS({baseURL, headers, timeout, overrideFn: baseURLOverride.invoices, internalAuthTokenProvider, agents}),
|
|
445
|
+
ratality: createRatality({baseURL, headers, timeout, overrideFn: baseURLOverride.ratality, agents})
|
|
431
446
|
};
|
|
432
447
|
}
|
|
433
448
|
|
|
@@ -27,7 +27,7 @@ function financingCostsFactory({client, internalAuthTokenProvider}) {
|
|
|
27
27
|
method: "post",
|
|
28
28
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
29
29
|
data: {
|
|
30
|
-
financingCost
|
|
30
|
+
financingcost: financingCost
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
}
|
|
@@ -46,7 +46,7 @@ function financingCostsFactory({client, internalAuthTokenProvider}) {
|
|
|
46
46
|
method: "put",
|
|
47
47
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
48
48
|
data: {
|
|
49
|
-
financingCost
|
|
49
|
+
financingcost: financingCost
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const {
|
|
2
|
+
authorizationHeaders
|
|
3
|
+
} = require("./../endpoints_helpers.js");
|
|
4
|
+
|
|
5
|
+
function clientsFactory({client, version}) {
|
|
6
|
+
function create({
|
|
7
|
+
jwtToken,
|
|
8
|
+
data,
|
|
9
|
+
headers
|
|
10
|
+
}) {
|
|
11
|
+
return client({
|
|
12
|
+
url: `/${version}/client`,
|
|
13
|
+
method: "post",
|
|
14
|
+
headers: authorizationHeaders({jwtToken, headers}),
|
|
15
|
+
data
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function get({
|
|
20
|
+
jwtToken, clientId
|
|
21
|
+
}) {
|
|
22
|
+
return client({
|
|
23
|
+
url: `/${version}/client`,
|
|
24
|
+
method: "get",
|
|
25
|
+
headers: Object.assign({clientId}, authorizationHeaders({jwtToken}))
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
create,
|
|
31
|
+
get
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = clientsFactory;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const {
|
|
2
|
+
authorizationHeaders
|
|
3
|
+
} = require("./../endpoints_helpers.js");
|
|
4
|
+
|
|
5
|
+
function integrationsFactory({client, version}) {
|
|
6
|
+
function get({
|
|
7
|
+
jwtToken, clientId
|
|
8
|
+
}) {
|
|
9
|
+
return client({
|
|
10
|
+
url: `/${version}/client/integrations`,
|
|
11
|
+
method: "get",
|
|
12
|
+
headers: Object.assign({clientId}, authorizationHeaders({jwtToken}))
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function create({
|
|
17
|
+
jwtToken, clientId, data
|
|
18
|
+
}) {
|
|
19
|
+
return client({
|
|
20
|
+
url: `/${version}/client/integrations`,
|
|
21
|
+
method: "post",
|
|
22
|
+
headers: Object.assign({clientId}, authorizationHeaders({jwtToken})),
|
|
23
|
+
data
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function remove({
|
|
28
|
+
jwtToken, clientId, integrationType
|
|
29
|
+
}) {
|
|
30
|
+
return client({
|
|
31
|
+
url: `/${version}/client/integrations/${integrationType}`,
|
|
32
|
+
method: "delete",
|
|
33
|
+
headers: Object.assign({clientId}, authorizationHeaders({jwtToken}))
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
get,
|
|
39
|
+
create,
|
|
40
|
+
remove
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = integrationsFactory;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const {expect} = require("chai");
|
|
2
|
+
const {axiosMock} = require("./../../test-helpers");
|
|
3
|
+
const api = require("./../../../src/client").createApiClient({ baseURL: "http://ratality.com" });
|
|
4
|
+
|
|
5
|
+
describe("auth", () => {
|
|
6
|
+
afterEach(function() {
|
|
7
|
+
axiosMock.restore();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it("should perform a token create", () => {
|
|
11
|
+
const data = {
|
|
12
|
+
"username": "user_123",
|
|
13
|
+
"password": "pass_123",
|
|
14
|
+
"rememberMe": true
|
|
15
|
+
};
|
|
16
|
+
const response = {id_token: "someToken"};
|
|
17
|
+
axiosMock.onPost("/authenticate").reply((config) => {
|
|
18
|
+
expect(config.data).to.eql(JSON.stringify(data));
|
|
19
|
+
return [200, response];
|
|
20
|
+
});
|
|
21
|
+
return api.ratality.auth.create({data});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const { axiosMock, expectRequest } = require("./../../test-helpers");
|
|
2
|
+
const api = require("./../../../src/client").createApiClient({ baseURL: "http://ratality.com/v2" });
|
|
3
|
+
|
|
4
|
+
describe("client", () => {
|
|
5
|
+
const jwtToken = 'I owe you a JWT token';
|
|
6
|
+
const version = "v2";
|
|
7
|
+
|
|
8
|
+
afterEach(function() {
|
|
9
|
+
axiosMock.restore();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("should perform a client create", () => {
|
|
13
|
+
const data = {
|
|
14
|
+
"name": "test_account",
|
|
15
|
+
"externalId": "testAccountId123"
|
|
16
|
+
};
|
|
17
|
+
axiosMock.onPost(`/${version}/client`).reply(expectRequest({statusCode: 200, jwtToken, body: data, withoutApiKey: true}));
|
|
18
|
+
return api.ratality.clients.create({
|
|
19
|
+
jwtToken,
|
|
20
|
+
data
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("should perform a client get", () => {
|
|
25
|
+
const clientId = "clientId123";
|
|
26
|
+
axiosMock.onGet(`/${version}/client`).reply(expectRequest({statusCode: 200, jwtToken, withoutApiKey: true}));
|
|
27
|
+
return api.ratality.clients.get({
|
|
28
|
+
jwtToken,
|
|
29
|
+
clientId
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const { expect } = require("chai");
|
|
2
|
+
const { axiosMock, expectRequest } = require("./../../test-helpers");
|
|
3
|
+
const api = require("./../../../src/client").createApiClient({ baseURL: "http://ratality.com/v2" });
|
|
4
|
+
|
|
5
|
+
describe("integrations", () => {
|
|
6
|
+
const jwtToken = 'I owe you a JWT token';
|
|
7
|
+
const version = "v2";
|
|
8
|
+
|
|
9
|
+
afterEach(function() {
|
|
10
|
+
axiosMock.restore();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("should perform an integration create", () => {
|
|
14
|
+
const clientId = "clientId123";
|
|
15
|
+
const data = {
|
|
16
|
+
"integrationType": "Betterez",
|
|
17
|
+
"outboundConnection": {
|
|
18
|
+
"url": "https://sandbox-api.betterez.com",
|
|
19
|
+
"username": "user@place.com",
|
|
20
|
+
"password": "123456"
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
axiosMock.onPost(`/${version}/client/integrations`).reply((config) => {
|
|
24
|
+
expectRequest({statusCode: 200, jwtToken, body: data, withoutApiKey: true});
|
|
25
|
+
expect(config.headers).to.include({clientId});
|
|
26
|
+
return [200, {
|
|
27
|
+
"integrationType": "Betterez",
|
|
28
|
+
"clientId": clientId,
|
|
29
|
+
"channelId": 1000,
|
|
30
|
+
"outboundConnection": {
|
|
31
|
+
"url": "https://sandbox-api.betterez.com",
|
|
32
|
+
"username": "user@place.com",
|
|
33
|
+
"password": "123456"
|
|
34
|
+
},
|
|
35
|
+
"inboundConnection": {
|
|
36
|
+
"url": "https://integrate.us.ratality.com/betterez/99999",
|
|
37
|
+
"tags": [
|
|
38
|
+
"brand.created",
|
|
39
|
+
"brand.updated",
|
|
40
|
+
"station.created",
|
|
41
|
+
"station.updated",
|
|
42
|
+
"route.created",
|
|
43
|
+
"route.updated",
|
|
44
|
+
"route.deleted",
|
|
45
|
+
"schedule.created",
|
|
46
|
+
"schedule.updated",
|
|
47
|
+
"schedule.deleted",
|
|
48
|
+
"ticket.created",
|
|
49
|
+
"ticket.updated",
|
|
50
|
+
"ticket.moved"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}];
|
|
54
|
+
});
|
|
55
|
+
return api.ratality.integrations.create({
|
|
56
|
+
jwtToken,
|
|
57
|
+
clientId,
|
|
58
|
+
data
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("should perform an integration get", () => {
|
|
63
|
+
const clientId = "clientId123";
|
|
64
|
+
axiosMock.onGet(`/${version}/client/integrations`).reply((config) => {
|
|
65
|
+
expectRequest({statusCode: 200, jwtToken, withoutApiKey: true});
|
|
66
|
+
expect(config.headers).to.include({clientId});
|
|
67
|
+
return [200, {integrations: []}];
|
|
68
|
+
});
|
|
69
|
+
return api.ratality.integrations.get({
|
|
70
|
+
jwtToken,
|
|
71
|
+
clientId
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("should perform an integration delete", () => {
|
|
76
|
+
const clientId = "clientId123";
|
|
77
|
+
const integrationType = "Betterez";
|
|
78
|
+
axiosMock.onDelete(`/${version}/client/integrations/${integrationType}`).reply((config) => {
|
|
79
|
+
expectRequest({statusCode: 200, jwtToken, withoutApiKey: true});
|
|
80
|
+
expect(config.headers).to.include({clientId});
|
|
81
|
+
expect(config.url).to.contain("Betterez");
|
|
82
|
+
return [200, {integrations: []}];
|
|
83
|
+
});
|
|
84
|
+
return api.ratality.integrations.remove({
|
|
85
|
+
jwtToken,
|
|
86
|
+
clientId,
|
|
87
|
+
integrationType
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
});
|
package/types/client.d.ts
CHANGED
|
@@ -4460,5 +4460,43 @@ export function createApiClient(options: {
|
|
|
4460
4460
|
client: axios.AxiosInstance;
|
|
4461
4461
|
};
|
|
4462
4462
|
};
|
|
4463
|
+
ratality: {
|
|
4464
|
+
auth: {
|
|
4465
|
+
create: ({ data, headers }: {
|
|
4466
|
+
data: any;
|
|
4467
|
+
headers: any;
|
|
4468
|
+
}) => any;
|
|
4469
|
+
};
|
|
4470
|
+
clients: {
|
|
4471
|
+
create: ({ jwtToken, data, headers }: {
|
|
4472
|
+
jwtToken: any;
|
|
4473
|
+
data: any;
|
|
4474
|
+
headers: any;
|
|
4475
|
+
}) => any;
|
|
4476
|
+
get: ({ jwtToken, clientId }: {
|
|
4477
|
+
jwtToken: any;
|
|
4478
|
+
clientId: any;
|
|
4479
|
+
}) => any;
|
|
4480
|
+
};
|
|
4481
|
+
integrations: {
|
|
4482
|
+
get: ({ jwtToken, clientId }: {
|
|
4483
|
+
jwtToken: any;
|
|
4484
|
+
clientId: any;
|
|
4485
|
+
}) => any;
|
|
4486
|
+
create: ({ jwtToken, clientId, data }: {
|
|
4487
|
+
jwtToken: any;
|
|
4488
|
+
clientId: any;
|
|
4489
|
+
data: any;
|
|
4490
|
+
}) => any;
|
|
4491
|
+
remove: ({ jwtToken, clientId, integrationType }: {
|
|
4492
|
+
jwtToken: any;
|
|
4493
|
+
clientId: any;
|
|
4494
|
+
integrationType: any;
|
|
4495
|
+
}) => any;
|
|
4496
|
+
};
|
|
4497
|
+
__test: {
|
|
4498
|
+
client: axios.AxiosInstance;
|
|
4499
|
+
};
|
|
4500
|
+
};
|
|
4463
4501
|
};
|
|
4464
4502
|
import axios = require("axios");
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export = clientsFactory;
|
|
2
|
+
declare function clientsFactory({ client, version }: {
|
|
3
|
+
client: any;
|
|
4
|
+
version: any;
|
|
5
|
+
}): {
|
|
6
|
+
create: ({ jwtToken, data, headers }: {
|
|
7
|
+
jwtToken: any;
|
|
8
|
+
data: any;
|
|
9
|
+
headers: any;
|
|
10
|
+
}) => any;
|
|
11
|
+
get: ({ jwtToken, clientId }: {
|
|
12
|
+
jwtToken: any;
|
|
13
|
+
clientId: any;
|
|
14
|
+
}) => any;
|
|
15
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export = integrationsFactory;
|
|
2
|
+
declare function integrationsFactory({ client, version }: {
|
|
3
|
+
client: any;
|
|
4
|
+
version: any;
|
|
5
|
+
}): {
|
|
6
|
+
get: ({ jwtToken, clientId }: {
|
|
7
|
+
jwtToken: any;
|
|
8
|
+
clientId: any;
|
|
9
|
+
}) => any;
|
|
10
|
+
create: ({ jwtToken, clientId, data }: {
|
|
11
|
+
jwtToken: any;
|
|
12
|
+
clientId: any;
|
|
13
|
+
data: any;
|
|
14
|
+
}) => any;
|
|
15
|
+
remove: ({ jwtToken, clientId, integrationType }: {
|
|
16
|
+
jwtToken: any;
|
|
17
|
+
clientId: any;
|
|
18
|
+
integrationType: any;
|
|
19
|
+
}) => any;
|
|
20
|
+
};
|
|
@@ -4414,5 +4414,43 @@ declare const _exports: {
|
|
|
4414
4414
|
client: import("axios").AxiosInstance;
|
|
4415
4415
|
};
|
|
4416
4416
|
};
|
|
4417
|
+
ratality: {
|
|
4418
|
+
auth: {
|
|
4419
|
+
create: ({ data, headers }: {
|
|
4420
|
+
data: any;
|
|
4421
|
+
headers: any;
|
|
4422
|
+
}) => any;
|
|
4423
|
+
};
|
|
4424
|
+
clients: {
|
|
4425
|
+
create: ({ jwtToken, data, headers }: {
|
|
4426
|
+
jwtToken: any;
|
|
4427
|
+
data: any;
|
|
4428
|
+
headers: any;
|
|
4429
|
+
}) => any;
|
|
4430
|
+
get: ({ jwtToken, clientId }: {
|
|
4431
|
+
jwtToken: any;
|
|
4432
|
+
clientId: any;
|
|
4433
|
+
}) => any;
|
|
4434
|
+
};
|
|
4435
|
+
integrations: {
|
|
4436
|
+
get: ({ jwtToken, clientId }: {
|
|
4437
|
+
jwtToken: any;
|
|
4438
|
+
clientId: any;
|
|
4439
|
+
}) => any;
|
|
4440
|
+
create: ({ jwtToken, clientId, data }: {
|
|
4441
|
+
jwtToken: any;
|
|
4442
|
+
clientId: any;
|
|
4443
|
+
data: any;
|
|
4444
|
+
}) => any;
|
|
4445
|
+
remove: ({ jwtToken, clientId, integrationType }: {
|
|
4446
|
+
jwtToken: any;
|
|
4447
|
+
clientId: any;
|
|
4448
|
+
integrationType: any;
|
|
4449
|
+
}) => any;
|
|
4450
|
+
};
|
|
4451
|
+
__test: {
|
|
4452
|
+
client: import("axios").AxiosInstance;
|
|
4453
|
+
};
|
|
4454
|
+
};
|
|
4417
4455
|
};
|
|
4418
4456
|
export = _exports;
|