Skip to content

Commit bd378df

Browse files
feat: update
1 parent 4915831 commit bd378df

File tree

10 files changed

+1348
-9
lines changed

10 files changed

+1348
-9
lines changed

.devcontainer/README.md

Lines changed: 30 additions & 0 deletions
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 openapi.json -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 openapi.json -l typescript -n {INPUT_TAG_NAME} -o ./samples
30+
```

.devcontainer/devcontainer.json

Lines changed: 45 additions & 0 deletions
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

Lines changed: 30 additions & 0 deletions
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 @speakeasy-api/code-samples
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 openapi.json -l typescript -o samples/root.ts

.speakeasy/gen.lock

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ management:
55
docVersion: 0.4.0
66
speakeasyVersion: 1.441.0
77
generationVersion: 2.460.1
8-
releaseVersion: 0.35.0
9-
configChecksum: 1de1cbeadb9ebd16f441a50fda7f87b9
8+
releaseVersion: 0.36.0
9+
configChecksum: 9505b45b3f0fe8a1a05ea6570deeca6b
1010
features:
1111
typescript:
1212
acceptHeaders: 2.81.2
1313
additionalDependencies: 0.1.0
1414
core: 3.18.5
1515
defaultEnabledRetries: 0.1.0
16+
devContainers: 2.90.0
1617
downloadStreams: 0.1.1
1718
enumUnions: 0.1.0
1819
envVarSecurityUsage: 0.1.2
@@ -30,6 +31,9 @@ features:
3031
tests: 0.7.0
3132
uploadStreams: 0.1.0
3233
generatedFiles:
34+
- .devcontainer/README.md
35+
- .devcontainer/devcontainer.json
36+
- .devcontainer/setup.sh
3337
- .eslintrc.cjs
3438
- .gitattributes
3539
- .npmignore
@@ -107,6 +111,7 @@ examples:
107111
responses:
108112
4XX:
109113
application/json: {"message": "<value>", "status_code": 159498}
114+
"200": {}
110115
generateCodeSamplePreviewAsync:
111116
speakeasy-default-generate-code-sample-preview-async:
112117
requestBody:
@@ -126,3 +131,4 @@ examples:
126131
application/json: {"status": "pending"}
127132
4XX:
128133
application/json: {"message": "<value>", "status_code": 893724}
134+
"200": {}

.speakeasy/gen.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
configVersion: 2.0.0
22
generation:
3+
devContainers:
4+
enabled: true
5+
schemaPath: openapi.json
36
sdkClassName: SDK
47
maintainOpenAPIOrder: true
58
usageSnippets:
@@ -13,7 +16,7 @@ generation:
1316
oAuth2ClientCredentialsEnabled: false
1417
oAuth2PasswordEnabled: false
1518
typescript:
16-
version: 0.35.0
19+
version: 0.36.0
1720
additionalDependencies:
1821
dependencies: {}
1922
devDependencies: {}

jsr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{
44
"name": "@speakeasy-api/code-samples",
5-
"version": "0.35.0",
5+
"version": "0.36.0",
66
"exports": {
77
".": "./src/index.ts",
88
"./models/errors": "./src/models/errors/index.ts",

0 commit comments

Comments
 (0)