UNPKG

@swell/cli

Version:

Swell's command line interface/utility

22 lines (21 loc) 1.09 kB
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. Use --api frontend for public key authentication via the frontend API. 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"]}\'', 'swell api get /products --api frontend', ]; 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.'); } }