roboto-js 1.8.8 → 1.8.9
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/dist/cjs/rbt_api.cjs +31 -21
- package/dist/esm/rbt_api.js +31 -21
- package/package.json +1 -1
- package/src/rbt_api.js +17 -8
package/dist/cjs/rbt_api.cjs
CHANGED
|
@@ -1939,11 +1939,12 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1939
1939
|
* Performs a GET request to the specified endpoint.
|
|
1940
1940
|
*
|
|
1941
1941
|
* This method uses the Axios instance to make an authenticated GET request.
|
|
1942
|
-
* The `authtoken`
|
|
1943
|
-
*
|
|
1942
|
+
* The `authtoken` and `accesskey` from axios defaults are automatically included.
|
|
1943
|
+
* Additional custom headers can be passed and will be merged with the defaults.
|
|
1944
1944
|
*
|
|
1945
1945
|
* @param {string} endpoint - The endpoint URL to which the GET request is made.
|
|
1946
1946
|
* @param {Object} [params={}] - Optional parameters to be sent with the request.
|
|
1947
|
+
* @param {Object} [customHeaders=null] - Optional custom headers to merge with defaults.
|
|
1947
1948
|
* @returns {Promise<Object>} - The response data from the API.
|
|
1948
1949
|
*/
|
|
1949
1950
|
)
|
|
@@ -1952,41 +1953,50 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1952
1953
|
value: (function () {
|
|
1953
1954
|
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(endpoint) {
|
|
1954
1955
|
var params,
|
|
1955
|
-
|
|
1956
|
+
customHeaders,
|
|
1957
|
+
config,
|
|
1956
1958
|
response,
|
|
1957
1959
|
_args29 = arguments;
|
|
1958
1960
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
1959
1961
|
while (1) switch (_context29.prev = _context29.next) {
|
|
1960
1962
|
case 0:
|
|
1961
1963
|
params = _args29.length > 1 && _args29[1] !== undefined ? _args29[1] : {};
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1964
|
+
customHeaders = _args29.length > 2 && _args29[2] !== undefined ? _args29[2] : null;
|
|
1965
|
+
_context29.prev = 2;
|
|
1966
|
+
// Build request config
|
|
1967
|
+
config = {
|
|
1968
|
+
params: params
|
|
1969
|
+
}; // Only pass headers if custom headers are provided
|
|
1970
|
+
// If no custom headers, let axios use its defaults automatically
|
|
1971
|
+
// This ensures proper merging of all default headers (accesskey, authtoken, apikey)
|
|
1972
|
+
if (customHeaders && Object.keys(customHeaders).length > 0) {
|
|
1973
|
+
// When custom headers are provided, we need to manually merge with defaults
|
|
1974
|
+
// Axios will handle merging when we pass them this way
|
|
1975
|
+
config.headers = customHeaders;
|
|
1976
|
+
}
|
|
1977
|
+
// Otherwise, don't set config.headers at all - let axios use its defaults
|
|
1978
|
+
|
|
1979
|
+
// Make the GET request using Axios
|
|
1980
|
+
_context29.next = 7;
|
|
1981
|
+
return this.axios.get(endpoint, config);
|
|
1982
|
+
case 7:
|
|
1973
1983
|
response = _context29.sent;
|
|
1974
1984
|
if (!(response.data.ok === false)) {
|
|
1975
|
-
_context29.next =
|
|
1985
|
+
_context29.next = 10;
|
|
1976
1986
|
break;
|
|
1977
1987
|
}
|
|
1978
1988
|
return _context29.abrupt("return", this._handleError(response));
|
|
1979
|
-
case
|
|
1989
|
+
case 10:
|
|
1980
1990
|
return _context29.abrupt("return", response.data);
|
|
1981
|
-
case
|
|
1982
|
-
_context29.prev =
|
|
1983
|
-
_context29.t0 = _context29["catch"](
|
|
1991
|
+
case 13:
|
|
1992
|
+
_context29.prev = 13;
|
|
1993
|
+
_context29.t0 = _context29["catch"](2);
|
|
1984
1994
|
return _context29.abrupt("return", this._handleError(_context29.t0));
|
|
1985
|
-
case
|
|
1995
|
+
case 16:
|
|
1986
1996
|
case "end":
|
|
1987
1997
|
return _context29.stop();
|
|
1988
1998
|
}
|
|
1989
|
-
}, _callee29, this, [[
|
|
1999
|
+
}, _callee29, this, [[2, 13]]);
|
|
1990
2000
|
}));
|
|
1991
2001
|
function get(_x18) {
|
|
1992
2002
|
return _get.apply(this, arguments);
|
package/dist/esm/rbt_api.js
CHANGED
|
@@ -1932,11 +1932,12 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1932
1932
|
* Performs a GET request to the specified endpoint.
|
|
1933
1933
|
*
|
|
1934
1934
|
* This method uses the Axios instance to make an authenticated GET request.
|
|
1935
|
-
* The `authtoken`
|
|
1936
|
-
*
|
|
1935
|
+
* The `authtoken` and `accesskey` from axios defaults are automatically included.
|
|
1936
|
+
* Additional custom headers can be passed and will be merged with the defaults.
|
|
1937
1937
|
*
|
|
1938
1938
|
* @param {string} endpoint - The endpoint URL to which the GET request is made.
|
|
1939
1939
|
* @param {Object} [params={}] - Optional parameters to be sent with the request.
|
|
1940
|
+
* @param {Object} [customHeaders=null] - Optional custom headers to merge with defaults.
|
|
1940
1941
|
* @returns {Promise<Object>} - The response data from the API.
|
|
1941
1942
|
*/
|
|
1942
1943
|
)
|
|
@@ -1945,41 +1946,50 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1945
1946
|
value: (function () {
|
|
1946
1947
|
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(endpoint) {
|
|
1947
1948
|
var params,
|
|
1948
|
-
|
|
1949
|
+
customHeaders,
|
|
1950
|
+
config,
|
|
1949
1951
|
response,
|
|
1950
1952
|
_args29 = arguments;
|
|
1951
1953
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
1952
1954
|
while (1) switch (_context29.prev = _context29.next) {
|
|
1953
1955
|
case 0:
|
|
1954
1956
|
params = _args29.length > 1 && _args29[1] !== undefined ? _args29[1] : {};
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1957
|
+
customHeaders = _args29.length > 2 && _args29[2] !== undefined ? _args29[2] : null;
|
|
1958
|
+
_context29.prev = 2;
|
|
1959
|
+
// Build request config
|
|
1960
|
+
config = {
|
|
1961
|
+
params: params
|
|
1962
|
+
}; // Only pass headers if custom headers are provided
|
|
1963
|
+
// If no custom headers, let axios use its defaults automatically
|
|
1964
|
+
// This ensures proper merging of all default headers (accesskey, authtoken, apikey)
|
|
1965
|
+
if (customHeaders && Object.keys(customHeaders).length > 0) {
|
|
1966
|
+
// When custom headers are provided, we need to manually merge with defaults
|
|
1967
|
+
// Axios will handle merging when we pass them this way
|
|
1968
|
+
config.headers = customHeaders;
|
|
1969
|
+
}
|
|
1970
|
+
// Otherwise, don't set config.headers at all - let axios use its defaults
|
|
1971
|
+
|
|
1972
|
+
// Make the GET request using Axios
|
|
1973
|
+
_context29.next = 7;
|
|
1974
|
+
return this.axios.get(endpoint, config);
|
|
1975
|
+
case 7:
|
|
1966
1976
|
response = _context29.sent;
|
|
1967
1977
|
if (!(response.data.ok === false)) {
|
|
1968
|
-
_context29.next =
|
|
1978
|
+
_context29.next = 10;
|
|
1969
1979
|
break;
|
|
1970
1980
|
}
|
|
1971
1981
|
return _context29.abrupt("return", this._handleError(response));
|
|
1972
|
-
case
|
|
1982
|
+
case 10:
|
|
1973
1983
|
return _context29.abrupt("return", response.data);
|
|
1974
|
-
case
|
|
1975
|
-
_context29.prev =
|
|
1976
|
-
_context29.t0 = _context29["catch"](
|
|
1984
|
+
case 13:
|
|
1985
|
+
_context29.prev = 13;
|
|
1986
|
+
_context29.t0 = _context29["catch"](2);
|
|
1977
1987
|
return _context29.abrupt("return", this._handleError(_context29.t0));
|
|
1978
|
-
case
|
|
1988
|
+
case 16:
|
|
1979
1989
|
case "end":
|
|
1980
1990
|
return _context29.stop();
|
|
1981
1991
|
}
|
|
1982
|
-
}, _callee29, this, [[
|
|
1992
|
+
}, _callee29, this, [[2, 13]]);
|
|
1983
1993
|
}));
|
|
1984
1994
|
function get(_x18) {
|
|
1985
1995
|
return _get.apply(this, arguments);
|
package/package.json
CHANGED
package/src/rbt_api.js
CHANGED
|
@@ -1239,24 +1239,33 @@ export default class RbtApi {
|
|
|
1239
1239
|
* Performs a GET request to the specified endpoint.
|
|
1240
1240
|
*
|
|
1241
1241
|
* This method uses the Axios instance to make an authenticated GET request.
|
|
1242
|
-
* The `authtoken`
|
|
1243
|
-
*
|
|
1242
|
+
* The `authtoken` and `accesskey` from axios defaults are automatically included.
|
|
1243
|
+
* Additional custom headers can be passed and will be merged with the defaults.
|
|
1244
1244
|
*
|
|
1245
1245
|
* @param {string} endpoint - The endpoint URL to which the GET request is made.
|
|
1246
1246
|
* @param {Object} [params={}] - Optional parameters to be sent with the request.
|
|
1247
|
+
* @param {Object} [customHeaders=null] - Optional custom headers to merge with defaults.
|
|
1247
1248
|
* @returns {Promise<Object>} - The response data from the API.
|
|
1248
1249
|
*/
|
|
1249
|
-
async get(endpoint, params = {}) {
|
|
1250
|
+
async get(endpoint, params = {}, customHeaders = null) {
|
|
1250
1251
|
|
|
1251
1252
|
try {
|
|
1252
1253
|
|
|
1253
|
-
//
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1256
|
-
|
|
1254
|
+
// Build request config
|
|
1255
|
+
const config = { params };
|
|
1256
|
+
|
|
1257
|
+
// Only pass headers if custom headers are provided
|
|
1258
|
+
// If no custom headers, let axios use its defaults automatically
|
|
1259
|
+
// This ensures proper merging of all default headers (accesskey, authtoken, apikey)
|
|
1260
|
+
if (customHeaders && Object.keys(customHeaders).length > 0) {
|
|
1261
|
+
// When custom headers are provided, we need to manually merge with defaults
|
|
1262
|
+
// Axios will handle merging when we pass them this way
|
|
1263
|
+
config.headers = customHeaders;
|
|
1264
|
+
}
|
|
1265
|
+
// Otherwise, don't set config.headers at all - let axios use its defaults
|
|
1257
1266
|
|
|
1258
1267
|
// Make the GET request using Axios
|
|
1259
|
-
const response = await this.axios.get(endpoint,
|
|
1268
|
+
const response = await this.axios.get(endpoint, config);
|
|
1260
1269
|
|
|
1261
1270
|
// Check if the response is not okay
|
|
1262
1271
|
if (response.data.ok === false) {
|