Skip to content

Commit fbe3cbe

Browse files
jsell-rhclaude
andcommitted
chore(sdk): revert Go/Python SDK regeneration to avoid breaking changes
The full SDK regeneration introduced conflicts with hand-written Go extension files (agent_extensions.go, session_messages.go) that depend on client methods not present in the generator templates. Reverting Go and Python SDKs to main state; this PR focuses on TS SDK changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4702763 commit fbe3cbe

48 files changed

Lines changed: 289 additions & 469 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

components/ambient-sdk/go-sdk/client/agent_api.go

Lines changed: 2 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/ambient-sdk/go-sdk/client/client.go

Lines changed: 42 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/ambient-sdk/go-sdk/client/credential_api.go

Lines changed: 10 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/ambient-sdk/go-sdk/client/inbox_message_api.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/ambient-sdk/go-sdk/client/iterator.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/ambient-sdk/go-sdk/client/project_api.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/ambient-sdk/go-sdk/client/project_settings_api.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/ambient-sdk/go-sdk/client/role_api.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/ambient-sdk/go-sdk/client/role_binding_api.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 65 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// Code generated by ambient-sdk-generator from openapi.yaml — DO NOT EDIT.
2-
// Source: ../../ambient-api-server/openapi/openapi.yaml
3-
// Spec SHA256: c9d4494778eb0a006db1f289630460fb9b5dc58df1895903c42735b4f56b0314
4-
// Generated: 2026-05-05T15:33:32Z
5-
61
package client
72

