Skip to content

Commit

Permalink
release: 0.1.0-alpha.19 (#77)
Browse files Browse the repository at this point in the history
* fix: fix unicode encoding for json (#76)

* docs: document raw responses (#78)

* release: 0.1.0-alpha.19

---------

Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
  • Loading branch information
stainless-app[bot] authored Feb 1, 2025
1 parent e7a37a1 commit f873275
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.18"
".": "0.1.0-alpha.19"
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.1.0-alpha.19 (2025-02-01)

Full Changelog: [v0.1.0-alpha.18...v0.1.0-alpha.19](https://github.com/nirvana-labs/nirvana-go/compare/v0.1.0-alpha.18...v0.1.0-alpha.19)

### Bug Fixes

* fix unicode encoding for json ([#76](https://github.com/nirvana-labs/nirvana-go/issues/76)) ([8cf4f32](https://github.com/nirvana-labs/nirvana-go/commit/8cf4f32734bc154dc7153af89542dce2d294520c))


### Documentation

* document raw responses ([#78](https://github.com/nirvana-labs/nirvana-go/issues/78)) ([7191806](https://github.com/nirvana-labs/nirvana-go/commit/7191806a52f05f6a1f19d24c2553f2a5f9c9097e))

## 0.1.0-alpha.18 (2025-01-31)

Full Changelog: [v0.1.0-alpha.17...v0.1.0-alpha.18](https://github.com/nirvana-labs/nirvana-go/compare/v0.1.0-alpha.17...v0.1.0-alpha.18)
Expand Down
41 changes: 40 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/nirvana-labs/nirvana-go@v0.1.0-alpha.18'
go get -u 'github.com/nirvana-labs/nirvana-go@v0.1.0-alpha.19'
```

<!-- x-release-please-end -->
Expand Down Expand Up @@ -310,6 +310,45 @@ client.Compute.VMs.New(
)
```

### Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the `option.WithResponseInto()` request option. This is useful when
you need to examine response headers, status codes, or other details.

```go
// Create a variable to store the HTTP response
var response *http.Response
operation, err := client.Compute.VMs.New(
context.TODO(),
compute.VMNewParams{
BootVolume: nirvana.F(compute.VMNewParamsBootVolume{
Size: nirvana.F(int64(100)),
}),
CPU: nirvana.F(compute.CPUParam{
Cores: nirvana.F(int64(2)),
}),
Name: nirvana.F("my-vm"),
OSImageName: nirvana.F("noble-2024-12-06"),
PublicIPEnabled: nirvana.F(true),
Ram: nirvana.F(compute.RamParam{
Size: nirvana.F(int64(2)),
}),
Region: nirvana.F(shared.RegionNameUsSea1),
SSHKey: nirvana.F(compute.SSHKeyParam{
PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"),
}),
},
option.WithResponseInto(&response),
)
if err != nil {
// handle error
}
fmt.Printf("%+v\n", operation)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
```

### Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented
Expand Down
2 changes: 1 addition & 1 deletion internal/apijson/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (e *encoder) newPrimitiveTypeEncoder(t reflect.Type) encoderFunc {
// code more and this current code shouldn't cause any issues
case reflect.String:
return func(v reflect.Value) ([]byte, error) {
return []byte(fmt.Sprintf("%q", v.String())), nil
return json.Marshal(v.Interface())
}
case reflect.Bool:
return func(v reflect.Value) ([]byte, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package internal

const PackageVersion = "0.1.0-alpha.18" // x-release-please-version
const PackageVersion = "0.1.0-alpha.19" // x-release-please-version

0 comments on commit f873275

Please sign in to comment.