Skip to content

Commit

Permalink
Renamed to Acme
Browse files Browse the repository at this point in the history
  • Loading branch information
dgellow committed Dec 17, 2024
1 parent 5777749 commit 9faa862
Show file tree
Hide file tree
Showing 148 changed files with 2,687 additions and 2,724 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
lint:
name: lint
runs-on: ubuntu-latest
if: github.repository == 'increase/increase-go'
if: github.repository == 'acme/acme-go'

steps:
- uses: actions/checkout@v3

- name: Setup go
uses: actions/setup-go@v4

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/create-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
release:
name: release
if: github.ref == 'refs/heads/main' && github.repository == 'increase/increase-go'
if: github.ref == 'refs/heads/main' && github.repository == 'acme/acme-go'
runs-on: ubuntu-latest

steps:
Expand All @@ -23,4 +23,4 @@ jobs:
if: ${{ steps.release.outputs.releases_created }}
run: |
version=$(jq -r '. | to_entries[0] | .value' .release-please-manifest.json)
curl -X POST https://pkg.go.dev/fetch/github.com/increase/increase-go@v${version}
curl -X POST https://pkg.go.dev/fetch/github.com/acme/acme-go@v${version}
2 changes: 1 addition & 1 deletion .github/workflows/handle-release-pr-title-edit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
startsWith(github.event.pull_request.head.ref, 'release-please--') &&
github.event.pull_request.state == 'open' &&
github.event.sender.login != 'stainless-bot' &&
github.repository == 'increase/increase-go'
github.repository == 'acme/acme-go'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
release_doctor:
name: release doctor
runs-on: ubuntu-latest
if: github.repository == 'increase/increase-go' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
if: github.repository == 'acme/acme-go' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v3
Expand Down
350 changes: 157 additions & 193 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2023 Increase
Copyright 2023 Acme

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions PROMPT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ This is an exercise in improving an API client library, just as you might
do at Stainless.

A contributor has been trying to add support for idempotency to the Stainless
Go client library for Increase. They've got some WIP code as shown in this
Go client library for Acme. They've got some WIP code as shown in this
repo.

But some tests are failing now, and they're not sure why, or what to do next.
Expand All @@ -12,7 +12,7 @@ Your task is to figure out what's wrong and to improve idempotency support in
this library.

You may use outside resources like Google and may also ask questions of
your interviewer. Please don't look in the production increase-go code though,
your interviewer. Please don't look in the production acme-go code though,
that might give away the answer too quickly!

You can run tests with this command:
Expand Down
69 changes: 34 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Increase Go API Library
# Acme Go API Library

<a href="https://pkg.go.dev/github.com/increase/increase-go"><img src="https://pkg.go.dev/badge/github.com/increase/increase-go.svg" alt="Go Reference"></a>
<a href="https://pkg.go.dev/github.com/acme/acme-go"><img src="https://pkg.go.dev/badge/github.com/acme/acme-go.svg" alt="Go Reference"></a>

