Skip to content

Commit

Permalink
chore: go live (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored May 14, 2024
1 parent e29a27e commit b6fc2c3
Show file tree
Hide file tree
Showing 25 changed files with 172 additions and 49 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Release Doctor
on:
pull_request:
workflow_dispatch:

jobs:
release_doctor:
name: release doctor
runs-on: ubuntu-latest
if: github.repository == 'terminaldotshop/terminal-sdk-go' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v4

- name: Check release environment
run: |
bash ./scripts/check-release-environment
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.0.1-alpha.0"
}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ To use a local version of this library from source in another project, edit the
directive. This can be done through the CLI with the following:

```bash
go mod edit -replace github.com/stainless-sdks/terminal-go=/path/to/terminal-go
go mod edit -replace github.com/terminaldotshop/terminal-sdk-go=/path/to/terminal-sdk-go
```

## Running tests
Expand Down
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Terminal Go API Library

<a href="https://pkg.go.dev/github.com/stainless-sdks/terminal-go"><img src="https://pkg.go.dev/badge/github.com/stainless-sdks/terminal-go.svg" alt="Go Reference"></a>
<a href="https://pkg.go.dev/github.com/terminaldotshop/terminal-sdk-go"><img src="https://pkg.go.dev/badge/github.com/terminaldotshop/terminal-sdk-go.svg" alt="Go Reference"></a>

