https://github.com/willmeyers/stainless-cli
A work-in-progress command-line utility for interacting with Stainless. This project is in no way affiliated with or supported by Stainless.
https://github.com/willmeyers/stainless-cli
cli code-generation openapi
Last synced: 7 months ago
JSON representation
A work-in-progress command-line utility for interacting with Stainless. This project is in no way affiliated with or supported by Stainless.
- Host: GitHub
- URL: https://github.com/willmeyers/stainless-cli
- Owner: willmeyers
- License: mit
- Created: 2024-04-24T07:02:58.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-28T14:44:59.000Z (almost 2 years ago)
- Last Synced: 2024-04-28T15:39:49.858Z (almost 2 years ago)
- Topics: cli, code-generation, openapi
- Language: Go
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Stainless API CLI
This is a tiny command-line utility for interacting with [Stainless API](https://www.stainlessapi.com/).
> This project is in no way affiated Stainless API.
## Installing
### Download Binary
[Download your platform's binary here](https://github.com/willmeyers/stainless-cli/releases).
### Building from Source
Simply run (for Linux and MacOS):
```bash
git clone https://github.com/willmeyers/stainless-cli
cd stainless-cli
make build
mv build/stainless-[darwin|linux] /usr/local/bin/stainless-cli
```
Windows binaries are available as well.
## 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:
```bash
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:
```bash
stainless-cli orgs
```
## Generate SDKs via the Command Line
The CLI is great for quickly executing SDK generations. To get started, run:
```bash
stainless-cli generate --help
```
You'll need a few items on hand to generate an SDK:
0. An existing organization and project
1. Your OpenAPI schema spec (in yaml)
2. You Stainless API config (in yaml)
From there you generate your project's SDKs with:
```bash
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.
```bash
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
```bash
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.