Skip to content

Commit

Permalink
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.481.1
Browse files Browse the repository at this point in the history
  • Loading branch information
speakeasybot committed Jan 31, 2025
1 parent 95373f8 commit 6c08d50
Show file tree
Hide file tree
Showing 21 changed files with 165 additions and 195 deletions.
28 changes: 20 additions & 8 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
lockVersion: 2.0.0
id: 2858c6d9-f946-4185-ae68-3b8e708830fb
management:
docChecksum: af467caf61bea274c32dd872e84f602e
docChecksum: a857476fabbb29418727d7b46e390a02
docVersion: 0.4.0
speakeasyVersion: 1.477.0
generationVersion: 2.497.0
releaseVersion: 3.21.0
configChecksum: 12e793493549628200c7c1d578f87af9
speakeasyVersion: 1.481.1
generationVersion: 2.500.5
releaseVersion: 3.22.0
configChecksum: f7c2163f50e57902cb5767a7534de7f9
repoURL: https://github.com/speakeasy-api/speakeasy-client-sdk-go.git
repoSubDirectory: .
installationURL: https://github.com/speakeasy-api/speakeasy-client-sdk-go
published: true
features:
go:
acceptHeaders: 2.81.2
additionalDependencies: 0.1.0
constsAndDefaults: 0.1.6
core: 3.6.9
core: 3.6.12
deepObjectParams: 0.1.1
defaultEnabledRetries: 0.2.0
deprecations: 2.81.2
Expand Down Expand Up @@ -809,10 +808,16 @@ examples:
application/json: {"message": "<value>", "status_code": 140843}
5XX:
application/json: {"message": "<value>", "status_code": 632138}
default:
requestBody:
multipart/form-data: {"language": "<value>", "schema_file": {"": "example.file"}}
responses:
2XX:
application/json: {"snippets": [{"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();", "language": "typescript", "method": "get", "operationId": "getPetById", "path": "/pet/{id}"}]}
generateCodeSamplePreviewAsync:
speakeasy-default-generate-code-sample-preview-async:
requestBody:
multipart/form-data: {"languages": ["<value>", "<value>", "<value>"], "schema_file": {"": "example.file"}}
multipart/form-data: {"language": "<value>", "schema_file": {"": "example.file"}}
responses:
"202":
application/json: {"job_id": "<id>", "status": "running"}
Expand Down Expand Up @@ -858,6 +863,13 @@ examples:
application/json: {"message": "<value>", "status_code": 44984}
5XX:
application/json: {"message": "<value>", "status_code": 416783}
default:
parameters:
path:
jobID: "<id>"
responses:
2XX:
application/json: {"snippets": [{"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();", "language": "typescript", "method": "get", "operationId": "getPetById", "path": "/pet/{id}"}]}
checkGithubAccess:
speakeasy-default-check-github-access:
parameters:
Expand Down
12 changes: 6 additions & 6 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
speakeasyVersion: 1.477.0
speakeasyVersion: 1.481.1
sources:
my-source:
sourceNamespace: my-source
sourceRevisionDigest: sha256:09ff689e93c381070f346714a7fb3083f1a6bd568ef630b21db0932b0cb9f3ec
sourceBlobDigest: sha256:c06cc83921f8f24dfc098c977539857c3b7ff65302887ea14acb0fe3d5b17c62
sourceRevisionDigest: sha256:85cedc03ea044870c54d91da42283ad4e3c44cf8e85f59025e281d46a59d8f04
sourceBlobDigest: sha256:e5a801f69893464607a29d5b486de1f301d0ee4e5602dacf50ce3e9e5ba5c20a
tags:
- latest
- main
Expand All @@ -12,10 +12,10 @@ targets:
speakeasy-client-sdk-go:
source: my-source
sourceNamespace: my-source
sourceRevisionDigest: sha256:09ff689e93c381070f346714a7fb3083f1a6bd568ef630b21db0932b0cb9f3ec
sourceBlobDigest: sha256:c06cc83921f8f24dfc098c977539857c3b7ff65302887ea14acb0fe3d5b17c62
sourceRevisionDigest: sha256:85cedc03ea044870c54d91da42283ad4e3c44cf8e85f59025e281d46a59d8f04
sourceBlobDigest: sha256:e5a801f69893464607a29d5b486de1f301d0ee4e5602dacf50ce3e9e5ba5c20a
codeSamplesNamespace: code-samples-go-speakeasy-client-sdk-go
codeSamplesRevisionDigest: sha256:cd898ee6c6a4dc4ba10f7ae39c74773e067c9df95774c733dfe5994e12f7275f
codeSamplesRevisionDigest: sha256:4d8403c598860d338eaaa99bbd2144f234250a846e7682f43fbc50e3fd61ac89
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -1596,4 +1596,14 @@ Based on:
### Generated
- [go v3.21.0] .
### Releases
- [Go v3.21.0] https://github.com/speakeasy-api/speakeasy-client-sdk-go/releases/tag/v3.21.0 - .
- [Go v3.21.0] https://github.com/speakeasy-api/speakeasy-client-sdk-go/releases/tag/v3.21.0 - .

