Skip to content

Commit 0d4dbb3

Browse files
committed
Push SDK
1 parent 26ac75e commit 0d4dbb3

File tree

2,064 files changed

+216091
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,064 files changed

+216091
-1
lines changed

.devcontainer/README.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
> **Remember to shutdown a GitHub Codespace when it is not in use!**
3+
4+
# Dev Containers Quick Start
5+
6+
The default location for usage snippets is the `samples` directory.
7+
8+
## Running a Usage Sample
9+
10+
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.
11+
12+
```
13+
ts-node root.ts
14+
```
15+
16+
## Generating Additional Usage Samples
17+
18+
The speakeasy CLI allows you to generate more usage snippets. Here's how:
19+
20+
- To generate a sample for a specific operation by providing an operation ID, use:
21+
22+
```
23+
speakeasy generate usage -s registry.speakeasyapi.dev/firehydrant/firehydrant/firehydrant-oas:main -l typescript -i {INPUT_OPERATION_ID} -o ./samples
24+
```
25+
26+
- To generate samples for an entire namespace (like a tag or group name), use:
27+
28+
```
29+
speakeasy generate usage -s registry.speakeasyapi.dev/firehydrant/firehydrant/firehydrant-oas:main -l typescript -n {INPUT_TAG_NAME} -o ./samples
30+
```

.devcontainer/devcontainer.json

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/images/tree/main/src/typescript-node
3+
{
4+
"name": "TypeScript",
5+
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
6+
// Features to add to the dev container. More info: https://containers.dev/features.
7+
// "features": {},
8+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
9+
// "forwardPorts": [],
10+
// Use 'postCreateCommand' to run commands after the container is created.
11+
"postCreateCommand": "sudo chmod +x ./.devcontainer/setup.sh && ./.devcontainer/setup.sh",
12+
"customizations": {
13+
"vscode": {
14+
"extensions": [
15+
"ms-vscode.vscode-typescript-tslint-plugin",
16+
"esbenp.prettier-vscode",
17+
"github.vscode-pull-request-github"
18+
],
19+
"settings": {
20+
"files.eol": "\n",
21+
"editor.formatOnSave": true,
22+
"typescript.tsc.autoDetect": "on",
23+
"typescript.updateImportsOnFileMove.enabled": "always",
24+
"typescript.preferences.importModuleSpecifier": "relative",
25+
"[typescript]": {
26+
"editor.codeActionsOnSave": {
27+
"source.organizeImports": true
28+
}
29+
},
30+
"[typescriptreact]": {
31+
"editor.codeActionsOnSave": {
32+
"source.organizeImports": true
33+
}
34+
}
35+
}
36+
},
37+
"codespaces": {
38+
"openFiles": [
39+
".devcontainer/README.md"
40+
]
41+
}
42+
}
43+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
44+
// "remoteUser": "root"
45+
}

.devcontainer/setup.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# Install the speakeasy CLI
4+
curl -fsSL https://raw.githubusercontent.com/speakeasy-api/speakeasy/main/install.sh | sh
5+
6+
# Setup samples directory
7+
rmdir samples || true
8+
mkdir samples
9+
10+
npm install
11+
npm install -g ts-node
12+
npm link
13+
npm link firehydrant-typescript-sdk
14+
TS_CONFIG_CONTENT=$(cat <<EOL
15+
{
16+
"compilerOptions": {
17+
"baseUrl": ".",
18+
"paths": {
19+
"openapi": ["../src/index"],
20+
"openapi/*": ["../src/*"]
21+
}
22+
},
23+
"include": ["./**/*.ts"]
24+
}
25+
EOL
26+
)
27+
echo "$TS_CONFIG_CONTENT" > samples/tsconfig.json
28+
29+
# Generate starter usage sample with speakeasy
30+
speakeasy generate usage -s registry.speakeasyapi.dev/firehydrant/firehydrant/firehydrant-oas:main -l typescript -o samples/root.ts

.eslintrc.cjs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* eslint-env node */
2+
module.exports = {
3+
root: true,
4+
extends: [
5+
"eslint:recommended",
6+
"plugin:@typescript-eslint/recommended",
7+
"plugin:import/recommended",
8+
"plugin:import/typescript",
9+
],
10+
parser: "@typescript-eslint/parser",
11+
plugins: ["@typescript-eslint"],
12+
settings: {
13+
"import/resolver": {
14+
typescript: true,
15+
node: true,
16+
},
17+
},
18+
rules: {
19+
// Handled by typescript compiler
20+
"@typescript-eslint/no-unused-vars": "off",
21+
"@typescript-eslint/ban-types": "off",
22+
"@typescript-eslint/no-namespace": "off",
23+
"@typescript-eslint/no-explicit-any": "off",
24+
"import/no-named-as-default-member": "off",
25+
26+
"import/no-default-export": "error",
27+
},
28+
};

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This allows generated code to be indexed correctly
2+
*.ts linguist-generated=false

.github/workflows/sdk_generation.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Generate
2+
permissions:
3+
checks: write
4+
contents: write
5+
pull-requests: write
6+
statuses: write
7+
id-token: write
8+
"on":
9+
workflow_dispatch:
10+
inputs:
11+
force:
12+
description: Force generation of SDKs
13+
type: boolean
14+
default: false
15+
set_version:
16+
description: optionally set a specific SDK version
17+
type: string
18+
schedule:
19+
- cron: 0 0 * * *
20+
jobs:
21+
generate:
22+
uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15
23+
with:
24+
force: ${{ github.event.inputs.force }}
25+
mode: pr
26+
set_version: ${{ github.event.inputs.set_version }}
27+
secrets:
28+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
29+
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}

.gitignore

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/models
2+
/models/errors
3+
/types
4+
/node_modules
5+
/lib
6+
/sdk
7+
/funcs
8+
/react-query
9+
/hooks
10+
/index.*
11+
/core.*
12+
/cjs
13+
/esm
14+
/dist
15+
/.tsbuildinfo
16+
/.tshy
17+
/.tshy-*
18+
/__tests__

.npmignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
**/*
2+
!/FUNCTIONS.md
3+
!/RUNTIMES.md
4+
!/REACT_QUERY.md
5+
!/**/*.ts
6+
!/**/*.js
7+
!/**/*.map
8+
9+
/.eslintrc.js
10+
/cjs
11+
/.tshy
12+
/.tshy-*
13+
/__tests__

0 commit comments

Comments
 (0)