diff --git a/main.js b/main.js index 12bfe2b..817aa33 100644 --- a/main.js +++ b/main.js @@ -27,5 +27,9 @@ if(runidNotProvided(my_config.run_id) || !startsWithRun(my_config.run_id)){ const run_details = await get_run_details(my_config.base_url, process.argv.slice(2), my_config.token); const plan_id = run_details.data.data.relationships.plan.data.id; +console.log(`The plan ID is ${plan_id}`); -console.log(await create_plan_export(my_config.base_url, plan_id, my_config.token)); \ No newline at end of file +const export_response = await create_plan_export(my_config.base_url, plan_id, my_config.token); + +const plan_export_id = export_response.data.data.id; +console.log(`The plan export ID is ${plan_export_id}`); \ No newline at end of file diff --git a/tfc-api-functions.mjs b/tfc-api-functions.mjs index 045a70d..9a6046d 100644 --- a/tfc-api-functions.mjs +++ b/tfc-api-functions.mjs @@ -54,4 +54,12 @@ const config = { create_plan_export_data, config ) +} + +// This will check the API response for an error. +// If one is detected, it will display the code and detail, then throw a node error. +export const check_for_error = (response_object, api_call_type) => { + if(response_object.data.errors) { + + } } \ No newline at end of file