Skip to content

Commit e36997f

Browse files
committed
Merge github.com:speakeasy-api/speakeasy-code-samples-ts
2 parents 4e5464c + 8255831 commit e36997f

File tree

19 files changed

+229
-57
lines changed

19 files changed

+229
-57
lines changed

.speakeasy/gen.lock

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
lockVersion: 2.0.0
22
id: 521af75f-d011-41f9-a5ff-9f8033773118
33
management:
4-
docChecksum: a0841885f1d2df6bf65c33550d1be776
4+
docChecksum: ef41927baaf8adac37d125d0ae44097c
55
docVersion: 0.4.0
6-
speakeasyVersion: 1.468.5
7-
generationVersion: 2.493.11
8-
releaseVersion: 2.0.13
9-
configChecksum: bb0274b648f58e16f339f488f406677b
6+
speakeasyVersion: 1.468.8
7+
generationVersion: 2.493.19
8+
releaseVersion: 2.0.14
9+
configChecksum: d413f3ea951f34adef2528339fa6640a
1010
repoURL: https://github.com/speakeasy-api/speakeasy-code-samples-ts.git
1111
installationURL: https://github.com/speakeasy-api/speakeasy-code-samples-ts
1212
published: true
1313
features:
1414
typescript:
1515
additionalDependencies: 0.1.0
16-
core: 3.18.14
16+
core: 3.18.15
1717
defaultEnabledRetries: 0.1.0
1818
devContainers: 2.90.0
1919
envVarSecurityUsage: 0.1.2
@@ -110,4 +110,55 @@ examples:
110110
application/json: {"snippets": [{"operationId": "<id>", "language": "<value>", "code": "<value>"}, {"operationId": "<id>", "language": "<value>", "code": "<value>"}]}
111111
4XX:
112112
application/json: {"message": "<value>", "status_code": 558834}
113+
"":
114+
parameters:
115+
query:
116+
registry_url: "https://spec.speakeasy.com/my-org/my-workspace/my-source"
117+
operation_ids: ["getPetById"]
118+
responses:
119+
2XX:
120+
application/json: {"snippets": [{"operationId": "<id>", "language": "<value>", "code": "<value>"}, {"operationId": "<id>", "language": "<value>", "code": "<value>"}]}
121+
4XX:
122+
application/json: {"message": "<value>", "status_code": 558834}
123+
python:
124+
parameters:
125+
query:
126+
registry_url: "https://spec.speakeasy.com/org/ws/my-source"
127+
operation_ids: ["getPetById"]
128+
languages: ["python"]
129+
responses:
130+
2XX:
131+
application/json: {"snippets": [{"operationId": "<id>", "language": "<value>", "code": "<value>"}, {"operationId": "<id>", "language": "<value>", "code": "<value>"}]}
132+
4XX:
133+
application/json: {"message": "<value>", "status_code": 521235}
134+
typescript:
135+
parameters:
136+
query:
137+
registry_url: "https://spec.speakeasy.com/org/ws/my-source"
138+
operation_ids: ["getPetById"]
139+
languages: ["typescript"]
140+
responses:
141+
2XX:
142+
application/json: {"snippets": [{"operationId": "<id>", "language": "<value>", "code": "<value>"}, {"operationId": "<id>", "language": "<value>", "code": "<value>"}, {"operationId": "<id>", "language": "<value>", "code": "<value>"}]}
143+
4XX:
144+
application/json: {"message": "<value>", "status_code": 458049}
145+
java:
146+
parameters:
147+
query:
148+
registry_url: "https://spec.speakeasy.com/org/ws/my-source"
149+
operation_ids: ["getPetById"]
150+
languages: ["java"]
151+
responses:
152+
2XX:
153+
application/json: {"snippets": [{"operationId": "<id>", "language": "<value>", "code": "<value>"}]}
154+
4XX:
155+
application/json: {"message": "<value>", "status_code": 262795}
156+
default:
157+
parameters:
158+
query:
159+
registry_url: "https://spec.speakeasy.com/org/ws/my-source"
160+
operation_ids: ["getPetById"]
161+
responses:
162+
2XX:
163+
application/json: {"snippets": [{"operationId": "getPetById", "language": "typescript", "code": "import { Petstore } from \"petstore-sdk\";\n\nconst petstore = new Petstore({\n apiKey: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await petstore.pet.getById({\n id: 137396,\n });\n\n // Handle the result\n console.log(result);\n}\n\nrun();"}]}
113164
generatedTests: {}

.speakeasy/gen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ generation:
1616
oAuth2ClientCredentialsEnabled: false
1717
oAuth2PasswordEnabled: false
1818
typescript:
19-
version: 2.0.13
19+
version: 2.0.14
2020
additionalDependencies:
2121
dependencies: {}
2222
devDependencies: {}

