-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish generator and client to npm (#240)
* move generator and client into directories in packages/ * move package.json into generator package dir * rework gen.sh so it can be run from anywhere, take gen script out of openapi-gen * add tsup, rename openapi-gen to openapi-gen-ts * put config in package.json * move stuff into src dir * try to make CI work * put tsconfig where it belongs, whoops * put some stuff in package.json like we're really gonna publish * maybe make CI linting work * try to fix update spec action * Autogenerate config update * try crunchbang * fix exports and main * 0.1.1 * Autogenerate config update * 0.1.2 * 0.1.3 * remove publish command * fix bin name, 0.1.4 * switch bin to cjs * npm pkg fix * use tsup-node! yes! * try different approach to static files * add tsup and package.json for @oxide/api, move src into src/ * try adding /validate sub export with zod * give each package its own readme * bump package versions * fix links in generator readme and bump version * Autogenerate config update * add barebones readme to @oxide/api * remove stray TBD from readme * Update README.md * move packages up a dir, kill packages directory * update readme with versioning scheme * put msw, zod, and type test behind --features flag in CLI * fail earlier if dest dir does not exist, fix tools/gen.sh --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
e662ca5
commit a3b9d1e
Showing
41 changed files
with
4,849 additions
and
1,253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
packages/openpi-gen/node_modules | ||
node_modules | ||
dist | ||
spec.json | ||
spec.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Oxide TypeScript SDK | ||
|
||
## Usage | ||
|
||
### Installation | ||
|
||
``` | ||
npm install @oxide/api | ||
``` | ||
|
||
### Getting an API token | ||
|
||
The easiest way to get a device token is to use the CLI. | ||
|
||
``` | ||
oxide auth login --host https://my-oxide-rack.com | ||
``` | ||
|
||
Then print the token: | ||
|
||
``` | ||
oxide auth status --show-token | ||
``` | ||
|
||
In the following example it's passed to the script through the `OXIDE_TOKEN` | ||
environment variable on the assumption that you don't want to hard-code a token | ||
into a script, but this can of course be done however you want. `OXIDE_TOKEN` is | ||
not a special variable for the TypeScript SDK (it is for the CLI). | ||
|
||
### Example | ||
|
||
```ts | ||
import { Api } from "@oxide/api" | ||
|
||
const api = new Api({ | ||
host: "https://my-oxide-rack.com", | ||
token: process.env.OXIDE_TOKEN, | ||
}) | ||
|
||
const result = await api.methods.projectList({}) | ||
|
||
if (result.type === "success") { | ||
console.log(result.data.items.map((p) => p.name)) | ||
} | ||
``` | ||
|
||
## How does it all work? | ||
|
||
### Methods | ||
|
||
### Request bodies | ||
|
||
### Responses: `ApiResult<T>` | ||
|
||
## Other stuff in the package | ||
|
||
Most likely nobody but us wants this, and we should take it out of the npm package. | ||
|
||
### Mock Service Worker API skeleton | ||
|
||
### Zod validators |
Oops, something went wrong.