The Increase Go library provides convenient access to [the Increase REST
API](https://increase.com/documentation) from applications written in Go.
The Acme Go library provides convenient access to [the Acme REST
API](https://acme.com/documentation) from applications written in Go.

## Installation

<!-- x-release-please-start-version -->

```go
import (
"github.com/increase/increase-go" // imported as increase
"github.com/acme/acme-go" // imported as acme
)
```

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

```sh
go get -u 'github.com/increase/increase[email protected]'
go get -u 'github.com/acme/acme[email protected]'
```

<!-- x-release-please-end -->
Expand All @@ -33,25 +33,25 @@ This library requires Go 1.18+.

## Usage

The full API of this library can be found in [api.md](https://www.github.com/increase/increase-go/blob/main/api.md).
The full API of this library can be found in [api.md](https://www.github.com/acme/acme-go/blob/main/api.md).

```go
package main

import (
"context"
"fmt"
"github.com/increase/increase-go"
"github.com/increase/increase-go/option"
"github.com/acme/acme-go"
"github.com/acme/acme-go/option"
)

func main() {
client := increase.NewClient(
option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("INCREASE_API_KEY")
client := acme.NewClient(
option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("ACME_API_KEY")
option.WithEnvironmentSandbox(), // defaults to option.WithEnvironmentProduction()
)
account, err := client.Accounts.New(context.TODO(), increase.AccountNewParams{
Name: increase.F("My First Increase Account"),
account, err := client.Accounts.New(context.TODO(), acme.AccountNewParams{
Name: acme.F("My First Acme Account"),
})
if err != nil {
panic(err.Error())
Expand All @@ -75,18 +75,18 @@ To send a null, use `Null[T]()`, and to send a nonconforming value, use `Raw[T](

```go
params := FooParams{
Name: increase.F("hello"),
Name: acme.F("hello"),

// Explicitly send `"description": null`
Description: increase.Null[string](),
Description: acme.Null[string](),

Point: increase.F(increase.Point{
X: increase.Int(0),
Y: increase.Int(1),
Point: acme.F(acme.Point{
X: acme.Int(0),
Y: acme.Int(1),

// In cases where the API specifies a given type,
// but you want to send something else, use `Raw`:
Z: increase.Raw[int64](0.01), // sends a float
Z: acme.Raw[int64](0.01), // sends a float
}),
}
```
Expand Down Expand Up @@ -140,7 +140,7 @@ This library uses the functional options pattern. Functions defined in the
requests. For example:

```go
client := increase.NewClient(
client := acme.NewClient(
// Adds a header to every request made by the client
option.WithHeader("X-Some-Header", "custom_header_info"),
)
Expand All @@ -153,7 +153,7 @@ client.Accounts.New(context.TODO(), ...,
)
```

The full list of request options is [here](https://pkg.go.dev/github.com/increase/increase-go/option).
The full list of request options is [here](https://pkg.go.dev/github.com/acme/acme-go/option).

### Pagination

Expand All @@ -162,7 +162,7 @@ This library provides some conveniences for working with paginated list endpoint
You can use `.ListAutoPaging()` methods to iterate through items across all pages:

```go
iter := client.Accounts.ListAutoPaging(context.TODO(), increase.AccountListParams{})
iter := client.Accounts.ListAutoPaging(context.TODO(), acme.AccountListParams{})
// Automatically fetches more pages as needed.
for iter.Next() {
account := iter.Current()
Expand All @@ -177,7 +177,7 @@ Or you can use simple `.List()` methods to fetch a single page and receive a sta
with additional helper methods like `.GetNextPage()`, e.g.:

```go
page, err := client.Accounts.List(context.TODO(), increase.AccountListParams{})
page, err := client.Accounts.List(context.TODO(), acme.AccountListParams{})
for page != nil {
for _, account := range page.Data {
fmt.Printf("%+v\n", account)
Expand All @@ -192,18 +192,18 @@ if err != nil {
### Errors

When the API returns a non-success status code, we return an error with type
`*increase.Error`. This contains the `StatusCode`, `*http.Request`, and
`*acme.Error`. This contains the `StatusCode`, `*http.Request`, and
`*http.Response` values of the request, as well as the JSON of the error body
(much like other response objects in the SDK).

To handle errors, we recommend that you use the `errors.As` pattern:

```go
_, err := client.Accounts.New(context.TODO(), increase.AccountNewParams{
Name: increase.F("New Account!"),
_, err := client.Accounts.New(context.TODO(), acme.AccountNewParams{
Name: acme.F("New Account!"),
})
if err != nil {
var apierr *increase.Error
var apierr *acme.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
Expand Down Expand Up @@ -232,8 +232,8 @@ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Accounts.List(
ctx,
increase.AccountListParams{
Status: increase.F(increase.AccountListParamsStatusOpen),
acme.AccountListParams{
Status: acme.F(acme.AccountListParamsStatusOpen),
},
// This sets the per-retry timeout
option.WithRequestTimeout(20*time.Second),
Expand All @@ -250,15 +250,15 @@ You can use the `WithMaxRetries` option to configure or disable this:

```go
// Configure the default for all requests:
client := increase.NewClient(
client := acme.NewClient(
option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Accounts.New(
context.TODO(),
increase.AccountNewParams{
Name: increase.F("Jack"),
acme.AccountNewParams{
Name: acme.F("Jack"),
},
option.WithMaxRetries(5),
)
Expand All @@ -285,7 +285,7 @@ func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response,
return res, err
}

client := increase.NewClient(
client := acme.NewClient(
option.WithMiddleware(Logger),
)
```
Expand All @@ -310,13 +310,12 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an [issue](https://www.github.com/increase/increase-go/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/acme/acme-go/issues) with questions, bugs, or suggestions.

## Development

The project should build with:


```sh
make
```
Expand Down
18 changes: 9 additions & 9 deletions account.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless.

package increase
package acme

import (
"context"
Expand All @@ -9,16 +9,16 @@ import (
"net/url"
"time"

"github.com/increase/increase-go/internal/apijson"
"github.com/increase/increase-go/internal/apiquery"
"github.com/increase/increase-go/internal/param"
"github.com/increase/increase-go/internal/requestconfig"
"github.com/increase/increase-go/internal/shared"
"github.com/increase/increase-go/option"
"github.com/acme/acme-go/internal/apijson"
"github.com/acme/acme-go/internal/apiquery"
"github.com/acme/acme-go/internal/param"
"github.com/acme/acme-go/internal/requestconfig"
"github.com/acme/acme-go/internal/shared"
"github.com/acme/acme-go/option"
)

// AccountService contains methods and other services that help with interacting
// with the increase API. Note, unlike clients, this service does not read
// with the acme API. Note, unlike clients, this service does not read
// variables from the environment automatically. You should not instantiate this
// service directly, and instead use the [NewAccountService] method instead.
type AccountService struct {
Expand Down Expand Up @@ -97,7 +97,7 @@ func (r *AccountService) Close(ctx context.Context, accountID string, opts ...op
return
}

// Accounts are your bank accounts with Increase. They store money, receive
// Accounts are your bank accounts with Acme. They store money, receive
// transfers, and send payments. They earn interest and have depository insurance.
type Account struct {
// The Account identifier.
Expand Down
Loading

0 comments on commit 9faa862

Please sign in to comment.