Skip to content

Commit

Permalink
ci: regenerated with OpenAPI Doc 0.1.0, Speakeay CLI 1.108.1
Browse files Browse the repository at this point in the history
  • Loading branch information
speakeasybot committed Oct 27, 2023
1 parent 5e7f9c9 commit 086a225
Show file tree
Hide file tree
Showing 44 changed files with 898 additions and 78 deletions.
14 changes: 13 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -905,4 +905,16 @@ Based on:
- [python v2.0.0] python-client-sdk
- [ruby v1.36.0] ruby-client-sdk
### Releases
- [Go v1.39.0] https://github.com/speakeasy-api/openapi-generation-tests/releases/tag/go-client-sdk/v1.39.0 - go-client-sdk
- [Go v1.39.0] https://github.com/speakeasy-api/openapi-generation-tests/releases/tag/go-client-sdk/v1.39.0 - go-client-sdk

## 2023-10-27 00:11:54
### Changes
Based on:
- OpenAPI Doc 0.1.0
- Speakeasy CLI 1.108.1 (2.172.4) https://github.com/speakeasy-api/speakeasy
### Generated
- [go v1.39.1] go-client-sdk
- [python v2.0.1] python-client-sdk
- [typescript v1.40.1] typescript-client-sdk
### Releases
- [Go v1.39.1] https://github.com/speakeasy-api/openapi-generation-tests/releases/tag/go-client-sdk/v1.39.1 - go-client-sdk
235 changes: 235 additions & 0 deletions go-client-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,241 @@ func main() {
```
<!-- End Global Parameters -->



<!-- Start Error Handling -->
# Error Handling

Handling errors in your SDK should largely match your expectations. All operations return a response object or an error, they will never return both. When specified by the OpenAPI spec document, the SDK will return the appropriate subclass.


## Example

```go
package main

import (
"context"
"log"
"openapi"
"openapi/pkg/models/shared"
)

func main() {
s := openapi.New(
openapi.WithSecurity(shared.Security{
APIKeyAuth: openapi.String("Token YOUR_API_KEY"),
}),
openapi.WithGlobalPathParam(100),
openapi.WithGlobalQueryParam("some example global query param"),
)

var statusCode int64 = 385913

ctx := context.Background()
res, err := s.Errors.StatusGetXSpeakeasyErrors(ctx, statusCode)
if err != nil {

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

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

}
}

```
<!-- End Error Handling -->



<!-- Start Server Selection -->
# Server Selection

## Select Server by Index

You can override the default server globally using the `WithServerIndex` option when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:

| # | Server | Variables |
| - | ------ | --------- |
| 0 | `http://localhost:35123` | None |
| 1 | `http://broken` | None |
| 2 | `http://{hostname}:{port}` | `hostname` (default is `localhost`), `port` (default is `35123`) |
| 3 | `http://localhost:35123/anything/{something}` | `something` (default is `something`) |
| 4 | `{protocol}://{hostname}:{port}` | `hostname` (default is `localhost`), `port` (default is `35123`), `protocol` (default is `http`) |


Some of the server options above contain variables. If you want to set the values of those variables, the following options are provided for doing so:
* `WithHostname string`

* `WithPort string`

* `WithProtocol string`

* `WithSomething ServerSomething`

For example:


```go
package main

import (
"context"
"log"
"openapi"
"openapi/pkg/models/shared"
)

func main() {
s := openapi.New(
openapi.WithSecurity(shared.Security{
APIKeyAuth: openapi.String("Token YOUR_API_KEY"),
}),
openapi.WithGlobalPathParam(100),
openapi.WithGlobalQueryParam("some example global query param"),
openapi.WithServerIndex(4),
)

ctx := context.Background()
res, err := s.SDK.PutAnythingIgnoredGeneration(ctx, "string")
if err != nil {
log.Fatal(err)
}

if res.PutAnythingIgnoredGeneration200ApplicationJSONObject != nil {
// handle response
}
}

```


## Override Server URL Per-Client

The default server can also be overridden globally using the `WithServerURL` option when initializing the SDK client instance. For example:


```go
package main

import (
"context"
"log"
"openapi"
"openapi/pkg/models/shared"
)

func main() {
s := openapi.New(
openapi.WithSecurity(shared.Security{
APIKeyAuth: openapi.String("Token YOUR_API_KEY"),
}),
openapi.WithGlobalPathParam(100),
openapi.WithGlobalQueryParam("some example global query param"),
openapi.WithServerURL("http://localhost:35123"),
)

ctx := context.Background()
res, err := s.SDK.PutAnythingIgnoredGeneration(ctx, "string")
if err != nil {
log.Fatal(err)
}

if res.PutAnythingIgnoredGeneration200ApplicationJSONObject != nil {
// handle response
}
}

```

## Override Server URL Per-Operation

The server URL can also be overridden on a per-operation basis, provided a server list was specified for the operation. For example:


```go
package main

import (
"context"
"log"
"openapi"
"openapi/pkg/models/shared"
)

func main() {
s := openapi.New(
openapi.WithSecurity(shared.Security{
APIKeyAuth: openapi.String("Token YOUR_API_KEY"),
}),
openapi.WithGlobalPathParam(100),
openapi.WithGlobalQueryParam("some example global query param"),
)

ctx := context.Background()
res, err := s.AuthNew.APIKeyAuthGlobalNew(ctx, shared.AuthServiceRequestBody{
BasicAuth: &shared.AuthServiceRequestBodyBasicAuth{
Password: "owsGgP4_AhRPMSJ",
Username: "Devonte_Bins",
},
HeaderAuth: []shared.AuthServiceRequestBodyHeaderAuth{
shared.AuthServiceRequestBodyHeaderAuth{
ExpectedValue: "string",
HeaderName: "string",
},
},
}, operations.WithServerURL("http://localhost:35456"))
if err != nil {
log.Fatal(err)
}

if res.StatusCode == http.StatusOK {
// handle response
}
}

```
<!-- End Server Selection -->



<!-- Start Custom HTTP Client -->
# Custom HTTP Client

The Go SDK makes API calls that wrap an internal HTTP client. The requirements for the HTTP client are very simple. It must match this interface:

```go
type HTTPClient interface {
Do(req *http.Request) (*http.Response, error)
}
```

The built-in `net/http` client satisfies this interface and a default client based on the built-in is provided by default. To replace this default with a client of your own, you can implement this interface yourself or provide your own client configured as desired. Here's a simple example, which adds a client with a 30 second timeout.

```go
import (
"net/http"
"time"
"github.com/myorg/your-go-sdk"
)

var (
httpClient = &http.Client{Timeout: 30 * time.Second}
sdkClient = sdk.New(sdk.WithClient(httpClient))
)
```

This can be a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration.
<!-- End Custom HTTP Client -->

<!-- Placeholder for Future Speakeasy SDK Sections -->


Expand Down
8 changes: 4 additions & 4 deletions go-client-sdk/docs/sdks/parameters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ func main() {
}

mapParamExploded := map[string]int64{
"test": 1,
"test2": 2,
"test": 1,
}

ctx := context.Background()
Expand Down Expand Up @@ -712,8 +712,8 @@ func main() {
}

xHeaderMapExplode := map[string]string{
"test2": "val2",
"test1": "val1",
"test2": "val2",
}

ctx := context.Background()
Expand Down Expand Up @@ -990,7 +990,7 @@ func main() {
Bool: true,
Int: 1,
Map: map[string]shared.SimpleObject{
"key": shared.SimpleObject{
"key2": shared.SimpleObject{
Any: "any",
Bigint: big.NewInt(8821239038968084),
BigintStr: types.MustNewBigIntFromString("9223372036854775808"),
Expand All @@ -1010,7 +1010,7 @@ func main() {
Str: "test",
StrOpt: openapi.String("testOptional"),
},
"key2": shared.SimpleObject{
"key": shared.SimpleObject{
Any: "any",
Bigint: big.NewInt(8821239038968084),
BigintStr: types.MustNewBigIntFromString("9223372036854775808"),
Expand Down
4 changes: 2 additions & 2 deletions go-client-sdk/docs/sdks/requestbodies/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2445,7 +2445,7 @@ func main() {
Bool: true,
Int: 1,
Map: map[string]shared.SimpleObject{
"key": shared.SimpleObject{
"key2": shared.SimpleObject{
Any: "any",
Bigint: big.NewInt(8821239038968084),
BigintStr: types.MustNewBigIntFromString("9223372036854775808"),
Expand All @@ -2465,7 +2465,7 @@ func main() {
Str: "test",
StrOpt: openapi.String("testOptional"),
},
"key2": shared.SimpleObject{
"key": shared.SimpleObject{
Any: "any",
Bigint: big.NewInt(8821239038968084),
BigintStr: types.MustNewBigIntFromString("9223372036854775808"),
Expand Down
4 changes: 2 additions & 2 deletions go-client-sdk/docs/sdks/unions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ func main() {
Bool: true,
Int: 1,
Map: map[string]shared.SimpleObject{
"key2": shared.SimpleObject{
"key": shared.SimpleObject{
Any: "any",
Bigint: big.NewInt(8821239038968084),
BigintStr: types.MustNewBigIntFromString("9223372036854775808"),
Expand All @@ -517,7 +517,7 @@ func main() {
Str: "test",
StrOpt: openapi.String("testOptional"),
},
"key": shared.SimpleObject{
"key2": shared.SimpleObject{
Any: "any",
Bigint: big.NewInt(8821239038968084),
BigintStr: types.MustNewBigIntFromString("9223372036854775808"),
Expand Down
8 changes: 4 additions & 4 deletions go-client-sdk/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ configVersion: 1.0.0
management:
docChecksum: 3f790c65afe8341dde1d7807cdaa1c4d
docVersion: 0.1.0
speakeasyVersion: 1.107.0
generationVersion: 2.171.0
speakeasyVersion: 1.108.1
generationVersion: 2.172.4
generation:
repoURL: https://github.com/speakeasy-api/openapi-generation-tests.git
sdkClassName: SDK
Expand All @@ -14,7 +14,7 @@ features:
constsAndDefaults: 0.1.1
core: 2.94.0
deprecations: 2.81.1
docs: 0.3.4
docs: 0.3.7
downloadStreams: 0.1.1
enums: 2.81.1
errors: 2.81.7
Expand All @@ -36,7 +36,7 @@ features:
tests: 0.0.0
unions: 2.84.0
go:
version: 1.39.0
version: 1.39.1
clientServerStatusCodesAsErrors: true
flattenGlobalSecurity: true
installationURL: https://github.com/speakeasy-api/openapi-generation-tests/go-client-sdk
Expand Down
6 changes: 3 additions & 3 deletions go-client-sdk/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ func New(opts ...SDKOption) *SDK {
sdkConfiguration: sdkConfiguration{
Language: "go",
OpenAPIDocVersion: "0.1.0",
SDKVersion: "1.39.0",
GenVersion: "2.171.0",
UserAgent: "speakeasy-sdk/go 1.39.0 2.171.0 0.1.0 openapi",
SDKVersion: "1.39.1",
GenVersion: "2.172.4",
UserAgent: "speakeasy-sdk/go 1.39.1 2.172.4 0.1.0 openapi",
Globals: map[string]map[string]map[string]interface{}{
"parameters": {},
},
Expand Down
Loading

0 comments on commit 086a225

Please sign in to comment.