summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-06-03 12:02:21 -0400
committerDax Raad <[email protected]>2025-06-03 12:02:21 -0400
commit274c8baa349be7994cde1a0df01130279bfe0f5d (patch)
tree4941938e65d449f49794c7b212cc9a96134d7a8e
parentbfb36a85664b87aa2d0e47a65ec28260d7e67349 (diff)
downloadopencode-274c8baa349be7994cde1a0df01130279bfe0f5d.tar.gz
opencode-274c8baa349be7994cde1a0df01130279bfe0f5d.zip
added app
-rw-r--r--packages/tui/pkg/client/gen/openapi.json55
-rw-r--r--packages/tui/pkg/client/generated-client.go114
2 files changed, 169 insertions, 0 deletions
diff --git a/packages/tui/pkg/client/gen/openapi.json b/packages/tui/pkg/client/gen/openapi.json
index 0f9949dad..7ca11e6b2 100644
--- a/packages/tui/pkg/client/gen/openapi.json
+++ b/packages/tui/pkg/client/gen/openapi.json
@@ -25,6 +25,25 @@
"description": "Get events"
}
},
+ "/app_info": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "200",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/App.Info"
+ }
+ }
+ }
+ }
+ },
+ "operationId": "postApp_info",
+ "parameters": [],
+ "description": "Get app info"
+ }
+ },
"/path_get": {
"post": {
"responses": {
@@ -910,6 +929,42 @@
"time"
]
},
+ "App.Info": {
+ "type": "object",
+ "properties": {
+ "time": {
+ "type": "object",
+ "properties": {
+ "initialized": {
+ "type": "number"
+ }
+ }
+ },
+ "path": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "string"
+ },
+ "root": {
+ "type": "string"
+ },
+ "cwd": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "data",
+ "root",
+ "cwd"
+ ]
+ }
+ },
+ "required": [
+ "time",
+ "path"
+ ]
+ },
"Provider.Info": {
"type": "object",
"properties": {
diff --git a/packages/tui/pkg/client/generated-client.go b/packages/tui/pkg/client/generated-client.go
index 2a662a47e..4552a37b4 100644
--- a/packages/tui/pkg/client/generated-client.go
+++ b/packages/tui/pkg/client/generated-client.go
@@ -24,6 +24,18 @@ const (
User MessageInfoRole = "user"
)
+// AppInfo defines model for App.Info.
+type AppInfo struct {
+ Path struct {
+ Cwd string `json:"cwd"`
+ Data string `json:"data"`
+ Root string `json:"root"`
+ } `json:"path"`
+ Time struct {
+ Initialized *float32 `json:"initialized,omitempty"`
+ } `json:"time"`
+}
+
// Event defines model for Event.
type Event struct {
union json.RawMessage
@@ -851,6 +863,9 @@ func WithRequestEditorFn(fn RequestEditorFn) ClientOption {
// The interface specification for the client above.
type ClientInterface interface {
+ // PostAppInfo request
+ PostAppInfo(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
+
// GetEvent request
GetEvent(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
@@ -892,6 +907,18 @@ type ClientInterface interface {
PostSessionSummarize(ctx context.Context, body PostSessionSummarizeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}
+func (c *Client) PostAppInfo(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
+ req, err := NewPostAppInfoRequest(c.Server)
+ if err != nil {
+ return nil, err
+ }
+ req = req.WithContext(ctx)
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
+ return nil, err
+ }
+ return c.Client.Do(req)
+}
+
func (c *Client) GetEvent(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGetEventRequest(c.Server)
if err != nil {
@@ -1072,6 +1099,33 @@ func (c *Client) PostSessionSummarize(ctx context.Context, body PostSessionSumma
return c.Client.Do(req)
}
+// NewPostAppInfoRequest generates requests for PostAppInfo
+func NewPostAppInfoRequest(server string) (*http.Request, error) {
+ var err error
+
+ serverURL, err := url.Parse(server)
+ if err != nil {
+ return nil, err
+ }
+
+ operationPath := fmt.Sprintf("/app_info")
+ if operationPath[0] == '/' {
+ operationPath = "." + operationPath
+ }
+
+ queryURL, err := serverURL.Parse(operationPath)
+ if err != nil {
+ return nil, err
+ }
+
+ req, err := http.NewRequest("POST", queryURL.String(), nil)
+ if err != nil {
+ return nil, err
+ }
+
+ return req, nil
+}
+
// NewGetEventRequest generates requests for GetEvent
func NewGetEventRequest(server string) (*http.Request, error) {
var err error
@@ -1450,6 +1504,9 @@ func WithBaseURL(baseURL string) ClientOption {
// ClientWithResponsesInterface is the interface specification for the client with responses above.
type ClientWithResponsesInterface interface {
+ // PostAppInfoWithResponse request
+ PostAppInfoWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostAppInfoResponse, error)
+
// GetEventWithResponse request
GetEventWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetEventResponse, error)
@@ -1491,6 +1548,28 @@ type ClientWithResponsesInterface interface {
PostSessionSummarizeWithResponse(ctx context.Context, body PostSessionSummarizeJSONRequestBody, reqEditors ...RequestEditorFn) (*PostSessionSummarizeResponse, error)
}
+type PostAppInfoResponse struct {
+ Body []byte
+ HTTPResponse *http.Response
+ JSON200 *AppInfo
+}
+
+// Status returns HTTPResponse.Status
+func (r PostAppInfoResponse) Status() string {
+ if r.HTTPResponse != nil {
+ return r.HTTPResponse.Status
+ }
+ return http.StatusText(0)
+}
+
+// StatusCode returns HTTPResponse.StatusCode
+func (r PostAppInfoResponse) StatusCode() int {
+ if r.HTTPResponse != nil {
+ return r.HTTPResponse.StatusCode
+ }
+ return 0
+}
+
type GetEventResponse struct {
Body []byte
HTTPResponse *http.Response
@@ -1716,6 +1795,15 @@ func (r PostSessionSummarizeResponse) StatusCode() int {
return 0
}
+// PostAppInfoWithResponse request returning *PostAppInfoResponse
+func (c *ClientWithResponses) PostAppInfoWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostAppInfoResponse, error) {
+ rsp, err := c.PostAppInfo(ctx, reqEditors...)
+ if err != nil {
+ return nil, err
+ }
+ return ParsePostAppInfoResponse(rsp)
+}
+
// GetEventWithResponse request returning *GetEventResponse
func (c *ClientWithResponses) GetEventWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetEventResponse, error) {
rsp, err := c.GetEvent(ctx, reqEditors...)
@@ -1846,6 +1934,32 @@ func (c *ClientWithResponses) PostSessionSummarizeWithResponse(ctx context.Conte
return ParsePostSessionSummarizeResponse(rsp)
}
+// ParsePostAppInfoResponse parses an HTTP response from a PostAppInfoWithResponse call
+func ParsePostAppInfoResponse(rsp *http.Response) (*PostAppInfoResponse, error) {
+ bodyBytes, err := io.ReadAll(rsp.Body)
+ defer func() { _ = rsp.Body.Close() }()
+ if err != nil {
+ return nil, err
+ }
+
+ response := &PostAppInfoResponse{
+ Body: bodyBytes,
+ HTTPResponse: rsp,
+ }
+
+ switch {
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
+ var dest AppInfo
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
+ return nil, err
+ }
+ response.JSON200 = &dest
+
+ }
+
+ return response, nil
+}
+
// ParseGetEventResponse parses an HTTP response from a GetEventWithResponse call
func ParseGetEventResponse(rsp *http.Response) (*GetEventResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)