Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.1.0-alpha.1"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 4
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-2af763aab4c314b382e1123edc4ee3d51c0fe7977730ce6776b9fb09b29fe291.yml
openapi_spec_hash: be02256478be81fa3f649076879850bc
config_hash: 71cb25ebb05ff0dd0e98c3b2ee091bc4
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-07d481d1498bf9677437b555e9ec2d843d50107faa7501e4c430a32b1f3c3343.yml
openapi_spec_hash: 296f78d82afbac95fad12c5eabd71f18
config_hash: 2c8351ba6611ce4a352e248405783846
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Changelog

## 0.1.0-alpha.1 (2025-05-14)

Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/onkernel/kernel-go-sdk/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)

### Features

* **api:** update via SDK Studio ([bb5cfe4](https://github.com/onkernel/kernel-go-sdk/commit/bb5cfe49047afce492f2a21ade2acbe1612e9f3c))


### Chores

* configure new SDK language ([dd0120b](https://github.com/onkernel/kernel-go-sdk/commit/dd0120b0ce673e0fe7c842d39e91f01b8ee8106a))
* update SDK settings ([b1b8645](https://github.com/onkernel/kernel-go-sdk/commit/b1b8645621de70f28e3cf0b3622c1a93159b561e))
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,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:

```sh
$ go mod edit -replace github.com/stainless-sdks/kernel-go=/path/to/kernel-go
$ go mod edit -replace github.com/onkernel/kernel-go-sdk=/path/to/kernel-go-sdk
```

## Running tests
Expand Down
56 changes: 36 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Kernel Go API Library

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

The Kernel Go library provides convenient access to the [Kernel REST API](https://docs.onkernel.com)
from applications written in Go.
Expand All @@ -9,18 +9,26 @@ It is generated with [Stainless](https://www.stainless.com/).

## Installation

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

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

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

Or to pin the version:

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

```sh
go get -u 'github.com/stainless-sdks/kernel-go@v0.0.1-alpha.0'
go get -u 'github.com/onkernel/kernel-go-sdk@v0.1.0-alpha.1'
```

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

## Requirements

This library requires Go 1.18+.
Expand All @@ -38,8 +46,8 @@ import (
"fmt"
"io"

"github.com/stainless-sdks/kernel-go"
"github.com/stainless-sdks/kernel-go/option"
"github.com/onkernel/kernel-go-sdk"
"github.com/onkernel/kernel-go-sdk/option"
)

func main() {
Expand All @@ -48,8 +56,9 @@ func main() {
option.WithEnvironmentDevelopment(), // defaults to option.WithEnvironmentProduction()
)
response, err := client.Apps.Deploy(context.TODO(), kernel.AppDeployParams{
File: io.Reader(bytes.NewBuffer([]byte("REPLACE_ME"))),
Version: kernel.String("REPLACE_ME"),
EntrypointRelPath: "app.py",
File: io.Reader(bytes.NewBuffer([]byte("REPLACE_ME"))),
Version: kernel.String("REPLACE_ME"),
})
if err != nil {
panic(err.Error())
Expand Down Expand Up @@ -268,7 +277,7 @@ client.Apps.Deploy(context.TODO(), ...,
)
```

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

### Pagination

Expand All @@ -290,8 +299,9 @@ To handle errors, we recommend that you use the `errors.As` pattern:

```go
_, err := client.Apps.Deploy(context.TODO(), kernel.AppDeployParams{
File: io.Reader(bytes.NewBuffer([]byte("REPLACE_ME"))),
Version: kernel.String("REPLACE_ME"),
EntrypointRelPath: "app.py",
File: io.Reader(bytes.NewBuffer([]byte("REPLACE_ME"))),
Version: kernel.String("REPLACE_ME"),
})
if err != nil {
var apierr *kernel.Error
Expand Down Expand Up @@ -320,8 +330,9 @@ defer cancel()
client.Apps.Deploy(
ctx,
kernel.AppDeployParams{
File: io.Reader(bytes.NewBuffer([]byte("REPLACE_ME"))),
Version: kernel.String("REPLACE_ME"),
EntrypointRelPath: "app.py",
File: io.Reader(bytes.NewBuffer([]byte("REPLACE_ME"))),
Version: kernel.String("REPLACE_ME"),
},
// This sets the per-retry timeout
option.WithRequestTimeout(20*time.Second),
Expand All @@ -345,17 +356,20 @@ which can be used to wrap any `io.Reader` with the appropriate file name and con
// A file from the file system
file, err := os.Open("/path/to/file")
kernel.AppDeployParams{
File: file,
EntrypointRelPath: "app.py",
File: file,
}

// A file from a string
kernel.AppDeployParams{
File: strings.NewReader("my file contents"),
EntrypointRelPath: "app.py",
File: strings.NewReader("my file contents"),
}

// With a custom filename and contentType
kernel.AppDeployParams{
File: kernel.File(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),
EntrypointRelPath: "app.py",
File: kernel.File(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),
}
```

Expand All @@ -377,8 +391,9 @@ client := kernel.NewClient(
client.Apps.Deploy(
context.TODO(),
kernel.AppDeployParams{
File: io.Reader(bytes.NewBuffer([]byte("REPLACE_ME"))),
Version: kernel.String("REPLACE_ME"),
EntrypointRelPath: "app.py",
File: io.Reader(bytes.NewBuffer([]byte("REPLACE_ME"))),
Version: kernel.String("REPLACE_ME"),
},
option.WithMaxRetries(5),
)
Expand All @@ -395,8 +410,9 @@ var response *http.Response
response, err := client.Apps.Deploy(
context.TODO(),
kernel.AppDeployParams{
File: io.Reader(bytes.NewBuffer([]byte("REPLACE_ME"))),
Version: kernel.String("REPLACE_ME"),
EntrypointRelPath: "app.py",
File: io.Reader(bytes.NewBuffer([]byte("REPLACE_ME"))),
Version: kernel.String("REPLACE_ME"),
},
option.WithResponseInto(&response),
)
Expand Down Expand Up @@ -504,7 +520,7 @@ 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/kernel-go/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/onkernel/kernel-go-sdk/issues) with questions, bugs, or suggestions.

## Contributing

Expand Down
4 changes: 2 additions & 2 deletions aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
package kernel

import (
"github.com/stainless-sdks/kernel-go/internal/apierror"
"github.com/stainless-sdks/kernel-go/packages/param"
"github.com/onkernel/kernel-go-sdk/internal/apierror"
"github.com/onkernel/kernel-go-sdk/packages/param"
)

// aliased to make [param.APIUnion] private when embedding
Expand Down
16 changes: 8 additions & 8 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

Response Types:

- <a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go">kernel</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go#AppDeployResponse">AppDeployResponse</a>
- <a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go">kernel</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go#AppInvokeResponse">AppInvokeResponse</a>
- <a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go">kernel</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go#AppGetInvocationResponse">AppGetInvocationResponse</a>
- <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#AppDeployResponse">AppDeployResponse</a>
- <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#AppInvokeResponse">AppInvokeResponse</a>
- <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#AppGetInvocationResponse">AppGetInvocationResponse</a>

Methods:

- <code title="post /apps/deploy">client.Apps.<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go#AppService.Deploy">Deploy</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go">kernel</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go#AppDeployParams">AppDeployParams</a>) (<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go">kernel</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go#AppDeployResponse">AppDeployResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /apps/invoke">client.Apps.<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go#AppService.Invoke">Invoke</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go">kernel</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go#AppInvokeParams">AppInvokeParams</a>) (<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go">kernel</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go#AppInvokeResponse">AppInvokeResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /apps/invocations/{id}">client.Apps.<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go#AppService.GetInvocation">GetInvocation</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/kernel-go">kernel</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go#AppGetInvocationResponse">AppGetInvocationResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /apps/deploy">client.Apps.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#AppService.Deploy">Deploy</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#AppDeployParams">AppDeployParams</a>) (<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#AppDeployResponse">AppDeployResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /apps/invoke">client.Apps.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#AppService.Invoke">Invoke</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#AppInvokeParams">AppInvokeParams</a>) (<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#AppInvokeResponse">AppInvokeResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /apps/invocations/{id}">client.Apps.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#AppService.GetInvocation">GetInvocation</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/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#AppGetInvocationResponse">AppGetInvocationResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

# Browser

Response Types:

- <a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go">kernel</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go#BrowserNewSessionResponse">BrowserNewSessionResponse</a>
- <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserNewSessionResponse">BrowserNewSessionResponse</a>

Methods:

- <code title="post /browser">client.Browser.<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go#BrowserService.NewSession">NewSession</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go">kernel</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go#BrowserNewSessionParams">BrowserNewSessionParams</a>) (<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go">kernel</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/kernel-go#BrowserNewSessionResponse">BrowserNewSessionResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /browser">client.Browser.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserService.NewSession">NewSession</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserNewSessionParams">BrowserNewSessionParams</a>) (<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk">kernel</a>.<a href="https://pkg.go.dev/github.com/onkernel/kernel-go-sdk#BrowserNewSessionResponse">BrowserNewSessionResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
16 changes: 8 additions & 8 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
"mime/multipart"
"net/http"

"github.com/stainless-sdks/kernel-go/internal/apiform"
"github.com/stainless-sdks/kernel-go/internal/apijson"
"github.com/stainless-sdks/kernel-go/internal/requestconfig"
"github.com/stainless-sdks/kernel-go/option"
"github.com/stainless-sdks/kernel-go/packages/param"
"github.com/stainless-sdks/kernel-go/packages/respjson"
"github.com/onkernel/kernel-go-sdk/internal/apiform"
"github.com/onkernel/kernel-go-sdk/internal/apijson"
"github.com/onkernel/kernel-go-sdk/internal/requestconfig"
"github.com/onkernel/kernel-go-sdk/option"
"github.com/onkernel/kernel-go-sdk/packages/param"
"github.com/onkernel/kernel-go-sdk/packages/respjson"
)

// AppService contains methods and other services that help with interacting with
Expand Down Expand Up @@ -191,10 +191,10 @@ func (r *AppGetInvocationResponse) UnmarshalJSON(data []byte) error {
}

type AppDeployParams struct {
// Relative path to the entrypoint of the application
EntrypointRelPath string `json:"entrypointRelPath,required"`
// ZIP file containing the application source directory
File io.Reader `json:"file,omitzero,required" format:"binary"`
// Relative path to the entrypoint of the application
EntrypointRelPath param.Opt[string] `json:"entrypointRelPath,omitzero"`
// Version of the application. Can be any string.
Version param.Opt[string] `json:"version,omitzero"`
// Allow overwriting an existing app version
Expand Down
8 changes: 4 additions & 4 deletions app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"os"
"testing"

"github.com/stainless-sdks/kernel-go"
"github.com/stainless-sdks/kernel-go/internal/testutil"
"github.com/stainless-sdks/kernel-go/option"
"github.com/onkernel/kernel-go-sdk"
"github.com/onkernel/kernel-go-sdk/internal/testutil"
"github.com/onkernel/kernel-go-sdk/option"
)

func TestAppDeployWithOptionalParams(t *testing.T) {
Expand All @@ -29,8 +29,8 @@ func TestAppDeployWithOptionalParams(t *testing.T) {
option.WithAPIKey("My API Key"),
)
_, err := client.Apps.Deploy(context.TODO(), kernel.AppDeployParams{
EntrypointRelPath: "app.py",
File: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
EntrypointRelPath: kernel.String("app.py"),
Force: kernel.AppDeployParamsForceFalse,
Region: kernel.AppDeployParamsRegionAwsUsEast1a,
Version: kernel.String("1.0.0"),
Expand Down
10 changes: 5 additions & 5 deletions browser.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"context"
"net/http"

"github.com/stainless-sdks/kernel-go/internal/apijson"
"github.com/stainless-sdks/kernel-go/internal/requestconfig"
"github.com/stainless-sdks/kernel-go/option"
"github.com/stainless-sdks/kernel-go/packages/param"
"github.com/stainless-sdks/kernel-go/packages/respjson"
"github.com/onkernel/kernel-go-sdk/internal/apijson"
"github.com/onkernel/kernel-go-sdk/internal/requestconfig"
"github.com/onkernel/kernel-go-sdk/option"
"github.com/onkernel/kernel-go-sdk/packages/param"
"github.com/onkernel/kernel-go-sdk/packages/respjson"
)

// BrowserService contains methods and other services that help with interacting
Expand Down
6 changes: 3 additions & 3 deletions browser_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/kernel-go"
"github.com/stainless-sdks/kernel-go/internal/testutil"
"github.com/stainless-sdks/kernel-go/option"
"github.com/onkernel/kernel-go-sdk"
"github.com/onkernel/kernel-go-sdk/internal/testutil"
"github.com/onkernel/kernel-go-sdk/option"
)

func TestBrowserNewSession(t *testing.T) {
Expand Down
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/kernel-go/internal/requestconfig"
"github.com/stainless-sdks/kernel-go/option"
"github.com/onkernel/kernel-go-sdk/internal/requestconfig"
"github.com/onkernel/kernel-go-sdk/option"
)

// Client creates a struct with services and top level methods that help with
Expand Down
Loading