diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 6b7b74c..da59f99 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.3.0"
+ ".": "0.4.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index d4463c3..be606c6 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 10
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-3edc7a0eef4a0d4495782efbdb0d9b777a55aee058dab119f90de56019441326.yml
-openapi_spec_hash: dff0b1efa1c1614cf770ed8327cefab2
-config_hash: cb04a4d88ee9f530b303ca57ff7090b3
+configured_endpoints: 11
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-64ccdff4ca5d73d79d89e817fe83ccfd3d529696df3e6818c3c75e586ae00801.yml
+openapi_spec_hash: 21c7b8757fc0cc9415cda1bc06251de6
+config_hash: b3fcacd707da56b21d31ce0baf4fb87d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bf507b3..fd5ee11 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 0.4.0 (2025-05-28)
+
+Full Changelog: [v0.3.0...v0.4.0](https://github.com/onkernel/kernel-go-sdk/compare/v0.3.0...v0.4.0)
+
+### Features
+
+* **api:** update via SDK Studio ([ac5cf50](https://github.com/onkernel/kernel-go-sdk/commit/ac5cf50867c042d1da5329f2441855ab89efd686))
+
## 0.3.0 (2025-05-22)
Full Changelog: [v0.2.0...v0.3.0](https://github.com/onkernel/kernel-go-sdk/compare/v0.2.0...v0.3.0)
diff --git a/README.md b/README.md
index b255900..2221887 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ Or to pin the version:
```sh
-go get -u 'github.com/onkernel/kernel-go-sdk@v0.3.0'
+go get -u 'github.com/onkernel/kernel-go-sdk@v0.4.0'
```
diff --git a/api.md b/api.md
index 61dff34..4fa940d 100644
--- a/api.md
+++ b/api.md
@@ -26,11 +26,13 @@ Response Types:
- kernel.AppInvocationNewResponse
- kernel.AppInvocationGetResponse
+- kernel.AppInvocationUpdateResponse
Methods:
- client.Apps.Invocations.New(ctx context.Context, body kernel.AppInvocationNewParams) (kernel.AppInvocationNewResponse, error)
- client.Apps.Invocations.Get(ctx context.Context, id string) (kernel.AppInvocationGetResponse, error)
+- client.Apps.Invocations.Update(ctx context.Context, id string, body kernel.AppInvocationUpdateParams) (kernel.AppInvocationUpdateResponse, error)
# Browsers
diff --git a/appinvocation.go b/appinvocation.go
index b44e221..48e4c44 100644
--- a/appinvocation.go
+++ b/appinvocation.go
@@ -55,6 +55,18 @@ func (r *AppInvocationService) Get(ctx context.Context, id string, opts ...optio
return
}
+// Update invocation status or output
+func (r *AppInvocationService) Update(ctx context.Context, id string, body AppInvocationUpdateParams, opts ...option.RequestOption) (res *AppInvocationUpdateResponse, err error) {
+ opts = append(r.Options[:], opts...)
+ if id == "" {
+ err = errors.New("missing required id parameter")
+ return
+ }
+ path := fmt.Sprintf("invocations/%s", id)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
+ return
+}
+
type AppInvocationNewResponse struct {
// ID of the invocation
ID string `json:"id,required"`
@@ -149,6 +161,61 @@ const (
AppInvocationGetResponseStatusFailed AppInvocationGetResponseStatus = "failed"
)
+type AppInvocationUpdateResponse struct {
+ // ID of the invocation
+ ID string `json:"id,required"`
+ // Name of the action invoked
+ ActionName string `json:"action_name,required"`
+ // Name of the application
+ AppName string `json:"app_name,required"`
+ // RFC 3339 Nanoseconds timestamp when the invocation started
+ StartedAt time.Time `json:"started_at,required" format:"date-time"`
+ // Status of the invocation
+ //
+ // Any of "queued", "running", "succeeded", "failed".
+ Status AppInvocationUpdateResponseStatus `json:"status,required"`
+ // RFC 3339 Nanoseconds timestamp when the invocation finished (null if still
+ // running)
+ FinishedAt time.Time `json:"finished_at,nullable" format:"date-time"`
+ // Output produced by the action, rendered as a JSON string. This could be: string,
+ // number, boolean, array, object, or null.
+ Output string `json:"output"`
+ // Payload provided to the invocation. This is a string that can be parsed as JSON.
+ Payload string `json:"payload"`
+ // Status reason
+ StatusReason string `json:"status_reason"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ ActionName respjson.Field
+ AppName respjson.Field
+ StartedAt respjson.Field
+ Status respjson.Field
+ FinishedAt respjson.Field
+ Output respjson.Field
+ Payload respjson.Field
+ StatusReason respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r AppInvocationUpdateResponse) RawJSON() string { return r.JSON.raw }
+func (r *AppInvocationUpdateResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Status of the invocation
+type AppInvocationUpdateResponseStatus string
+
+const (
+ AppInvocationUpdateResponseStatusQueued AppInvocationUpdateResponseStatus = "queued"
+ AppInvocationUpdateResponseStatusRunning AppInvocationUpdateResponseStatus = "running"
+ AppInvocationUpdateResponseStatusSucceeded AppInvocationUpdateResponseStatus = "succeeded"
+ AppInvocationUpdateResponseStatusFailed AppInvocationUpdateResponseStatus = "failed"
+)
+
type AppInvocationNewParams struct {
// Name of the action to invoke
ActionName string `json:"action_name,required"`
@@ -156,6 +223,9 @@ type AppInvocationNewParams struct {
AppName string `json:"app_name,required"`
// Version of the application
Version string `json:"version,required"`
+ // If true, invoke asynchronously. When set, the API responds 202 Accepted with
+ // status "queued".
+ Async param.Opt[bool] `json:"async,omitzero"`
// Input data for the action, sent as a JSON string.
Payload param.Opt[string] `json:"payload,omitzero"`
paramObj
@@ -168,3 +238,29 @@ func (r AppInvocationNewParams) MarshalJSON() (data []byte, err error) {
func (r *AppInvocationNewParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+
+type AppInvocationUpdateParams struct {
+ // New status for the invocation.
+ //
+ // Any of "succeeded", "failed".
+ Status AppInvocationUpdateParamsStatus `json:"status,omitzero,required"`
+ // Updated output of the invocation rendered as JSON string.
+ Output param.Opt[string] `json:"output,omitzero"`
+ paramObj
+}
+
+func (r AppInvocationUpdateParams) MarshalJSON() (data []byte, err error) {
+ type shadow AppInvocationUpdateParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *AppInvocationUpdateParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// New status for the invocation.
+type AppInvocationUpdateParamsStatus string
+
+const (
+ AppInvocationUpdateParamsStatusSucceeded AppInvocationUpdateParamsStatus = "succeeded"
+ AppInvocationUpdateParamsStatusFailed AppInvocationUpdateParamsStatus = "failed"
+)
diff --git a/appinvocation_test.go b/appinvocation_test.go
index 4c199b6..3b7b972 100644
--- a/appinvocation_test.go
+++ b/appinvocation_test.go
@@ -30,6 +30,7 @@ func TestAppInvocationNewWithOptionalParams(t *testing.T) {
ActionName: "analyze",
AppName: "my-app",
Version: "1.0.0",
+ Async: kernel.Bool(true),
Payload: kernel.String(`{"data":"example input"}`),
})
if err != nil {
@@ -63,3 +64,33 @@ func TestAppInvocationGet(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}
+
+func TestAppInvocationUpdateWithOptionalParams(t *testing.T) {
+ t.Skip("skipped: tests are disabled for the time being")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := kernel.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAPIKey("My API Key"),
+ )
+ _, err := client.Apps.Invocations.Update(
+ context.TODO(),
+ "id",
+ kernel.AppInvocationUpdateParams{
+ Status: kernel.AppInvocationUpdateParamsStatusSucceeded,
+ Output: kernel.String("output"),
+ },
+ )
+ if err != nil {
+ var apierr *kernel.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/internal/version.go b/internal/version.go
index 7cb1898..5c62cac 100644
--- a/internal/version.go
+++ b/internal/version.go
@@ -2,4 +2,4 @@
package internal
-const PackageVersion = "0.3.0" // x-release-please-version
+const PackageVersion = "0.4.0" // x-release-please-version