From 8cf4f32734bc154dc7153af89542dce2d294520c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 03:54:59 +0000 Subject: [PATCH 1/3] fix: fix unicode encoding for json (#76) --- internal/apijson/encoder.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/apijson/encoder.go b/internal/apijson/encoder.go index 8a693a7..f86bddb 100644 --- a/internal/apijson/encoder.go +++ b/internal/apijson/encoder.go @@ -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) { From 7191806a52f05f6a1f19d24c2553f2a5f9c9097e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 04:19:38 +0000 Subject: [PATCH 2/3] docs: document raw responses (#78) --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/README.md b/README.md index e51a4c6..76ac149 100644 --- a/README.md +++ b/README.md @@ -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 From 4b1fe264f8fc766b9b5885d7dacf88adc4689a2d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 04:19:53 +0000 Subject: [PATCH 3/3] release: 0.1.0-alpha.19 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ README.md | 2 +- internal/version.go | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3cf71e6..b386bef 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.18" + ".": "0.1.0-alpha.19" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 0663c0e..2270064 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/README.md b/README.md index 76ac149..b496c9a 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Or to pin the 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' ``` diff --git a/internal/version.go b/internal/version.go index 53d10d9..296d72b 100644 --- a/internal/version.go +++ b/internal/version.go @@ -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