Skip to content

chore: 🐝 Update SDK - Generate 2.4.0-beta.1 #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/examples/node_modules
.DS_Store
**/.speakeasy/temp/
**/.speakeasy/logs/
.DS_Store
.env
.env.local
.env.*.local
/mcp-server
/bin
/.eslintcache
Expand Down
37 changes: 22 additions & 15 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
lockVersion: 2.0.0
id: 521af75f-d011-41f9-a5ff-9f8033773118
management:
docChecksum: 80bdf0b395520d76da9a1e1e2896dae0
docChecksum: 2bf97fa8e6ca517b859cc9784a1260b5
docVersion: 0.4.0
speakeasyVersion: 1.514.0
generationVersion: 2.546.0
releaseVersion: 2.4.0-beta
configChecksum: ef5d56dcfd4f4ba9e07e1a535f410421
speakeasyVersion: 1.581.2
generationVersion: 2.656.9
releaseVersion: 2.4.0-beta.1
configChecksum: 40ea56fc4802cdc2a9d623111efc2329
repoURL: https://github.com/speakeasy-api/speakeasy-code-samples-ts.git
installationURL: https://github.com/speakeasy-api/speakeasy-code-samples-ts
published: true
features:
typescript:
additionalDependencies: 0.1.0
core: 3.21.3
core: 3.21.14
deepObjectParams: 0.1.0
defaultEnabledRetries: 0.1.0
devContainers: 2.90.0
Expand All @@ -22,15 +22,15 @@ features:
globalSecurity: 2.82.13
globalSecurityCallbacks: 0.1.0
globalSecurityFlattening: 0.1.0
globalServerURLs: 2.82.4
globalServerURLs: 2.82.5
globals: 2.82.2
groups: 2.81.2
mcpServer: 0.6.0
mcpServer: 0.9.3
nameOverrides: 2.81.2
reactQueryHooks: 0.2.2
reactQueryHooks: 0.2.3
responseFormat: 0.2.3
retries: 2.83.0
sdkHooks: 0.2.0
sdkHooks: 0.3.0
serverIDs: 2.81.2
generatedFiles:
- .devcontainer/README.md
Expand All @@ -54,6 +54,10 @@ generatedFiles:
- docs/sdks/codesamples/README.md
- docs/sdks/speakeasycodesamples/README.md
- eslint.config.mjs
- examples/.env.template
- examples/README.md
- examples/codeSamplesGet.example.ts
- examples/package.json
- jsr.json
- package.json
- src/core.ts
Expand Down Expand Up @@ -84,6 +88,7 @@ generatedFiles:
- src/mcp-server/console-logger.ts
- src/mcp-server/extensions.ts
- src/mcp-server/mcp-server.ts
- src/mcp-server/prompts.ts
- src/mcp-server/resources.ts
- src/mcp-server/scopes.ts
- src/mcp-server/server.ts
Expand All @@ -99,7 +104,9 @@ generatedFiles:
- src/models/errors/error.ts
- src/models/errors/httpclienterrors.ts
- src/models/errors/index.ts
- src/models/errors/responsevalidationerror.ts
- src/models/errors/sdkvalidationerror.ts
- src/models/errors/speakeasycodesampleserror.ts
- src/models/operations/getcodesamples.ts
- src/models/operations/index.ts
- src/react-query/_context.tsx
Expand All @@ -121,18 +128,18 @@ generatedFiles:
- tsconfig.json
examples:
getCodeSamples:
"":
speakeasy-default-get-code-samples:
parameters:
query:
registry_url: "https://spec.speakeasy.com/my-org/my-workspace/my-source"
registry_url: "https://spec.speakeasy.com/org/ws/my-source"
operation_ids: ["getPets"]
method_paths: [{"method": "get", "path": "/pets"}]
languages: ["python", "javascript"]
responses:
2XX:
application/json: {"snippets": [{"path": "/sbin", "method": "<value>", "operationId": "<id>", "language": "php,", "code": "<value>"}, {"path": "/root", "method": "<value>", "operationId": "<id>", "language": "unity,", "code": "<value>"}]}
application/json: {"snippets": []}
4XX:
application/json: {"message": "<value>", "status_code": 521235}
application/json: {"message": "<value>", "status_code": 887801}
default:
parameters:
query:
Expand All @@ -143,5 +150,5 @@ examples:
responses:
2XX:
application/json: {"snippets": [{"path": "/pet/{id}", "method": "get", "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();"}]}
examplesVersion: 1.0.0
examplesVersion: 1.0.2
generatedTests: {}
11 changes: 10 additions & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,23 @@ generation:
maintainOpenAPIOrder: true
usageSnippets:
optionalPropertyRendering: withExample
sdkInitStyle: constructor
useClassNamesForArrayFields: true
fixes:
nameResolutionFeb2025: false
parameterOrderingFeb2024: false
requestResponseComponentNamesFeb2024: false
securityFeb2025: false
sharedErrorComponentsApr2025: false
auth:
oAuth2ClientCredentialsEnabled: false
oAuth2PasswordEnabled: false
tests:
generateTests: true
generateNewTests: false
skipResponseBodyAssertions: false
typescript:
version: 2.4.0-beta
version: 2.4.0-beta.1
additionalDependencies:
dependencies:
'@emotion/css': ^11.13.5
Expand All @@ -28,14 +34,17 @@ typescript:
peerDependencies: {}
additionalPackageJSON: {}
author: Speakeasy
baseErrorName: SpeakeasyCodeSamplesError
clientServerStatusCodesAsErrors: true
constFieldsAlwaysOptional: true
defaultErrorName: APIError
enableCustomCodeRegions: false
enableMCPServer: true
enableReactQuery: true
enumFormat: union
flattenGlobalSecurity: true
flatteningOrder: body-first
generateExamples: true
imports:
option: openapi
paths:
Expand Down
14 changes: 7 additions & 7 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
speakeasyVersion: 1.514.0
speakeasyVersion: 1.581.2
sources:
speakeasy-OAS:
sourceNamespace: speakeasy-oas
sourceRevisionDigest: sha256:c95b7bde7a889f8d6461e405347f2dac28defaaf6a36cc19709b4ce29f4eaefb
sourceBlobDigest: sha256:706c912b2e5755fdaff8d2a95ca3ce6fb1fff777a7aa49a8afcb0b909cc22892
sourceRevisionDigest: sha256:6b8652973fd0a9bf346a3af06472bc616830e9e3c881a0f583f3bfd12979591a
sourceBlobDigest: sha256:63f67500135f962b2c56c1d0664fef7f7d040d733c89169633eae8ec2f9d1b85
tags:
- latest
- speakeasy-sdk-regen-1741642416
- speakeasy-sdk-regen-1746489958
- 0.4.0
targets:
code_samples_typescript_sdk:
source: speakeasy-OAS
sourceNamespace: speakeasy-oas
sourceRevisionDigest: sha256:c95b7bde7a889f8d6461e405347f2dac28defaaf6a36cc19709b4ce29f4eaefb
sourceBlobDigest: sha256:706c912b2e5755fdaff8d2a95ca3ce6fb1fff777a7aa49a8afcb0b909cc22892
sourceRevisionDigest: sha256:6b8652973fd0a9bf346a3af06472bc616830e9e3c881a0f583f3bfd12979591a
sourceBlobDigest: sha256:63f67500135f962b2c56c1d0664fef7f7d040d733c89169633eae8ec2f9d1b85
codeSamplesNamespace: speakeasy-oas-typescript-code-samples
codeSamplesRevisionDigest: sha256:73a780b60ccc00d5344b505208070173d62dfcb9013e97f8f123e322230d6afe
codeSamplesRevisionDigest: sha256:b1dd14a70682337921089bf92025cbdb2a0175f13250e07d113bb9aa979db52a
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
38 changes: 13 additions & 25 deletions FUNCTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,24 @@ specific category of applications.
```typescript
import { SpeakeasyCodeSamplesCore } from "@speakeasyapi/code-samples/core.js";
import { codeSamplesGet } from "@speakeasyapi/code-samples/funcs/codeSamplesGet.js";
import { SDKValidationError } from "@speakeasyapi/code-samples/models/errors/sdkvalidationerror.js";

// Use `SpeakeasyCodeSamplesCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasyCodeSamples = new SpeakeasyCodeSamplesCore({
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
apiKey: "<YOUR_API_KEY_HERE>",
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
});

