btrz-api-client 5.90.0 → 5.92.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 +1 -1
- package/lib/client.js +1 -0
- package/lib/endpoints/operations/parcels.js +17 -2
- package/lib/endpoints/sales/parcel-quotes.js +29 -0
- package/package.json +1 -1
- package/src/client.js +1 -0
- package/src/endpoints/operations/parcels.js +11 -2
- package/src/endpoints/sales/parcel-quotes.js +20 -0
- package/test/endpoints/operations/parcels.test.js +8 -1
- package/test/endpoints/sales/parcel-quotes.test.js +32 -0
- package/types/client.d.ts +15 -0
- package/types/endpoints/operations/parcels.d.ts +7 -0
- package/types/endpoints/sales/parcel-quotes.d.ts +12 -0
- package/types/initializedClient.d.ts +15 -0
package/lib/client.js
CHANGED
|
@@ -218,6 +218,7 @@ function createSales(_ref5) {
|
|
|
218
218
|
|
|
219
219
|
return {
|
|
220
220
|
docs: require("./endpoints/sales/docs.js")({ client: client }),
|
|
221
|
+
parcelQuotes: require("./endpoints/sales/parcel-quotes.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
221
222
|
paymentProviders: require("./endpoints/sales/payment-providers.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
222
223
|
cart: require("./endpoints/sales/cart.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
223
224
|
giftCertificates: require("./endpoints/sales/gift-certificates.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
@@ -58,18 +58,33 @@ function parcelFactory(_ref) {
|
|
|
58
58
|
comment = _ref5.comment;
|
|
59
59
|
|
|
60
60
|
return client({
|
|
61
|
-
url: "/parcels/" + id + "/comments",
|
|
61
|
+
url: "/parcels/" + id + "/user-comments",
|
|
62
62
|
method: "post",
|
|
63
63
|
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
64
64
|
data: { comment: comment }
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
function deleteComment(_ref6) {
|
|
69
|
+
var token = _ref6.token,
|
|
70
|
+
jwtToken = _ref6.jwtToken,
|
|
71
|
+
headers = _ref6.headers,
|
|
72
|
+
id = _ref6.id,
|
|
73
|
+
commentId = _ref6.commentId;
|
|
74
|
+
|
|
75
|
+
return client({
|
|
76
|
+
url: "/parcels/" + id + "/user-comments/" + commentId,
|
|
77
|
+
method: "delete",
|
|
78
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
68
82
|
return {
|
|
69
83
|
get: get,
|
|
70
84
|
all: all,
|
|
71
85
|
addScan: addScan,
|
|
72
|
-
addComment: addComment
|
|
86
|
+
addComment: addComment,
|
|
87
|
+
deleteComment: deleteComment
|
|
73
88
|
};
|
|
74
89
|
}
|
|
75
90
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _require = require("./../endpoints_helpers.js"),
|
|
4
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
5
|
+
|
|
6
|
+
function parcelQuotesFactory(_ref) {
|
|
7
|
+
var client = _ref.client,
|
|
8
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
9
|
+
|
|
10
|
+
function get(_ref2) {
|
|
11
|
+
var token = _ref2.token,
|
|
12
|
+
parcelQuoteData = _ref2.parcelQuoteData,
|
|
13
|
+
jwtToken = _ref2.jwtToken,
|
|
14
|
+
headers = _ref2.headers;
|
|
15
|
+
|
|
16
|
+
return client({
|
|
17
|
+
url: "/parcel-quotes",
|
|
18
|
+
method: "post",
|
|
19
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
20
|
+
data: parcelQuoteData
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
get: get
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = parcelQuotesFactory;
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -177,6 +177,7 @@ function createSales({baseURL, headers, timeout, overrideFn, internalAuthTokenPr
|
|
|
177
177
|
|
|
178
178
|
return {
|
|
179
179
|
docs: require("./endpoints/sales/docs.js")({client}),
|
|
180
|
+
parcelQuotes: require("./endpoints/sales/parcel-quotes.js")({client, internalAuthTokenProvider}),
|
|
180
181
|
paymentProviders: require("./endpoints/sales/payment-providers.js")({client, internalAuthTokenProvider}),
|
|
181
182
|
cart: require("./endpoints/sales/cart.js")({client, internalAuthTokenProvider}),
|
|
182
183
|
giftCertificates: require("./endpoints/sales/gift-certificates.js")({client, internalAuthTokenProvider}),
|
|
@@ -28,18 +28,27 @@ function parcelFactory({ client, internalAuthTokenProvider }) {
|
|
|
28
28
|
|
|
29
29
|
function addComment({token, jwtToken, headers, id, comment}) {
|
|
30
30
|
return client({
|
|
31
|
-
url: `/parcels/${id}/comments`,
|
|
31
|
+
url: `/parcels/${id}/user-comments`,
|
|
32
32
|
method: "post",
|
|
33
33
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
34
34
|
data: {comment}
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
function deleteComment({token, jwtToken, headers, id, commentId}) {
|
|
39
|
+
return client({
|
|
40
|
+
url: `/parcels/${id}/user-comments/${commentId}`,
|
|
41
|
+
method: "delete",
|
|
42
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
38
46
|
return {
|
|
39
47
|
get,
|
|
40
48
|
all,
|
|
41
49
|
addScan,
|
|
42
|
-
addComment
|
|
50
|
+
addComment,
|
|
51
|
+
deleteComment
|
|
43
52
|
};
|
|
44
53
|
}
|
|
45
54
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const {
|
|
2
|
+
authorizationHeaders
|
|
3
|
+
} = require("./../endpoints_helpers.js");
|
|
4
|
+
|
|
5
|
+
function parcelQuotesFactory({client, internalAuthTokenProvider}) {
|
|
6
|
+
function get({token, parcelQuoteData, jwtToken, headers}) {
|
|
7
|
+
return client({
|
|
8
|
+
url: "/parcel-quotes",
|
|
9
|
+
method: "post",
|
|
10
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
11
|
+
data: parcelQuoteData
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
get
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = parcelQuotesFactory;
|
|
@@ -30,7 +30,14 @@ describe('operations/parcels', function() {
|
|
|
30
30
|
|
|
31
31
|
it("should add a comment to parcel", function() {
|
|
32
32
|
const parcelId = "parcelId1";
|
|
33
|
-
axiosMock.onPost(`/parcels/${parcelId}/comments`).reply(expectRequest({ statusCode: 200, token, jwtToken }));
|
|
33
|
+
axiosMock.onPost(`/parcels/${parcelId}/user-comments`).reply(expectRequest({ statusCode: 200, token, jwtToken }));
|
|
34
34
|
return api.operations.parcel.addComment({ jwtToken, token, id: parcelId, comment: "A comment" });
|
|
35
35
|
});
|
|
36
|
+
|
|
37
|
+
it("should delete a comment from a parcel", () => {
|
|
38
|
+
const parcelId = "parcelId1";
|
|
39
|
+
const commentId = "commentId1";
|
|
40
|
+
axiosMock.onDelete(`/parcels/${parcelId}/user-comments/${commentId}`).reply(expectRequest({ statusCode: 200, token, jwtToken }));
|
|
41
|
+
return api.operations.parcel.deleteComment({ jwtToken, token, id: parcelId, commentId });
|
|
42
|
+
});
|
|
36
43
|
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const {
|
|
2
|
+
axiosMock, expectRequest
|
|
3
|
+
} = require("./../../test-helpers.js");
|
|
4
|
+
|
|
5
|
+
const api = require("./../../../src/client.js").createApiClient({
|
|
6
|
+
baseURL: "http://test.com"
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe("sales/order", () => {
|
|
10
|
+
const token = "I owe you a token";
|
|
11
|
+
const jwtToken = "I owe you a JWT token";
|
|
12
|
+
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
axiosMock.reset();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("should return a parcel quote", () => {
|
|
18
|
+
axiosMock.onPost("/parcel-quotes").reply(expectRequest({
|
|
19
|
+
statusCode: 200,
|
|
20
|
+
token,
|
|
21
|
+
jwtToken
|
|
22
|
+
}));
|
|
23
|
+
return api.sales.parcelQuotes.get({
|
|
24
|
+
jwtToken,
|
|
25
|
+
token,
|
|
26
|
+
parcelQuoteData: {
|
|
27
|
+
parcels: []
|
|
28
|
+
},
|
|
29
|
+
headers: {}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
package/types/client.d.ts
CHANGED
|
@@ -2006,6 +2006,14 @@ export function createApiClient(options: {
|
|
|
2006
2006
|
docs: {
|
|
2007
2007
|
get: () => any;
|
|
2008
2008
|
};
|
|
2009
|
+
parcelQuotes: {
|
|
2010
|
+
get: ({ token, parcelQuoteData, jwtToken, headers }: {
|
|
2011
|
+
token: any;
|
|
2012
|
+
parcelQuoteData: any;
|
|
2013
|
+
jwtToken: any;
|
|
2014
|
+
headers: any;
|
|
2015
|
+
}) => any;
|
|
2016
|
+
};
|
|
2009
2017
|
paymentProviders: {
|
|
2010
2018
|
all: ({ token, jwtToken, query, headers }: {
|
|
2011
2019
|
token: any;
|
|
@@ -2220,6 +2228,13 @@ export function createApiClient(options: {
|
|
|
2220
2228
|
id: any;
|
|
2221
2229
|
comment: any;
|
|
2222
2230
|
}) => any;
|
|
2231
|
+
deleteComment: ({ token, jwtToken, headers, id, commentId }: {
|
|
2232
|
+
token: any;
|
|
2233
|
+
jwtToken: any;
|
|
2234
|
+
headers: any;
|
|
2235
|
+
id: any;
|
|
2236
|
+
commentId: any;
|
|
2237
|
+
}) => any;
|
|
2223
2238
|
};
|
|
2224
2239
|
appliedInsurance: {
|
|
2225
2240
|
all: ({ token, jwtToken, trxId, headers }: {
|
|
@@ -30,4 +30,11 @@ declare function parcelFactory({ client, internalAuthTokenProvider }: {
|
|
|
30
30
|
id: any;
|
|
31
31
|
comment: any;
|
|
32
32
|
}) => any;
|
|
33
|
+
deleteComment: ({ token, jwtToken, headers, id, commentId }: {
|
|
34
|
+
token: any;
|
|
35
|
+
jwtToken: any;
|
|
36
|
+
headers: any;
|
|
37
|
+
id: any;
|
|
38
|
+
commentId: any;
|
|
39
|
+
}) => any;
|
|
33
40
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export = parcelQuotesFactory;
|
|
2
|
+
declare function parcelQuotesFactory({ client, internalAuthTokenProvider }: {
|
|
3
|
+
client: any;
|
|
4
|
+
internalAuthTokenProvider: any;
|
|
5
|
+
}): {
|
|
6
|
+
get: ({ token, parcelQuoteData, jwtToken, headers }: {
|
|
7
|
+
token: any;
|
|
8
|
+
parcelQuoteData: any;
|
|
9
|
+
jwtToken: any;
|
|
10
|
+
headers: any;
|
|
11
|
+
}) => any;
|
|
12
|
+
};
|
|
@@ -1960,6 +1960,14 @@ declare const _exports: {
|
|
|
1960
1960
|
docs: {
|
|
1961
1961
|
get: () => any;
|
|
1962
1962
|
};
|
|
1963
|
+
parcelQuotes: {
|
|
1964
|
+
get: ({ token, parcelQuoteData, jwtToken, headers }: {
|
|
1965
|
+
token: any;
|
|
1966
|
+
parcelQuoteData: any;
|
|
1967
|
+
jwtToken: any;
|
|
1968
|
+
headers: any;
|
|
1969
|
+
}) => any;
|
|
1970
|
+
};
|
|
1963
1971
|
paymentProviders: {
|
|
1964
1972
|
all: ({ token, jwtToken, query, headers }: {
|
|
1965
1973
|
token: any;
|
|
@@ -2174,6 +2182,13 @@ declare const _exports: {
|
|
|
2174
2182
|
id: any;
|
|
2175
2183
|
comment: any;
|
|
2176
2184
|
}) => any;
|
|
2185
|
+
deleteComment: ({ token, jwtToken, headers, id, commentId }: {
|
|
2186
|
+
token: any;
|
|
2187
|
+
jwtToken: any;
|
|
2188
|
+
headers: any;
|
|
2189
|
+
id: any;
|
|
2190
|
+
commentId: any;
|
|
2191
|
+
}) => any;
|
|
2177
2192
|
};
|
|
2178
2193
|
appliedInsurance: {
|
|
2179
2194
|
all: ({ token, jwtToken, trxId, headers }: {
|