summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/pkg/client
diff options
context:
space:
mode:
Diffstat (limited to 'packages/tui/pkg/client')
-rw-r--r--packages/tui/pkg/client/gen/openapi.json73
-rw-r--r--packages/tui/pkg/client/generated-client.go148
2 files changed, 219 insertions, 2 deletions
diff --git a/packages/tui/pkg/client/gen/openapi.json b/packages/tui/pkg/client/gen/openapi.json
index 9cbfc70e2..0afe49373 100644
--- a/packages/tui/pkg/client/gen/openapi.json
+++ b/packages/tui/pkg/client/gen/openapi.json
@@ -478,6 +478,25 @@
}
}
}
+ },
+ "/installation_info": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Get installation info",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/InstallationInfo"
+ }
+ }
+ }
+ }
+ },
+ "operationId": "postInstallation_info",
+ "parameters": [],
+ "description": "Get installation info"
+ }
}
},
"components": {
@@ -504,6 +523,9 @@
},
{
"$ref": "#/components/schemas/Event.session.error"
+ },
+ {
+ "$ref": "#/components/schemas/Event.installation.updated"
}
],
"discriminator": {
@@ -515,7 +537,8 @@
"message.updated": "#/components/schemas/Event.message.updated",
"message.part.updated": "#/components/schemas/Event.message.part.updated",
"session.updated": "#/components/schemas/Event.session.updated",
- "session.error": "#/components/schemas/Event.session.error"
+ "session.error": "#/components/schemas/Event.session.error",
+ "installation.updated": "#/components/schemas/Event.installation.updated"
}
}
},
@@ -1269,6 +1292,30 @@
"properties"
]
},
+ "Event.installation.updated": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string",
+ "const": "installation.updated"
+ },
+ "properties": {
+ "type": "object",
+ "properties": {
+ "version": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "version"
+ ]
+ }
+ },
+ "required": [
+ "type",
+ "properties"
+ ]
+ },
"App.Info": {
"type": "object",
"properties": {
@@ -1292,13 +1339,17 @@
},
"cwd": {
"type": "string"
+ },
+ "state": {
+ "type": "string"
}
},
"required": [
"config",
"data",
"root",
- "cwd"
+ "cwd",
+ "state"
]
},
"time": {
@@ -1344,6 +1395,9 @@
"id": {
"type": "string"
},
+ "npm": {
+ "type": "string"
+ },
"models": {
"type": "object",
"additionalProperties": {
@@ -1424,6 +1478,21 @@
"limit",
"id"
]
+ },
+ "InstallationInfo": {
+ "type": "object",
+ "properties": {
+ "version": {
+ "type": "string"
+ },
+ "latest": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "version",
+ "latest"
+ ]
}
}
}
diff --git a/packages/tui/pkg/client/generated-client.go b/packages/tui/pkg/client/generated-client.go
index 59332f0a9..4f85f858e 100644
--- a/packages/tui/pkg/client/generated-client.go
+++ b/packages/tui/pkg/client/generated-client.go
@@ -31,6 +31,7 @@ type AppInfo struct {
Cwd string `json:"cwd"`
Data string `json:"data"`
Root string `json:"root"`
+ State string `json:"state"`
} `json:"path"`
Time struct {
Initialized *float32 `json:"initialized,omitempty"`
@@ -48,6 +49,14 @@ type Event struct {
union json.RawMessage
}
+// EventInstallationUpdated defines model for Event.installation.updated.
+type EventInstallationUpdated struct {
+ Properties struct {
+ Version string `json:"version"`
+ } `json:"properties"`
+ Type string `json:"type"`
+}
+
// EventLspClientDiagnostics defines model for Event.lsp.client.diagnostics.
type EventLspClientDiagnostics struct {
Properties struct {
@@ -111,6 +120,12 @@ type EventStorageWrite struct {
Type string `json:"type"`
}
+// InstallationInfo defines model for InstallationInfo.
+type InstallationInfo struct {
+ Latest string `json:"latest"`
+ Version string `json:"version"`
+}
+
// MessageInfo defines model for Message.Info.
type MessageInfo struct {
Id string `json:"id"`
@@ -269,6 +284,7 @@ type ProviderInfo struct {
Id string `json:"id"`
Models map[string]ModelInfo `json:"models"`
Name string `json:"name"`
+ Npm *string `json:"npm,omitempty"`
}
// ProviderAuthError defines model for ProviderAuthError.
@@ -652,6 +668,34 @@ func (t *Event) MergeEventSessionError(v EventSessionError) error {
return err
}
+// AsEventInstallationUpdated returns the union data inside the Event as a EventInstallationUpdated
+func (t Event) AsEventInstallationUpdated() (EventInstallationUpdated, error) {
+ var body EventInstallationUpdated
+ err := json.Unmarshal(t.union, &body)
+ return body, err
+}
+
+// FromEventInstallationUpdated overwrites any union data inside the Event as the provided EventInstallationUpdated
+func (t *Event) FromEventInstallationUpdated(v EventInstallationUpdated) error {
+ v.Type = "installation.updated"
+ b, err := json.Marshal(v)
+ t.union = b
+ return err
+}
+
+// MergeEventInstallationUpdated performs a merge with any union data inside the Event, using the provided EventInstallationUpdated
+func (t *Event) MergeEventInstallationUpdated(v EventInstallationUpdated) error {
+ v.Type = "installation.updated"
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+
+ merged, err := runtime.JSONMerge(t.union, b)
+ t.union = merged
+ return err
+}
+
func (t Event) Discriminator() (string, error) {
var discriminator struct {
Discriminator string `json:"type"`
@@ -666,6 +710,8 @@ func (t Event) ValueByDiscriminator() (interface{}, error) {
return nil, err
}
switch discriminator {
+ case "installation.updated":
+ return t.AsEventInstallationUpdated()
case "lsp.client.diagnostics":
return t.AsEventLspClientDiagnostics()
case "message.part.updated":
@@ -1288,6 +1334,9 @@ type ClientInterface interface {
PostFileSearch(ctx context.Context, body PostFileSearchJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
+ // PostInstallationInfo request
+ PostInstallationInfo(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
+
// PostPathGet request
PostPathGet(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
@@ -1391,6 +1440,18 @@ func (c *Client) PostFileSearch(ctx context.Context, body PostFileSearchJSONRequ
return c.Client.Do(req)
}
+func (c *Client) PostInstallationInfo(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
+ req, err := NewPostInstallationInfoRequest(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) PostPathGet(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostPathGetRequest(c.Server)
if err != nil {
@@ -1704,6 +1765,33 @@ func NewPostFileSearchRequestWithBody(server string, contentType string, body io
return req, nil
}
+// NewPostInstallationInfoRequest generates requests for PostInstallationInfo
+func NewPostInstallationInfoRequest(server string) (*http.Request, error) {
+ var err error
+
+ serverURL, err := url.Parse(server)
+ if err != nil {
+ return nil, err
+ }
+
+ operationPath := fmt.Sprintf("/installation_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
+}
+
// NewPostPathGetRequest generates requests for PostPathGet
func NewPostPathGetRequest(server string) (*http.Request, error) {
var err error
@@ -2109,6 +2197,9 @@ type ClientWithResponsesInterface interface {
PostFileSearchWithResponse(ctx context.Context, body PostFileSearchJSONRequestBody, reqEditors ...RequestEditorFn) (*PostFileSearchResponse, error)
+ // PostInstallationInfoWithResponse request
+ PostInstallationInfoWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostInstallationInfoResponse, error)
+
// PostPathGetWithResponse request
PostPathGetWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostPathGetResponse, error)
@@ -2240,6 +2331,28 @@ func (r PostFileSearchResponse) StatusCode() int {
return 0
}
+type PostInstallationInfoResponse struct {
+ Body []byte
+ HTTPResponse *http.Response
+ JSON200 *InstallationInfo
+}
+
+// Status returns HTTPResponse.Status
+func (r PostInstallationInfoResponse) Status() string {
+ if r.HTTPResponse != nil {
+ return r.HTTPResponse.Status
+ }
+ return http.StatusText(0)
+}
+
+// StatusCode returns HTTPResponse.StatusCode
+func (r PostInstallationInfoResponse) StatusCode() int {
+ if r.HTTPResponse != nil {
+ return r.HTTPResponse.StatusCode
+ }
+ return 0
+}
+
type PostPathGetResponse struct {
Body []byte
HTTPResponse *http.Response
@@ -2513,6 +2626,15 @@ func (c *ClientWithResponses) PostFileSearchWithResponse(ctx context.Context, bo
return ParsePostFileSearchResponse(rsp)
}
+// PostInstallationInfoWithResponse request returning *PostInstallationInfoResponse
+func (c *ClientWithResponses) PostInstallationInfoWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostInstallationInfoResponse, error) {
+ rsp, err := c.PostInstallationInfo(ctx, reqEditors...)
+ if err != nil {
+ return nil, err
+ }
+ return ParsePostInstallationInfoResponse(rsp)
+}
+
// PostPathGetWithResponse request returning *PostPathGetResponse
func (c *ClientWithResponses) PostPathGetWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostPathGetResponse, error) {
rsp, err := c.PostPathGet(ctx, reqEditors...)
@@ -2755,6 +2877,32 @@ func ParsePostFileSearchResponse(rsp *http.Response) (*PostFileSearchResponse, e
return response, nil
}
+// ParsePostInstallationInfoResponse parses an HTTP response from a PostInstallationInfoWithResponse call
+func ParsePostInstallationInfoResponse(rsp *http.Response) (*PostInstallationInfoResponse, error) {
+ bodyBytes, err := io.ReadAll(rsp.Body)
+ defer func() { _ = rsp.Body.Close() }()
+ if err != nil {
+ return nil, err
+ }
+
+ response := &PostInstallationInfoResponse{
+ Body: bodyBytes,
+ HTTPResponse: rsp,
+ }
+
+ switch {
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
+ var dest InstallationInfo
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
+ return nil, err
+ }
+ response.JSON200 = &dest
+
+ }
+
+ return response, nil
+}
+
// ParsePostPathGetResponse parses an HTTP response from a PostPathGetWithResponse call
func ParsePostPathGetResponse(rsp *http.Response) (*PostPathGetResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)