async function run() {
const res = await codeSamplesGet(speakeasyCodeSamples, {
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
operationIds: [
"getPets",
"g",
"e",
"t",
"P",
"e",
"t",
"s",
],
methodPaths: [
{
Expand All @@ -47,28 +51,12 @@ async function run() {
"javascript",
],
});

switch (true) {
case res.ok:
// The success case will be handled outside of the switch block
break;
case res.error instanceof SDKValidationError:
// Pretty-print validation errors.
return console.log(res.error.pretty());
case res.error instanceof Error:
return console.log(res.error);
default:
// TypeScript's type checking will fail on the following line if the above
// cases were not exhaustive.
res.error satisfies never;
throw new Error("Assertion failed: expected error checks to be exhaustive: " + res.error);
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("codeSamplesGet failed:", res.error);
}


const { value: result } = res;

// Handle the result
console.log(result);
}

run();
Expand Down
42 changes: 31 additions & 11 deletions REACT_QUERY.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import { SpeakeasyCodeSamplesProvider } from "@speakeasyapi/code-samples/react-q

const queryClient = new QueryClient();
const speakeasyCodeSamples = new SpeakeasyCodeSamplesCore({
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
apiKey: "<YOUR_API_KEY_HERE>",
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
});

// Retries are handled by the underlying SDK.
Expand Down Expand Up @@ -55,9 +55,14 @@ import { useCodeSamples } from "@speakeasyapi/code-samples/react-query/codeSampl

export function Example() {
const { data, error, status } = useCodeSamples({
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
operationIds: [
"getPets",
"g",
"e",
"t",
"P",
"e",
"t",
"s",
],
methodPaths: [
{
Expand Down Expand Up @@ -88,9 +93,14 @@ export function ExampleWithOptions() {
const [enabled, setEnabled] = useState(true);
const { data, error, status } = useCodeSamples(
{
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
operationIds: [
"getPets",
"g",
"e",
"t",
"P",
"e",
"t",
"s",
],
methodPaths: [
{
Expand Down Expand Up @@ -189,8 +199,8 @@ import { useCodeSamplesSuspense } from "@speakeasyapi/code-samples/react-query/c

const queryClient = new QueryClient();
const speakeasyCodeSamples = new SpeakeasyCodeSamplesCore({
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
apiKey: "<YOUR_API_KEY_HERE>",
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
});

export function App() {
Expand Down Expand Up @@ -222,9 +232,14 @@ export function App() {

function Example() {
const { data } = useCodeSamplesSuspense({
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
operationIds: [
"getPets",
"g",
"e",
"t",
"P",
"e",
"t",
"s",
],
methodPaths: [
{
Expand Down Expand Up @@ -261,14 +276,19 @@ import { prefetchCodeSamples } from "@speakeasyapi/code-samples/react-query/code
export default async function Page() {
const queryClient = new QueryClient();
const speakeasyCodeSamples = new SpeakeasyCodeSamplesCore({
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
apiKey: "<YOUR_API_KEY_HERE>",
registryUrl: "https://spec.speakeasy.com/org/ws/my-source",
});

await prefetchCodeSamples(queryClient, speakeasyCodeSamples, {
registryUrl: "https://spec.speakeasy.com/my-org/my-workspace/my-source",
operationIds: [
"getPets",
"g",
"e",
"t",
"P",
"e",
"t",
"s",
],
methodPaths: [
{
Expand Down
Loading