.speakeasy/workflow.lock

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
speakeasyVersion: 1.468.5
1+
speakeasyVersion: 1.468.8
22
sources:
33
speakeasy-OAS:
44
sourceNamespace: speakeasy-oas
5-
sourceRevisionDigest: sha256:eccb5c0b494c102a3985fedd96b152ad956b8be90681e6f5f21b5756463f66ab
6-
sourceBlobDigest: sha256:6d9de4a70686f4366747b9dbf16917300a43dea8857ad6583f35ef3531bffbdb
5+
sourceRevisionDigest: sha256:3f07a3b9272ae4fbeb71c9533bafeba3dc62eca59431c354f4890bf6dfe9514d
6+
sourceBlobDigest: sha256:8d43792e5ba3b16a95d37ec0eb7a9a1e4e2cd81d1c9585e91edfea10f3dc24f3
77
tags:
88
- latest
9+
- speakeasy-sdk-regen-1736994552
910
- 0.4.0
1011
targets:
1112
code_samples_typescript_sdk:
1213
source: speakeasy-OAS
1314
sourceNamespace: speakeasy-oas
14-
sourceRevisionDigest: sha256:eccb5c0b494c102a3985fedd96b152ad956b8be90681e6f5f21b5756463f66ab
15-
sourceBlobDigest: sha256:6d9de4a70686f4366747b9dbf16917300a43dea8857ad6583f35ef3531bffbdb
15+
sourceRevisionDigest: sha256:3f07a3b9272ae4fbeb71c9533bafeba3dc62eca59431c354f4890bf6dfe9514d
16+
sourceBlobDigest: sha256:8d43792e5ba3b16a95d37ec0eb7a9a1e4e2cd81d1c9585e91edfea10f3dc24f3
17+
codeSamplesNamespace: speakeasy-oas-typescript-code-samples
18+
codeSamplesRevisionDigest: sha256:c74c236d2c1a72c1120f1056d2d78219eed15bf1d981b6946a691fb93c53d084
1619
workflow:
1720
workflowVersion: 1.0.0
1821
speakeasyVersion: latest