## 2025-01-31 22:02:19
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.481.1 (2.500.5) https://github.com/speakeasy-api/speakeasy
### Generated
- [go v3.22.0] .
### Releases
- [Go v3.22.0] https://github.com/speakeasy-api/speakeasy-client-sdk-go/releases/tag/v3.22.0 - .
6 changes: 3 additions & 3 deletions codeSamples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,19 @@ actions:
x-codeSamples:
- lang: go
label: generateCodeSamplePreview
source: "package main\n\nimport(\n\t\"context\"\n\tspeakeasyclientsdkgo \"github.com/speakeasy-api/speakeasy-client-sdk-go/v3\"\n\t\"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared\"\n\t\"os\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := speakeasyclientsdkgo.New(\n speakeasyclientsdkgo.WithSecurity(shared.Security{\n APIKey: speakeasyclientsdkgo.String(\"<YOUR_API_KEY_HERE>\"),\n }),\n )\n\n content, fileErr := os.Open(\"example.file\")\n if fileErr != nil {\n panic(fileErr)\n }\n\n\n res, err := s.CodeSamples.GenerateCodeSamplePreview(ctx, shared.CodeSampleSchemaInput{\n Languages: []string{\n \"<value>\",\n \"<value>\",\n },\n SchemaFile: shared.SchemaFile{\n FileName: \"example.file\",\n Content: content,\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.TwoHundredApplicationXYamlResponseStream != nil {\n // handle response\n }\n}"
source: "package main\n\nimport(\n\t\"context\"\n\tspeakeasyclientsdkgo \"github.com/speakeasy-api/speakeasy-client-sdk-go/v3\"\n\t\"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared\"\n\t\"os\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := speakeasyclientsdkgo.New(\n speakeasyclientsdkgo.WithSecurity(shared.Security{\n APIKey: speakeasyclientsdkgo.String(\"<YOUR_API_KEY_HERE>\"),\n }),\n )\n\n content, fileErr := os.Open(\"example.file\")\n if fileErr != nil {\n panic(fileErr)\n }\n\n\n res, err := s.CodeSamples.GenerateCodeSamplePreview(ctx, shared.CodeSampleSchemaInput{\n Language: \"<value>\",\n SchemaFile: shared.SchemaFile{\n FileName: \"example.file\",\n Content: content,\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.UsageSnippets != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/code_sample/preview/async"]["post"]
update:
x-codeSamples:
- lang: go
label: generateCodeSamplePreviewAsync
source: "package main\n\nimport(\n\t\"context\"\n\tspeakeasyclientsdkgo \"github.com/speakeasy-api/speakeasy-client-sdk-go/v3\"\n\t\"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared\"\n\t\"os\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := speakeasyclientsdkgo.New(\n speakeasyclientsdkgo.WithSecurity(shared.Security{\n APIKey: speakeasyclientsdkgo.String(\"<YOUR_API_KEY_HERE>\"),\n }),\n )\n\n content, fileErr := os.Open(\"example.file\")\n if fileErr != nil {\n panic(fileErr)\n }\n\n\n res, err := s.CodeSamples.GenerateCodeSamplePreviewAsync(ctx, shared.CodeSampleSchemaInput{\n Languages: []string{\n \"<value>\",\n \"<value>\",\n \"<value>\",\n },\n SchemaFile: shared.SchemaFile{\n FileName: \"example.file\",\n Content: content,\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
source: "package main\n\nimport(\n\t\"context\"\n\tspeakeasyclientsdkgo \"github.com/speakeasy-api/speakeasy-client-sdk-go/v3\"\n\t\"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared\"\n\t\"os\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := speakeasyclientsdkgo.New(\n speakeasyclientsdkgo.WithSecurity(shared.Security{\n APIKey: speakeasyclientsdkgo.String(\"<YOUR_API_KEY_HERE>\"),\n }),\n )\n\n content, fileErr := os.Open(\"example.file\")\n if fileErr != nil {\n panic(fileErr)\n }\n\n\n res, err := s.CodeSamples.GenerateCodeSamplePreviewAsync(ctx, shared.CodeSampleSchemaInput{\n Language: \"<value>\",\n SchemaFile: shared.SchemaFile{\n FileName: \"example.file\",\n Content: content,\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/code_sample/preview/async/{jobID}"]["get"]
update:
x-codeSamples:
- lang: go
label: getCodeSamplePreviewAsync
source: "package main\n\nimport(\n\t\"context\"\n\tspeakeasyclientsdkgo \"github.com/speakeasy-api/speakeasy-client-sdk-go/v3\"\n\t\"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared\"\n\t\"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := speakeasyclientsdkgo.New(\n speakeasyclientsdkgo.WithSecurity(shared.Security{\n APIKey: speakeasyclientsdkgo.String(\"<YOUR_API_KEY_HERE>\"),\n }),\n )\n\n res, err := s.CodeSamples.GetCodeSamplePreviewAsync(ctx, operations.GetCodeSamplePreviewAsyncRequest{\n JobID: \"<id>\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.TwoHundredApplicationXYamlResponseStream != nil {\n // handle response\n }\n}"
source: "package main\n\nimport(\n\t\"context\"\n\tspeakeasyclientsdkgo \"github.com/speakeasy-api/speakeasy-client-sdk-go/v3\"\n\t\"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared\"\n\t\"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := speakeasyclientsdkgo.New(\n speakeasyclientsdkgo.WithSecurity(shared.Security{\n APIKey: speakeasyclientsdkgo.String(\"<YOUR_API_KEY_HERE>\"),\n }),\n )\n\n res, err := s.CodeSamples.GetCodeSamplePreviewAsync(ctx, operations.GetCodeSamplePreviewAsyncRequest{\n JobID: \"<id>\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}"
- target: $["paths"]["/v1/github/action"]["get"]
update:
x-codeSamples:
Expand Down
54 changes: 25 additions & 29 deletions codesamples.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func (s *CodeSamples) GenerateCodeSamplePreview(ctx context.Context, request sha
supportedOptions := []string{
operations.SupportedOptionRetries,
operations.SupportedOptionTimeout,
operations.SupportedOptionAcceptHeaderOverride,
}

for _, opt := range opts {
Expand Down Expand Up @@ -81,12 +80,7 @@ func (s *CodeSamples) GenerateCodeSamplePreview(ctx context.Context, request sha
if err != nil {
return nil, fmt.Errorf("error creating request: %w", err)
}
if o.AcceptHeaderOverride != nil {
req.Header.Set("Accept", string(*o.AcceptHeaderOverride))
} else {
req.Header.Set("Accept", "application/json;q=1, application/x-yaml;q=0")
}

req.Header.Set("Accept", "application/json")
req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent)
if reqContentType != "" {
req.Header.Set("Content-Type", reqContentType)
Expand Down Expand Up @@ -196,16 +190,20 @@ func (s *CodeSamples) GenerateCodeSamplePreview(ctx context.Context, request sha
}

switch {
case httpRes.StatusCode == 200:
case httpRes.StatusCode >= 200 && httpRes.StatusCode < 300:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
res.TwoHundredApplicationJSONResponseStream = httpRes.Body
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}

return res, nil
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/x-yaml`):
res.TwoHundredApplicationXYamlResponseStream = httpRes.Body
var out shared.UsageSnippets
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}

return res, nil
res.UsageSnippets = &out
default:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
Expand Down Expand Up @@ -738,7 +736,6 @@ func (s *CodeSamples) GetCodeSamplePreviewAsync(ctx context.Context, request ope
supportedOptions := []string{
operations.SupportedOptionRetries,
operations.SupportedOptionTimeout,
operations.SupportedOptionAcceptHeaderOverride,
}

for _, opt := range opts {
Expand Down Expand Up @@ -773,12 +770,7 @@ func (s *CodeSamples) GetCodeSamplePreviewAsync(ctx context.Context, request ope
if err != nil {
return nil, fmt.Errorf("error creating request: %w", err)
}
if o.AcceptHeaderOverride != nil {
req.Header.Set("Accept", string(*o.AcceptHeaderOverride))
} else {
req.Header.Set("Accept", "application/json;q=1, application/x-yaml;q=0")
}

req.Header.Set("Accept", "application/json")
req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent)

if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil {
Expand Down Expand Up @@ -885,37 +877,41 @@ func (s *CodeSamples) GetCodeSamplePreviewAsync(ctx context.Context, request ope
}

switch {
case httpRes.StatusCode == 200:
case httpRes.StatusCode == 202:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
res.TwoHundredApplicationJSONResponseStream = httpRes.Body
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}

return res, nil
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/x-yaml`):
res.TwoHundredApplicationXYamlResponseStream = httpRes.Body
var out operations.GetCodeSamplePreviewAsyncResponseBody
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}

return res, nil
res.Object = &out
default:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
}
case httpRes.StatusCode == 202:
case httpRes.StatusCode >= 200 && httpRes.StatusCode < 300:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}

var out operations.GetCodeSamplePreviewAsyncResponseBody
var out shared.UsageSnippets
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}

res.TwoHundredAndTwoApplicationJSONObject = &out
res.UsageSnippets = &out
default:
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
Expand Down
13 changes: 6 additions & 7 deletions docs/pkg/models/operations/generatecodesamplepreviewresponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

## Fields

| Field | Type | Required | Description |
| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- |
| `TwoHundredApplicationJSONResponseStream` | *io.ReadCloser* | :heavy_minus_sign: | Successfully returned codeSample overlay file |
| `TwoHundredApplicationXYamlResponseStream` | *io.ReadCloser* | :heavy_minus_sign: | Successfully returned codeSample overlay file |
| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation |
| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation |
| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing |
| Field | Type | Required | Description |
| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- |
| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation |
| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation |
| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing |
| `UsageSnippets` | [*shared.UsageSnippets](../../../pkg/models/shared/usagesnippets.md) | :heavy_minus_sign: | OK |
Loading

0 comments on commit 6c08d50

Please sign in to comment.