How to use the @twilio-labs/serverless-api.TwilioServerlessApiClient function in @twilio-labs/serverless-api

To help you get started, we’ve selected a few @twilio-labs/serverless-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github twilio-labs / twilio-run / src / commands / deploy.ts View on Github external
if (!config) {
    logError('Internal Error');
    process.exit(1);
    return;
  }

  debug('Deploy Config %P', config);

  checkConfigForCredentials(config);

  printConfigInfo(config);

  const spinner = getOraSpinner('Deploying Function').start();
  try {
    const client = new TwilioServerlessApiClient(config);
    client.on('status-update', evt => {
      spinner.text = evt.message + '\n';
    });
    const result = await client.deployLocalProject(config);
    spinner.text = 'Serverless project successfully deployed\n';
    spinner.succeed();
    printDeployedResources(config, result);
    const { serviceSid, buildSid } = result;
    await saveLatestDeploymentData(
      config.cwd,
      serviceSid,
      buildSid,
      config.accountSid.startsWith('AC')
        ? config.accountSid
        : externalCliOptions && externalCliOptions.accountSid
    );
github twilio-labs / twilio-run / src / commands / activate.ts View on Github external
process.exit(1);
    return;
  }

  checkConfigForCredentials(config);

  printActivateConfig(config);

  const details = config.buildSid
    ? `(${config.buildSid})`
    : `from ${config.sourceEnvironment}`;
  const spinner = getOraSpinner(
    `Activating build ${details} to ${config.targetEnvironment || 'production'}`
  ).start();
  try {
    const client = new TwilioServerlessApiClient(config);
    const result = await client.activateBuild(config);
    spinner.succeed(
      `Activated new build ${details} on ${config.targetEnvironment ||
        'production'}`
    );
    printActivateResult(result);
  } catch (err) {
    handleError(err, spinner);
  }
}
github twilio-labs / twilio-run / src / commands / list.ts View on Github external
if (!config) {
    logError('Internal Error');
    process.exit(1);
    return;
  }

  checkConfigForCredentials(config);

  if (config.types !== 'services' && config.types[0] !== 'services') {
    const command = getFullCommand(flags);
    checkForValidServiceSid(command, config.serviceSid);
  }

  try {
    const client = new TwilioServerlessApiClient(config);
    const result = await client.list({ ...config });
    printListResult(result, config);
  } catch (err) {
    handleError(err);
  }
}

@twilio-labs/serverless-api

API-wrapper for the Twilio Serverless API

MIT
Latest version published 6 days ago

Package Health Score

83 / 100
Full package analysis