Skip to content

Commit

Permalink
Merge pull request #9 from maestro-org/release-please--branches--main…
Browse files Browse the repository at this point in the history
…--changes--next

release: 0.1.0-alpha.3
  • Loading branch information
Vardominator authored Oct 8, 2024
2 parents f49aebc + 4997c2b commit f3d944b
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 24 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @maestro-org/Go
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.2"
".": "0.1.0-alpha.3"
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
128 changes: 128 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -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
[email protected].
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.
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Maestro Go API Library
# Maestro Bitcoin Go SDK

<a href="https://pkg.go.dev/github.com/maestro-org/maestro-bitcoin-go-sdk"><img src="https://pkg.go.dev/badge/github.com/maestro-org/maestro-bitcoin-go-sdk.svg" alt="Go Reference"></a>

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

<!-- x-release-please-start-version -->
Expand All @@ -24,7 +22,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/maestro-org/[email protected].2'
go get -u 'github.com/maestro-org/[email protected].3'
```

<!-- x-release-please-end -->
Expand Down Expand Up @@ -53,11 +51,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)
}

```
Expand Down Expand Up @@ -146,7 +144,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
Expand Down Expand Up @@ -175,14 +173,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 { ... }
}
```

Expand All @@ -200,7 +198,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),
Expand Down Expand Up @@ -235,7 +233,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
Expand Down
16 changes: 8 additions & 8 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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")
}
Expand Down Expand Up @@ -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")
}
Expand Down Expand Up @@ -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")
}
Expand Down Expand Up @@ -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")
}
Expand All @@ -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")
}
Expand All @@ -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")
}
Expand All @@ -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")
}
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.2" // x-release-please-version
const PackageVersion = "0.1.0-alpha.3" // x-release-please-version
4 changes: 2 additions & 2 deletions usage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit f3d944b

Please sign in to comment.