UNPKG

@lifeomic/cli

Version:

CLI for interacting with the LifeOmic PHC API.

24 lines (20 loc) 623 B
'use strict'; const { get, getAccount } = require('../../fhir'); const print = require('../../print'); exports.command = 'get <type> <id>'; exports.desc = 'Fetch a FHIR resource by type <type> and id <id>.'; exports.builder = yargs => { yargs.positional('type', { describe: 'The FHIR resource type.', type: 'string' }).positional('id', { describe: 'The FHIR resource ID.', type: 'string' }); }; exports.handler = async argv => { const account = getAccount(argv); const url = `/${account}/dstu3/${argv.type}/${argv.id}`; const response = await get(argv, url); print(response.data, argv); };