mirror of
https://github.com/LukeHagar/Prowlarr-TS-SDK.git
synced 2025-12-06 04:21:03 +00:00
initial generation
This commit is contained in:
30
.devcontainer/README.md
Normal file
30
.devcontainer/README.md
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
> **Remember to shutdown a GitHub Codespace when it is not in use!**
|
||||
|
||||
# Dev Containers Quick Start
|
||||
|
||||
The default location for usage snippets is the `samples` directory.
|
||||
|
||||
## Running a Usage Sample
|
||||
|
||||
A sample usage example has been provided in a `root.ts` file. As you work with the SDK, it's expected that you will modify these samples to fit your needs. To execute this particular snippet, use the command below.
|
||||
|
||||
```
|
||||
ts-node root.ts
|
||||
```
|
||||
|
||||
## Generating Additional Usage Samples
|
||||
|
||||
The speakeasy CLI allows you to generate more usage snippets. Here's how:
|
||||
|
||||
- To generate a sample for a specific operation by providing an operation ID, use:
|
||||
|
||||
```
|
||||
speakeasy generate usage -s https://raw.githubusercontent.com/Prowlarr/Prowlarr/develop/src/Prowlarr.Api.V1/openapi.json -l typescript -i {INPUT_OPERATION_ID} -o ./samples
|
||||
```
|
||||
|
||||
- To generate samples for an entire namespace (like a tag or group name), use:
|
||||
|
||||
```
|
||||
speakeasy generate usage -s https://raw.githubusercontent.com/Prowlarr/Prowlarr/develop/src/Prowlarr.Api.V1/openapi.json -l typescript -n {INPUT_TAG_NAME} -o ./samples
|
||||
```
|
||||
45
.devcontainer/devcontainer.json
Normal file
45
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,45 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/images/tree/main/src/typescript-node
|
||||
{
|
||||
"name": "TypeScript",
|
||||
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
// "features": {},
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": "sudo chmod +x ./.devcontainer/setup.sh && ./.devcontainer/setup.sh",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"ms-vscode.vscode-typescript-tslint-plugin",
|
||||
"esbenp.prettier-vscode",
|
||||
"github.vscode-pull-request-github"
|
||||
],
|
||||
"settings": {
|
||||
"files.eol": "\n",
|
||||
"editor.formatOnSave": true,
|
||||
"typescript.tsc.autoDetect": "on",
|
||||
"typescript.updateImportsOnFileMove.enabled": "always",
|
||||
"typescript.preferences.importModuleSpecifier": "relative",
|
||||
"[typescript]": {
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports": true
|
||||
}
|
||||
},
|
||||
"[typescriptreact]": {
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"codespaces": {
|
||||
"openFiles": [
|
||||
".devcontainer/README.md"
|
||||
]
|
||||
}
|
||||
}
|
||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||
// "remoteUser": "root"
|
||||
}
|
||||
30
.devcontainer/setup.sh
Normal file
30
.devcontainer/setup.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Install the speakeasy CLI
|
||||
curl -fsSL https://raw.githubusercontent.com/speakeasy-api/speakeasy/main/install.sh | sh
|
||||
|
||||
# Setup samples directory
|
||||
rmdir samples || true
|
||||
mkdir samples
|
||||
|
||||
npm install
|
||||
npm install -g ts-node
|
||||
npm link
|
||||
npm link prowlarr
|
||||
TS_CONFIG_CONTENT=$(cat <<EOL
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"openapi": ["../src/index"],
|
||||
"openapi/*": ["../src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["./**/*.ts"]
|
||||
}
|
||||
EOL
|
||||
)
|
||||
echo "$TS_CONFIG_CONTENT" > samples/tsconfig.json
|
||||
|
||||
# Generate starter usage sample with speakeasy
|
||||
speakeasy generate usage -s https://raw.githubusercontent.com/Prowlarr/Prowlarr/develop/src/Prowlarr.Api.V1/openapi.json -l typescript -o samples/root.ts
|
||||
Reference in New Issue
Block a user