ApiCommand constructor
ApiCommand()
Implementation
ApiCommand() {
argParser.addOptionMorphemeYaml();
argParser.addOption(
'feature-name',
abbr: 'f',
help: 'Name of the feature to be added api',
mandatory: true,
);
argParser.addOption(
'page-name',
abbr: 'p',
help: 'Name of the page to be added api',
mandatory: true,
);
argParser.addFlag(
'json2dart',
help: 'Generate models handle by json2dart',
defaultsTo: false,
);
argParser.addOption(
'method',
abbr: 'm',
allowed: [
'get',
'post',
'put',
'patch',
'delete',
'multipart',
'postMultipart',
'patchMultipart',
'head',
'getSse',
'postSse',
'putSse',
'patchSse',
'deleteSse',
'download',
],
defaultsTo: 'post',
);
argParser.addOption('path');
argParser.addOption(
'header',
help: 'path file json additional header fetch api',
);
argParser.addOption(
'return-data',
abbr: 'r',
help:
'Specify the type of data to return from the API response. Options include: model, header, body_bytes, body_string, status_code, and raw.',
allowed: [
'model',
'header',
'body_bytes',
'body_string',
'status_code',
'raw',
],
defaultsTo: 'model',
);
argParser.addFlag(
'body-list',
help: 'body for api is list',
defaultsTo: false,
);
argParser.addFlag(
'response-list',
help: 'response for api is list',
defaultsTo: false,
);
argParser.addOption(
'cache-strategy',
help: 'Strategy for caching response api',
allowed: ['async_or_cache', 'cache_or_async', 'just_async', 'just_cache'],
);
argParser.addOption(
'ttl',
help: 'Duration of expired cache in cache strategy in minutes',
);
argParser.addOption(
'keep-expired-cache',
help: 'Keep cache without expired.',
);
argParser.addOption(
'apps-name',
abbr: 'a',
help: 'Generate spesific apps (Optional)',
);
}