83
import (
@@ -11,7 +6,6 @@ import (
116
"fmt"
127
"net/http"
138
"net/url"
14-
"strings"
159

1610
"github.com/ambient-code/platform/components/ambient-sdk/go-sdk/types"
1711
)
@@ -23,57 +17,98 @@ type ScheduledSessionAPI struct {
2317
func (c *Client) ScheduledSessions() *ScheduledSessionAPI {
2418
return &ScheduledSessionAPI{client: c}
2519
}
26-
func (a *ScheduledSessionAPI) basePath() string {
27-
return strings.NewReplacer("{id}", url.PathEscape(a.client.project)).Replace("/projects/{id}/scheduled-sessions")
20+
21+
func (a *ScheduledSessionAPI) basePath(projectID string) string {
22+
return "/projects/" + url.PathEscape(projectID) + "/scheduled-sessions"
2823
}
2924

30-
func (a *ScheduledSessionAPI) Create(ctx context.Context, resource *types.ScheduledSession) (*types.ScheduledSession, error) {
31-
body, err := json.Marshal(resource)
32-
if err != nil {
33-
return nil, fmt.Errorf("marshal scheduled_session: %w", err)
34-
}
35-
var result types.ScheduledSession
36-
if err := a.client.do(ctx, http.MethodPost, a.basePath(), body, http.StatusCreated, &result); err != nil {
25+
func (a *ScheduledSessionAPI) List(ctx context.Context, projectID string, opts *types.ListOptions) (*types.ScheduledSessionList, error) {
26+
var result types.ScheduledSessionList
27+
if err := a.client.doWithQuery(ctx, http.MethodGet, a.basePath(projectID), nil, http.StatusOK, &result, opts); err != nil {
3728
return nil, err
3829
}
3930
return &result, nil
4031
}
4132

42-
func (a *ScheduledSessionAPI) Get(ctx context.Context, id string) (*types.ScheduledSession, error) {
33+
func (a *ScheduledSessionAPI) Get(ctx context.Context, projectID, id string) (*types.ScheduledSession, error) {
4334
var result types.ScheduledSession
44-
if err := a.client.do(ctx, http.MethodGet, a.basePath()+"/"+url.PathEscape(id), nil, http.StatusOK, &result); err != nil {
35+
path := a.basePath(projectID) + "/" + url.PathEscape(id)
36+
if err := a.client.do(ctx, http.MethodGet, path, nil, http.StatusOK, &result); err != nil {
4537
return nil, err
4638
}
4739
return &result, nil
4840
}
4941

50-
func (a *ScheduledSessionAPI) List(ctx context.Context, opts *types.ListOptions) (*types.ScheduledSessionList, error) {
51-
var result types.ScheduledSessionList
52-
if err := a.client.doWithQuery(ctx, http.MethodGet, a.basePath(), nil, http.StatusOK, &result, opts); err != nil {
42+
func (a *ScheduledSessionAPI) Create(ctx context.Context, projectID string, resource *types.ScheduledSession) (*types.ScheduledSession, error) {
43+
body, err := json.Marshal(resource)
44+
if err != nil {
45+
return nil, fmt.Errorf("marshal scheduled session: %w", err)
46+
}
47+
var result types.ScheduledSession
48+
if err := a.client.do(ctx, http.MethodPost, a.basePath(projectID), body, http.StatusCreated, &result); err != nil {
5349
return nil, err
5450
}
5551
return &result, nil
5652
}
57-
func (a *ScheduledSessionAPI) Update(ctx context.Context, id string, patch map[string]any) (*types.ScheduledSession, error) {
53+
54+
func (a *ScheduledSessionAPI) Update(ctx context.Context, projectID, id string, patch *types.ScheduledSessionPatch) (*types.ScheduledSession, error) {
5855
body, err := json.Marshal(patch)
5956
if err != nil {
6057
return nil, fmt.Errorf("marshal patch: %w", err)
6158
}
6259
var result types.ScheduledSession
63-
if err := a.client.do(ctx, http.MethodPatch, a.basePath()+"/"+url.PathEscape(id), body, http.StatusOK, &result); err != nil {
60+
path := a.basePath(projectID) + "/" + url.PathEscape(id)
61+
if err := a.client.do(ctx, http.MethodPatch, path, body, http.StatusOK, &result); err != nil {
62+
return nil, err
63+
}
64+
return &result, nil
65+
}
66+
67+
func (a *ScheduledSessionAPI) Delete(ctx context.Context, projectID, id string) error {
68+
return a.client.do(ctx, http.MethodDelete, a.basePath(projectID)+"/"+url.PathEscape(id), nil, http.StatusNoContent, nil)
69+
}
70+
71+
func (a *ScheduledSessionAPI) Suspend(ctx context.Context, projectID, id string) (*types.ScheduledSession, error) {
72+
var result types.ScheduledSession
73+
path := a.basePath(projectID) + "/" + url.PathEscape(id) + "/suspend"
74+
if err := a.client.do(ctx, http.MethodPost, path, nil, http.StatusOK, &result); err != nil {
75+
return nil, err
76+
}
77+
return &result, nil
78+
}
79+
80+
func (a *ScheduledSessionAPI) Resume(ctx context.Context, projectID, id string) (*types.ScheduledSession, error) {
81+
var result types.ScheduledSession
82+
path := a.basePath(projectID) + "/" + url.PathEscape(id) + "/resume"
83+
if err := a.client.do(ctx, http.MethodPost, path, nil, http.StatusOK, &result); err != nil {
6484
return nil, err
6585
}
6686
return &result, nil
6787
}
6888

69-
func (a *ScheduledSessionAPI) Delete(ctx context.Context, id string) error {
70-
return a.client.do(ctx, http.MethodDelete, a.basePath()+"/"+url.PathEscape(id), nil, http.StatusNoContent, nil)
89+
func (a *ScheduledSessionAPI) Trigger(ctx context.Context, projectID, id string) error {
90+
path := a.basePath(projectID) + "/" + url.PathEscape(id) + "/trigger"
91+
return a.client.do(ctx, http.MethodPost, path, nil, http.StatusOK, nil)
7192
}
7293

73-
func (a *ScheduledSessionAPI) ListAll(ctx context.Context, opts *types.ListOptions) *Iterator[types.ScheduledSession] {
74-
return NewIterator(func(page int) (*types.ScheduledSessionList, error) {
75-
o := *opts
76-
o.Page = page
77-
return a.List(ctx, &o)
78-
})
94+
func (a *ScheduledSessionAPI) Runs(ctx context.Context, projectID, id string, opts *types.ListOptions) (*types.SessionList, error) {
95+
var result types.SessionList
96+
path := a.basePath(projectID) + "/" + url.PathEscape(id) + "/runs"
97+
if err := a.client.doWithQuery(ctx, http.MethodGet, path, nil, http.StatusOK, &result, opts); err != nil {
98+
return nil, err
99+
}
100+
return &result, nil
101+
}
102+
103+
func (a *ScheduledSessionAPI) GetByName(ctx context.Context, projectID, name string) (*types.ScheduledSession, error) {
104+
list, err := a.List(ctx, projectID, &types.ListOptions{Search: "name = '" + name + "'"})
105+
if err != nil {
106+
return nil, err
107+
}
108+
for i := range list.Items {
109+
if list.Items[i].Name == name {
110+
return &list.Items[i], nil
111+
}
112+
}
113+
return nil, fmt.Errorf("scheduled session %q not found in project %q", name, projectID)
79114
}

0 commit comments

Comments
 (0)