From 9be23c37cf2bd57fc41454344b512b675e4806e6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 19:05:43 +0000 Subject: [PATCH 1/4] feat(api): update via SDK Studio (#8) --- README.md | 14 +++++++------- client_test.go | 16 ++++++++-------- usage_test.go | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 77b37b6..581ee39 100644 --- a/README.md +++ b/README.md @@ -53,11 +53,11 @@ func main() { option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("API_KEY") option.WithEnvironmentMainnet(), // defaults to option.WithEnvironmentMainnet() ) - timestampedBlockchainInfo, err := client.General.Info.Get(context.TODO()) + timestampedBlock, err := client.Blocks.Latest.Get(context.TODO()) if err != nil { panic(err.Error()) } - fmt.Printf("%+v\n", timestampedBlockchainInfo.Data) + fmt.Printf("%+v\n", timestampedBlock.Data) } ``` @@ -146,7 +146,7 @@ client := maestrobitcoingosdk.NewClient( option.WithHeader("X-Some-Header", "custom_header_info"), ) -client.General.Info.Get(context.TODO(), ..., +client.Blocks.Latest.Get(context.TODO(), ..., // Override the header option.WithHeader("X-Some-Header", "some_other_custom_header_info"), // Add an undocumented field to the request body, using sjson syntax @@ -175,14 +175,14 @@ When the API returns a non-success status code, we return an error with type To handle errors, we recommend that you use the `errors.As` pattern: ```go -_, err := client.General.Info.Get(context.TODO()) +_, err := client.Blocks.Latest.Get(context.TODO()) if err != nil { var apierr *maestrobitcoingosdk.Error if errors.As(err, &apierr) { println(string(apierr.DumpRequest(true))) // Prints the serialized HTTP request println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response } - panic(err.Error()) // GET "/general/info": 400 Bad Request { ... } + panic(err.Error()) // GET "/blocks/latest": 400 Bad Request { ... } } ``` @@ -200,7 +200,7 @@ To set a per-retry timeout, use `option.WithRequestTimeout()`. // This sets the timeout for the request, including all the retries. ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() -client.General.Info.Get( +client.Blocks.Latest.Get( ctx, // This sets the per-retry timeout option.WithRequestTimeout(20*time.Second), @@ -235,7 +235,7 @@ client := maestrobitcoingosdk.NewClient( ) // Override per-request: -client.General.Info.Get(context.TODO(), option.WithMaxRetries(5)) +client.Blocks.Latest.Get(context.TODO(), option.WithMaxRetries(5)) ``` ### Making custom/undocumented requests diff --git a/client_test.go b/client_test.go index a6cc3f1..d9129c5 100644 --- a/client_test.go +++ b/client_test.go @@ -37,7 +37,7 @@ func TestUserAgentHeader(t *testing.T) { }, }), ) - client.General.Info.Get(context.Background()) + client.Blocks.Latest.Get(context.Background()) if userAgent != fmt.Sprintf("Maestro/Go %s", internal.PackageVersion) { t.Errorf("Expected User-Agent to be correct, but got: %#v", userAgent) } @@ -60,7 +60,7 @@ func TestRetryAfter(t *testing.T) { }, }), ) - res, err := client.General.Info.Get(context.Background()) + res, err := client.Blocks.Latest.Get(context.Background()) if err == nil || res != nil { t.Error("Expected there to be a cancel error and for the response to be nil") } @@ -94,7 +94,7 @@ func TestDeleteRetryCountHeader(t *testing.T) { }), option.WithHeaderDel("X-Stainless-Retry-Count"), ) - res, err := client.General.Info.Get(context.Background()) + res, err := client.Blocks.Latest.Get(context.Background()) if err == nil || res != nil { t.Error("Expected there to be a cancel error and for the response to be nil") } @@ -123,7 +123,7 @@ func TestOverwriteRetryCountHeader(t *testing.T) { }), option.WithHeader("X-Stainless-Retry-Count", "42"), ) - res, err := client.General.Info.Get(context.Background()) + res, err := client.Blocks.Latest.Get(context.Background()) if err == nil || res != nil { t.Error("Expected there to be a cancel error and for the response to be nil") } @@ -151,7 +151,7 @@ func TestRetryAfterMs(t *testing.T) { }, }), ) - res, err := client.General.Info.Get(context.Background()) + res, err := client.Blocks.Latest.Get(context.Background()) if err == nil || res != nil { t.Error("Expected there to be a cancel error and for the response to be nil") } @@ -173,7 +173,7 @@ func TestContextCancel(t *testing.T) { ) cancelCtx, cancel := context.WithCancel(context.Background()) cancel() - res, err := client.General.Info.Get(cancelCtx) + res, err := client.Blocks.Latest.Get(cancelCtx) if err == nil || res != nil { t.Error("Expected there to be a cancel error and for the response to be nil") } @@ -192,7 +192,7 @@ func TestContextCancelDelay(t *testing.T) { ) cancelCtx, cancel := context.WithTimeout(context.Background(), 2*time.Millisecond) defer cancel() - res, err := client.General.Info.Get(cancelCtx) + res, err := client.Blocks.Latest.Get(cancelCtx) if err == nil || res != nil { t.Error("expected there to be a cancel error and for the response to be nil") } @@ -217,7 +217,7 @@ func TestContextDeadline(t *testing.T) { }, }), ) - res, err := client.General.Info.Get(deadlineCtx) + res, err := client.Blocks.Latest.Get(deadlineCtx) if err == nil || res != nil { t.Error("expected there to be a deadline error and for the response to be nil") } diff --git a/usage_test.go b/usage_test.go index 3ff6d77..c24ee39 100644 --- a/usage_test.go +++ b/usage_test.go @@ -24,9 +24,9 @@ func TestUsage(t *testing.T) { option.WithBaseURL(baseURL), option.WithAPIKey("My API Key"), ) - timestampedBlockchainInfo, err := client.General.Info.Get(context.TODO()) + timestampedBlock, err := client.Blocks.Latest.Get(context.TODO()) if err != nil { t.Error(err) } - t.Logf("%+v\n", timestampedBlockchainInfo.Data) + t.Logf("%+v\n", timestampedBlock.Data) } From 534c1d65e2a17f62f606a7aa4dec05c53dcd33b6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 19:06:04 +0000 Subject: [PATCH 2/4] release: 0.1.0-alpha.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 2 +- internal/version.go | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f14b480..aaf968a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.2" + ".": "0.1.0-alpha.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a7be4b2..4964da1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.1.0-alpha.3 (2024-10-08) + +Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/maestro-org/maestro-bitcoin-go-sdk/compare/v0.1.0-alpha.2...v0.1.0-alpha.3) + +### Features + +* **api:** update via SDK Studio ([#8](https://github.com/maestro-org/maestro-bitcoin-go-sdk/issues/8)) ([9be23c3](https://github.com/maestro-org/maestro-bitcoin-go-sdk/commit/9be23c37cf2bd57fc41454344b512b675e4806e6)) + ## 0.1.0-alpha.2 (2024-10-08) Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/maestro-org/maestro-bitcoin-go-sdk/compare/v0.1.0-alpha.1...v0.1.0-alpha.2) diff --git a/README.md b/README.md index 581ee39..ee900d8 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Or to pin the version: ```sh -go get -u 'github.com/maestro-org/maestro-bitcoin-go-sdk@v0.1.0-alpha.2' +go get -u 'github.com/maestro-org/maestro-bitcoin-go-sdk@v0.1.0-alpha.3' ``` diff --git a/internal/version.go b/internal/version.go index d6f40b3..2d1d85e 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.1.0-alpha.2" // x-release-please-version +const PackageVersion = "0.1.0-alpha.3" // x-release-please-version From 023a6b7806b41d8d2df496782f12b28b35069a35 Mon Sep 17 00:00:00 2001 From: Vardominator Date: Tue, 8 Oct 2024 19:08:15 +0000 Subject: [PATCH 3/4] update readme --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ee900d8..f075261 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,10 @@ -# Maestro Go API Library +# Maestro Bitcoin Go SDK Go Reference -The Maestro Go library provides convenient access to [the Maestro REST +The Maestro Bitcoin Go SDK provides convenient access to [the Maestro Bitcoin REST API](https://docs.gomaestro.org/) from applications written in Go. The full API of this library can be found in [api.md](api.md). -It is generated with [Stainless](https://www.stainlessapi.com/). - ## Installation From 4997c2b52090c759d03fc3353832c37c5604fd37 Mon Sep 17 00:00:00 2001 From: Vardominator Date: Tue, 8 Oct 2024 19:09:53 +0000 Subject: [PATCH 4/4] deets --- .github/CODEOWNERS | 1 + CODE_OF_CONDUCT.md | 128 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 CODE_OF_CONDUCT.md diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..0bd7208 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @maestro-org/Go \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..10b0bbc --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +support@gomaestro.org. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations.