btrz-api-client 8.31.0 → 8.33.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.
Files changed (93) hide show
  1. package/.cursor/rules/jsdoc-endpoints.mdc +1 -1
  2. package/lib/client-standalone-min.js +3 -3
  3. package/lib/client.js +5 -0
  4. package/lib/endpoints/accounts/agencies.js +52 -0
  5. package/lib/endpoints/accounts/application-settings.js +19 -18
  6. package/lib/endpoints/accounts/applications.js +8 -7
  7. package/lib/endpoints/accounts/customers.js +27 -24
  8. package/lib/endpoints/accounts/domains.js +16 -11
  9. package/lib/endpoints/accounts/email-settings.js +22 -18
  10. package/lib/endpoints/accounts/email-templates.js +8 -4
  11. package/lib/endpoints/accounts/exchange-rates.js +12 -7
  12. package/lib/endpoints/accounts/exchange-receipts.js +10 -6
  13. package/lib/endpoints/accounts/external-customers.js +50 -0
  14. package/lib/endpoints/accounts/goal-settings.js +8 -6
  15. package/lib/endpoints/accounts/images.js +14 -13
  16. package/lib/endpoints/accounts/interline.js +35 -27
  17. package/lib/endpoints/accounts/journey-prices-settings.js +8 -6
  18. package/lib/endpoints/accounts/lexicons.js +13 -13
  19. package/lib/endpoints/accounts/market-pricing-settings.js +7 -6
  20. package/lib/endpoints/accounts/multiproduct-sales-settings.js +7 -6
  21. package/lib/endpoints/accounts/network.js +28 -13
  22. package/lib/endpoints/accounts/operation-settings.js +8 -6
  23. package/lib/endpoints/accounts/people-lookups.js +17 -17
  24. package/lib/endpoints/accounts/point-to-point-settings.js +6 -6
  25. package/lib/endpoints/accounts/print-settings.js +9 -6
  26. package/lib/endpoints/accounts/print-templates.js +37 -21
  27. package/lib/endpoints/accounts/printers.js +10 -4
  28. package/lib/endpoints/accounts/rms-settings.js +19 -11
  29. package/lib/endpoints/accounts/salesforce-settings.js +8 -6
  30. package/lib/endpoints/accounts/shift-settings.js +7 -6
  31. package/lib/endpoints/accounts/shifts.js +13 -9
  32. package/lib/endpoints/accounts/sms-templates.js +28 -19
  33. package/lib/endpoints/accounts/sub-print-templates.js +5 -3
  34. package/lib/endpoints/accounts/ticket-movement-settings.js +8 -5
  35. package/lib/endpoints/accounts/travellers.js +18 -12
  36. package/lib/endpoints/accounts/trusted-machines.js +11 -8
  37. package/lib/endpoints/accounts/twilio-settings.js +8 -5
  38. package/lib/endpoints/accounts/users.js +105 -63
  39. package/lib/endpoints/accounts/verified-emails.js +130 -0
  40. package/lib/endpoints/accounts/websales-config.js +7 -5
  41. package/lib/endpoints/coltrane/healthcheck.js +35 -0
  42. package/lib/endpoints/coltrane/info.js +35 -0
  43. package/lib/endpoints/coltrane/paths.js +17 -13
  44. package/package.json +1 -1
  45. package/src/client.js +5 -0
  46. package/src/endpoints/accounts/agencies.js +40 -0
  47. package/src/endpoints/accounts/application-settings.js +19 -18
  48. package/src/endpoints/accounts/applications.js +8 -7
  49. package/src/endpoints/accounts/customers.js +27 -24
  50. package/src/endpoints/accounts/domains.js +16 -11
  51. package/src/endpoints/accounts/email-settings.js +22 -18
  52. package/src/endpoints/accounts/email-templates.js +8 -4
  53. package/src/endpoints/accounts/exchange-rates.js +12 -7
  54. package/src/endpoints/accounts/exchange-receipts.js +10 -6
  55. package/src/endpoints/accounts/external-customers.js +37 -0
  56. package/src/endpoints/accounts/goal-settings.js +8 -6
  57. package/src/endpoints/accounts/images.js +14 -13
  58. package/src/endpoints/accounts/interline.js +35 -28
  59. package/src/endpoints/accounts/journey-prices-settings.js +8 -6
  60. package/src/endpoints/accounts/lexicons.js +13 -13
  61. package/src/endpoints/accounts/market-pricing-settings.js +7 -6
  62. package/src/endpoints/accounts/multiproduct-sales-settings.js +7 -6
  63. package/src/endpoints/accounts/network.js +28 -14
  64. package/src/endpoints/accounts/operation-settings.js +8 -6
  65. package/src/endpoints/accounts/people-lookups.js +17 -17
  66. package/src/endpoints/accounts/point-to-point-settings.js +6 -6
  67. package/src/endpoints/accounts/print-settings.js +9 -7
  68. package/src/endpoints/accounts/print-templates.js +31 -19
  69. package/src/endpoints/accounts/printers.js +10 -5
  70. package/src/endpoints/accounts/rms-settings.js +19 -11
  71. package/src/endpoints/accounts/salesforce-settings.js +8 -6
  72. package/src/endpoints/accounts/shift-settings.js +7 -6
  73. package/src/endpoints/accounts/shifts.js +13 -9
  74. package/src/endpoints/accounts/sms-templates.js +28 -19
  75. package/src/endpoints/accounts/sub-print-templates.js +5 -3
  76. package/src/endpoints/accounts/ticket-movement-settings.js +8 -5
  77. package/src/endpoints/accounts/travellers.js +18 -12
  78. package/src/endpoints/accounts/trusted-machines.js +11 -8
  79. package/src/endpoints/accounts/twilio-settings.js +8 -5
  80. package/src/endpoints/accounts/users.js +42 -5
  81. package/src/endpoints/accounts/verified-emails.js +100 -0
  82. package/src/endpoints/accounts/websales-config.js +7 -5
  83. package/src/endpoints/coltrane/healthcheck.js +28 -0
  84. package/src/endpoints/coltrane/info.js +28 -0
  85. package/src/endpoints/coltrane/paths.js +17 -13
  86. package/test/endpoints/accounts/agencies.test.js +58 -0
  87. package/test/endpoints/accounts/external-customers.test.js +62 -0
  88. package/test/endpoints/accounts/users.js +10 -0
  89. package/test/endpoints/accounts/verified-emails.test.js +35 -0
  90. package/test/endpoints/coltrane/healthcheck.test.js +13 -0
  91. package/test/endpoints/coltrane/info.test.js +13 -0
  92. package/types/endpoints/accounts/users.d.ts +2 -1
  93. package/types/endpoints/accounts/verified-emails.d.ts +19 -0