FUNCTIONS.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ const speakeasyCodeSamples = new SpeakeasyCodeSamplesCore({
3232

3333
async function run() {
3434
const res = await codeSamplesGet(speakeasyCodeSamples, {
35-
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
35+
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
36+
operationIds: [
37+
"getPetById",
38+
],
39+
languages: [
40+
"python",
41+
],
3642
});
3743

3844
switch (true) {

REACT_QUERY.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ import { useCodeSamplesGet } from "@speakeasyapi/code-samples/react-query/codeSa
5555

5656
export function Example() {
5757
const { data, error, status } = useCodeSamplesGet({
58-
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
58+
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
59+
operationIds: [
60+
"getPetById",
61+
],
62+
languages: [
63+
"python",
64+
],
5965
});
6066

6167
// Render the UI here...
@@ -75,7 +81,13 @@ export function ExampleWithOptions() {
7581
const [enabled, setEnabled] = useState(true);
7682
const { data, error, status } = useCodeSamplesGet(
7783
{
78-
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
84+
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
85+
operationIds: [
86+
"getPetById",
87+
],
88+
languages: [
89+
"python",
90+
],
7991
},
8092
{
8193
// TanStack Query options:
@@ -196,7 +208,13 @@ export function App() {
196208

197209
function Example() {
198210
const { data } = useCodeSamplesGetSuspense({
199-
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
211+
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
212+
operationIds: [
213+
"getPetById",
214+
],
215+
languages: [
216+
"python",
217+
],
200218
});
201219

202220
// Render the UI here...
@@ -227,7 +245,13 @@ export default async function Page() {
227245
});
228246

229247
await prefetchCodeSamplesGet(queryClient, speakeasyCodeSamples, {
230-
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
248+
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
249+
operationIds: [
250+
"getPetById",
251+
],
252+
languages: [
253+
"python",
254+
],
231255
});
232256

233257
return (

README.md

Lines changed: 61 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ Developer-friendly & type-safe Typescript SDK specifically catered to leverage _
1717
<!-- Start Summary [summary] -->
1818
## Summary
1919

20-
Speakeasy API: The Subscriptions API manages subscriptions for CLI and registry events
20+
Speakeasy Code Samples API: REST APIs for retrieving SDK usage snippets from the Speakeasy Code Samples API.
21+
2122

2223
For more information about the API: [The Speakeasy Platform Documentation](/docs)
2324
<!-- End Summary [summary] -->
@@ -111,7 +112,13 @@ const speakeasyCodeSamples = new SpeakeasyCodeSamples({
111112

112113
async function run() {
113114
const result = await speakeasyCodeSamples.codeSamples.get({
114-
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
115+
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
116+
operationIds: [
117+
"getPetById",
118+
],
119+
languages: [
120+
"python",
121+
],
115122
});
116123

117124
// Handle the result
@@ -188,7 +195,13 @@ const speakeasyCodeSamples = new SpeakeasyCodeSamples({
188195

189196
async function run() {
190197
const result = await speakeasyCodeSamples.codeSamples.get({
191-
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
198+
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
199+
operationIds: [
200+
"getPetById",
201+
],
202+
languages: [
203+
"python",
204+
],
192205
});
193206

194207
// Handle the result
@@ -208,7 +221,7 @@ run();
208221

209222
### [codeSamples](docs/sdks/codesamples/README.md)
210223

211-
* [get](docs/sdks/codesamples/README.md#get) - Retrieve usage snippets from document stored in the registry
224+
* [get](docs/sdks/codesamples/README.md#get) - Retrieve usage snippets
212225

213226

214227
</details>
@@ -229,7 +242,7 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
229242

230243
<summary>Available standalone functions</summary>
231244

232-
- [`codeSamplesGet`](docs/sdks/codesamples/README.md#get) - Retrieve usage snippets from document stored in the registry
245+
- [`codeSamplesGet`](docs/sdks/codesamples/README.md#get) - Retrieve usage snippets
233246

234247
</details>
235248
<!-- End Standalone functions [standalone-funcs] -->
@@ -256,7 +269,7 @@ To learn about this feature and how to get started, check
256269

257270
<summary>Available React hooks</summary>
258271

259-
- [`useCodeSamplesGet`](docs/sdks/codesamples/README.md#get) - Retrieve usage snippets from document stored in the registry
272+
- [`useCodeSamplesGet`](docs/sdks/codesamples/README.md#get) - Retrieve usage snippets
260273

261274
</details>
262275
<!-- End React hooks with TanStack Query [react-query] -->
@@ -289,7 +302,13 @@ const speakeasyCodeSamples = new SpeakeasyCodeSamples({
289302

290303
async function run() {
291304
const result = await speakeasyCodeSamples.codeSamples.get({
292-
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
305+
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
306+
operationIds: [
307+
"getPetById",
308+
],
309+
languages: [
310+
"python",
311+
],
293312
});
294313

295314
// Handle the result
@@ -317,7 +336,13 @@ const speakeasyCodeSamples = new SpeakeasyCodeSamples({
317336

318337
async function run() {
319338
const result = await speakeasyCodeSamples.codeSamples.get({
320-
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
339+
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
340+
operationIds: [
341+
"getPetById",
342+
],
343+
languages: [
344+
"python",
345+
],
321346
}, {
322347
retries: {
323348
strategy: "backoff",
@@ -360,7 +385,13 @@ const speakeasyCodeSamples = new SpeakeasyCodeSamples({
360385

361386
async function run() {
362387
const result = await speakeasyCodeSamples.codeSamples.get({
363-
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
388+
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
389+
operationIds: [
390+
"getPetById",
391+
],
392+
languages: [
393+
"python",
394+
],
364395
});
365396

366397
// Handle the result
@@ -400,7 +431,13 @@ async function run() {
400431
let result;
401432
try {
402433
result = await speakeasyCodeSamples.codeSamples.get({
403-
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
434+
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
435+
operationIds: [
436+
"getPetById",
437+
],
438+
languages: [
439+
"python",
440+
],
404441
});
405442

406443
// Handle the result
@@ -469,7 +506,13 @@ const speakeasyCodeSamples = new SpeakeasyCodeSamples({
469506

470507
async function run() {
471508
const result = await speakeasyCodeSamples.codeSamples.get({
472-
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
509+
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
510+
operationIds: [
511+
"getPetById",
512+
],
513+
languages: [
514+
"python",
515+
],
473516
});
474517

475518
// Handle the result
@@ -494,7 +537,13 @@ const speakeasyCodeSamples = new SpeakeasyCodeSamples({
494537

495538
async function run() {
496539
const result = await speakeasyCodeSamples.codeSamples.get({
497-
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
540+
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
541+
operationIds: [
542+
"getPetById",
543+
],
544+
languages: [
545+
"python",
546+
],
498547
});
499548

500549
// Handle the result

RELEASES.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,14 @@ Based on:
5252
### Generated
5353
- [typescript v2.0.9] .
5454
### Releases
55-
- [NPM v2.0.9] https://www.npmjs.com/package/@speakeasyapi/code-samples/v/2.0.9 - .
55+
- [NPM v2.0.9] https://www.npmjs.com/package/@speakeasyapi/code-samples/v/2.0.9 - .
56+
57+
## 2025-01-16 02:28:57
58+
### Changes
59+
Based on:
60+
- OpenAPI Doc
61+
- Speakeasy CLI 1.468.8 (2.493.19) https://github.com/speakeasy-api/speakeasy
62+
### Generated
63+
- [typescript v2.0.14] .
64+
### Releases
65+
- [NPM v2.0.14] https://www.npmjs.com/package/@speakeasyapi/code-samples/v/2.0.14 - .

USAGE.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ const speakeasyCodeSamples = new SpeakeasyCodeSamples({
99

1010
async function run() {
1111
const result = await speakeasyCodeSamples.codeSamples.get({
12-
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
12+
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
13+
operationIds: [
14+
"getPetById",
15+
],
16+
languages: [
17+
"python",
18+
],
1319
});
1420

1521
// Handle the result

0 commit comments

Comments
 (0)