diff --git a/internal/api/client.gen.go b/internal/api/client.gen.go index 22c1188..8c0cecf 100644 --- a/internal/api/client.gen.go +++ b/internal/api/client.gen.go @@ -8395,6 +8395,9 @@ type ClientInterface interface { ProfileCookiesSet(ctx context.Context, profileId string, params *ProfileCookiesSetParams, body ProfileCookiesSetJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // ReadyCheck request + ReadyCheck(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) + // SearchWebWithBody request with any body SearchWebWithBody(ctx context.Context, params *SearchWebParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -9001,6 +9004,18 @@ func (c *Client) ProfileCookiesSet(ctx context.Context, profileId string, params return c.Client.Do(req) } +func (c *Client) ReadyCheck(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewReadyCheckRequest(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) SearchWebWithBody(ctx context.Context, params *SearchWebParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewSearchWebRequestWithBody(c.Server, params, contentType, body) if err != nil { @@ -12143,6 +12158,33 @@ func NewProfileCookiesSetRequestWithBody(server string, profileId string, params return req, nil } +// NewReadyCheckRequest generates requests for ReadyCheck +func NewReadyCheckRequest(server string) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/ready") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewSearchWebRequest calls the generic SearchWeb builder with application/json body func NewSearchWebRequest(server string, params *SearchWebParams, body SearchWebJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader @@ -15026,6 +15068,9 @@ type ClientWithResponsesInterface interface { ProfileCookiesSetWithResponse(ctx context.Context, profileId string, params *ProfileCookiesSetParams, body ProfileCookiesSetJSONRequestBody, reqEditors ...RequestEditorFn) (*ProfileCookiesSetResult, error) + // ReadyCheckWithResponse request + ReadyCheckWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ReadyCheckResult, error) + // SearchWebWithBodyWithResponse request with any body SearchWebWithBodyWithResponse(ctx context.Context, params *SearchWebParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchWebResult, error) @@ -15887,6 +15932,28 @@ func (r ProfileCookiesSetResult) StatusCode() int { return 0 } +type ReadyCheckResult struct { + Body []byte + HTTPResponse *http.Response + JSON200 *HealthResponse +} + +// Status returns HTTPResponse.Status +func (r ReadyCheckResult) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ReadyCheckResult) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type SearchWebResult struct { Body []byte HTTPResponse *http.Response @@ -17045,6 +17112,15 @@ func (c *ClientWithResponses) ProfileCookiesSetWithResponse(ctx context.Context, return ParseProfileCookiesSetResult(rsp) } +// ReadyCheckWithResponse request returning *ReadyCheckResult +func (c *ClientWithResponses) ReadyCheckWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ReadyCheckResult, error) { + rsp, err := c.ReadyCheck(ctx, reqEditors...) + if err != nil { + return nil, err + } + return ParseReadyCheckResult(rsp) +} + // SearchWebWithBodyWithResponse request with arbitrary body returning *SearchWebResult func (c *ClientWithResponses) SearchWebWithBodyWithResponse(ctx context.Context, params *SearchWebParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchWebResult, error) { rsp, err := c.SearchWebWithBody(ctx, params, contentType, body, reqEditors...) @@ -18489,6 +18565,32 @@ func ParseProfileCookiesSetResult(rsp *http.Response) (*ProfileCookiesSetResult, return response, nil } +// ParseReadyCheckResult parses an HTTP response from a ReadyCheckWithResponse call +func ParseReadyCheckResult(rsp *http.Response) (*ReadyCheckResult, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ReadyCheckResult{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest HealthResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + // ParseSearchWebResult parses an HTTP response from a SearchWebWithResponse call func ParseSearchWebResult(rsp *http.Response) (*SearchWebResult, error) { bodyBytes, err := io.ReadAll(rsp.Body)