@@ -12,6 +12,7 @@ const {
12
12
  * @property {string} [sort] - relevance | natural | createdAsc | createdDesc | updatedAsc | updatedDesc
13
13
  * @property {string} [templateCollectionId] - default | custom
14
14
  * @property {string} [status] - draft | published
15
+ * @property {string} [agencyId] - Filter sub-templates for this agency (ObjectId)
15
16
  * @property {string} [mainTemplateAccountId] - Filter by source provider (ObjectId)
16
17
  * @property {string} [lang] - ISO language code (e.g. en-us)
17
18
  * @property {number} [page] - 1-based page for pagination
@@ -41,12 +42,13 @@ const {
41
42
  */
42
43
  function smsTemplatesFactory({client, internalAuthTokenProvider}) {
43
44
  /**
44
- * GET /sms-templates/types - returns available template types. API does not accept query params.
45
+ * GET /sms-templates/types - returns available template types.
45
46
  * @param {Object} opts
46
47
  * @param {string} [opts.token] - API key
47
48
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
48
49
  * @param {Object} [opts.headers] - Optional headers
49
- * @returns {Promise<import("axios").AxiosResponse>}
50
+ * @returns {Promise<import("axios").AxiosResponse<{ types: string[] }>>}
51
+ * @throws {import("axios").AxiosError} 401, 500
50
52
  */
51
53
  function getTypes({token, jwtToken, headers}) {
52
54
  return client({
@@ -56,13 +58,14 @@ function smsTemplatesFactory({client, internalAuthTokenProvider}) {
56
58
  }
57
59
 
58
60
  /**
59
- * GET /sms-templates - list SMS templates.
61
+ * GET /sms-templates - list SMS templates (paginated when page is provided).
60
62
  * @param {Object} opts
61
63
  * @param {string} [opts.token] - API key
62
64
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
63
- * @param {SmsTemplatesListQuery} [opts.query] - Query params (providerId, type, channel, sort, etc.)
65
+ * @param {SmsTemplatesListQuery} [opts.query] - Query params (providerId, type, channel, sort, agencyId, etc.)
64
66
  * @param {Object} [opts.headers] - Optional headers
65
- * @returns {Promise<import("axios").AxiosResponse>}
67
+ * @returns {Promise<import("axios").AxiosResponse<{ smsTemplates: object[], next?: string, previous?: string, totalRecords?: number, page?: number }>>}
68
+ * @throws {import("axios").AxiosError} 400 WRONG_DATA, 401, 500
66
69
  */
67
70
  function all({token, jwtToken, query = {}, headers}) {
68
71
  return client({
@@ -80,7 +83,8 @@ function smsTemplatesFactory({client, internalAuthTokenProvider}) {
80
83
  * @param {string} opts.smsTemplateId - Template id (ObjectId)
81
84
  * @param {SmsTemplateGetByIdQuery} [opts.query] - Query params (providerId, superUserId, superUserHash)
82
85
  * @param {Object} [opts.headers] - Optional headers
83
- * @returns {Promise<import("axios").AxiosResponse>}
86
+ * @returns {Promise<import("axios").AxiosResponse<{ smsTemplate: object }>>}
87
+ * @throws {import("axios").AxiosError} 400 INVALID_SMS_TEMPLATE_ID / INVALID_PROVIDER_ID, 401, 404 SMS_TEMPLATE_NOT_FOUND, 500
84
88
  */
85
89
  function get({token, jwtToken, smsTemplateId, query = {}, headers}) {
86
90
  return client({
@@ -91,13 +95,14 @@ function smsTemplatesFactory({client, internalAuthTokenProvider}) {
91
95
  }
92
96
 
93
97
  /**
94
- * POST /sms-templates - create an SMS template. API does not accept query params.
98
+ * POST /sms-templates - create an SMS template. Body: smsTemplate (name, type, lang, txtTemplate required).
95
99
  * @param {Object} opts
96
100
  * @param {string} [opts.token] - API key
97
101
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
98
- * @param {Object} opts.data - Request body
102
+ * @param {Object} opts.data - Request body (smsTemplate or root with name, type, lang, txtTemplate)
99
103
  * @param {Object} [opts.headers] - Optional headers
100
- * @returns {Promise<import("axios").AxiosResponse>}
104
+ * @returns {Promise<import("axios").AxiosResponse<{ smsTemplate: object }>>}
105
+ * @throws {import("axios").AxiosError} 400 WRONG_DATA / TEMPLATE_* / LANG_* / TXT_TEMPLATE_REQUIRED, 401 NOT_SUPER_USER, 500
101
106
  */
102
107
  function create({token, jwtToken, data, headers}) {
103
108
  return client({
@@ -109,14 +114,15 @@ function smsTemplatesFactory({client, internalAuthTokenProvider}) {
109
114
  }
110
115
 
111
116
  /**
112
- * PUT /sms-templates/:smsTemplateId - update an SMS template. API does not accept query params.
117
+ * PUT /sms-templates/:smsTemplateId - update an SMS template. Body: smsTemplate (name, type, txtTemplate required; lang read-only).
113
118
  * @param {Object} opts
114
119
  * @param {string} [opts.token] - API key
115
120
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
116
121
  * @param {string} opts.smsTemplateId - Template id (ObjectId)
117
- * @param {Object} opts.data - Request body
122
+ * @param {Object} opts.data - Request body (smsTemplate or root)
118
123
  * @param {Object} [opts.headers] - Optional headers
119
- * @returns {Promise<import("axios").AxiosResponse>}
124
+ * @returns {Promise<import("axios").AxiosResponse<{ smsTemplate: object }>>}
125
+ * @throws {import("axios").AxiosError} 400 WRONG_DATA / TEMPLATE_* / TXT_TEMPLATE_REQUIRED, 401 NOT_SUPER_USER, 404 SMS_TEMPLATE_NOT_FOUND, 500
120
126
  */
121
127
  function update({token, jwtToken, smsTemplateId, data, headers}) {
122
128
  return client({
@@ -128,13 +134,14 @@ function smsTemplatesFactory({client, internalAuthTokenProvider}) {
128
134
  }
129
135
 
130
136
  /**
131
- * DELETE /sms-templates/:smsTemplateId - delete an SMS template. API does not accept query params.
137
+ * DELETE /sms-templates/:smsTemplateId - delete an SMS template.
132
138
  * @param {Object} opts
133
139
  * @param {string} [opts.token] - API key
134
140
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
135
141
  * @param {string} opts.smsTemplateId - Template id (ObjectId)
136
142
  * @param {Object} [opts.headers] - Optional headers
137
- * @returns {Promise<import("axios").AxiosResponse>}
143
+ * @returns {Promise<import("axios").AxiosResponse<{ smsTemplateId: string }>>}
144
+ * @throws {import("axios").AxiosError} 400 SMS_TEMPLATE_ID, 401, 404 SMS_TEMPLATE_NOT_FOUND, 500
138
145
  */
139
146
  function remove({token, jwtToken, smsTemplateId, headers}) {
140
147
  return client({
@@ -145,14 +152,15 @@ function smsTemplatesFactory({client, internalAuthTokenProvider}) {
145
152
  }
146
153
 
147
154
  /**
148
- * POST /sub-sms-templates - create a sub SMS template from a main template. API does not accept query params.
155
+ * POST /sub-sms-templates - create a sub SMS template from a main template.
149
156
  * @param {Object} opts
150
157
  * @param {string} [opts.token] - API key
151
158
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
152
159
  * @param {string} opts.mainTemplateId - Main template id (ObjectId)
153
160
  * @param {string} opts.agencyId - Agency id (ObjectId)
154
161
  * @param {Object} [opts.headers] - Optional headers
155
- * @returns {Promise<import("axios").AxiosResponse>}
162
+ * @returns {Promise<import("axios").AxiosResponse<{ smsTemplate: object }>>}
163
+ * @throws {import("axios").AxiosError} 400 WRONG_DATA / MAIN_TEMPLATE_IS_NOT_CUSTOM, 401 MAIN_TEMPLATE_ACCOUNT_MISMATCH / MAIN_TEMPLATE_NOT_FROM_PROVIDER, 404 MAIN_TEMPLATE_NOT_FOUND, 500
156
164
  */
157
165
  function createSub({token, jwtToken, mainTemplateId, agencyId, headers}) {
158
166
  return client({
@@ -165,15 +173,16 @@ function smsTemplatesFactory({client, internalAuthTokenProvider}) {
165
173
 
166
174
  const versions = {
167
175
  /**
168
- * PUT /sms-templates/:smsTemplateId/versions/:versionId - roll back sms template to a version.
176
+ * PUT /sms-templates/:smsTemplateId/versions/:versionId - roll back SMS template to a saved version (versionId = zero-based index).
169
177
  * @param {Object} opts
170
178
  * @param {string} [opts.token] - API key
171
179
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
172
180
  * @param {string} opts.smsTemplateId - Template id (ObjectId)
173
181
  * @param {string} opts.versionId - Zero-based version index (e.g. "0", "1")
174
- * @param {SmsTemplateVersionUpdateQuery} [opts.query] - Query params (superUserId, superUserHash)
182
+ * @param {SmsTemplateVersionUpdateQuery} [opts.query] - Query params (superUserId, superUserHash for default templates)
175
183
  * @param {Object} [opts.headers] - Optional headers
176
- * @returns {Promise<import("axios").AxiosResponse>}
184
+ * @returns {Promise<import("axios").AxiosResponse<{ smsTemplate: object }>>}
185
+ * @throws {import("axios").AxiosError} 400 WRONG_DATA, 401 NOT_SUPER_USER, 404 SMS_TEMPLATE_NOT_FOUND / SMS_TEMPLATE_VERSION_NOT_FOUND, 500
177
186
  */
178
187
  update({token, jwtToken, smsTemplateId, versionId, query = {}, headers}) {
179
188
  return client({
@@ -1,3 +1,4 @@
1
+ /* eslint-disable max-len */
1
2
  const {
2
3
  authorizationHeaders
3
4
  } = require("./../endpoints_helpers.js");
@@ -11,13 +12,14 @@ const {
11
12
  */
12
13
  function subPrintTemplatesFactory({client, internalAuthTokenProvider}) {
13
14
  /**
14
- * POST /sub-print-templates - create a sub print template. API does not accept query params.
15
+ * POST /sub-print-templates - create a sub print template from a main template (body: agencyId, mainTemplateId).
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
- * @param {Object} opts.subPrintTemplate - Sub print template payload
19
+ * @param {Object} opts.subPrintTemplate - Payload with agencyId and mainTemplateId (both ObjectIds)
19
20
  * @param {Object} [opts.headers] - Optional headers
20
- * @returns {Promise<import("axios").AxiosResponse>}
21
+ * @returns {Promise<import("axios").AxiosResponse<{ printTemplate: object }>>}
22
+ * @throws {import("axios").AxiosError} 400 WRONG_DATA / MAIN_TEMPLATE_IS_NOT_CUSTOM, 401 MAIN_TEMPLATE_ACCOUNT_MISMATCH / MAIN_TEMPLATE_NOT_FROM_PROVIDER, 404 MAIN_TEMPLATE_NOT_FOUND, 500
21
23
  */
22
24
  function create({jwtToken, token, subPrintTemplate, headers}) {
23
25
  return client({
@@ -11,12 +11,13 @@ const {
11
11
  */
12
12
  function ticketMovementSettingsFactory({client, internalAuthTokenProvider}) {
13
13
  /**
14
- * GET /ticket-movement-settings - get ticket movement settings. API does not accept query params.
14
+ * GET /ticket-movement-settings - get ticket movement settings for the account.
15
+ * No query or path parameters. See get-handler getSpec() in btrz-api-accounts for response schema.
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<Object>>} Response body: ticket movement settings object. Errors: 401, 500
20
21
  */
21
22
  function get({token, jwtToken, headers}) {
22
23
  return client({
@@ -26,13 +27,15 @@ function ticketMovementSettingsFactory({client, internalAuthTokenProvider}) {
26
27
  }
27
28
 
28
29
  /**
29
- * PUT /ticket-movement-settings - update ticket movement settings. API does not accept query params.
30
+ * PUT /ticket-movement-settings - update ticket movement settings for the account.
31
+ * Body must include all required fields (see put-handler getSpec() in btrz-api-accounts).
32
+ * Side effect: persists to account.preferences.ticketMovements.
30
33
  * @param {Object} opts
31
34
  * @param {string} [opts.token] - API key
32
35
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
33
- * @param {Object} opts.ticketMovementSettings - Settings payload
36
+ * @param {Object} opts.ticketMovementSettings - Full settings payload (see put-handler getSpec())
34
37
  * @param {Object} [opts.headers] - Optional headers
35
- * @returns {Promise<import("axios").AxiosResponse>}
38
+ * @returns {Promise<import("axios").AxiosResponse<Object>>} Updated settings. Errors: 400, 401, 500
36
39
  */
37
40
  function update({token, jwtToken, ticketMovementSettings, headers}) {
38
41
  return client({
@@ -23,13 +23,14 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
23
23
  */
24
24
  function travellersFactory({client, internalAuthTokenProvider}) {
25
25
  /**
26
- * GET /travellers - list travellers.
26
+ * GET /travellers - list travellers for the account. See get-handler getSpec() in btrz-api-accounts.
27
27
  * @param {Object} opts
28
28
  * @param {string} [opts.token] - API key
29
29
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
30
30
  * @param {TravellersListQuery} [opts.query] - Query params (customerId, page, providerIds)
31
31
  * @param {Object} [opts.headers] - Optional headers
32
- * @returns {Promise<import("axios").AxiosResponse>}
32
+ * @returns {Promise<import("axios").AxiosResponse<{ travellers: Array, page?: number, count?: number }>>}
33
+ * Errors: 401, 404 (CUSTOMER_NOT_FOUND), 500
33
34
  */
34
35
  function all({token, jwtToken, query, headers}) {
35
36
  return client({
@@ -40,13 +41,15 @@ function travellersFactory({client, internalAuthTokenProvider}) {
40
41
  }
41
42
 
42
43
  /**
43
- * GET /travellers/:id - get a traveller. API does not accept query params.
44
+ * GET /travellers/:id - get a traveller by id. See get-by-id-handler getSpec() in btrz-api-accounts.
44
45
  * @param {Object} opts
45
46
  * @param {string} [opts.token] - API key
46
47
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
47
48
  * @param {string} opts.id - Traveller id (ObjectId)
49
+ * @param {Object} [opts.query] - Optional query params
48
50
  * @param {Object} [opts.headers] - Optional headers
49
- * @returns {Promise<import("axios").AxiosResponse>}
51
+ * @returns {Promise<import("axios").AxiosResponse<{ traveller: Object }>>}
52
+ * Errors: 400, 401, 404 (TRAVELLER_NOT_FOUND), 500
50
53
  */
51
54
  function get({token, jwtToken, id, query = {}, headers}) {
52
55
  return client({
@@ -58,15 +61,16 @@ function travellersFactory({client, internalAuthTokenProvider}) {
58
61
  }
59
62
 
60
63
  /**
61
- * PUT /travellers/:id - update a traveller.
64
+ * PUT /travellers/:id - update a traveller. See put-handler getSpec() in btrz-api-accounts.
62
65
  * @param {Object} opts
63
66
  * @param {string} [opts.token] - API key
64
67
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
65
68
  * @param {string} opts.id - Traveller id (ObjectId)
66
- * @param {Object} opts.data - Traveller payload
69
+ * @param {Object} opts.data - Traveller payload (TravellerPutData)
67
70
  * @param {TravellerProviderIdsQuery} [opts.query] - Query params (providerIds)
68
71
  * @param {Object} [opts.headers] - Optional headers
69
- * @returns {Promise<import("axios").AxiosResponse>}
72
+ * @returns {Promise<import("axios").AxiosResponse<{ traveller: Object }>>}
73
+ * Errors: 400, 401, 404, 409, 500
70
74
  */
71
75
  function update({token, jwtToken, id, data, query = {}, headers}) {
72
76
  return client({
@@ -79,14 +83,15 @@ function travellersFactory({client, internalAuthTokenProvider}) {
79
83
  }
80
84
 
81
85
  /**
82
- * DELETE /travellers/:id - remove a traveller.
86
+ * DELETE /travellers/:id - remove a traveller. Returns 204 No Content. See delete-handler getSpec().
83
87
  * @param {Object} opts
84
88
  * @param {string} [opts.token] - API key
85
89
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
86
90
  * @param {string} opts.id - Traveller id (ObjectId)
87
91
  * @param {TravellerProviderIdsQuery} [opts.query] - Query params (providerIds)
88
92
  * @param {Object} [opts.headers] - Optional headers
89
- * @returns {Promise<import("axios").AxiosResponse>}
93
+ * @returns {Promise<import("axios").AxiosResponse<void>>}
94
+ * Errors: 400, 401, 404 (TRAVELLER_NOT_FOUND), 500
90
95
  */
91
96
  function remove({token, jwtToken, id, query = {}, headers}) {
92
97
  return client({
@@ -98,14 +103,15 @@ function travellersFactory({client, internalAuthTokenProvider}) {
98
103
  }
99
104
 
100
105
  /**
101
- * POST /travellers - create a traveller.
106
+ * POST /travellers - create a traveller. Returns 201. See post-handler getSpec() in btrz-api-accounts.
102
107
  * @param {Object} opts
103
108
  * @param {string} [opts.token] - API key
104
109
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
105
- * @param {Object} opts.data - Traveller payload
110
+ * @param {Object} opts.data - Traveller payload (TravellerPostData: customerId, fareId, cards, etc.)
106
111
  * @param {TravellerProviderIdsQuery} [opts.query] - Query params (providerIds)
107
112
  * @param {Object} [opts.headers] - Optional headers
108
- * @returns {Promise<import("axios").AxiosResponse>}
113
+ * @returns {Promise<import("axios").AxiosResponse<{ traveller: Object }>>}
114
+ * Errors: 400, 401, 404, 409, 500
109
115
  */
110
116
  function create({token, jwtToken, query = {}, data, headers}) {
111
117
  return client({
@@ -17,13 +17,14 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
17
17
  */
18
18
  function trustedMachinesFactory({client, internalAuthTokenProvider}) {
19
19
  /**
20
- * POST /trusted-machines - create (register) a trusted machine. API does not accept query params.
20
+ * POST /trusted-machines - trust the machine (hideInDocumentation: true in API). Sets cookie via Set-Cookie.
21
21
  * @param {Object} opts
22
22
  * @param {string} [opts.token] - API key
23
23
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
24
- * @param {Object} opts.data - Trusted machine payload
24
+ * @param {Object} opts.data - Body (NewTrustedMachine: expirationDays, browserFingerprint, etc.)
25
25
  * @param {Object} [opts.headers] - Optional headers
26
- * @returns {Promise<import("axios").AxiosResponse>}
26
+ * @returns {Promise<import("axios").AxiosResponse<{ result: string, trustedMachine: Object }>>}
27
+ * Errors: 400, 401, 409, 500
27
28
  */
28
29
  function create({token, jwtToken, data, headers}) {
29
30
  return client({
@@ -36,13 +37,14 @@ function trustedMachinesFactory({client, internalAuthTokenProvider}) {
36
37
  }
37
38
 
38
39
  /**
39
- * GET /trusted-machines/:id - get a trusted machine. API does not accept query params.
40
+ * GET /trusted-machines/:id - get a trusted machine by id. See get-by-id-handler getSpec() in btrz-api-accounts.
40
41
  * @param {Object} opts
41
42
  * @param {string} [opts.token] - API key
42
43
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
43
44
  * @param {string} opts.id - Trusted machine id (ObjectId)
44
45
  * @param {Object} [opts.headers] - Optional headers
45
- * @returns {Promise<import("axios").AxiosResponse>}
46
+ * @returns {Promise<import("axios").AxiosResponse<{ trustedmachine: Object }>>}
47
+ * Errors: 400, 401, 404 (TRUSTED_MACHINE_NOT_FOUND), 500
46
48
  */
47
49
  function get({token, jwtToken, id, headers}) {
48
50
  return client({
@@ -53,13 +55,14 @@ function trustedMachinesFactory({client, internalAuthTokenProvider}) {
53
55
  }
54
56
 
55
57
  /**
56
- * GET /trusted-machines - list trusted machines.
58
+ * GET /trusted-machines - list enabled trusted machines for the account. See get-handler getSpec().
57
59
  * @param {Object} opts
58
60
  * @param {string} [opts.token] - API key
59
61
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
60
- * @param {TrustedMachinesListQuery} [opts.query] - Query params (userId, page, recordsPerPage)
62
+ * @param {TrustedMachinesListQuery} [opts.query] - Query params (userId, page, recordsPerPage max 100)
61
63
  * @param {Object} [opts.headers] - Optional headers
62
- * @returns {Promise<import("axios").AxiosResponse>}
64
+ * @returns {Promise<import("axios").AxiosResponse<{ trustedmachines: Array }>>}
65
+ * Paginated. Errors: 401, 500
63
66
  */
64
67
  function all({token, jwtToken, query = {}, headers}) {
65
68
  return client({
@@ -11,12 +11,14 @@ const {
11
11
  */
12
12
  function twilioSettingsFactory({client, internalAuthTokenProvider}) {
13
13
  /**
14
- * GET /twilio-settings - get Twilio settings. API does not accept query params.
14
+ * GET /twilio-settings - get Twilio settings for the account. See get-handler getSpec() in btrz-api-accounts.
15
15
  * @param {Object} opts
16
16
  * @param {string} [opts.token] - API key
17
17
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
18
+ * @param {Object} [opts.query] - Optional query params
18
19
  * @param {Object} [opts.headers] - Optional headers
19
- * @returns {Promise<import("axios").AxiosResponse>}
20
+ * @returns {Promise<import("axios").AxiosResponse<{ twilioSettings: Object }>>}
21
+ * Errors: 401, 404 (TWILIO_SETTINGS_NOT_FOUND), 500
20
22
  */
21
23
  function get({jwtToken, token, query, headers}) {
22
24
  return client({
@@ -27,13 +29,14 @@ function twilioSettingsFactory({client, internalAuthTokenProvider}) {
27
29
  }
28
30
 
29
31
  /**
30
- * PUT /twilio-settings - update Twilio settings. API does not accept query params.
32
+ * PUT /twilio-settings - update Twilio settings. See put-handler getSpec() in btrz-api-accounts.
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.twilioSettings - Settings payload
36
+ * @param {Object} opts.twilioSettings - Settings payload (TwilioSettingsPayload: enabled, sendingNumber, etc.)
35
37
  * @param {Object} [opts.headers] - Optional headers
36
- * @returns {Promise<import("axios").AxiosResponse>}
38
+ * @returns {Promise<import("axios").AxiosResponse<{ twilioSettings: Object }>>}
39
+ * Errors: 401, 404, 409, 500
37
40
  */
38
41
  function update({jwtToken, token, twilioSettings, headers}) {
39
42
  return client({
@@ -1,6 +1,24 @@
1
1
  /* eslint-disable max-len */
2
2
  const {authorizationHeaders} = require("./../endpoints_helpers.js");
3
3
 
4
+ /**
5
+ * Query params for GET /users (btrz-api-accounts). See get-users getSpec().
6
+ * @typedef {Object} GetUsersListQuery
7
+ * @property {number} [page] - Page number (1-based). When provided, response is limited to pageSize items.
8
+ * @property {string} [deleted] - "true" | "false" to filter by deleted flag
9
+ * @property {string} [firstName] - Filter by first name (prefix, case-insensitive)
10
+ * @property {string} [lastName] - Filter by last name (prefix, case-insensitive)
11
+ * @property {string} [display] - Filter by display name (prefix, case-insensitive)
12
+ * @property {string} [externalId] - Filter by external ID (exact)
13
+ * @property {string} [employeeNumber] - Filter by employee number (exact)
14
+ * @property {string} [email] - Filter by email (prefix, case-insensitive)
15
+ * @property {string} [assignableToManifest] - "true" | "false"
16
+ * @property {string} [role] - Filter users that have this role (role key)
17
+ * @property {string} [excludedRoles] - Comma-separated role keys to exclude
18
+ * @property {string} [preferredLocationId] - Filter by preferred location ID
19
+ * @property {string} [preferredLocationIds] - Filter by preferred location IDs
20
+ */
21
+
4
22
  /**
5
23
  * Query params for GET /users/:userId/sequences (btrz-api-accounts). See get-user-sequences-handler getSpec().
6
24
  * @typedef {Object} UserSequencesListQuery
@@ -13,7 +31,7 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
13
31
  * @param {Object} deps
14
32
  * @param {import("axios").AxiosInstance} deps.client
15
33
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
16
- * @returns {{ get: function, getV2: function, all: function, create: function, login: function, update: function, createOrUpdateMany: function, impersonate: function, startMfa: function, confirmMfa: function, disableMfa: function, sequences: { get: function, all: function, create: function, update: function, transfer: function } }}
34
+ * @returns {{ get: function, getV2: function, all: function, create: function, login: function, update: function, delete: function, createOrUpdateMany: function, impersonate: function, startMfa: function, confirmMfa: function, disableMfa: function, sequences: { get: function, all: function, create: function, update: function, transfer: function } }}
17
35
  */
18
36
  function usersFactory({client, internalAuthTokenProvider}) {
19
37
  /**
@@ -49,10 +67,11 @@ function usersFactory({client, internalAuthTokenProvider}) {
49
67
  }
50
68
 
51
69
  /**
52
- * GET /users - list users. API getSpec() does not define query params.
70
+ * GET /users - list users with optional pagination and filters.
53
71
  * @param {Object} opts
54
72
  * @param {string} [opts.token] - API key
55
73
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
74
+ * @param {GetUsersListQuery} [opts.query] - Query params (page, deleted, firstName, lastName, display, externalId, employeeNumber, email, assignableToManifest, role, excludedRoles, preferredLocationId, preferredLocationIds)
56
75
  * @param {Object} [opts.headers] - Optional headers
57
76
  * @returns {Promise<import("axios").AxiosResponse>}
58
77
  */
@@ -97,14 +116,14 @@ function usersFactory({client, internalAuthTokenProvider}) {
97
116
  }
98
117
 
99
118
  /**
100
- * PUT /users/:userId - update a user.
119
+ * PUT /users/:userId - update a user. Emits webhook user.updated.
101
120
  * @param {Object} opts
102
121
  * @param {string} [opts.token] - API key
103
122
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
104
123
  * @param {string} opts.userId - User id (ObjectId)
105
- * @param {Object} opts.user - User payload
124
+ * @param {Object} opts.user - User payload (allowed fields per PUT /users/:userId spec)
106
125
  * @param {Object} [opts.headers] - Optional headers
107
- * @returns {Promise<import("axios").AxiosResponse>}
126
+ * @returns {Promise<import("axios").AxiosResponse<{ user: Object }>>}
108
127
  */
109
128
  function update({token, jwtToken, userId, user, headers}) {
110
129
  return client({
@@ -115,6 +134,23 @@ function usersFactory({client, internalAuthTokenProvider}) {
115
134
  });
116
135
  }
117
136
 
137
+ /**
138
+ * DELETE /users/:id - delete a user. Emits webhook user.deleted. Returns 204 on success.
139
+ * @param {Object} opts
140
+ * @param {string} [opts.token] - API key
141
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
142
+ * @param {string} opts.id - User id (ObjectId)
143
+ * @param {Object} [opts.headers] - Optional headers
144
+ * @returns {Promise<import("axios").AxiosResponse>}
145
+ */
146
+ function deleteUser({token, jwtToken, id, headers}) {
147
+ return client({
148
+ url: `/users/${id}`,
149
+ method: "delete",
150
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
151
+ });
152
+ }
153
+
118
154
  /**
119
155
  * POST /users/import - create or update many users.
120
156
  * @param {Object} opts
@@ -306,6 +342,7 @@ function usersFactory({client, internalAuthTokenProvider}) {
306
342
  create,
307
343
  login,
308
344
  update,
345
+ delete: deleteUser,
309
346
  createOrUpdateMany,
310
347
  impersonate,
311
348
  startMfa,
@@ -0,0 +1,100 @@
1
+ const {authorizationHeaders} = require("./../endpoints_helpers.js");
2
+
3
+ /**
4
+ * Query params for GET /verified-emails (btrz-api-accounts). See get-handler getSpec().
5
+ * @typedef {Object} VerifiedEmailsListQuery
6
+ * @property {number} [page] - Page number (1-based). Default 1.
7
+ * @property {number} [pageSize] - Page size. Default 20.
8
+ */
9
+
10
+ /**
11
+ * Factory for verified-emails API (btrz-api-accounts).
12
+ * @param {Object} deps
13
+ * @param {import("axios").AxiosInstance} deps.client
14
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
15
+ * @returns {{ all: function, get: function, create: function, update: function }}
16
+ */
17
+ function verifiedEmailsFactory({client, internalAuthTokenProvider}) {
18
+ /**
19
+ * GET /verified-emails - list verified emails for the account (paginated).
20
+ * @param {Object} opts
21
+ * @param {string} [opts.token] - API key
22
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
23
+ * @param {VerifiedEmailsListQuery} [opts.query] - Query params (page, pageSize)
24
+ * @param {Object} [opts.headers] - Optional headers
25
+ * @returns {Promise<import("axios").AxiosResponse<{ verifiedEmails: Array }>>}
26
+ * Errors: 401, 500
27
+ */
28
+ function all({token, jwtToken, query = {}, headers}) {
29
+ return client({
30
+ url: "/verified-emails",
31
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
32
+ params: query
33
+ });
34
+ }
35
+
36
+ /**
37
+ * GET /verified-emails/:email - get a verified email by email address.
38
+ * @param {Object} opts
39
+ * @param {string} [opts.token] - API key
40
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
41
+ * @param {string} opts.email - Email address (path parameter)
42
+ * @param {Object} [opts.headers] - Optional headers
43
+ * @returns {Promise<import("axios").AxiosResponse<{ verifiedEmail: Object }>>}
44
+ * Errors: 400 (WRONG_DATA), 401, 404 (VERIFIED_EMAIL_NOT_FOUND), 500
45
+ */
46
+ function get({token, jwtToken, email, headers}) {
47
+ return client({
48
+ url: `/verified-emails/${encodeURIComponent(email)}`,
49
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
50
+ });
51
+ }
52
+
53
+ /**
54
+ * POST /verified-emails - create a verified email. Emits webhook verifiedEmails.created.
55
+ * @param {Object} opts
56
+ * @param {string} [opts.token] - API key
57
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
58
+ * @param {Object} opts.data - Body: email (required), status (BLACKLISTED | BLOCKED | WHITELISTED), optional QEVResponse
59
+ * @param {Object} [opts.headers] - Optional headers
60
+ * @returns {Promise<import("axios").AxiosResponse<{ verifiedEmail: Object }>>}
61
+ * Errors: 400 (WRONG_DATA, INVALID_STATUS), 401, 500
62
+ */
63
+ function create({token, jwtToken, data, headers}) {
64
+ return client({
65
+ url: "/verified-emails",
66
+ method: "post",
67
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
68
+ data
69
+ });
70
+ }
71
+
72
+ /**
73
+ * PUT /verified-emails/:email - update a verified email. Emits webhook verifiedEmails.updated.
74
+ * @param {Object} opts
75
+ * @param {string} [opts.token] - API key
76
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
77
+ * @param {string} opts.email - Email address (path parameter)
78
+ * @param {Object} opts.data - Body: status (BLACKLISTED | BLOCKED | WHITELISTED), optional QEVResponse
79
+ * @param {Object} [opts.headers] - Optional headers
80
+ * @returns {Promise<import("axios").AxiosResponse<{ verifiedEmail: Object }>>}
81
+ * Errors: 400 (INVALID_STATUS, VERIFIED_EMAIL_BLOCKED), 401, 404 (VERIFIED_EMAIL_NOT_FOUND), 500
82
+ */
83
+ function update({token, jwtToken, email, data, headers}) {
84
+ return client({
85
+ url: `/verified-emails/${encodeURIComponent(email)}`,
86
+ method: "put",
87
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
88
+ data
89
+ });
90
+ }
91
+
92
+ return {
93
+ all,
94
+ get,
95
+ create,
96
+ update
97
+ };
98
+ }
99
+
100
+ module.exports = verifiedEmailsFactory;
@@ -17,13 +17,14 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
17
17
  */
18
18
  function websalesConfigFactory({client, internalAuthTokenProvider}) {
19
19
  /**
20
- * GET /websales-config - get websales config (list).
20
+ * GET /websales-config - get websales config list (paginated). Query: domain, providerId.
21
21
  * @param {Object} opts
22
22
  * @param {string} [opts.token] - API key
23
23
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
24
24
  * @param {WebsalesConfigListQuery} [opts.query] - Query params (domain, providerId)
25
25
  * @param {Object} [opts.headers] - Optional headers
26
- * @returns {Promise<import("axios").AxiosResponse>}
26
+ * @returns {Promise<import("axios").AxiosResponse<{ websalesConfig: Array, next?: string, previous?: string, count?: number }>>}
27
+ * Errors: 401, 500
27
28
  */
28
29
  function get({token, jwtToken, query = {}, headers}) {
29
30
  return client({
@@ -34,14 +35,15 @@ function websalesConfigFactory({client, internalAuthTokenProvider}) {
34
35
  }
35
36
 
36
37
  /**
37
- * PUT /websales-config/:websalesConfigId - update websales config. API does not accept query params.
38
+ * PUT /websales-config/:websalesConfigId - update websales config. Emits webhook websalesConfig.updated.
38
39
  * @param {Object} opts
39
40
  * @param {string} [opts.token] - API key
40
41
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
41
42
  * @param {string} opts.websalesConfigId - Websales config id (ObjectId)
42
- * @param {Object} opts.websalesConfig - Config payload
43
+ * @param {Object} opts.websalesConfig - Config payload (WebsalesConfigPutData; SSO cannot be updated)
43
44
  * @param {Object} [opts.headers] - Optional headers
44
- * @returns {Promise<import("axios").AxiosResponse>}
45
+ * @returns {Promise<import("axios").AxiosResponse<{ websalesConfig: Object }>>}
46
+ * Errors: 400, 401, 404 (WEBSALESCONFIG_NOT_FOUND), 409, 500
45
47
  */
46
48
  function update({token, jwtToken, websalesConfigId, websalesConfig, headers}) {
47
49
  return client({
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Factory for Coltrane healthcheck API (btrz-api-coltrane) — liveness probe.
3
+ * @param {Object} deps
4
+ * @param {import("axios").AxiosInstance} deps.client
5
+ * @returns {{ get: function }}
6
+ */
7
+ function healthcheckFactory({client}) {
8
+ /**
9
+ * GET /healthcheck — liveness probe. Returns 200 with empty body when the service is running. No authentication required.
10
+ * @param {Object} [opts]
11
+ * @param {Object} [opts.headers] - Optional request headers
12
+ * @returns {Promise<import("axios").AxiosResponse<{ data: {} }>>}
13
+ * @throws {import("axios").AxiosError} 500 Service unhealthy or shutting down
14
+ */
15
+ function get({headers} = {}) {
16
+ return client({
17
+ url: "/healthcheck",
18
+ method: "get",
19
+ headers: headers || {}
20
+ });
21
+ }
22
+
23
+ return {
24
+ get
25
+ };
26
+ }
27
+
28
+ module.exports = healthcheckFactory;