UNPKG

@constructor-io/constructorio-connect-cli

Version:

CLI tool to enable users to interface with the Constructor Connect Ecosystem

29 lines (28 loc) 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getFixture = getFixture; const axios_1 = require("axios"); const errors_1 = require("@oclif/core/errors"); const ux_action_1 = require("../helpers/ux-action"); const http_client_1 = require("./http-client"); async function getFixture(args) { const client = await (0, http_client_1.getHttpClient)(); try { const response = await (0, ux_action_1.uxAction)("📡 Fetching fixtures", async () => { return await client.get(`/templates/catalog_fixture`, { params: { connection_id: args.connectionId, type: args.type, }, }); })(); return response.data; } catch (error) { if ((0, axios_1.isAxiosError)(error) && error.response) { throw new errors_1.CLIError("Something went wrong while fetching fixtures: \n" + error.response.data.message); } throw error; } }