btrz-api-client 8.31.0 → 8.32.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/.cursor/rules/jsdoc-endpoints.mdc +1 -1
- package/lib/client-standalone-min.js +3 -3
- package/lib/client.js +3 -0
- package/lib/endpoints/accounts/agencies.js +52 -0
- package/lib/endpoints/accounts/application-settings.js +19 -18
- package/lib/endpoints/accounts/applications.js +8 -7
- package/lib/endpoints/accounts/customers.js +27 -24
- package/lib/endpoints/accounts/domains.js +16 -11
- package/lib/endpoints/accounts/email-settings.js +22 -18
- package/lib/endpoints/accounts/email-templates.js +8 -4
- package/lib/endpoints/accounts/exchange-rates.js +12 -7
- package/lib/endpoints/accounts/exchange-receipts.js +10 -6
- package/lib/endpoints/accounts/external-customers.js +50 -0
- package/lib/endpoints/accounts/goal-settings.js +8 -6
- package/lib/endpoints/accounts/images.js +14 -13
- package/lib/endpoints/accounts/interline.js +35 -27
- package/lib/endpoints/accounts/journey-prices-settings.js +8 -6
- package/lib/endpoints/accounts/lexicons.js +13 -13
- package/lib/endpoints/accounts/market-pricing-settings.js +7 -6
- package/lib/endpoints/accounts/multiproduct-sales-settings.js +7 -6
- package/lib/endpoints/accounts/network.js +28 -13
- package/lib/endpoints/accounts/operation-settings.js +8 -6
- package/lib/endpoints/accounts/people-lookups.js +17 -17
- package/lib/endpoints/accounts/point-to-point-settings.js +6 -6
- package/lib/endpoints/accounts/print-settings.js +9 -6
- package/lib/endpoints/accounts/print-templates.js +37 -21
- package/lib/endpoints/accounts/printers.js +10 -4
- package/lib/endpoints/accounts/rms-settings.js +19 -11
- package/lib/endpoints/accounts/salesforce-settings.js +8 -6
- package/lib/endpoints/accounts/shift-settings.js +7 -6
- package/lib/endpoints/accounts/shifts.js +13 -9
- package/lib/endpoints/accounts/sms-templates.js +28 -19
- package/lib/endpoints/accounts/sub-print-templates.js +5 -3
- package/lib/endpoints/accounts/ticket-movement-settings.js +8 -5
- package/lib/endpoints/accounts/travellers.js +18 -12
- package/lib/endpoints/accounts/trusted-machines.js +11 -8
- package/lib/endpoints/accounts/twilio-settings.js +8 -5
- package/lib/endpoints/accounts/users.js +105 -63
- package/lib/endpoints/accounts/verified-emails.js +130 -0
- package/lib/endpoints/accounts/websales-config.js +7 -5
- package/package.json +1 -1
- package/src/client.js +3 -0
- package/src/endpoints/accounts/agencies.js +40 -0
- package/src/endpoints/accounts/application-settings.js +19 -18
- package/src/endpoints/accounts/applications.js +8 -7
- package/src/endpoints/accounts/customers.js +27 -24
- package/src/endpoints/accounts/domains.js +16 -11
- package/src/endpoints/accounts/email-settings.js +22 -18
- package/src/endpoints/accounts/email-templates.js +8 -4
- package/src/endpoints/accounts/exchange-rates.js +12 -7
- package/src/endpoints/accounts/exchange-receipts.js +10 -6
- package/src/endpoints/accounts/external-customers.js +37 -0
- package/src/endpoints/accounts/goal-settings.js +8 -6
- package/src/endpoints/accounts/images.js +14 -13
- package/src/endpoints/accounts/interline.js +35 -28
- package/src/endpoints/accounts/journey-prices-settings.js +8 -6
- package/src/endpoints/accounts/lexicons.js +13 -13
- package/src/endpoints/accounts/market-pricing-settings.js +7 -6
- package/src/endpoints/accounts/multiproduct-sales-settings.js +7 -6
- package/src/endpoints/accounts/network.js +28 -14
- package/src/endpoints/accounts/operation-settings.js +8 -6
- package/src/endpoints/accounts/people-lookups.js +17 -17
- package/src/endpoints/accounts/point-to-point-settings.js +6 -6
- package/src/endpoints/accounts/print-settings.js +9 -7
- package/src/endpoints/accounts/print-templates.js +31 -19
- package/src/endpoints/accounts/printers.js +10 -5
- package/src/endpoints/accounts/rms-settings.js +19 -11
- package/src/endpoints/accounts/salesforce-settings.js +8 -6
- package/src/endpoints/accounts/shift-settings.js +7 -6
- package/src/endpoints/accounts/shifts.js +13 -9
- package/src/endpoints/accounts/sms-templates.js +28 -19
- package/src/endpoints/accounts/sub-print-templates.js +5 -3
- package/src/endpoints/accounts/ticket-movement-settings.js +8 -5
- package/src/endpoints/accounts/travellers.js +18 -12
- package/src/endpoints/accounts/trusted-machines.js +11 -8
- package/src/endpoints/accounts/twilio-settings.js +8 -5
- package/src/endpoints/accounts/users.js +42 -5
- package/src/endpoints/accounts/verified-emails.js +100 -0
- package/src/endpoints/accounts/websales-config.js +7 -5
- package/test/endpoints/accounts/agencies.test.js +58 -0
- package/test/endpoints/accounts/external-customers.test.js +62 -0
- package/test/endpoints/accounts/users.js +10 -0
- package/test/endpoints/accounts/verified-emails.test.js +35 -0
- package/types/endpoints/accounts/users.d.ts +2 -1
- package/types/endpoints/accounts/verified-emails.d.ts +19 -0
|
@@ -3,7 +3,8 @@ const {
|
|
|
3
3
|
} = require("../endpoints_helpers.js");
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Factory for interline API (btrz-api-accounts).
|
|
6
|
+
* Factory for interline API (btrz-api-accounts). Interline invitations, consumers, providers, network.
|
|
7
|
+
* POST/PUT/DELETE require BETTEREZ_APP.
|
|
7
8
|
* @param {Object} deps
|
|
8
9
|
* @param {import("axios").AxiosInstance} deps.client
|
|
9
10
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
@@ -12,12 +13,13 @@ const {
|
|
|
12
13
|
function interlineFactory({client, internalAuthTokenProvider}) {
|
|
13
14
|
const invitations = {
|
|
14
15
|
/**
|
|
15
|
-
* GET /interline/invitations
|
|
16
|
+
* GET /interline/invitations – List interline invitations (paginated). Query: page.
|
|
16
17
|
* @param {Object} opts
|
|
17
18
|
* @param {string} [opts.token] - API key
|
|
18
19
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
20
|
+
* @param {Object} [opts.query] - Optional query (e.g. page)
|
|
19
21
|
* @param {Object} [opts.headers] - Optional headers
|
|
20
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
22
|
+
* @returns {Promise<import("axios").AxiosResponse<{ invitations: object[], totalRecords: number, ... }>>}
|
|
21
23
|
*/
|
|
22
24
|
all({token, jwtToken, query = {}, headers}) {
|
|
23
25
|
return client({
|
|
@@ -27,12 +29,12 @@ function interlineFactory({client, internalAuthTokenProvider}) {
|
|
|
27
29
|
});
|
|
28
30
|
},
|
|
29
31
|
/**
|
|
30
|
-
* GET /interline/invitations/:invitationId
|
|
32
|
+
* GET /interline/invitations/:invitationId – Get a single invitation by id (24 hex ObjectId).
|
|
31
33
|
* @param {Object} opts
|
|
32
34
|
* @param {string} [opts.token] - API key
|
|
33
|
-
* @param {string} opts.invitationId - Invitation id (
|
|
35
|
+
* @param {string} opts.invitationId - Invitation id (24 hex characters)
|
|
34
36
|
* @param {Object} [opts.headers] - Optional headers
|
|
35
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
37
|
+
* @returns {Promise<import("axios").AxiosResponse<{ invitation: object }>>}
|
|
36
38
|
*/
|
|
37
39
|
get({token, invitationId, headers}) {
|
|
38
40
|
return client.get(`/interline/invitations/${invitationId}`, {
|
|
@@ -40,13 +42,14 @@ function interlineFactory({client, internalAuthTokenProvider}) {
|
|
|
40
42
|
});
|
|
41
43
|
},
|
|
42
44
|
/**
|
|
43
|
-
* POST /interline/invitations
|
|
45
|
+
* POST /interline/invitations – Create an invitation. Requires BETTEREZ_APP JWT. Emits interlineinvitation.created.
|
|
46
|
+
* Body: { interline } or InterlineInvitationPost at root.
|
|
44
47
|
* @param {Object} opts
|
|
45
48
|
* @param {string} [opts.token] - API key
|
|
46
|
-
* @param {string} [opts.jwtToken] - JWT
|
|
49
|
+
* @param {string} [opts.jwtToken] - JWT (BETTEREZ_APP audience)
|
|
47
50
|
* @param {Object} opts.data - Invitation payload
|
|
48
51
|
* @param {Object} [opts.headers] - Optional headers
|
|
49
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
52
|
+
* @returns {Promise<import("axios").AxiosResponse<{ invitation: object }>>}
|
|
50
53
|
*/
|
|
51
54
|
create({data, token, jwtToken, headers}) {
|
|
52
55
|
return client({
|
|
@@ -57,14 +60,15 @@ function interlineFactory({client, internalAuthTokenProvider}) {
|
|
|
57
60
|
});
|
|
58
61
|
},
|
|
59
62
|
/**
|
|
60
|
-
* PUT /interline/invitations/:invitationId
|
|
63
|
+
* PUT /interline/invitations/:invitationId – Update invitation (e.g. accept/reject). Requires BETTEREZ_APP.
|
|
64
|
+
* Emits interlineinvitation.updated.
|
|
61
65
|
* @param {Object} opts
|
|
62
66
|
* @param {string} [opts.token] - API key
|
|
63
67
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
64
|
-
* @param {string} opts.invitationId - Invitation id (ObjectId)
|
|
65
|
-
* @param {Object} opts.data -
|
|
68
|
+
* @param {string} opts.invitationId - Invitation id (24 hex ObjectId)
|
|
69
|
+
* @param {Object} opts.data - Body (InterlineInvitePutData)
|
|
66
70
|
* @param {Object} [opts.headers] - Optional headers
|
|
67
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
71
|
+
* @returns {Promise<import("axios").AxiosResponse<{ invitation: object }>>}
|
|
68
72
|
*/
|
|
69
73
|
update({invitationId, data, token, jwtToken, headers}) {
|
|
70
74
|
return client({
|
|
@@ -78,12 +82,13 @@ function interlineFactory({client, internalAuthTokenProvider}) {
|
|
|
78
82
|
|
|
79
83
|
const consumers = {
|
|
80
84
|
/**
|
|
81
|
-
* GET /interline/consumers
|
|
85
|
+
* GET /interline/consumers – List interline consumers (paginated). Query: page.
|
|
82
86
|
* @param {Object} opts
|
|
83
87
|
* @param {string} [opts.token] - API key
|
|
84
88
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
89
|
+
* @param {Object} [opts.query] - Optional query (e.g. page)
|
|
85
90
|
* @param {Object} [opts.headers] - Optional headers
|
|
86
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
91
|
+
* @returns {Promise<import("axios").AxiosResponse<{ consumers: object[], totalRecords: number, ... }>>}
|
|
87
92
|
*/
|
|
88
93
|
all({token, jwtToken, query = {}, headers}) {
|
|
89
94
|
return client({
|
|
@@ -96,12 +101,13 @@ function interlineFactory({client, internalAuthTokenProvider}) {
|
|
|
96
101
|
|
|
97
102
|
const providers = {
|
|
98
103
|
/**
|
|
99
|
-
* GET /interline/providers
|
|
104
|
+
* GET /interline/providers – List interline providers (paginated). Query: page.
|
|
100
105
|
* @param {Object} opts
|
|
101
106
|
* @param {string} [opts.token] - API key
|
|
102
107
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
108
|
+
* @param {Object} [opts.query] - Optional query (e.g. page)
|
|
103
109
|
* @param {Object} [opts.headers] - Optional headers
|
|
104
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
110
|
+
* @returns {Promise<import("axios").AxiosResponse<{ providers: object[], totalRecords: number, ... }>>}
|
|
105
111
|
*/
|
|
106
112
|
all({token, jwtToken, query = {}, headers}) {
|
|
107
113
|
return client({
|
|
@@ -114,27 +120,28 @@ function interlineFactory({client, internalAuthTokenProvider}) {
|
|
|
114
120
|
|
|
115
121
|
const network = {
|
|
116
122
|
/**
|
|
117
|
-
* GET /interline/:interlineId/network
|
|
123
|
+
* GET /interline/:interlineId/network – Get interline network by interline id (24 hex ObjectId).
|
|
118
124
|
* @param {Object} opts
|
|
119
125
|
* @param {string} [opts.token] - API key
|
|
120
|
-
* @param {string} opts.
|
|
126
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
127
|
+
* @param {string} opts.interlineId - Interline id (24 hex ObjectId)
|
|
121
128
|
* @param {Object} [opts.headers] - Optional headers
|
|
122
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
129
|
+
* @returns {Promise<import("axios").AxiosResponse<{ network: object }>>}
|
|
123
130
|
*/
|
|
124
|
-
get({token, interlineId, headers}) {
|
|
131
|
+
get({token, jwtToken, interlineId, headers}) {
|
|
125
132
|
return client.get(`/interline/${interlineId}/network`, {
|
|
126
|
-
headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
|
|
133
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
127
134
|
});
|
|
128
135
|
},
|
|
129
136
|
/**
|
|
130
|
-
* PUT /interline/:interlineId/network
|
|
137
|
+
* PUT /interline/:interlineId/network – Update interline network. Requires BETTEREZ_APP. Emits interlinenetwork.updated.
|
|
131
138
|
* @param {Object} opts
|
|
132
139
|
* @param {string} [opts.token] - API key
|
|
133
140
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
134
|
-
* @param {string} opts.interlineId - Interline id (ObjectId)
|
|
135
|
-
* @param {Object} opts.data - Network payload
|
|
141
|
+
* @param {string} opts.interlineId - Interline id (24 hex ObjectId)
|
|
142
|
+
* @param {Object} opts.data - Network payload (InterlinePutData)
|
|
136
143
|
* @param {Object} [opts.headers] - Optional headers
|
|
137
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
144
|
+
* @returns {Promise<import("axios").AxiosResponse<{ network: object }>>}
|
|
138
145
|
*/
|
|
139
146
|
update({interlineId, data, token, jwtToken, headers}) {
|
|
140
147
|
return client({
|
|
@@ -152,11 +159,11 @@ function interlineFactory({client, internalAuthTokenProvider}) {
|
|
|
152
159
|
providers,
|
|
153
160
|
network,
|
|
154
161
|
/**
|
|
155
|
-
* DELETE /interline/:interlineId
|
|
162
|
+
* DELETE /interline/:interlineId – Remove an interline. Requires BETTEREZ_APP. Emits interlinenetwork.deleted.
|
|
156
163
|
* @param {Object} opts
|
|
157
164
|
* @param {string} [opts.token] - API key
|
|
158
165
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
159
|
-
* @param {string} opts.interlineId - Interline id (ObjectId)
|
|
166
|
+
* @param {string} opts.interlineId - Interline id (24 hex ObjectId)
|
|
160
167
|
* @param {Object} [opts.headers] - Optional headers
|
|
161
168
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
162
169
|
*/
|
|
@@ -3,7 +3,8 @@ const {
|
|
|
3
3
|
} = require("../endpoints_helpers.js");
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Factory for journey-prices-settings API (btrz-api-accounts).
|
|
6
|
+
* Factory for journey-prices-settings API (btrz-api-accounts). Journey pricing settings (record protection rules, pricing parameters).
|
|
7
|
+
* Requires user logged in to backoffice app.
|
|
7
8
|
* @param {Object} deps
|
|
8
9
|
* @param {import("axios").AxiosInstance} deps.client
|
|
9
10
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
@@ -11,12 +12,12 @@ const {
|
|
|
11
12
|
*/
|
|
12
13
|
function journeyPricesSettingsFactory({client, internalAuthTokenProvider}) {
|
|
13
14
|
/**
|
|
14
|
-
* GET /journey-prices-settings
|
|
15
|
+
* GET /journey-prices-settings – Get journey prices settings for the account.
|
|
15
16
|
* @param {Object} opts
|
|
16
17
|
* @param {string} [opts.token] - API key
|
|
17
18
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
18
19
|
* @param {Object} [opts.headers] - Optional headers
|
|
19
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
20
|
+
* @returns {Promise<import("axios").AxiosResponse<{ journeyPricesSettings: object }>>}
|
|
20
21
|
*/
|
|
21
22
|
function get({token, jwtToken, headers}) {
|
|
22
23
|
return client({
|
|
@@ -26,13 +27,14 @@ function journeyPricesSettingsFactory({client, internalAuthTokenProvider}) {
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
|
-
* PUT /journey-prices-settings
|
|
30
|
+
* PUT /journey-prices-settings – Update journey prices settings. Body: JourneyPricesSettings at root.
|
|
31
|
+
* Required: recordProtectionRules. Optional: pricingParameters, allowEachTripSegmentToBePricedIndividually.
|
|
30
32
|
* @param {Object} opts
|
|
31
33
|
* @param {string} [opts.token] - API key
|
|
32
34
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
33
|
-
* @param {Object} opts.journeyPricesSettings -
|
|
35
|
+
* @param {Object} opts.journeyPricesSettings - { recordProtectionRules, pricingParameters?, allowEachTripSegmentToBePricedIndividually? }
|
|
34
36
|
* @param {Object} [opts.headers] - Optional headers
|
|
35
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
37
|
+
* @returns {Promise<import("axios").AxiosResponse<{ journeyPricesSettings: object }>>}
|
|
36
38
|
*/
|
|
37
39
|
function update({token, jwtToken, journeyPricesSettings, headers}) {
|
|
38
40
|
return client({
|
|
@@ -43,13 +43,13 @@ function lexiconsFactory({
|
|
|
43
43
|
client, internalAuthTokenProvider
|
|
44
44
|
}) {
|
|
45
45
|
/**
|
|
46
|
-
* GET /lexicons/buscompany
|
|
46
|
+
* GET /lexicons/buscompany – list account translations from buscompany collection. Query params from get-lexicons getSpec().
|
|
47
47
|
* @param {Object} opts
|
|
48
48
|
* @param {string} [opts.token] - API key
|
|
49
49
|
* @param {string} [opts.context] - Context of the lexicons to search (merged into query)
|
|
50
50
|
* @param {LexiconsListQuery} [opts.query] - Query params: providerIds, context, accountOnly, key, keys, lang, langs
|
|
51
51
|
* @param {Object} [opts.headers] - Optional headers
|
|
52
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
52
|
+
* @returns {Promise<import("axios").AxiosResponse<{ lexicons: Array }>>}
|
|
53
53
|
*/
|
|
54
54
|
function all({
|
|
55
55
|
token,
|
|
@@ -67,13 +67,13 @@ function lexiconsFactory({
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
|
-
* POST /lexicons
|
|
70
|
+
* POST /lexicons – create lexicon entries. Body: { entries }. Requires BETTEREZ_APP audience.
|
|
71
71
|
* @param {Object} opts
|
|
72
72
|
* @param {string} [opts.token] - API key
|
|
73
73
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
74
|
-
* @param {Array} opts.lexiconEntries - Entries to create
|
|
74
|
+
* @param {Array} opts.lexiconEntries - Entries to create (accountId, name, values, context per item)
|
|
75
75
|
* @param {Object} [opts.headers] - Optional headers
|
|
76
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
76
|
+
* @returns {Promise<import("axios").AxiosResponse<{ successes: Array, failures: Array }>>}
|
|
77
77
|
*/
|
|
78
78
|
function create({
|
|
79
79
|
token,
|
|
@@ -92,13 +92,13 @@ function lexiconsFactory({
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
|
-
* PUT /lexicons
|
|
95
|
+
* PUT /lexicons – create or update many lexicon entries. Body: { entries }. Emits webhook lexicons.updated. Requires BETTEREZ_APP audience.
|
|
96
96
|
* @param {Object} opts
|
|
97
97
|
* @param {string} [opts.token] - API key
|
|
98
98
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
99
|
-
* @param {Array} opts.entries - Entries to create or update
|
|
99
|
+
* @param {Array} opts.entries - Entries to create or update (key, values per item)
|
|
100
100
|
* @param {Object} [opts.headers] - Optional headers
|
|
101
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
101
|
+
* @returns {Promise<import("axios").AxiosResponse<{ status: string, entries: Array }>>}
|
|
102
102
|
*/
|
|
103
103
|
function createOrUpdateMany({
|
|
104
104
|
token,
|
|
@@ -119,13 +119,13 @@ function lexiconsFactory({
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
* PATCH /lexicons
|
|
122
|
+
* PATCH /lexicons – update many lexicon entries. Body: { updates } (key, accountId, values and/or context). Requires BETTEREZ_APP audience.
|
|
123
123
|
* @param {Object} opts
|
|
124
124
|
* @param {string} [opts.token] - API key
|
|
125
125
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
126
|
-
* @param {Array} opts.updates - Updates to apply
|
|
126
|
+
* @param {Array} opts.updates - Updates to apply (key, accountId, values?, context?)
|
|
127
127
|
* @param {Object} [opts.headers] - Optional headers
|
|
128
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
128
|
+
* @returns {Promise<import("axios").AxiosResponse<{ entries: Array }>>}
|
|
129
129
|
*/
|
|
130
130
|
function updateMany({
|
|
131
131
|
token,
|
|
@@ -144,14 +144,14 @@ function lexiconsFactory({
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
|
-
*
|
|
147
|
+
* GET /lexicons/:lang/content – search global lexicons (no account) by partial match on translation value. Requires BETTEREZ_APP audience.
|
|
148
148
|
* @param {Object} opts
|
|
149
149
|
* @param {string} opts.lang - Language code (e.g. en-us, pt-br). Must be a supported language.
|
|
150
150
|
* @param {string} opts.txt - Text to search for (partial, case-insensitive). Required.
|
|
151
151
|
* @param {string} [opts.token] - API key
|
|
152
152
|
* @param {string} [opts.jwtToken] - JWT
|
|
153
153
|
* @param {Object} [opts.headers] - Optional request headers
|
|
154
|
-
* @returns {Promise<{
|
|
154
|
+
* @returns {Promise<import("axios").AxiosResponse<{ lexiconTextContentItems: Array }>>}
|
|
155
155
|
*/
|
|
156
156
|
function getByText({token, jwtToken, headers, lang, txt}) {
|
|
157
157
|
return client({
|
|
@@ -3,7 +3,8 @@ const {
|
|
|
3
3
|
} = require("../endpoints_helpers.js");
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Factory for market-pricing-settings API (btrz-api-accounts).
|
|
6
|
+
* Factory for market-pricing-settings API (btrz-api-accounts). Market pricing configuration (e.g. useOnlySpecificFareTable).
|
|
7
|
+
* Requires user logged in to backoffice app.
|
|
7
8
|
* @param {Object} deps
|
|
8
9
|
* @param {import("axios").AxiosInstance} deps.client
|
|
9
10
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
@@ -11,12 +12,12 @@ const {
|
|
|
11
12
|
*/
|
|
12
13
|
function marketPricingSettingsFactory({client, internalAuthTokenProvider}) {
|
|
13
14
|
/**
|
|
14
|
-
* GET /market-pricing-settings
|
|
15
|
+
* GET /market-pricing-settings – Get market pricing settings for the account.
|
|
15
16
|
* @param {Object} opts
|
|
16
17
|
* @param {string} [opts.token] - API key
|
|
17
18
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
18
19
|
* @param {Object} [opts.headers] - Optional headers
|
|
19
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
20
|
+
* @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: { useOnlySpecificFareTable: boolean } }>>}
|
|
20
21
|
*/
|
|
21
22
|
function get({token, jwtToken, headers}) {
|
|
22
23
|
return client({
|
|
@@ -26,13 +27,13 @@ function marketPricingSettingsFactory({client, internalAuthTokenProvider}) {
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
|
-
* PUT /market-pricing-settings
|
|
30
|
+
* PUT /market-pricing-settings – Update market pricing settings. Body: MarketPricingSettings at root (useOnlySpecificFareTable required).
|
|
30
31
|
* @param {Object} opts
|
|
31
32
|
* @param {string} [opts.token] - API key
|
|
32
33
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
33
|
-
* @param {Object} opts.marketPricingSettings -
|
|
34
|
+
* @param {Object} opts.marketPricingSettings - { useOnlySpecificFareTable: boolean }
|
|
34
35
|
* @param {Object} [opts.headers] - Optional headers
|
|
35
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
36
|
+
* @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: object }>>}
|
|
36
37
|
*/
|
|
37
38
|
function update({token, jwtToken, marketPricingSettings, headers}) {
|
|
38
39
|
return client({
|
|
@@ -3,7 +3,8 @@ const {
|
|
|
3
3
|
} = require("../endpoints_helpers.js");
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Factory for multiproduct-sales-settings API (btrz-api-accounts).
|
|
6
|
+
* Factory for multiproduct-sales-settings API (btrz-api-accounts). Multi-product sales settings (product/station/fare/fareClass mappings).
|
|
7
|
+
* Requires BETTEREZ_APP audience. PUT emits webhooks networks.created or networks.updated.
|
|
7
8
|
* @param {Object} deps
|
|
8
9
|
* @param {import("axios").AxiosInstance} deps.client
|
|
9
10
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
@@ -11,12 +12,12 @@ const {
|
|
|
11
12
|
*/
|
|
12
13
|
function multiproductSalesSettingsFactory({client, internalAuthTokenProvider}) {
|
|
13
14
|
/**
|
|
14
|
-
* GET /multiproduct-sales-settings
|
|
15
|
+
* GET /multiproduct-sales-settings – Get multi-product sales settings for the account.
|
|
15
16
|
* @param {Object} opts
|
|
16
17
|
* @param {string} [opts.token] - API key
|
|
17
18
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
18
19
|
* @param {Object} [opts.headers] - Optional headers
|
|
19
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
20
|
+
* @returns {Promise<import("axios").AxiosResponse<{ multiProductSettings: object }>>}
|
|
20
21
|
*/
|
|
21
22
|
function get({token, jwtToken, headers}) {
|
|
22
23
|
return client({
|
|
@@ -26,13 +27,13 @@ function multiproductSalesSettingsFactory({client, internalAuthTokenProvider}) {
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
|
-
* PUT /multiproduct-sales-settings
|
|
30
|
+
* PUT /multiproduct-sales-settings – Create or update multi-product sales settings (upsert). Body: MultiProductSettingsPayload (productsMapping, stationsMapping, faresMapping, fareClassesMapping). Emits networks.created or networks.updated.
|
|
30
31
|
* @param {Object} opts
|
|
31
32
|
* @param {string} [opts.token] - API key
|
|
32
33
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
33
|
-
* @param {Object} opts.data -
|
|
34
|
+
* @param {Object} opts.data - multiProductSettings payload (productsMapping, stationsMapping, faresMapping, fareClassesMapping; each key ObjectId, each value array of ObjectIds)
|
|
34
35
|
* @param {Object} [opts.headers] - Optional headers
|
|
35
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
36
|
+
* @returns {Promise<import("axios").AxiosResponse<{ multiProductSettings: object }>>}
|
|
36
37
|
*/
|
|
37
38
|
function update({token, jwtToken, data, headers}) {
|
|
38
39
|
return client({
|
|
@@ -3,6 +3,13 @@ const {
|
|
|
3
3
|
authorizationHeaders
|
|
4
4
|
} = require("../endpoints_helpers.js");
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Query params for GET /network/agencies (btrz-api-accounts). See get-agencies-handler getSpec().
|
|
8
|
+
* @typedef {Object} NetworkAgenciesListQuery
|
|
9
|
+
* @property {string} [name] - Filter by agency/seller name (prefix, case-insensitive)
|
|
10
|
+
* @property {number} [page] - Page number (1-based)
|
|
11
|
+
*/
|
|
12
|
+
|
|
6
13
|
/**
|
|
7
14
|
* Factory for network API (btrz-api-accounts).
|
|
8
15
|
* @param {Object} deps
|
|
@@ -13,12 +20,14 @@ const {
|
|
|
13
20
|
function networkFactory({client, internalAuthTokenProvider}) {
|
|
14
21
|
const agencies = {
|
|
15
22
|
/**
|
|
16
|
-
* GET /network/agencies - list agencies
|
|
23
|
+
* GET /network/agencies - list agencies (paginated). Query: name, page.
|
|
17
24
|
* @param {Object} opts
|
|
18
25
|
* @param {string} [opts.token] - API key
|
|
19
26
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
27
|
+
* @param {NetworkAgenciesListQuery} [opts.query] - Query params (name, page)
|
|
20
28
|
* @param {Object} [opts.headers] - Optional headers
|
|
21
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
29
|
+
* @returns {Promise<import("axios").AxiosResponse<{ agencies: Array, next?: string, previous?: string, count?: number }>>}
|
|
30
|
+
* Errors: 401, 500
|
|
22
31
|
*/
|
|
23
32
|
all({token, jwtToken, query = {}, headers}) {
|
|
24
33
|
return client({
|
|
@@ -28,18 +37,21 @@ function networkFactory({client, internalAuthTokenProvider}) {
|
|
|
28
37
|
});
|
|
29
38
|
},
|
|
30
39
|
/**
|
|
31
|
-
* GET /network/agencies/:agencyId - get an agency by id.
|
|
40
|
+
* GET /network/agencies/:agencyId - get an agency by id.
|
|
32
41
|
* @param {Object} opts
|
|
33
42
|
* @param {string} [opts.token] - API key
|
|
34
|
-
* @param {string} opts.
|
|
43
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
44
|
+
* @param {string} opts.sellerId - Seller/agency id (ObjectId), path param agencyId
|
|
45
|
+
* @param {Object} [opts.query] - Optional query params
|
|
35
46
|
* @param {Object} [opts.headers] - Optional headers
|
|
36
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
47
|
+
* @returns {Promise<import("axios").AxiosResponse<{ agency: Object }>>}
|
|
48
|
+
* Errors: 400 (INVALID_AGENCY_ID), 401, 404 (AGENCY_NOT_FOUND), 500
|
|
37
49
|
*/
|
|
38
|
-
get({token, query, headers, sellerId}) {
|
|
50
|
+
get({token, jwtToken, query, headers, sellerId}) {
|
|
39
51
|
return client({
|
|
40
52
|
url: `/network/agencies/${sellerId}`,
|
|
41
|
-
params: query,
|
|
42
|
-
headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
|
|
53
|
+
params: query || {},
|
|
54
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
43
55
|
});
|
|
44
56
|
},
|
|
45
57
|
/**
|
|
@@ -87,13 +99,14 @@ function networkFactory({client, internalAuthTokenProvider}) {
|
|
|
87
99
|
});
|
|
88
100
|
},
|
|
89
101
|
/**
|
|
90
|
-
* PUT /network/agencies/remove-product - remove
|
|
102
|
+
* PUT /network/agencies/remove-product - remove productId from all agencies for the account.
|
|
91
103
|
* @param {Object} opts
|
|
92
104
|
* @param {string} [opts.token] - API key
|
|
93
105
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
94
|
-
* @param {string} opts.productId - Product id (
|
|
106
|
+
* @param {string} opts.productId - Product id (non-empty string)
|
|
95
107
|
* @param {Object} [opts.headers] - Optional headers
|
|
96
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
108
|
+
* @returns {Promise<import("axios").AxiosResponse<{}>>}
|
|
109
|
+
* Errors: 400 (WRONG_DATA), 401, 500
|
|
97
110
|
*/
|
|
98
111
|
removeProduct({token, jwtToken, productId, headers}) {
|
|
99
112
|
return client({
|
|
@@ -108,13 +121,14 @@ function networkFactory({client, internalAuthTokenProvider}) {
|
|
|
108
121
|
});
|
|
109
122
|
},
|
|
110
123
|
/**
|
|
111
|
-
* PUT /network/agencies/remove-fare - remove
|
|
124
|
+
* PUT /network/agencies/remove-fare - remove fareId from all agencies for the account.
|
|
112
125
|
* @param {Object} opts
|
|
113
126
|
* @param {string} [opts.token] - API key
|
|
114
127
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
115
|
-
* @param {string} opts.fareId - Fare id (
|
|
128
|
+
* @param {string} opts.fareId - Fare id (non-empty string)
|
|
116
129
|
* @param {Object} [opts.headers] - Optional headers
|
|
117
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
130
|
+
* @returns {Promise<import("axios").AxiosResponse<{}>>}
|
|
131
|
+
* Errors: 400 (WRONG_DATA), 401, 500
|
|
118
132
|
*/
|
|
119
133
|
removeFare({token, jwtToken, fareId, headers}) {
|
|
120
134
|
return client({
|
|
@@ -3,7 +3,8 @@ const {
|
|
|
3
3
|
} = require("./../endpoints_helpers.js");
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Factory for operation-settings API (btrz-api-accounts).
|
|
6
|
+
* Factory for operation-settings API (btrz-api-accounts). Operation settings (manifest, schedule, preferences.operations).
|
|
7
|
+
* Requires BETTEREZ_APP audience. PUT emits webhook operationsettings.updated.
|
|
7
8
|
* @param {Object} deps
|
|
8
9
|
* @param {import("axios").AxiosInstance} deps.client
|
|
9
10
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
@@ -11,12 +12,13 @@ const {
|
|
|
11
12
|
*/
|
|
12
13
|
function operationSettingsFactory({client, internalAuthTokenProvider}) {
|
|
13
14
|
/**
|
|
14
|
-
* GET /operation-settings
|
|
15
|
+
* GET /operation-settings – Get operation settings for the account.
|
|
15
16
|
* @param {Object} opts
|
|
16
17
|
* @param {string} [opts.token] - API key
|
|
17
18
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
19
|
+
* @param {Object} [opts.query] - Optional query params (passed to request)
|
|
18
20
|
* @param {Object} [opts.headers] - Optional headers
|
|
19
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
21
|
+
* @returns {Promise<import("axios").AxiosResponse<{ operationSettings: object }>>}
|
|
20
22
|
*/
|
|
21
23
|
function get({token, jwtToken, query, headers}) {
|
|
22
24
|
return client({
|
|
@@ -27,13 +29,13 @@ function operationSettingsFactory({client, internalAuthTokenProvider}) {
|
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
|
-
* PUT /operation-settings
|
|
32
|
+
* PUT /operation-settings – Update operation settings. Body: { operationSettings } (OperationSettingsPutData). Emits operationsettings.updated.
|
|
31
33
|
* @param {Object} opts
|
|
32
34
|
* @param {string} [opts.token] - API key
|
|
33
35
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
34
|
-
* @param {Object} opts.operationSettings -
|
|
36
|
+
* @param {Object} opts.operationSettings - Operation settings payload (partial or full OperationSettingsPutData)
|
|
35
37
|
* @param {Object} [opts.headers] - Optional headers
|
|
36
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
38
|
+
* @returns {Promise<import("axios").AxiosResponse<{ operationSettings: object }>>}
|
|
37
39
|
*/
|
|
38
40
|
function update({jwtToken, token, operationSettings, headers}) {
|
|
39
41
|
return client({
|
|
@@ -4,11 +4,11 @@ const {
|
|
|
4
4
|
} = require("./../endpoints_helpers.js");
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Query params for GET /people-lookups (btrz-api-accounts).
|
|
7
|
+
* Query params for GET /people-lookups (btrz-api-accounts). Optional filters; when provided only matching people are returned.
|
|
8
8
|
* @typedef {Object} PeopleLookupsListQuery
|
|
9
9
|
* @property {string} [dynamicFormId] - If provided, only include this dynamic form's data in response
|
|
10
10
|
* @property {string} [documentNumber] - Document number to search for
|
|
11
|
-
* @property {string} [documentTypeId] - Document type id to search for
|
|
11
|
+
* @property {string} [documentTypeId] - Document type id (ObjectId) to search for
|
|
12
12
|
* @property {string} [email] - Email to search for
|
|
13
13
|
* @property {string} [customerNumber] - Customer number to search for
|
|
14
14
|
* @property {string} [phone] - Phone to search for
|
|
@@ -29,14 +29,14 @@ const {
|
|
|
29
29
|
*/
|
|
30
30
|
function peopleLookupsFactory({client, internalAuthTokenProvider}) {
|
|
31
31
|
/**
|
|
32
|
-
* GET /people-lookups
|
|
32
|
+
* GET /people-lookups – list people lookups (paginated). Requires BETTEREZ_APP audience.
|
|
33
33
|
* @param {Object} opts
|
|
34
34
|
* @param {string} [opts.token] - API key
|
|
35
35
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
36
36
|
* @param {PeopleLookupsListQuery} [opts.query] - Query params (dynamicFormId, documentNumber, documentTypeId, email, customerNumber, phone)
|
|
37
37
|
* @param {string} [opts.providerId] - Provider id (ObjectId); merged into query for provider context
|
|
38
38
|
* @param {Object} [opts.headers] - Optional headers
|
|
39
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
39
|
+
* @returns {Promise<import("axios").AxiosResponse<{ people: object[], totalRecords: number, page?: number, pageSize?: number }>>}
|
|
40
40
|
*/
|
|
41
41
|
function all({token, jwtToken, query, headers, providerId}) {
|
|
42
42
|
const query_ = providerId ? {...query, providerId} : query;
|
|
@@ -48,15 +48,15 @@ function peopleLookupsFactory({client, internalAuthTokenProvider}) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* GET /people-lookups/:personId
|
|
51
|
+
* GET /people-lookups/:personId – get a single person lookup by id. Returns 404 if not found. Requires BETTEREZ_APP audience.
|
|
52
52
|
* @param {Object} opts
|
|
53
53
|
* @param {string} [opts.token] - API key
|
|
54
54
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
55
|
-
* @param {string} opts.personId - Person id (ObjectId)
|
|
55
|
+
* @param {string} opts.personId - Person id (24 hex ObjectId)
|
|
56
56
|
* @param {PeopleLookupGetByIdQuery} [opts.query] - Query params: dynamicFormId
|
|
57
57
|
* @param {string} [opts.providerId] - Provider id (ObjectId); merged into query for provider context
|
|
58
58
|
* @param {Object} [opts.headers] - Optional headers
|
|
59
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
59
|
+
* @returns {Promise<import("axios").AxiosResponse<{ person: object }>>}
|
|
60
60
|
*/
|
|
61
61
|
function getById({token, jwtToken, query, headers, personId, providerId}) {
|
|
62
62
|
const query_ = providerId ? {...query, providerId} : query;
|
|
@@ -69,15 +69,15 @@ function peopleLookupsFactory({client, internalAuthTokenProvider}) {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
* PUT /people-lookups/:personId
|
|
72
|
+
* PUT /people-lookups/:personId – update a person lookup. Emits peopleLookups.updated webhook. Requires BETTEREZ_APP audience.
|
|
73
73
|
* @param {Object} opts
|
|
74
74
|
* @param {string} [opts.token] - API key
|
|
75
75
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
76
|
-
* @param {string} opts.personId - Person id (ObjectId)
|
|
77
|
-
* @param {Object} opts.person - Person payload
|
|
76
|
+
* @param {string} opts.personId - Person id (24 hex ObjectId)
|
|
77
|
+
* @param {Object} opts.person - Person payload (PeopleLookupPutData: documentTypeId, documentNumber, firstName, lastName, email, phone, dynamicForms, etc.)
|
|
78
78
|
* @param {string} [opts.providerId] - Provider id (ObjectId); sent as query for provider context
|
|
79
79
|
* @param {Object} [opts.headers] - Optional headers
|
|
80
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
80
|
+
* @returns {Promise<import("axios").AxiosResponse<{ person: object }>>}
|
|
81
81
|
*/
|
|
82
82
|
function update({jwtToken, token, personId, person, headers, providerId}) {
|
|
83
83
|
const query = providerId ? {providerId} : {};
|
|
@@ -96,14 +96,14 @@ function peopleLookupsFactory({client, internalAuthTokenProvider}) {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* POST /people-lookups
|
|
99
|
+
* POST /people-lookups – create a person lookup. Emits peopleLookups.created webhook. Requires BETTEREZ_APP audience. Body requires documentTypeId and documentNumber.
|
|
100
100
|
* @param {Object} opts
|
|
101
101
|
* @param {string} [opts.token] - API key
|
|
102
102
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
103
|
-
* @param {Object} opts.person - Person payload
|
|
103
|
+
* @param {Object} opts.person - Person payload (PeopleLookupPostData: documentTypeId, documentNumber required; firstName, lastName, email, phone, dynamicForms, etc.)
|
|
104
104
|
* @param {string} [opts.providerId] - Provider id (ObjectId); sent as query for provider context
|
|
105
105
|
* @param {Object} [opts.headers] - Optional headers
|
|
106
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
106
|
+
* @returns {Promise<import("axios").AxiosResponse<{ person: object }>>}
|
|
107
107
|
*/
|
|
108
108
|
function create({jwtToken, token, person, headers, providerId}) {
|
|
109
109
|
const query = providerId ? {providerId} : {};
|
|
@@ -122,13 +122,13 @@ function peopleLookupsFactory({client, internalAuthTokenProvider}) {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
|
-
* DELETE /people-lookups/:personId
|
|
125
|
+
* DELETE /people-lookups/:personId – remove a person lookup. Emits peoplelookups.deleted webhook. Returns 404 if person not found. Requires BETTEREZ_APP audience.
|
|
126
126
|
* @param {Object} opts
|
|
127
127
|
* @param {string} [opts.token] - API key
|
|
128
128
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
129
|
-
* @param {string} opts.personId - Person id (ObjectId)
|
|
129
|
+
* @param {string} opts.personId - Person id (24 hex ObjectId)
|
|
130
130
|
* @param {Object} [opts.headers] - Optional headers
|
|
131
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
131
|
+
* @returns {Promise<import("axios").AxiosResponse<{ personId: string }>>}
|
|
132
132
|
*/
|
|
133
133
|
function remove({personId, token, jwtToken, headers}) {
|
|
134
134
|
return client({
|