stainless-cli

module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2024 License: MIT

README

Stainless API CLI

This is a tiny command-line utility for interacting with Stainless API.

This project is in no way affiated Stainless API.

Installing

Download Binary

Download your platform's binary here.

Building from Source

Simply run (for Linux and MacOS):

git clone https://github.com/willmeyers/stainless-cli
cd stainless-cli
make build
mv build/stainless-[darwin|linux|windows] /usr/local/bin/stainless-cli

Get Started

Stainless does not have a complete API accessible via API keys. We must login, obtain the necessary session tokens.

To get started, run:

stainless-cli login

Complete the OAuth flow as you normally would.

After logging in, you can check your authentication status by listing your organizations with:

stainless-cli orgs

Generate SDKs via the Command Line

The CLI is great for quickly executing SDK generations. To get started, run:

stainless-cli generate --help

You'll need a few items on hand to generate an SDK:

  1. An existing organization and project
  2. Your OpenAPI schema spec (in yaml)
  3. You Stainless API config (in yaml)

From there you generate your project's SDKs with:

stainless-cli generate all --openapi ./openapi.yml --config ./stainless.yml

Finally, if an output directory (--out-dir) is given, stainless-cli will perform a git clone/pull automatically once the generation is complete.

stainless-cli generate all --openapi ./openapi.yml --config ./stainless.yml --out-dir ./sdks

After each SDK generates, its GitHub repository is cloned or updated in a respective directory inside the specified out directory.

Security

For your security, please consider running

stainless-cli logout

to remove any cached credentials saved on your filesystem. The credentials cached are session tokens and, if comprimised, can be used to login to your Stainless API account anywhere.

Directories

Path Synopsis
cmd
pkg
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL