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',
    ],
    defaultsTo: 'post',
  );
  argParser.addOption('path');
  argParser.addOption(
    'header',
    help: 'path file json additional header fetch api',
  );
  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)',
  );
}