@swell/cli
Version:
Swell's command line interface/utility
33 lines (32 loc) • 1.07 kB
JavaScript
import { Args, Flags } from '@oclif/core';
import { HttpMethod } from '../../lib/api.js';
import { SwellApiCommand } from '../../swell-api-command.js';
export default class ApiGet extends SwellApiCommand {
static summary = 'Send a GET request to the Swell API.';
static description = `Retrieve data from the Swell Backend API.
The command performs a GET request to the specified endpoint path.`;
static args = {
path: Args.string({
description: 'API endpoint path (must start with /)',
required: true,
}),
};
static flags = {
live: Flags.boolean({
description: 'Use live environment instead of test',
default: false,
}),
};
static examples = [
'swell api get /products',
'swell api get "/products?limit=10&category=shoes"',
'swell api get /products/abc123',
'swell api get /functions/my-app/get-inventory',
];
get method() {
return HttpMethod.GET;
}
async run() {
await this.request(ApiGet);
}
}