gizmo-api
Version:
A minimal wrapper for interfacing with the Gizmo API.
23 lines • 702 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.gizmoFetch = void 0;
// Utils
const constants_1 = require("./constants");
function _fetch(url, options) {
if (typeof fetch === "function") {
return fetch(url, options);
}
else {
// eslint-disable-next-line @typescript-eslint/no-var-requires
return require("cross-fetch")(url, options);
}
}
async function gizmoFetch(uri, options = {}) {
const response = await _fetch(`${constants_1.GIZMO_ENDPOINT}${uri}`, options);
return {
status: response.status,
data: await response.json()
};
}
exports.gizmoFetch = gizmoFetch;
//# sourceMappingURL=fetch.js.map