UNPKG

@swell/cli

Version:

Swell's command line interface/utility

20 lines (19 loc) 960 B
import { Command } from '@oclif/core'; export default class Api extends Command { static summary = 'Send requests directly to the Swell Backend API.'; static description = `Run Swell API requests directly from the command line. Supports GET, POST, PUT, and DELETE methods with optional test/live environments. Call app functions via /functions/<app_id>/<function_name> paths.`; static examples = [ 'swell api get /products', 'swell api post /products --body \'{"name":"New product"}\'', 'swell api put /products/abc123 --body ./update.json', 'swell api delete /products/abc123', 'swell api get /functions/my-app/get-inventory', 'swell api post /functions/my-app/create-order --body \'{"items":["sku-1"]}\'', ]; async run() { this.log('Use "swell api get|post|put|delete" to interact with the Swell API.'); this.log('Run "swell api --help" for more information.'); } }