btrz-api-client 3.40.1 → 3.42.3
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 +0 -1
- package/lib/endpoints/operations/manifest.js +38 -8
- package/lib/initializedClient.js +6 -0
- package/package.json +4 -2
- package/src/client.js +0 -1
- package/src/endpoints/operations/manifest.js +56 -16
- package/src/initializedClient.js +3 -0
- package/test/endpoints/operations/manifest.test.js +66 -17
- package/types/client.d.ts +2310 -0
- package/types/constants.d.ts +1 -0
- package/types/endpoints/accounts/accounts.d.ts +11 -0
- package/types/endpoints/accounts/application-settings.d.ts +38 -0
- package/types/endpoints/accounts/application.d.ts +11 -0
- package/types/endpoints/accounts/applications.d.ts +18 -0
- package/types/endpoints/accounts/current-shifts.d.ts +12 -0
- package/types/endpoints/accounts/customers.d.ts +45 -0
- package/types/endpoints/accounts/docs.d.ts +6 -0
- package/types/endpoints/accounts/domains.d.ts +23 -0
- package/types/endpoints/accounts/email-settings.d.ts +38 -0
- package/types/endpoints/accounts/exchange-rates.d.ts +19 -0
- package/types/endpoints/accounts/interline.d.ts +68 -0
- package/types/endpoints/accounts/lexicons.d.ts +30 -0
- package/types/endpoints/accounts/print-settings.d.ts +31 -0
- package/types/endpoints/accounts/printers.d.ts +11 -0
- package/types/endpoints/accounts/shifts.d.ts +11 -0
- package/types/endpoints/accounts/travellers.d.ts +41 -0
- package/types/endpoints/accounts/trusted-machines.d.ts +12 -0
- package/types/endpoints/accounts/users.d.ts +18 -0
- package/types/endpoints/btrzpay/customerCards.d.ts +37 -0
- package/types/endpoints/btrzpay/customers.d.ts +27 -0
- package/types/endpoints/btrzpay/docs.d.ts +6 -0
- package/types/endpoints/btrzpay/payment-methods.d.ts +45 -0
- package/types/endpoints/btrzpay/payments.d.ts +18 -0
- package/types/endpoints/btrzpay/reference-numbers.d.ts +12 -0
- package/types/endpoints/btrzpay/referenced-payments.d.ts +21 -0
- package/types/endpoints/btrzpay/square.d.ts +22 -0
- package/types/endpoints/coltrane/docs.d.ts +6 -0
- package/types/endpoints/coltrane/paths.d.ts +11 -0
- package/types/endpoints/endpoints_helpers.d.ts +9 -0
- package/types/endpoints/gps/scanner-app-location.d.ts +10 -0
- package/types/endpoints/inventory/amenities.d.ts +30 -0
- package/types/endpoints/inventory/amenity-groups.d.ts +30 -0
- package/types/endpoints/inventory/bare-routes.d.ts +17 -0
- package/types/endpoints/inventory/brands.d.ts +31 -0
- package/types/endpoints/inventory/bundle-fares.d.ts +13 -0
- package/types/endpoints/inventory/bundles.d.ts +18 -0
- package/types/endpoints/inventory/companies.d.ts +12 -0
- package/types/endpoints/inventory/countries.d.ts +11 -0
- package/types/endpoints/inventory/custom-content.d.ts +35 -0
- package/types/endpoints/inventory/docs.d.ts +6 -0
- package/types/endpoints/inventory/fare-classes.d.ts +25 -0
- package/types/endpoints/inventory/fares.d.ts +16 -0
- package/types/endpoints/inventory/fees.d.ts +11 -0
- package/types/endpoints/inventory/filtered-trips-v2.d.ts +12 -0
- package/types/endpoints/inventory/filtered-trips.d.ts +12 -0
- package/types/endpoints/inventory/gift-certificate-definitions.d.ts +11 -0
- package/types/endpoints/inventory/healthcheck.d.ts +7 -0
- package/types/endpoints/inventory/insurances.d.ts +35 -0
- package/types/endpoints/inventory/insurancesCost.d.ts +13 -0
- package/types/endpoints/inventory/items.d.ts +11 -0
- package/types/endpoints/inventory/journey-prices.d.ts +25 -0
- package/types/endpoints/inventory/marketplace-modifiers.d.ts +35 -0
- package/types/endpoints/inventory/operating-companies.d.ts +31 -0
- package/types/endpoints/inventory/operation-messages.d.ts +41 -0
- package/types/endpoints/inventory/parcel-zones.d.ts +24 -0
- package/types/endpoints/inventory/payment-terminals.d.ts +35 -0
- package/types/endpoints/inventory/products.d.ts +18 -0
- package/types/endpoints/inventory/promos.d.ts +51 -0
- package/types/endpoints/inventory/routes.d.ts +53 -0
- package/types/endpoints/inventory/schedules.d.ts +11 -0
- package/types/endpoints/inventory/seatfees.d.ts +29 -0
- package/types/endpoints/inventory/seatmaps.d.ts +15 -0
- package/types/endpoints/inventory/service-numbers.d.ts +31 -0
- package/types/endpoints/inventory/service-types.d.ts +35 -0
- package/types/endpoints/inventory/ssrs.d.ts +11 -0
- package/types/endpoints/inventory/station-groups.d.ts +11 -0
- package/types/endpoints/inventory/stations-zones.d.ts +11 -0
- package/types/endpoints/inventory/stations.d.ts +16 -0
- package/types/endpoints/inventory/taxes.d.ts +30 -0
- package/types/endpoints/inventory/traveller-card-providers-types.d.ts +11 -0
- package/types/endpoints/inventory/traveller-card-providers.d.ts +31 -0
- package/types/endpoints/inventory/traveller-card-types.d.ts +37 -0
- package/types/endpoints/inventory/trips.d.ts +17 -0
- package/types/endpoints/inventory/zone-price-overages.d.ts +35 -0
- package/types/endpoints/inventory/zone-prices.d.ts +35 -0
- package/types/endpoints/invoices/docs.d.ts +6 -0
- package/types/endpoints/invoices/emails.d.ts +13 -0
- package/types/endpoints/invoices/infile.d.ts +13 -0
- package/types/endpoints/invoices/pdfs.d.ts +13 -0
- package/types/endpoints/invoices/providers.d.ts +41 -0
- package/types/endpoints/invoices/tax-ids.d.ts +12 -0
- package/types/endpoints/loyalty/movements.d.ts +31 -0
- package/types/endpoints/loyalty/programs.d.ts +25 -0
- package/types/endpoints/notifications/customers.d.ts +12 -0
- package/types/endpoints/notifications/email.d.ts +12 -0
- package/types/endpoints/notifications/manifest-notifications.d.ts +18 -0
- package/types/endpoints/notifications/printed-tickets.d.ts +15 -0
- package/types/endpoints/operations/accounting_items.d.ts +16 -0
- package/types/endpoints/operations/applied_insurance.d.ts +12 -0
- package/types/endpoints/operations/calendar_entries.d.ts +11 -0
- package/types/endpoints/operations/docs.d.ts +6 -0
- package/types/endpoints/operations/flexpasses.d.ts +13 -0
- package/types/endpoints/operations/loans.d.ts +16 -0
- package/types/endpoints/operations/manifest.d.ts +68 -0
- package/types/endpoints/operations/movements.d.ts +13 -0
- package/types/endpoints/operations/outlook-trips.d.ts +10 -0
- package/types/endpoints/operations/parcels.d.ts +26 -0
- package/types/endpoints/operations/redemption.d.ts +19 -0
- package/types/endpoints/operations/scheduled_notifications.d.ts +38 -0
- package/types/endpoints/operations/segments.d.ts +14 -0
- package/types/endpoints/operations/tickets.d.ts +26 -0
- package/types/endpoints/operations/transaction.d.ts +13 -0
- package/types/endpoints/operations/transactions.d.ts +55 -0
- package/types/endpoints/operations/trip_change_info.d.ts +13 -0
- package/types/endpoints/operations/waitlists.d.ts +30 -0
- package/types/endpoints/reports/custom-reports.d.ts +24 -0
- package/types/endpoints/reports/report-types.d.ts +18 -0
- package/types/endpoints/sales/bundles.d.ts +11 -0
- package/types/endpoints/sales/cart-promo.d.ts +20 -0
- package/types/endpoints/sales/cart.d.ts +48 -0
- package/types/endpoints/sales/custom-fields.d.ts +11 -0
- package/types/endpoints/sales/docs.d.ts +6 -0
- package/types/endpoints/sales/flexpasses.d.ts +13 -0
- package/types/endpoints/sales/gift-certificates.d.ts +12 -0
- package/types/endpoints/sales/order.d.ts +18 -0
- package/types/endpoints/sales/payment-providers.d.ts +12 -0
- package/types/endpoints/sales/redeemable-items.d.ts +18 -0
- package/types/endpoints/sales/sync-entry.d.ts +12 -0
- package/types/endpoints/sales/voucher.d.ts +11 -0
- package/types/endpoints/seatmaps/access-ticket.d.ts +11 -0
- package/types/endpoints/seatmaps/seat.d.ts +12 -0
- package/types/endpoints/uploads/files.d.ts +11 -0
- package/types/endpoints/uploads/images.d.ts +11 -0
- package/types/endpoints/webhooks/events.d.ts +13 -0
- package/types/endpoints/webhooks/subscriptions.d.ts +38 -0
- package/types/endpoints/webhooks/undelivered.d.ts +36 -0
- package/types/endpoints/webhooks/webhooks.d.ts +12 -0
- package/types/initializedClient.d.ts +2264 -0
- package/types/productionDefaults.d.ts +6 -0
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _require = require("./../endpoints_helpers"),
|
|
3
|
+
var _require = require("./../endpoints_helpers.js"),
|
|
4
4
|
authorizationHeaders = _require.authorizationHeaders;
|
|
5
5
|
|
|
6
6
|
function manifestFactory(_ref) {
|
|
7
7
|
var client = _ref.client,
|
|
8
8
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
function get(_ref2) {
|
|
12
11
|
var token = _ref2.token,
|
|
13
12
|
jwtToken = _ref2.jwtToken,
|
|
@@ -32,7 +31,9 @@ function manifestFactory(_ref) {
|
|
|
32
31
|
return client({
|
|
33
32
|
url: "/manifests/" + manifestId,
|
|
34
33
|
method: "get",
|
|
35
|
-
headers: authorizationHeaders({
|
|
34
|
+
headers: authorizationHeaders({
|
|
35
|
+
token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
|
|
36
|
+
})
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
|
|
@@ -64,7 +65,9 @@ function manifestFactory(_ref) {
|
|
|
64
65
|
url: "/outlook-manifests",
|
|
65
66
|
method: "get",
|
|
66
67
|
params: query,
|
|
67
|
-
headers: authorizationHeaders({
|
|
68
|
+
headers: authorizationHeaders({
|
|
69
|
+
token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
|
|
70
|
+
})
|
|
68
71
|
});
|
|
69
72
|
}
|
|
70
73
|
|
|
@@ -81,7 +84,9 @@ function manifestFactory(_ref) {
|
|
|
81
84
|
method: "patch",
|
|
82
85
|
params: query,
|
|
83
86
|
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
84
|
-
data: {
|
|
87
|
+
data: {
|
|
88
|
+
operations: operations
|
|
89
|
+
}
|
|
85
90
|
});
|
|
86
91
|
}
|
|
87
92
|
|
|
@@ -113,7 +118,9 @@ function manifestFactory(_ref) {
|
|
|
113
118
|
return client({
|
|
114
119
|
url: "/manifests/" + manifestId + "/users",
|
|
115
120
|
method: "post",
|
|
116
|
-
headers: authorizationHeaders({
|
|
121
|
+
headers: authorizationHeaders({
|
|
122
|
+
token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
|
|
123
|
+
}),
|
|
117
124
|
params: query,
|
|
118
125
|
data: data
|
|
119
126
|
});
|
|
@@ -129,7 +136,29 @@ function manifestFactory(_ref) {
|
|
|
129
136
|
return client({
|
|
130
137
|
url: "/manifests/" + manifestId + "/users/" + userId,
|
|
131
138
|
method: "delete",
|
|
132
|
-
headers: authorizationHeaders({
|
|
139
|
+
headers: authorizationHeaders({
|
|
140
|
+
token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
|
|
141
|
+
})
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function updateComment(_ref10) {
|
|
146
|
+
var token = _ref10.token,
|
|
147
|
+
jwtToken = _ref10.jwtToken,
|
|
148
|
+
manifestId = _ref10.manifestId,
|
|
149
|
+
_ref10$query = _ref10.query,
|
|
150
|
+
query = _ref10$query === undefined ? {} : _ref10$query,
|
|
151
|
+
data = _ref10.data,
|
|
152
|
+
headers = _ref10.headers;
|
|
153
|
+
|
|
154
|
+
return client({
|
|
155
|
+
url: "/manifests/" + manifestId + "/comments",
|
|
156
|
+
method: "put",
|
|
157
|
+
headers: authorizationHeaders({
|
|
158
|
+
token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
|
|
159
|
+
}),
|
|
160
|
+
params: query,
|
|
161
|
+
data: data
|
|
133
162
|
});
|
|
134
163
|
}
|
|
135
164
|
|
|
@@ -141,7 +170,8 @@ function manifestFactory(_ref) {
|
|
|
141
170
|
patch: patch,
|
|
142
171
|
save: save,
|
|
143
172
|
addUser: addUser,
|
|
144
|
-
removeUser: removeUser
|
|
173
|
+
removeUser: removeUser,
|
|
174
|
+
updateComment: updateComment
|
|
145
175
|
};
|
|
146
176
|
}
|
|
147
177
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "btrz-api-client",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.42.3",
|
|
4
4
|
"description": "Api client for Betterez endpoints",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
"test:integration": "mocha --recursive -r test-integration/ports.js test-integration/",
|
|
10
10
|
"browserify": "browserify lib/client.js --standalone BtrzApiClient -p tinyify -o lib/client-standalone-min.js",
|
|
11
11
|
"commit-transpile": "git add lib/ && (git diff-index --quiet HEAD || git commit -m \"transpiled src\")",
|
|
12
|
+
"commit-types": "git add types/ && (git diff-index --quiet HEAD || git commit -m \"generated types from src\")",
|
|
12
13
|
"pretranspile": "rm -rf lib/",
|
|
14
|
+
"types": "npx -p typescript tsc src/**.js --declaration --allowJs --emitDeclarationOnly --outDir types",
|
|
13
15
|
"transpile": "babel --presets es2015 -d lib/ src/",
|
|
14
|
-
"preversion": "npm test && npm run transpile && npm run browserify && npm run commit-transpile",
|
|
16
|
+
"preversion": "npm test && npm run transpile && npm run browserify && npm run types && npm run commit-transpile && npm run commit-types",
|
|
15
17
|
"postversion": "git push origin master && git push --tags",
|
|
16
18
|
"version": "git tag $1"
|
|
17
19
|
},
|
package/src/client.js
CHANGED
|
@@ -333,7 +333,6 @@ function createGPS({baseURL, headers, timeout, overrideFn, internalAuthTokenProv
|
|
|
333
333
|
* returns an authorization token that's valid for making service-to-service API calls.
|
|
334
334
|
* @param {Function} options.internalAuthTokenProvider.getToken
|
|
335
335
|
* @param {{httpAgent: import("http").Agent, httpsAgent: import("https").Agent}} options.agents - An object containg one or both http agents
|
|
336
|
-
* @returns {Object} An object with a client for every "module" (needed to override baseURL)
|
|
337
336
|
*/
|
|
338
337
|
function createApiClient(options) {
|
|
339
338
|
const {baseURL, baseURLOverride = {}, headers, timeout = 0, internalAuthTokenProvider, agents} = options || productionOptions;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
const {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const {
|
|
2
|
+
authorizationHeaders
|
|
3
|
+
} = require("./../endpoints_helpers.js");
|
|
4
4
|
|
|
5
|
+
function manifestFactory({
|
|
6
|
+
client, internalAuthTokenProvider
|
|
7
|
+
}) {
|
|
5
8
|
function get({token, jwtToken, query = {}, headers}) {
|
|
6
9
|
return client({
|
|
7
10
|
url: "/manifests",
|
|
@@ -11,11 +14,15 @@ function manifestFactory({ client, internalAuthTokenProvider }) {
|
|
|
11
14
|
});
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
function getById({
|
|
17
|
+
function getById({
|
|
18
|
+
token, jwtToken, manifestId, headers
|
|
19
|
+
}) {
|
|
15
20
|
return client({
|
|
16
21
|
url: `/manifests/${manifestId}`,
|
|
17
22
|
method: "get",
|
|
18
|
-
headers: authorizationHeaders({
|
|
23
|
+
headers: authorizationHeaders({
|
|
24
|
+
token, jwtToken, internalAuthTokenProvider, headers
|
|
25
|
+
})
|
|
19
26
|
});
|
|
20
27
|
}
|
|
21
28
|
|
|
@@ -30,28 +37,38 @@ function manifestFactory({ client, internalAuthTokenProvider }) {
|
|
|
30
37
|
});
|
|
31
38
|
}
|
|
32
39
|
|
|
33
|
-
function outlook({
|
|
40
|
+
function outlook({
|
|
41
|
+
token, jwtToken, query = {}, headers
|
|
42
|
+
}) {
|
|
34
43
|
return client({
|
|
35
44
|
url: "/outlook-manifests",
|
|
36
45
|
method: "get",
|
|
37
46
|
params: query,
|
|
38
|
-
headers: authorizationHeaders({
|
|
47
|
+
headers: authorizationHeaders({
|
|
48
|
+
token, jwtToken, internalAuthTokenProvider, headers
|
|
49
|
+
})
|
|
39
50
|
});
|
|
40
51
|
}
|
|
41
52
|
|
|
42
|
-
function patch({
|
|
53
|
+
function patch({
|
|
54
|
+
token, jwtToken, query = {}, operations, headers
|
|
55
|
+
}) {
|
|
43
56
|
return client({
|
|
44
57
|
url: "/manifests",
|
|
45
58
|
method: "patch",
|
|
46
59
|
params: query,
|
|
47
60
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
48
|
-
data: {
|
|
61
|
+
data: {
|
|
62
|
+
operations
|
|
63
|
+
}
|
|
49
64
|
});
|
|
50
65
|
}
|
|
51
66
|
|
|
52
|
-
function save({
|
|
67
|
+
function save({
|
|
68
|
+
token, jwtToken, providerId, data, headers
|
|
69
|
+
}) {
|
|
53
70
|
return client({
|
|
54
|
-
url:
|
|
71
|
+
url: "/manifests",
|
|
55
72
|
method: "put",
|
|
56
73
|
params: {providerId, manifestId: data.manifestId},
|
|
57
74
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
@@ -59,21 +76,43 @@ function manifestFactory({ client, internalAuthTokenProvider }) {
|
|
|
59
76
|
});
|
|
60
77
|
}
|
|
61
78
|
|
|
62
|
-
function addUser({
|
|
79
|
+
function addUser({
|
|
80
|
+
token, jwtToken, manifestId, query = {}, data, headers
|
|
81
|
+
}) {
|
|
63
82
|
return client({
|
|
64
83
|
url: `/manifests/${manifestId}/users`,
|
|
65
84
|
method: "post",
|
|
66
|
-
headers: authorizationHeaders({
|
|
85
|
+
headers: authorizationHeaders({
|
|
86
|
+
token, jwtToken, internalAuthTokenProvider, headers
|
|
87
|
+
}),
|
|
67
88
|
params: query,
|
|
68
89
|
data
|
|
69
90
|
});
|
|
70
91
|
}
|
|
71
92
|
|
|
72
|
-
function removeUser({
|
|
93
|
+
function removeUser({
|
|
94
|
+
token, jwtToken, manifestId, userId, headers
|
|
95
|
+
}) {
|
|
73
96
|
return client({
|
|
74
97
|
url: `/manifests/${manifestId}/users/${userId}`,
|
|
75
98
|
method: "delete",
|
|
76
|
-
headers: authorizationHeaders({
|
|
99
|
+
headers: authorizationHeaders({
|
|
100
|
+
token, jwtToken, internalAuthTokenProvider, headers
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function updateComment({
|
|
106
|
+
token, jwtToken, manifestId, query = {}, data, headers
|
|
107
|
+
}) {
|
|
108
|
+
return client({
|
|
109
|
+
url: `/manifests/${manifestId}/comments`,
|
|
110
|
+
method: "put",
|
|
111
|
+
headers: authorizationHeaders({
|
|
112
|
+
token, jwtToken, internalAuthTokenProvider, headers
|
|
113
|
+
}),
|
|
114
|
+
params: query,
|
|
115
|
+
data
|
|
77
116
|
});
|
|
78
117
|
}
|
|
79
118
|
|
|
@@ -85,7 +124,8 @@ function manifestFactory({ client, internalAuthTokenProvider }) {
|
|
|
85
124
|
patch,
|
|
86
125
|
save,
|
|
87
126
|
addUser,
|
|
88
|
-
removeUser
|
|
127
|
+
removeUser,
|
|
128
|
+
updateComment
|
|
89
129
|
};
|
|
90
130
|
}
|
|
91
131
|
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
const {expect} = require("chai");
|
|
2
|
-
const {
|
|
3
|
-
|
|
2
|
+
const {
|
|
3
|
+
axiosMock, expectRequest
|
|
4
|
+
} = require("./../../test-helpers.js");
|
|
5
|
+
const api = require("./../../../src/client.js").createApiClient({
|
|
6
|
+
baseURL: "http://test.com"
|
|
7
|
+
});
|
|
4
8
|
|
|
5
9
|
describe("operations/manifest", () => {
|
|
6
|
-
const token = "I owe you a token"
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
const token = "I owe you a token";
|
|
11
|
+
const jwtToken = "I owe you a JWT token";
|
|
12
|
+
const providerId = "providerId";
|
|
9
13
|
|
|
10
14
|
afterEach(() => {
|
|
11
15
|
axiosMock.reset();
|
|
@@ -18,14 +22,22 @@ describe("operations/manifest", () => {
|
|
|
18
22
|
scheduleId: "abc",
|
|
19
23
|
date: "2017-10-10"
|
|
20
24
|
};
|
|
21
|
-
axiosMock.onGet("/manifests").reply(expectRequest({
|
|
22
|
-
|
|
25
|
+
axiosMock.onGet("/manifests").reply(expectRequest({
|
|
26
|
+
statusCode: 200, token
|
|
27
|
+
}));
|
|
28
|
+
return api.operations.manifest.get({
|
|
29
|
+
token, jwtToken, query
|
|
30
|
+
});
|
|
23
31
|
});
|
|
24
32
|
|
|
25
33
|
it("should get a manifest by manifestId", () => {
|
|
26
34
|
const manifestId = "manifestId";
|
|
27
|
-
axiosMock.onGet(`/manifests/${manifestId}`).reply(expectRequest({
|
|
28
|
-
|
|
35
|
+
axiosMock.onGet(`/manifests/${manifestId}`).reply(expectRequest({
|
|
36
|
+
statusCode: 200, token
|
|
37
|
+
}));
|
|
38
|
+
return api.operations.manifest.getById({
|
|
39
|
+
token, jwtToken, manifestId
|
|
40
|
+
});
|
|
29
41
|
});
|
|
30
42
|
|
|
31
43
|
it("should get many manifests", () => {
|
|
@@ -46,13 +58,21 @@ describe("operations/manifest", () => {
|
|
|
46
58
|
productId: "productId",
|
|
47
59
|
date: "2018-01-01"
|
|
48
60
|
};
|
|
49
|
-
axiosMock.onGet("/outlook-manifests").reply(expectRequest({
|
|
50
|
-
|
|
61
|
+
axiosMock.onGet("/outlook-manifests").reply(expectRequest({
|
|
62
|
+
statusCode: 200, token, jwtToken
|
|
63
|
+
}));
|
|
64
|
+
return api.operations.manifest.outlook({
|
|
65
|
+
token, jwtToken, query
|
|
66
|
+
});
|
|
51
67
|
});
|
|
52
68
|
|
|
53
69
|
it("should patch a manifest", () => {
|
|
54
|
-
axiosMock.onPatch("/manifests").reply(expectRequest({
|
|
55
|
-
|
|
70
|
+
axiosMock.onPatch("/manifests").reply(expectRequest({
|
|
71
|
+
statusCode: 200, token, jwtToken
|
|
72
|
+
}));
|
|
73
|
+
return api.operations.manifest.patch({
|
|
74
|
+
token, jwtToken, query: {providerId}, operations: {op: "add_tickets", tickets: []}
|
|
75
|
+
});
|
|
56
76
|
});
|
|
57
77
|
|
|
58
78
|
it("should save a manifest", () => {
|
|
@@ -61,8 +81,33 @@ describe("operations/manifest", () => {
|
|
|
61
81
|
comments: "This is a comment!",
|
|
62
82
|
capacity: 22
|
|
63
83
|
};
|
|
64
|
-
axiosMock.onPut("/manifests").reply(expectRequest({
|
|
65
|
-
|
|
84
|
+
axiosMock.onPut("/manifests").reply(expectRequest({
|
|
85
|
+
statusCode: 200, token, jwtToken
|
|
86
|
+
}));
|
|
87
|
+
return api.operations.manifest.save({
|
|
88
|
+
token, jwtToken, providerId, data
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("should add comment to the manifest", async () => {
|
|
93
|
+
const manifestId = "theId";
|
|
94
|
+
const data = {
|
|
95
|
+
comment: {
|
|
96
|
+
test: "The comment"
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// optional query
|
|
101
|
+
const query = {
|
|
102
|
+
accountId: providerId,
|
|
103
|
+
routeId: "2349283409238429348",
|
|
104
|
+
scheduleId: "abc",
|
|
105
|
+
date: "2017-10-10"
|
|
106
|
+
};
|
|
107
|
+
axiosMock.onPut(`/manifests/${manifestId}/comments`).reply(expectRequest({statusCode: 201, token, jwtToken}));
|
|
108
|
+
const call = await api.operations.manifest.updateComment({token, jwtToken, manifestId, data, query});
|
|
109
|
+
expect(call.config.params).to.be.eql(query);
|
|
110
|
+
return call;
|
|
66
111
|
});
|
|
67
112
|
|
|
68
113
|
it("should add user to the manifest", async () => {
|
|
@@ -90,7 +135,11 @@ describe("operations/manifest", () => {
|
|
|
90
135
|
const manifestId = "theId";
|
|
91
136
|
const userId = "theUserId";
|
|
92
137
|
|
|
93
|
-
axiosMock.onDelete(`/manifests/${manifestId}/users/${userId}`).reply(expectRequest({
|
|
94
|
-
|
|
138
|
+
axiosMock.onDelete(`/manifests/${manifestId}/users/${userId}`).reply(expectRequest({
|
|
139
|
+
statusCode: 201, token, jwtToken
|
|
140
|
+
}));
|
|
141
|
+
return api.operations.manifest.removeUser({
|
|
142
|
+
token, jwtToken, manifestId, userId
|
|
143
|
+
});
|
|
95
144
|
});
|
|
96
145
|
});
|