The Terminal Go library provides convenient access to [the Terminal REST
API](https://docs.terminal.com) from applications written in Go. The full API of this library can be found in [api.md](api.md).
Expand All @@ -9,18 +9,26 @@ It is generated with [Stainless](https://www.stainlessapi.com/).

## Installation

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

```go
import (
"github.com/stainless-sdks/terminal-go" // imported as terminal
"github.com/terminaldotshop/terminal-sdk-go" // imported as terminal
)
```

<!-- x-release-please-end -->

Or to pin the version:

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

```sh
go get -u 'github.com/stainless-sdks/[email protected]'
go get -u 'github.com/terminaldotshop/terminal-sdk[email protected]'
```

<!-- x-release-please-end -->

## Requirements

This library requires Go 1.18+.
Expand All @@ -36,8 +44,8 @@ import (
"context"
"fmt"

"github.com/stainless-sdks/terminal-go"
"github.com/stainless-sdks/terminal-go/option"
"github.com/terminaldotshop/terminal-sdk-go"
"github.com/terminaldotshop/terminal-sdk-go/option"
)

func main() {
Expand Down Expand Up @@ -146,7 +154,7 @@ client.Product.Get(context.TODO(), ...,
)
```

See the [full list of request options](https://pkg.go.dev/github.com/stainless-sdks/terminal-go/option).
See the [full list of request options](https://pkg.go.dev/github.com/terminaldotshop/terminal-sdk-go/option).

### Pagination

Expand Down Expand Up @@ -325,4 +333,4 @@ 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/stainless-sdks/terminal-go/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/terminaldotshop/terminal-sdk-go/issues) with questions, bugs, or suggestions.
2 changes: 1 addition & 1 deletion aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package terminal

import (
"github.com/stainless-sdks/terminal-go/internal/apierror"
"github.com/terminaldotshop/terminal-sdk-go/internal/apierror"
)

type Error = apierror.Error
10 changes: 5 additions & 5 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

Response Types:

- <a href="https://pkg.go.dev/github.com/stainless-sdks/terminal-go">terminal</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/terminal-go#ProductGetResponse">ProductGetResponse</a>
- <a href="https://pkg.go.dev/github.com/terminaldotshop/terminal-sdk-go">terminal</a>.<a href="https://pkg.go.dev/github.com/terminaldotshop/terminal-sdk-go#ProductGetResponse">ProductGetResponse</a>

Methods:

- <code title="get /product">client.Product.<a href="https://pkg.go.dev/github.com/stainless-sdks/terminal-go#ProductService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<a href="https://pkg.go.dev/github.com/stainless-sdks/terminal-go">terminal</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/terminal-go#ProductGetResponse">ProductGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /product">client.Product.<a href="https://pkg.go.dev/github.com/terminaldotshop/terminal-sdk-go#ProductService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<a href="https://pkg.go.dev/github.com/terminaldotshop/terminal-sdk-go">terminal</a>.<a href="https://pkg.go.dev/github.com/terminaldotshop/terminal-sdk-go#ProductGetResponse">ProductGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

# User

Response Types:

- <a href="https://pkg.go.dev/github.com/stainless-sdks/terminal-go">terminal</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/terminal-go#User">User</a>
- <a href="https://pkg.go.dev/github.com/stainless-sdks/terminal-go">terminal</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/terminal-go#UserGetResponse">UserGetResponse</a>
- <a href="https://pkg.go.dev/github.com/terminaldotshop/terminal-sdk-go">terminal</a>.<a href="https://pkg.go.dev/github.com/terminaldotshop/terminal-sdk-go#User">User</a>
- <a href="https://pkg.go.dev/github.com/terminaldotshop/terminal-sdk-go">terminal</a>.<a href="https://pkg.go.dev/github.com/terminaldotshop/terminal-sdk-go#UserGetResponse">UserGetResponse</a>

Methods:

- <code title="get /user/{id}">client.User.<a href="https://pkg.go.dev/github.com/stainless-sdks/terminal-go#UserService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/stainless-sdks/terminal-go">terminal</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/terminal-go#UserGetResponse">UserGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /user/{id}">client.User.<a href="https://pkg.go.dev/github.com/terminaldotshop/terminal-sdk-go#UserService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/terminaldotshop/terminal-sdk-go">terminal</a>.<a href="https://pkg.go.dev/github.com/terminaldotshop/terminal-sdk-go#UserGetResponse">UserGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
4 changes: 2 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"net/http"
"os"

"github.com/stainless-sdks/terminal-go/internal/requestconfig"
"github.com/stainless-sdks/terminal-go/option"
"github.com/terminaldotshop/terminal-sdk-go/internal/requestconfig"
"github.com/terminaldotshop/terminal-sdk-go/option"
)

// Client creates a struct with services and top level methods that help with
Expand Down
6 changes: 3 additions & 3 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"testing"
"time"

"github.com/stainless-sdks/terminal-go"
"github.com/stainless-sdks/terminal-go/internal"
"github.com/stainless-sdks/terminal-go/option"
"github.com/terminaldotshop/terminal-sdk-go"
"github.com/terminaldotshop/terminal-sdk-go/internal"
"github.com/terminaldotshop/terminal-sdk-go/option"
)

type closureTransport struct {
Expand Down
4 changes: 2 additions & 2 deletions field.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package terminal

import (
"github.com/stainless-sdks/terminal-go/internal/param"
"github.com/terminaldotshop/terminal-sdk-go/internal/param"
"io"
)

// F is a param field helper used to initialize a [param.Field] generic struct.
// This helps specify null, zero values, and overrides, as well as normal values.
// You can read more about this in our [README].
//
// [README]: https://pkg.go.dev/github.com/stainless-sdks/terminal-go#readme-request-fields
// [README]: https://pkg.go.dev/github.com/terminaldotshop/terminal-sdk-go#readme-request-fields
func F[T any](value T) param.Field[T] { return param.Field[T]{Value: value, Present: true} }

// Null is a param field helper which explicitly sends null to the API.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/stainless-sdks/terminal-go
module github.com/terminaldotshop/terminal-sdk-go

go 1.19

Expand Down
2 changes: 1 addition & 1 deletion internal/apierror/apierror.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net/http"
"net/http/httputil"

"github.com/stainless-sdks/terminal-go/internal/apijson"
"github.com/terminaldotshop/terminal-sdk-go/internal/apijson"
)

// Error represents an error that originates from the API, i.e. when a request is
Expand Down
2 changes: 1 addition & 1 deletion internal/apiform/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"sync"
"time"

"github.com/stainless-sdks/terminal-go/internal/param"
"github.com/terminaldotshop/terminal-sdk-go/internal/param"
)

var encoders sync.Map // map[encoderEntry]encoderFunc
Expand Down
2 changes: 1 addition & 1 deletion internal/apijson/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/tidwall/sjson"

"github.com/stainless-sdks/terminal-go/internal/param"
"github.com/terminaldotshop/terminal-sdk-go/internal/param"
)

var encoders sync.Map // map[encoderEntry]encoderFunc
Expand Down
2 changes: 1 addition & 1 deletion internal/apijson/field_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/stainless-sdks/terminal-go/internal/param"
"github.com/terminaldotshop/terminal-sdk-go/internal/param"
)

type Struct struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/apiquery/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"sync"
"time"

"github.com/stainless-sdks/terminal-go/internal/param"
"github.com/terminaldotshop/terminal-sdk-go/internal/param"
)

var encoders sync.Map // map[reflect.Type]encoderFunc
Expand Down
8 changes: 4 additions & 4 deletions internal/requestconfig/requestconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (
"strings"
"time"

"github.com/stainless-sdks/terminal-go/internal"
"github.com/stainless-sdks/terminal-go/internal/apierror"
"github.com/stainless-sdks/terminal-go/internal/apiform"
"github.com/stainless-sdks/terminal-go/internal/apiquery"
"github.com/terminaldotshop/terminal-sdk-go/internal"
"github.com/terminaldotshop/terminal-sdk-go/internal/apierror"
"github.com/terminaldotshop/terminal-sdk-go/internal/apiform"
"github.com/terminaldotshop/terminal-sdk-go/internal/apiquery"
)

func getDefaultHeaders() map[string]string {
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.0.1-alpha.0"
const PackageVersion = "0.0.1-alpha.0" // x-release-please-version
4 changes: 2 additions & 2 deletions option/requestoption.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import (
"net/url"
"time"

"github.com/stainless-sdks/terminal-go/internal/requestconfig"
"github.com/terminaldotshop/terminal-sdk-go/internal/requestconfig"
"github.com/tidwall/sjson"
)

// RequestOption is an option for the requests made by the terminal API Client
// which can be supplied to clients, services, and methods. You can read more about this functional
// options pattern in our [README].
//
// [README]: https://pkg.go.dev/github.com/stainless-sdks/terminal-go#readme-requestoptions
// [README]: https://pkg.go.dev/github.com/terminaldotshop/terminal-sdk-go#readme-requestoptions
type RequestOption = func(*requestconfig.RequestConfig) error

// WithBaseURL returns a RequestOption that sets the BaseURL for the client.
Expand Down
6 changes: 3 additions & 3 deletions product.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"context"
"net/http"

"github.com/stainless-sdks/terminal-go/internal/apijson"
"github.com/stainless-sdks/terminal-go/internal/requestconfig"
"github.com/stainless-sdks/terminal-go/option"
"github.com/terminaldotshop/terminal-sdk-go/internal/apijson"
"github.com/terminaldotshop/terminal-sdk-go/internal/requestconfig"
"github.com/terminaldotshop/terminal-sdk-go/option"
)

// ProductService contains methods and other services that help with interacting
Expand Down
6 changes: 3 additions & 3 deletions product_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"os"
"testing"

"github.com/stainless-sdks/terminal-go"
"github.com/stainless-sdks/terminal-go/internal/testutil"
"github.com/stainless-sdks/terminal-go/option"
"github.com/terminaldotshop/terminal-sdk-go"
"github.com/terminaldotshop/terminal-sdk-go/internal/testutil"
"github.com/terminaldotshop/terminal-sdk-go/option"
)

func TestProductGet(t *testing.T) {
Expand Down
67 changes: 67 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"packages": {
".": {}
},
"$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
"include-v-in-tag": true,
"include-component-in-tag": false,
"versioning": "prerelease",
"prerelease": true,
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": false,
"pull-request-header": "Automated Release PR",
"pull-request-title-pattern": "release: ${version}",
"changelog-sections": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "chore",
"section": "Chores"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "style",
"section": "Styles"
},
{
"type": "refactor",
"section": "Refactors"
},
{
"type": "test",
"section": "Tests",
"hidden": true
},
{
"type": "build",
"section": "Build System"
},
{
"type": "ci",
"section": "Continuous Integration",
"hidden": true
}
],
"release-type": "go",
"extra-files": [
"internal/version.go",
"README.md"
]
}
28 changes: 28 additions & 0 deletions scripts/check-release-environment
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

warnings=()
errors=()

lenWarnings=${#warnings[@]}

if [[ lenWarnings -gt 0 ]]; then
echo -e "Found the following warnings in the release environment:\n"

for warning in "${warnings[@]}"; do
echo -e "- $warning\n"
done
fi

lenErrors=${#errors[@]}

if [[ lenErrors -gt 0 ]]; then
echo -e "Found the following errors in the release environment:\n"

for error in "${errors[@]}"; do
echo -e "- $error\n"
done

exit 1
fi

echo "The environment is ready to push releases!"
6 changes: 3 additions & 3 deletions usage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"os"
"testing"

"github.com/stainless-sdks/terminal-go"
"github.com/stainless-sdks/terminal-go/internal/testutil"
"github.com/stainless-sdks/terminal-go/option"
"github.com/terminaldotshop/terminal-sdk-go"
"github.com/terminaldotshop/terminal-sdk-go/internal/testutil"
"github.com/terminaldotshop/terminal-sdk-go/option"
)

func TestUsage(t *testing.T) {
Expand Down
Loading

0 comments on commit b6fc2c3

Please sign in to comment.