Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.DS_Store
**/.speakeasy/temp/
**/.speakeasy/logs/
.speakeasy/reports
# .gitignore
120 changes: 105 additions & 15 deletions .speakeasy/gen.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ generation:
useClassNamesForArrayFields: true
fixes:
nameResolutionDec2023: true
nameResolutionFeb2025: false
parameterOrderingFeb2024: true
requestResponseComponentNamesFeb2024: true
securityFeb2025: false
sharedErrorComponentsApr2025: false
auth:
oAuth2ClientCredentialsEnabled: true
oAuth2PasswordEnabled: false
go:
version: 0.12.0
version: 0.13.0
additionalDependencies: {}
allowUnknownFieldsInWeakUnions: false
clientServerStatusCodesAsErrors: true
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.481.1
speakeasyVersion: 1.542.3
sources:
openapi.json:
sourceNamespace: openapi-json
sourceRevisionDigest: sha256:4178e9da06ec543aefb7c30ed1950f75bb58d07a258c3af060c361017cea7d5c
sourceBlobDigest: sha256:80c886c09d00fa411bdbabd47b78ae9f876f36f600ae342c9a7c300e79c15d98
sourceRevisionDigest: sha256:659bee904b6d370b335bcc63d8041efb96e0a8ab05f440b941bffc476b3cde06
sourceBlobDigest: sha256:b98f7d2c560a644a3e7449388f73759520ecbfe5b64c57deda338cfad258b527
tags:
- latest
- speakeasy-sdk-regen-1736900992
- speakeasy-sdk-regen-1738542651
- 1.0.0
targets:
go:
source: openapi.json
sourceNamespace: openapi-json
sourceRevisionDigest: sha256:4178e9da06ec543aefb7c30ed1950f75bb58d07a258c3af060c361017cea7d5c
sourceBlobDigest: sha256:80c886c09d00fa411bdbabd47b78ae9f876f36f600ae342c9a7c300e79c15d98
sourceRevisionDigest: sha256:659bee904b6d370b335bcc63d8041efb96e0a8ab05f440b941bffc476b3cde06
sourceBlobDigest: sha256:b98f7d2c560a644a3e7449388f73759520ecbfe5b64c57deda338cfad258b527
codeSamplesNamespace: openapi-json-go-code-samples
codeSamplesRevisionDigest: sha256:f629299411e3cfd98aafaaf5c6e0e5fa8d23ed4546d7c7d1128e6f9e59be7353
codeSamplesRevisionDigest: sha256:8869a502c3887b06a2685bf60bac3ac08307791da57bfeb4694c18cf217cc032
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ For example, the `V1Liveness` function may return the following errors:
| sdkerrors.ErrForbidden | 403 | application/json |
| sdkerrors.ErrNotFound | 404 | application/json |
| sdkerrors.ErrConflict | 409 | application/json |
| sdkerrors.ErrPreconditionFailed | 412 | application/json |
| sdkerrors.ErrTooManyRequests | 429 | application/json |
| sdkerrors.ErrInternalServerError | 500 | application/json |
| sdkerrors.SDKError | 4XX, 5XX | \*/\* |
Expand Down Expand Up @@ -224,6 +225,12 @@ func main() {
log.Fatal(e.Error())
}

var e *sdkerrors.ErrPreconditionFailed
if errors.As(err, &e) {
// handle error
log.Fatal(e.Error())
}

var e *sdkerrors.ErrTooManyRequests
if errors.As(err, &e) {
// handle error
Expand Down Expand Up @@ -252,7 +259,7 @@ func main() {

### Override Server URL Per-Client

The default server can also be overridden globally using the `WithServerURL(serverURL string)` option when initializing the SDK client instance. For example:
The default server can be overridden globally using the `WithServerURL(serverURL string)` option when initializing the SDK client instance. For example:
```go
package main

Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,14 @@ Based on:
### Generated
- [go v0.12.0] .
### Releases
- [Go v0.12.0] https://github.com/unkeyed/unkey-go/releases/tag/v0.12.0 - .
- [Go v0.12.0] https://github.com/unkeyed/unkey-go/releases/tag/v0.12.0 - .

## 2025-05-08 00:34:20
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.542.3 (2.597.9) https://github.com/speakeasy-api/speakeasy
### Generated
- [go v0.13.0] .
### Releases
- [Go v0.13.0] https://github.com/unkeyed/unkey-go/releases/tag/v0.13.0 - .
38 changes: 30 additions & 8 deletions analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ func newAnalytics(sdkConfig sdkConfiguration) *Analytics {
}

func (s *Analytics) GetVerifications(ctx context.Context, request operations.GetVerificationsRequest, opts ...operations.Option) (*operations.GetVerificationsResponse, error) {
hookCtx := hooks.HookContext{
Context: ctx,
OperationID: "getVerifications",
OAuth2Scopes: []string{},
SecuritySource: s.sdkConfiguration.Security,
}

o := operations.Options{}
supportedOptions := []string{
operations.SupportedOptionRetries,
Expand All @@ -57,6 +50,14 @@ func (s *Analytics) GetVerifications(ctx context.Context, request operations.Get
return nil, fmt.Errorf("error generating URL: %w", err)
}

hookCtx := hooks.HookContext{
BaseURL: baseURL,
Context: ctx,
OperationID: "getVerifications",
OAuth2Scopes: []string{},
SecuritySource: s.sdkConfiguration.Security,
}

timeout := o.Timeout
if timeout == nil {
timeout = s.sdkConfiguration.Timeout
Expand Down Expand Up @@ -167,7 +168,7 @@ func (s *Analytics) GetVerifications(ctx context.Context, request operations.Get

_, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
return nil, err
} else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "409", "429", "4XX", "500", "5XX"}, httpRes.StatusCode) {
} else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "409", "412", "429", "4XX", "500", "5XX"}, httpRes.StatusCode) {
_httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil)
if err != nil {
return nil, err
Expand Down Expand Up @@ -308,6 +309,27 @@ func (s *Analytics) GetVerifications(ctx context.Context, request operations.Get
return nil, err
}

return nil, &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 == 412:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}

var out sdkerrors.ErrPreconditionFailed
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}

return nil, &out
default:
rawBody, err := utils.ConsumeRawBody(httpRes)
Expand Down
Loading