btrz-api-client 5.177.0 → 5.179.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 +2 -0
- package/lib/endpoints/accounts/s3buckets.js +59 -0
- package/lib/endpoints/inventory/stations-types.js +28 -0
- package/package.json +1 -1
- package/src/client.js +2 -0
- package/src/endpoints/accounts/s3buckets.js +37 -0
- package/src/endpoints/inventory/stations-types.js +19 -0
- package/test/endpoints/accounts/s3Buckets.test.js +40 -0
- package/test/endpoints/inventory/stations-types.test.js +21 -0
- package/test-integration/endpoints/uploads/images.test.js +9 -5
- package/types/client.d.ts +28 -0
- package/types/endpoints/accounts/s3buckets.d.ts +25 -0
- package/types/endpoints/inventory/stations-types.d.ts +11 -0
- package/types/initializedClient.d.ts +28 -0
package/lib/client.js
CHANGED
|
@@ -62,6 +62,7 @@ function createInventory(_ref) {
|
|
|
62
62
|
insurancesCost: require("./endpoints/inventory/insurancesCost.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
63
63
|
stations: require("./endpoints/inventory/stations.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
64
64
|
stationsProvinces: require("./endpoints/inventory/stations-provinces.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
65
|
+
stationsTypes: require("./endpoints/inventory/stations-types.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
65
66
|
stationsZones: require("./endpoints/inventory/stations-zones.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
66
67
|
parcelZones: require("./endpoints/inventory/parcel-zones.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
67
68
|
countries: require("./endpoints/inventory/countries.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
@@ -201,6 +202,7 @@ function createAccounts(_ref4) {
|
|
|
201
202
|
subPrintTemplates: require("./endpoints/accounts/sub-print-templates.js")({
|
|
202
203
|
client: client, internalAuthTokenProvider: internalAuthTokenProvider
|
|
203
204
|
}),
|
|
205
|
+
s3Buckets: require("./endpoints/accounts/s3buckets.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
204
206
|
shifts: require("./endpoints/accounts/shifts.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
205
207
|
shiftSettings: require("./endpoints/accounts/shift-settings.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
206
208
|
ticketMovementSettings: require("./endpoints/accounts/ticket-movement-settings.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _require = require("./../endpoints_helpers.js"),
|
|
4
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
5
|
+
|
|
6
|
+
function s3BucketsFactory(_ref) {
|
|
7
|
+
var client = _ref.client,
|
|
8
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
9
|
+
|
|
10
|
+
function update(_ref2) {
|
|
11
|
+
var jwtToken = _ref2.jwtToken,
|
|
12
|
+
token = _ref2.token,
|
|
13
|
+
bucketId = _ref2.bucketId,
|
|
14
|
+
application = _ref2.application,
|
|
15
|
+
headers = _ref2.headers;
|
|
16
|
+
|
|
17
|
+
return client({
|
|
18
|
+
url: "/account/s3Buckets/" + bucketId,
|
|
19
|
+
method: "put",
|
|
20
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
21
|
+
data: { application: application }
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function remove(_ref3) {
|
|
26
|
+
var jwtToken = _ref3.jwtToken,
|
|
27
|
+
token = _ref3.token,
|
|
28
|
+
bucketId = _ref3.bucketId,
|
|
29
|
+
headers = _ref3.headers;
|
|
30
|
+
|
|
31
|
+
return client({
|
|
32
|
+
url: "/account/s3Buckets/" + bucketId,
|
|
33
|
+
method: "delete",
|
|
34
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function create(_ref4) {
|
|
39
|
+
var jwtToken = _ref4.jwtToken,
|
|
40
|
+
token = _ref4.token,
|
|
41
|
+
application = _ref4.application,
|
|
42
|
+
headers = _ref4.headers;
|
|
43
|
+
|
|
44
|
+
return client({
|
|
45
|
+
url: "/account/s3Buckets",
|
|
46
|
+
method: "post",
|
|
47
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
48
|
+
data: { application: application }
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
update: update,
|
|
54
|
+
remove: remove,
|
|
55
|
+
create: create
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = s3BucketsFactory;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _require = require("../endpoints_helpers.js"),
|
|
4
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
5
|
+
|
|
6
|
+
function stationsTypesFactory(_ref) {
|
|
7
|
+
var client = _ref.client,
|
|
8
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
9
|
+
|
|
10
|
+
function all(_ref2) {
|
|
11
|
+
var token = _ref2.token,
|
|
12
|
+
_ref2$query = _ref2.query,
|
|
13
|
+
query = _ref2$query === undefined ? {} : _ref2$query,
|
|
14
|
+
headers = _ref2.headers;
|
|
15
|
+
|
|
16
|
+
return client({
|
|
17
|
+
url: "/stations/types",
|
|
18
|
+
params: query,
|
|
19
|
+
headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
all: all
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = stationsTypesFactory;
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -49,6 +49,7 @@ function createInventory({baseURL, headers, timeout, overrideFn, internalAuthTok
|
|
|
49
49
|
insurancesCost: require("./endpoints/inventory/insurancesCost.js")({client, internalAuthTokenProvider}),
|
|
50
50
|
stations: require("./endpoints/inventory/stations.js")({client, internalAuthTokenProvider}),
|
|
51
51
|
stationsProvinces: require("./endpoints/inventory/stations-provinces.js")({client, internalAuthTokenProvider}),
|
|
52
|
+
stationsTypes: require("./endpoints/inventory/stations-types.js")({client, internalAuthTokenProvider}),
|
|
52
53
|
stationsZones: require("./endpoints/inventory/stations-zones.js")({client, internalAuthTokenProvider}),
|
|
53
54
|
parcelZones: require("./endpoints/inventory/parcel-zones.js")({client, internalAuthTokenProvider}),
|
|
54
55
|
countries: require("./endpoints/inventory/countries.js")({client, internalAuthTokenProvider}),
|
|
@@ -167,6 +168,7 @@ function createAccounts({baseURL, headers, timeout, overrideFn, internalAuthToke
|
|
|
167
168
|
subPrintTemplates: require("./endpoints/accounts/sub-print-templates.js")({
|
|
168
169
|
client, internalAuthTokenProvider
|
|
169
170
|
}),
|
|
171
|
+
s3Buckets: require("./endpoints/accounts/s3buckets.js")({client, internalAuthTokenProvider}),
|
|
170
172
|
shifts: require("./endpoints/accounts/shifts.js")({client, internalAuthTokenProvider}),
|
|
171
173
|
shiftSettings: require("./endpoints/accounts/shift-settings.js")({client, internalAuthTokenProvider}),
|
|
172
174
|
ticketMovementSettings: require("./endpoints/accounts/ticket-movement-settings.js")({client, internalAuthTokenProvider}),
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
2
|
+
|
|
3
|
+
function s3BucketsFactory({client, internalAuthTokenProvider}) {
|
|
4
|
+
function update({jwtToken, token, bucketId, application, headers}) {
|
|
5
|
+
return client({
|
|
6
|
+
url: `/account/s3Buckets/${bucketId}`,
|
|
7
|
+
method: "put",
|
|
8
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
9
|
+
data: {application}
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function remove({jwtToken, token, bucketId, headers}) {
|
|
14
|
+
return client({
|
|
15
|
+
url: `/account/s3Buckets/${bucketId}`,
|
|
16
|
+
method: "delete",
|
|
17
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function create({jwtToken, token, application, headers}) {
|
|
22
|
+
return client({
|
|
23
|
+
url: "/account/s3Buckets",
|
|
24
|
+
method: "post",
|
|
25
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
26
|
+
data: {application}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
update,
|
|
32
|
+
remove,
|
|
33
|
+
create
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = s3BucketsFactory;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const {
|
|
2
|
+
authorizationHeaders
|
|
3
|
+
} = require("../endpoints_helpers.js");
|
|
4
|
+
|
|
5
|
+
function stationsTypesFactory({client, internalAuthTokenProvider}) {
|
|
6
|
+
function all({token, query = {}, headers}) {
|
|
7
|
+
return client({
|
|
8
|
+
url: "/stations/types",
|
|
9
|
+
params: query,
|
|
10
|
+
headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
all
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = stationsTypesFactory;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const {axiosMock, expectRequest} = require("./../../test-helpers.js");
|
|
2
|
+
const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
3
|
+
|
|
4
|
+
describe("accounts/account/s3Buckets", () => {
|
|
5
|
+
const token = "I owe you a token";
|
|
6
|
+
const jwtToken = "secret";
|
|
7
|
+
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
axiosMock.reset();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("should update an existing s3Bucket", () => {
|
|
13
|
+
const application = {
|
|
14
|
+
name: "A"
|
|
15
|
+
};
|
|
16
|
+
const bucketId = "somebucketId";
|
|
17
|
+
|
|
18
|
+
axiosMock.onPut(`/account/s3Buckets/${bucketId}`)
|
|
19
|
+
.reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
20
|
+
return api.accounts.s3Buckets.update({token, jwtToken, bucketId, application});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("should remove an s3Bucket", () => {
|
|
24
|
+
const bucketId = "somebucketId";
|
|
25
|
+
|
|
26
|
+
axiosMock.onDelete(`/account/s3Buckets/${bucketId}`)
|
|
27
|
+
.reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
28
|
+
return api.accounts.s3Buckets.remove({token, jwtToken, bucketId});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("should create an s3Bucket", () => {
|
|
32
|
+
const application = {
|
|
33
|
+
name: "A"
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
axiosMock.onPost("/account/s3Buckets")
|
|
37
|
+
.reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
38
|
+
return api.accounts.s3Buckets.create({token, jwtToken, application});
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const {
|
|
2
|
+
axiosMock, expectRequest
|
|
3
|
+
} = require("./../../test-helpers.js");
|
|
4
|
+
const api = require("./../../../src/client.js").createApiClient({
|
|
5
|
+
baseURL: "http://test.com"
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
describe("inventory/stations/types", () => {
|
|
9
|
+
const token = "I owe you a token";
|
|
10
|
+
|
|
11
|
+
afterEach(() => {
|
|
12
|
+
axiosMock.reset();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it("should list zones", () => {
|
|
16
|
+
axiosMock.onGet("/stations/types").reply(expectRequest({statusCode: 200, token}));
|
|
17
|
+
return api.inventory.stationsTypes.all({
|
|
18
|
+
token
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {
|
|
2
|
+
expect
|
|
3
|
+
} = require("chai");
|
|
2
4
|
const FormData = require("form-data");
|
|
3
5
|
const fs = require("fs");
|
|
4
6
|
|
|
5
7
|
const port = process.env.UPLOADS_API_PORT;
|
|
6
8
|
const token = process.env.API_TOKEN;
|
|
7
9
|
|
|
8
|
-
const api = require("./../../../src/client").createApiClient({
|
|
10
|
+
const api = require("./../../../src/client.js").createApiClient({
|
|
9
11
|
baseURL: `http://localhost:${port}`,
|
|
10
12
|
baseURLOverride: {
|
|
11
|
-
uploads: (baseUrl) =>
|
|
13
|
+
uploads: (baseUrl) => {
|
|
14
|
+
return `${baseUrl}/uploads`;
|
|
15
|
+
}
|
|
12
16
|
}
|
|
13
17
|
});
|
|
14
18
|
|
|
15
19
|
|
|
16
20
|
describe("uploads/images", () => {
|
|
17
21
|
it("should upload a image file", () => {
|
|
18
|
-
const formData = new FormData()
|
|
19
|
-
|
|
22
|
+
const formData = new FormData();
|
|
23
|
+
const fileStream = fs.createReadStream(`${__dirname}/sample.png`);
|
|
20
24
|
|
|
21
25
|
formData.append("file", fileStream);
|
|
22
26
|
return api.uploads.images.create({
|
package/types/client.d.ts
CHANGED
|
@@ -212,6 +212,13 @@ export function createApiClient(options: {
|
|
|
212
212
|
headers: any;
|
|
213
213
|
}) => any;
|
|
214
214
|
};
|
|
215
|
+
stationsTypes: {
|
|
216
|
+
all: ({ token, query, headers }: {
|
|
217
|
+
token: any;
|
|
218
|
+
query?: {};
|
|
219
|
+
headers: any;
|
|
220
|
+
}) => any;
|
|
221
|
+
};
|
|
215
222
|
stationsZones: {
|
|
216
223
|
get: ({ token, query, headers }: {
|
|
217
224
|
token: any;
|
|
@@ -2134,6 +2141,27 @@ export function createApiClient(options: {
|
|
|
2134
2141
|
headers: any;
|
|
2135
2142
|
}) => any;
|
|
2136
2143
|
};
|
|
2144
|
+
s3Buckets: {
|
|
2145
|
+
update: ({ jwtToken, token, bucketId, application, headers }: {
|
|
2146
|
+
jwtToken: any;
|
|
2147
|
+
token: any;
|
|
2148
|
+
bucketId: any;
|
|
2149
|
+
application: any;
|
|
2150
|
+
headers: any;
|
|
2151
|
+
}) => any;
|
|
2152
|
+
remove: ({ jwtToken, token, bucketId, headers }: {
|
|
2153
|
+
jwtToken: any;
|
|
2154
|
+
token: any;
|
|
2155
|
+
bucketId: any;
|
|
2156
|
+
headers: any;
|
|
2157
|
+
}) => any;
|
|
2158
|
+
create: ({ jwtToken, token, application, headers }: {
|
|
2159
|
+
jwtToken: any;
|
|
2160
|
+
token: any;
|
|
2161
|
+
application: any;
|
|
2162
|
+
headers: any;
|
|
2163
|
+
}) => any;
|
|
2164
|
+
};
|
|
2137
2165
|
shifts: {
|
|
2138
2166
|
all: ({ jwtToken, token, query, headers }: {
|
|
2139
2167
|
jwtToken: any;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export = s3BucketsFactory;
|
|
2
|
+
declare function s3BucketsFactory({ client, internalAuthTokenProvider }: {
|
|
3
|
+
client: any;
|
|
4
|
+
internalAuthTokenProvider: any;
|
|
5
|
+
}): {
|
|
6
|
+
update: ({ jwtToken, token, bucketId, application, headers }: {
|
|
7
|
+
jwtToken: any;
|
|
8
|
+
token: any;
|
|
9
|
+
bucketId: any;
|
|
10
|
+
application: any;
|
|
11
|
+
headers: any;
|
|
12
|
+
}) => any;
|
|
13
|
+
remove: ({ jwtToken, token, bucketId, headers }: {
|
|
14
|
+
jwtToken: any;
|
|
15
|
+
token: any;
|
|
16
|
+
bucketId: any;
|
|
17
|
+
headers: any;
|
|
18
|
+
}) => any;
|
|
19
|
+
create: ({ jwtToken, token, application, headers }: {
|
|
20
|
+
jwtToken: any;
|
|
21
|
+
token: any;
|
|
22
|
+
application: any;
|
|
23
|
+
headers: any;
|
|
24
|
+
}) => any;
|
|
25
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export = stationsTypesFactory;
|
|
2
|
+
declare function stationsTypesFactory({ client, internalAuthTokenProvider }: {
|
|
3
|
+
client: any;
|
|
4
|
+
internalAuthTokenProvider: any;
|
|
5
|
+
}): {
|
|
6
|
+
all: ({ token, query, headers }: {
|
|
7
|
+
token: any;
|
|
8
|
+
query?: {};
|
|
9
|
+
headers: any;
|
|
10
|
+
}) => any;
|
|
11
|
+
};
|
|
@@ -166,6 +166,13 @@ declare const _exports: {
|
|
|
166
166
|
headers: any;
|
|
167
167
|
}) => any;
|
|
168
168
|
};
|
|
169
|
+
stationsTypes: {
|
|
170
|
+
all: ({ token, query, headers }: {
|
|
171
|
+
token: any;
|
|
172
|
+
query?: {};
|
|
173
|
+
headers: any;
|
|
174
|
+
}) => any;
|
|
175
|
+
};
|
|
169
176
|
stationsZones: {
|
|
170
177
|
get: ({ token, query, headers }: {
|
|
171
178
|
token: any;
|
|
@@ -2088,6 +2095,27 @@ declare const _exports: {
|
|
|
2088
2095
|
headers: any;
|
|
2089
2096
|
}) => any;
|
|
2090
2097
|
};
|
|
2098
|
+
s3Buckets: {
|
|
2099
|
+
update: ({ jwtToken, token, bucketId, application, headers }: {
|
|
2100
|
+
jwtToken: any;
|
|
2101
|
+
token: any;
|
|
2102
|
+
bucketId: any;
|
|
2103
|
+
application: any;
|
|
2104
|
+
headers: any;
|
|
2105
|
+
}) => any;
|
|
2106
|
+
remove: ({ jwtToken, token, bucketId, headers }: {
|
|
2107
|
+
jwtToken: any;
|
|
2108
|
+
token: any;
|
|
2109
|
+
bucketId: any;
|
|
2110
|
+
headers: any;
|
|
2111
|
+
}) => any;
|
|
2112
|
+
create: ({ jwtToken, token, application, headers }: {
|
|
2113
|
+
jwtToken: any;
|
|
2114
|
+
token: any;
|
|
2115
|
+
application: any;
|
|
2116
|
+
headers: any;
|
|
2117
|
+
}) => any;
|
|
2118
|
+
};
|
|
2091
2119
|
shifts: {
|
|
2092
2120
|
all: ({ jwtToken, token, query, headers }: {
|
|
2093
2121
|
jwtToken: any;
|