Skip to content

Commit

Permalink
Merge pull request #44 from dubinc/speakeasy-sdk-regen-1728778401
Browse files Browse the repository at this point in the history
chore: 🐝 Update SDK - Generate 0.9.10
  • Loading branch information
devkiran authored Oct 13, 2024
2 parents 9d3ea7e + 6c26662 commit 9b2d870
Show file tree
Hide file tree
Showing 15 changed files with 619 additions and 1,191 deletions.
12 changes: 6 additions & 6 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
lockVersion: 2.0.0
id: 1773e9c7-1931-4663-8ac8-4deaf8db76f5
management:
docChecksum: 8620b0f24a0133906ad7b91d73cc1651
docChecksum: a31838ebdf42ec2dd03d62aa6a2b788e
docVersion: 0.0.1
speakeasyVersion: 1.410.0
generationVersion: 2.434.1
releaseVersion: 0.9.9
configChecksum: a44872345ac3bac755ba9de9786711f9
speakeasyVersion: 1.418.1
generationVersion: 2.438.3
releaseVersion: 0.9.10
configChecksum: 0c0eaae045134633255ae736d2a3c70d
repoURL: https://github.com/dubinc/dub-go.git
installationURL: https://github.com/dubinc/dub-go
features:
go:
additionalDependencies: 0.1.0
constsAndDefaults: 0.1.6
core: 3.5.12
core: 3.5.13
defaultEnabledRetries: 0.2.0
deprecations: 2.81.1
envVarSecurityUsage: 0.3.1
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: true
go:
version: 0.9.9
version: 0.9.10
additionalDependencies: {}
allowUnknownFieldsInWeakUnions: false
clientServerStatusCodesAsErrors: true
Expand Down
12 changes: 6 additions & 6 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
speakeasyVersion: 1.410.0
speakeasyVersion: 1.418.1
sources:
dub:
sourceNamespace: dub
sourceRevisionDigest: sha256:c1b7ab42a8e776cf6092984d69480c76dfa227d5d72ad433ab6382b968cd670a
sourceBlobDigest: sha256:b0117061fe4ab404ff5e4d1469815d30c20d84ec47ba79728102ae69a6e8957a
sourceRevisionDigest: sha256:60885a57426bc52d0283636fd0b09fe8665f95c74529f82ea8e9947c7892b01e
sourceBlobDigest: sha256:5bbb141fb5875836afd42e81a8f8ff058c9fb7ac1132a898d06fe85e5db1b660
tags:
- latest
- main
targets:
my-first-target:
source: dub
sourceNamespace: dub
sourceRevisionDigest: sha256:c1b7ab42a8e776cf6092984d69480c76dfa227d5d72ad433ab6382b968cd670a
sourceBlobDigest: sha256:b0117061fe4ab404ff5e4d1469815d30c20d84ec47ba79728102ae69a6e8957a
sourceRevisionDigest: sha256:60885a57426bc52d0283636fd0b09fe8665f95c74529f82ea8e9947c7892b01e
sourceBlobDigest: sha256:5bbb141fb5875836afd42e81a8f8ff058c9fb7ac1132a898d06fe85e5db1b660
codeSamplesNamespace: code-samples-go-my-first-target
codeSamplesRevisionDigest: sha256:79cc6c9b69c4983d3b80d2d7e681e0e9ff5b41914c9593b95484b9af5284c2ee
codeSamplesRevisionDigest: sha256:9c2e2ae9a3f624e3a487a69c18b82cce226cba2b612c1a942d055d9a3df6cef9
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 @@ -408,4 +408,14 @@ Based on:
### Generated
- [go v0.9.9] .
### Releases
- [Go v0.9.9] https://github.com/dubinc/dub-go/releases/tag/v0.9.9 - .
- [Go v0.9.9] https://github.com/dubinc/dub-go/releases/tag/v0.9.9 - .

## 2024-10-13 00:13:15
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.418.1 (2.438.3) https://github.com/speakeasy-api/speakeasy
### Generated
- [go v0.9.10] .
### Releases
- [Go v0.9.10] https://github.com/dubinc/dub-go/releases/tag/v0.9.10 - .
67 changes: 22 additions & 45 deletions analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/dubinc/dub-go/internal/utils"
"github.com/dubinc/dub-go/models/operations"
"github.com/dubinc/dub-go/models/sdkerrors"
"io"
"net/http"
"net/url"
)
Expand Down Expand Up @@ -165,21 +164,11 @@ func (s *Analytics) Retrieve(ctx context.Context, request operations.RetrieveAna
}
}

getRawBody := func() ([]byte, error) {
rawBody, err := io.ReadAll(httpRes.Body)
if err != nil {
return nil, fmt.Errorf("error reading response body: %w", err)
}
httpRes.Body.Close()
httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody))
return rawBody, nil
}

switch {
case httpRes.StatusCode == 200:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := getRawBody()
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
Expand All @@ -191,17 +180,16 @@ func (s *Analytics) Retrieve(ctx context.Context, request operations.RetrieveAna

return &out, nil
default:
rawBody, err := getRawBody()
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 == 400:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := getRawBody()
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
Expand All @@ -213,17 +201,16 @@ func (s *Analytics) Retrieve(ctx context.Context, request operations.RetrieveAna

return nil, &out
default:
rawBody, err := getRawBody()
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 == 401:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := getRawBody()
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
Expand All @@ -235,17 +222,16 @@ func (s *Analytics) Retrieve(ctx context.Context, request operations.RetrieveAna

return nil, &out
default:
rawBody, err := getRawBody()
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 == 403:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := getRawBody()
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
Expand All @@ -257,17 +243,16 @@ func (s *Analytics) Retrieve(ctx context.Context, request operations.RetrieveAna

return nil, &out
default:
rawBody, err := getRawBody()
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 == 404:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := getRawBody()
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
Expand All @@ -279,17 +264,16 @@ func (s *Analytics) Retrieve(ctx context.Context, request operations.RetrieveAna

return nil, &out
default:
rawBody, err := getRawBody()
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 == 409:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := getRawBody()
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
Expand All @@ -301,17 +285,16 @@ func (s *Analytics) Retrieve(ctx context.Context, request operations.RetrieveAna

return nil, &out
default:
rawBody, err := getRawBody()
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 == 410:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := getRawBody()
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
Expand All @@ -323,17 +306,16 @@ func (s *Analytics) Retrieve(ctx context.Context, request operations.RetrieveAna

return nil, &out
default:
rawBody, err := getRawBody()
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 == 422:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := getRawBody()
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
Expand All @@ -345,17 +327,16 @@ func (s *Analytics) Retrieve(ctx context.Context, request operations.RetrieveAna

return nil, &out
default:
rawBody, err := getRawBody()
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 == 429:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := getRawBody()
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
Expand All @@ -367,17 +348,16 @@ func (s *Analytics) Retrieve(ctx context.Context, request operations.RetrieveAna

return nil, &out
default:
rawBody, err := getRawBody()
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 == 500:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
rawBody, err := getRawBody()
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}
Expand All @@ -389,28 +369,25 @@ func (s *Analytics) Retrieve(ctx context.Context, request operations.RetrieveAna

return nil, &out
default:
rawBody, err := getRawBody()
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 >= 400 && httpRes.StatusCode < 500:
fallthrough
case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
rawBody, err := getRawBody()
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}

return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
default:
rawBody, err := getRawBody()
rawBody, err := utils.ConsumeRawBody(httpRes)
if err != nil {
return nil, err
}

return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes)
}

Expand Down
Loading

0 comments on commit 9b2d870

Please sign in to comment.