btrz-api-client 8.51.0 → 8.52.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.
@@ -7,6 +7,7 @@ var _require = require("./../endpoints_helpers.js"),
7
7
  * Query params for GET /countries (btrz-api-inventory). See get-countries getSpec().
8
8
  * @typedef {Object} CountriesListQuery
9
9
  * @property {string} [isoCode] - Country 2- or 3-letter ISO code (must be 2 or 3 chars if provided)
10
+ * @property {"name"|"ord"} [sortBy] - Sort: `name` (default) by country name ascending; `ord` by display order then name
10
11
  */
11
12
 
12
13
  /**
@@ -30,11 +31,11 @@ function countriesFactory(_ref) {
30
31
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
31
32
 
32
33
  /**
33
- * GET /countries — List countries. Optional filter by isoCode (2 or 3 characters).
34
+ * GET /countries — List countries. Optional filter by isoCode (2 or 3 characters) and sortBy.
34
35
  * @param {Object} opts
35
36
  * @param {string} [opts.token] - API key
36
37
  * @param {string} [opts.jwtToken] - JWT or internal auth
37
- * @param {CountriesListQuery} [opts.query] - Query params (isoCode)
38
+ * @param {CountriesListQuery} [opts.query] - Query params (isoCode, sortBy)
38
39
  * @param {Object} [opts.headers] - Optional headers
39
40
  * @returns {Promise<import("axios").AxiosResponse<{ countries: Object[] }>>}
40
41
  * @throws 400 Validation failure (e.g. invalid isoCode length)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "8.51.0",
3
+ "version": "8.52.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -4,6 +4,7 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
4
4
  * Query params for GET /countries (btrz-api-inventory). See get-countries getSpec().
5
5
  * @typedef {Object} CountriesListQuery
6
6
  * @property {string} [isoCode] - Country 2- or 3-letter ISO code (must be 2 or 3 chars if provided)
7
+ * @property {"name"|"ord"} [sortBy] - Sort: `name` (default) by country name ascending; `ord` by display order then name
7
8
  */
8
9
 
9
10
  /**
@@ -22,11 +23,11 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
22
23
  */
23
24
  function countriesFactory({client, internalAuthTokenProvider}) {
24
25
  /**
25
- * GET /countries — List countries. Optional filter by isoCode (2 or 3 characters).
26
+ * GET /countries — List countries. Optional filter by isoCode (2 or 3 characters) and sortBy.
26
27
  * @param {Object} opts
27
28
  * @param {string} [opts.token] - API key
28
29
  * @param {string} [opts.jwtToken] - JWT or internal auth
29
- * @param {CountriesListQuery} [opts.query] - Query params (isoCode)
30
+ * @param {CountriesListQuery} [opts.query] - Query params (isoCode, sortBy)
30
31
  * @param {Object} [opts.headers] - Optional headers
31
32
  * @returns {Promise<import("axios").AxiosResponse<{ countries: Object[] }>>}
32
33
  * @throws 400 Validation failure (e.g. invalid isoCode length)
@@ -14,6 +14,12 @@ describe("inventory/countries", () => {
14
14
  return api.inventory.countries.all({token});
15
15
  });
16
16
 
17
+ it("should list countries with query params (e.g. sortBy)", () => {
18
+ const query = {sortBy: "ord"};
19
+ axiosMock.onGet("/countries").reply(expectRequest({statusCode: 200, token, query}));
20
+ return api.inventory.countries.all({token, query});
21
+ });
22
+
17
23
  it("should get a country by id", () => {
18
24
  const countryId = "countryId";
19
25
  axiosMock.onGet(`/countries/${countryId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));