forgejo-runner-sizer/pkg/client/client.gen.go
Manuel Ganter bc9d0dd8ea
All checks were successful
ci / ci (push) Successful in 2m2s
feat: migrate receiver to Fuego framework with OpenAPI generation
Replace net/http handlers with Fuego framework for automatic OpenAPI 3.0
spec generation. Add generated Go client package, OpenAPI extraction
script, and update Makefile with separate build/run targets for both
binaries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 11:16:02 +01:00

1096 lines
32 KiB
Go

// Package client provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.
package client
import (
"context"
"encoding/json"
"encoding/xml"
"fmt"
"io"
"net/http"
"net/url"
"strings"
"time"
"github.com/oapi-codegen/runtime"
)
// HTTPError HTTPError schema
type HTTPError struct {
// Detail Human readable error message
Detail *string `json:"detail"`
Errors *[]struct {
// More Additional information about the error
More *map[string]*interface{} `json:"more"`
// Name For example, name of the parameter that caused the error
Name *string `json:"name,omitempty"`
// Reason Human readable error message
Reason *string `json:"reason,omitempty"`
} `json:"errors"`
Instance *string `json:"instance"`
// Status HTTP status code
Status *int `json:"status"`
// Title Short title of the error
Title *string `json:"title"`
// Type URL of the error type. Can be used to lookup the error in a documentation
Type *string `json:"type"`
}
// HealthResponse HealthResponse schema
type HealthResponse struct {
Status *string `json:"status,omitempty"`
}
// MetricCreatedResponse MetricCreatedResponse schema
type MetricCreatedResponse struct {
Id *int `json:"id,omitempty"`
Status *string `json:"status,omitempty"`
}
// MetricResponse MetricResponse schema
type MetricResponse struct {
Id *int `json:"id,omitempty"`
Job *string `json:"job,omitempty"`
Organization *string `json:"organization,omitempty"`
Payload interface{} `json:"payload,omitempty"`
ReceivedAt *time.Time `json:"received_at,omitempty"`
Repository *string `json:"repository,omitempty"`
RunId *string `json:"run_id,omitempty"`
Workflow *string `json:"workflow,omitempty"`
}
// SizingResponse SizingResponse schema
type SizingResponse struct {
Containers *[]struct {
Cpu *struct {
Limit *string `json:"limit,omitempty"`
Request *string `json:"request,omitempty"`
} `json:"cpu,omitempty"`
Memory *struct {
Limit *string `json:"limit,omitempty"`
Request *string `json:"request,omitempty"`
} `json:"memory,omitempty"`
Name *string `json:"name,omitempty"`
} `json:"containers,omitempty"`
Meta *struct {
BufferPercent *int `json:"buffer_percent,omitempty"`
CpuPercentile *string `json:"cpu_percentile,omitempty"`
RunsAnalyzed *int `json:"runs_analyzed,omitempty"`
} `json:"meta,omitempty"`
Total *struct {
Cpu *struct {
Limit *string `json:"limit,omitempty"`
Request *string `json:"request,omitempty"`
} `json:"cpu,omitempty"`
Memory *struct {
Limit *string `json:"limit,omitempty"`
Request *string `json:"request,omitempty"`
} `json:"memory,omitempty"`
} `json:"total,omitempty"`
}
// TokenRequest TokenRequest schema
type TokenRequest struct {
Job *string `json:"job,omitempty"`
Organization *string `json:"organization,omitempty"`
Repository *string `json:"repository,omitempty"`
Workflow *string `json:"workflow,omitempty"`
}
// TokenResponse TokenResponse schema
type TokenResponse struct {
Token *string `json:"token,omitempty"`
}
// POSTapiv1metricsParams defines parameters for POSTapiv1metrics.
type POSTapiv1metricsParams struct {
Accept *string `json:"Accept,omitempty"`
}
// GETapiv1metricsrepoOrgRepoWorkflowJobParams defines parameters for GETapiv1metricsrepoOrgRepoWorkflowJob.
type GETapiv1metricsrepoOrgRepoWorkflowJobParams struct {
Accept *string `json:"Accept,omitempty"`
}
// GETapiv1sizingrepoOrgRepoWorkflowJobParams defines parameters for GETapiv1sizingrepoOrgRepoWorkflowJob.
type GETapiv1sizingrepoOrgRepoWorkflowJobParams struct {
Accept *string `json:"Accept,omitempty"`
}
// POSTapiv1tokenParams defines parameters for POSTapiv1token.
type POSTapiv1tokenParams struct {
Accept *string `json:"Accept,omitempty"`
}
// GEThealthParams defines parameters for GEThealth.
type GEThealthParams struct {
Accept *string `json:"Accept,omitempty"`
}
// RequestEditorFn is the function signature for the RequestEditor callback function
type RequestEditorFn func(ctx context.Context, req *http.Request) error
// Doer performs HTTP requests.
//
// The standard http.Client implements this interface.
type HttpRequestDoer interface {
Do(req *http.Request) (*http.Response, error)
}
// Client which conforms to the OpenAPI3 specification for this service.
type Client struct {
// The endpoint of the server conforming to this interface, with scheme,
// https://api.deepmap.com for example. This can contain a path relative
// to the server, such as https://api.deepmap.com/dev-test, and all the
// paths in the swagger spec will be appended to the server.
Server string
// Doer for performing requests, typically a *http.Client with any
// customized settings, such as certificate chains.
Client HttpRequestDoer
// A list of callbacks for modifying requests which are generated before sending over
// the network.
RequestEditors []RequestEditorFn
}
// ClientOption allows setting custom parameters during construction
type ClientOption func(*Client) error
// Creates a new Client, with reasonable defaults
func NewClient(server string, opts ...ClientOption) (*Client, error) {
// create a client with sane default values
client := Client{
Server: server,
}
// mutate client and add all optional params
for _, o := range opts {
if err := o(&client); err != nil {
return nil, err
}
}
// ensure the server URL always has a trailing slash
if !strings.HasSuffix(client.Server, "/") {
client.Server += "/"
}
// create httpClient, if not already present
if client.Client == nil {
client.Client = &http.Client{}
}
return &client, nil
}
// WithHTTPClient allows overriding the default Doer, which is
// automatically created using http.Client. This is useful for tests.
func WithHTTPClient(doer HttpRequestDoer) ClientOption {
return func(c *Client) error {
c.Client = doer
return nil
}
}
// WithRequestEditorFn allows setting up a callback function, which will be
// called right before sending the request. This can be used to mutate the request.
func WithRequestEditorFn(fn RequestEditorFn) ClientOption {
return func(c *Client) error {
c.RequestEditors = append(c.RequestEditors, fn)
return nil
}
}
// The interface specification for the client above.
type ClientInterface interface {
// POSTapiv1metrics request
POSTapiv1metrics(ctx context.Context, params *POSTapiv1metricsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// GETapiv1metricsrepoOrgRepoWorkflowJob request
GETapiv1metricsrepoOrgRepoWorkflowJob(ctx context.Context, org string, repo string, workflow string, job string, params *GETapiv1metricsrepoOrgRepoWorkflowJobParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// GETapiv1sizingrepoOrgRepoWorkflowJob request
GETapiv1sizingrepoOrgRepoWorkflowJob(ctx context.Context, org string, repo string, workflow string, job string, params *GETapiv1sizingrepoOrgRepoWorkflowJobParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// POSTapiv1tokenWithBody request with any body
POSTapiv1tokenWithBody(ctx context.Context, params *POSTapiv1tokenParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
// GEThealth request
GEThealth(ctx context.Context, params *GEThealthParams, reqEditors ...RequestEditorFn) (*http.Response, error)
}
func (c *Client) POSTapiv1metrics(ctx context.Context, params *POSTapiv1metricsParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPOSTapiv1metricsRequest(c.Server, params)
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) GETapiv1metricsrepoOrgRepoWorkflowJob(ctx context.Context, org string, repo string, workflow string, job string, params *GETapiv1metricsrepoOrgRepoWorkflowJobParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGETapiv1metricsrepoOrgRepoWorkflowJobRequest(c.Server, org, repo, workflow, job, params)
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) GETapiv1sizingrepoOrgRepoWorkflowJob(ctx context.Context, org string, repo string, workflow string, job string, params *GETapiv1sizingrepoOrgRepoWorkflowJobParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGETapiv1sizingrepoOrgRepoWorkflowJobRequest(c.Server, org, repo, workflow, job, params)
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) POSTapiv1tokenWithBody(ctx context.Context, params *POSTapiv1tokenParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPOSTapiv1tokenRequestWithBody(c.Server, params, contentType, body)
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) GEThealth(ctx context.Context, params *GEThealthParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGEThealthRequest(c.Server, params)
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)
}
// NewPOSTapiv1metricsRequest generates requests for POSTapiv1metrics
func NewPOSTapiv1metricsRequest(server string, params *POSTapiv1metricsParams) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/metrics")
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
}
if params != nil {
if params.Accept != nil {
var headerParam0 string
headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Accept", runtime.ParamLocationHeader, *params.Accept)
if err != nil {
return nil, err
}
req.Header.Set("Accept", headerParam0)
}
}
return req, nil
}
// NewGETapiv1metricsrepoOrgRepoWorkflowJobRequest generates requests for GETapiv1metricsrepoOrgRepoWorkflowJob
func NewGETapiv1metricsrepoOrgRepoWorkflowJobRequest(server string, org string, repo string, workflow string, job string, params *GETapiv1metricsrepoOrgRepoWorkflowJobParams) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "org", runtime.ParamLocationPath, org)
if err != nil {
return nil, err
}
var pathParam1 string
pathParam1, err = runtime.StyleParamWithLocation("simple", false, "repo", runtime.ParamLocationPath, repo)
if err != nil {
return nil, err
}
var pathParam2 string
pathParam2, err = runtime.StyleParamWithLocation("simple", false, "workflow", runtime.ParamLocationPath, workflow)
if err != nil {
return nil, err
}
var pathParam3 string
pathParam3, err = runtime.StyleParamWithLocation("simple", false, "job", runtime.ParamLocationPath, job)
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/metrics/repo/%s/%s/%s/%s", pathParam0, pathParam1, pathParam2, pathParam3)
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
}
if params != nil {
if params.Accept != nil {
var headerParam0 string
headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Accept", runtime.ParamLocationHeader, *params.Accept)
if err != nil {
return nil, err
}
req.Header.Set("Accept", headerParam0)
}
}
return req, nil
}
// NewGETapiv1sizingrepoOrgRepoWorkflowJobRequest generates requests for GETapiv1sizingrepoOrgRepoWorkflowJob
func NewGETapiv1sizingrepoOrgRepoWorkflowJobRequest(server string, org string, repo string, workflow string, job string, params *GETapiv1sizingrepoOrgRepoWorkflowJobParams) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "org", runtime.ParamLocationPath, org)
if err != nil {
return nil, err
}
var pathParam1 string
pathParam1, err = runtime.StyleParamWithLocation("simple", false, "repo", runtime.ParamLocationPath, repo)
if err != nil {
return nil, err
}
var pathParam2 string
pathParam2, err = runtime.StyleParamWithLocation("simple", false, "workflow", runtime.ParamLocationPath, workflow)
if err != nil {
return nil, err
}
var pathParam3 string
pathParam3, err = runtime.StyleParamWithLocation("simple", false, "job", runtime.ParamLocationPath, job)
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/sizing/repo/%s/%s/%s/%s", pathParam0, pathParam1, pathParam2, pathParam3)
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
}
if params != nil {
if params.Accept != nil {
var headerParam0 string
headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Accept", runtime.ParamLocationHeader, *params.Accept)
if err != nil {
return nil, err
}
req.Header.Set("Accept", headerParam0)
}
}
return req, nil
}
// NewPOSTapiv1tokenRequestWithBody generates requests for POSTapiv1token with any type of body
func NewPOSTapiv1tokenRequestWithBody(server string, params *POSTapiv1tokenParams, contentType string, body io.Reader) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/token")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
if params != nil {
if params.Accept != nil {
var headerParam0 string
headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Accept", runtime.ParamLocationHeader, *params.Accept)
if err != nil {
return nil, err
}
req.Header.Set("Accept", headerParam0)
}
}
return req, nil
}
// NewGEThealthRequest generates requests for GEThealth
func NewGEThealthRequest(server string, params *GEThealthParams) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/health")
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
}
if params != nil {
if params.Accept != nil {
var headerParam0 string
headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Accept", runtime.ParamLocationHeader, *params.Accept)
if err != nil {
return nil, err
}
req.Header.Set("Accept", headerParam0)
}
}
return req, nil
}
func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error {
for _, r := range c.RequestEditors {
if err := r(ctx, req); err != nil {
return err
}
}
for _, r := range additionalEditors {
if err := r(ctx, req); err != nil {
return err
}
}
return nil
}
// ClientWithResponses builds on ClientInterface to offer response payloads
type ClientWithResponses struct {
ClientInterface
}
// NewClientWithResponses creates a new ClientWithResponses, which wraps
// Client with return type handling
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) {
client, err := NewClient(server, opts...)
if err != nil {
return nil, err
}
return &ClientWithResponses{client}, nil
}
// WithBaseURL overrides the baseURL.
func WithBaseURL(baseURL string) ClientOption {
return func(c *Client) error {
newBaseURL, err := url.Parse(baseURL)
if err != nil {
return err
}
c.Server = newBaseURL.String()
return nil
}
}
// ClientWithResponsesInterface is the interface specification for the client with responses above.
type ClientWithResponsesInterface interface {
// POSTapiv1metricsWithResponse request
POSTapiv1metricsWithResponse(ctx context.Context, params *POSTapiv1metricsParams, reqEditors ...RequestEditorFn) (*POSTapiv1metricsResponse, error)
// GETapiv1metricsrepoOrgRepoWorkflowJobWithResponse request
GETapiv1metricsrepoOrgRepoWorkflowJobWithResponse(ctx context.Context, org string, repo string, workflow string, job string, params *GETapiv1metricsrepoOrgRepoWorkflowJobParams, reqEditors ...RequestEditorFn) (*GETapiv1metricsrepoOrgRepoWorkflowJobResponse, error)
// GETapiv1sizingrepoOrgRepoWorkflowJobWithResponse request
GETapiv1sizingrepoOrgRepoWorkflowJobWithResponse(ctx context.Context, org string, repo string, workflow string, job string, params *GETapiv1sizingrepoOrgRepoWorkflowJobParams, reqEditors ...RequestEditorFn) (*GETapiv1sizingrepoOrgRepoWorkflowJobResponse, error)
// POSTapiv1tokenWithBodyWithResponse request with any body
POSTapiv1tokenWithBodyWithResponse(ctx context.Context, params *POSTapiv1tokenParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*POSTapiv1tokenResponse, error)
// GEThealthWithResponse request
GEThealthWithResponse(ctx context.Context, params *GEThealthParams, reqEditors ...RequestEditorFn) (*GEThealthResponse, error)
}
type POSTapiv1metricsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *MetricCreatedResponse
XML200 *MetricCreatedResponse
JSON400 *HTTPError
XML400 *HTTPError
JSON500 *HTTPError
XML500 *HTTPError
}
// Status returns HTTPResponse.Status
func (r POSTapiv1metricsResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r POSTapiv1metricsResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type GETapiv1metricsrepoOrgRepoWorkflowJobResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *[]MetricResponse
XML200 *[]MetricResponse
JSON400 *HTTPError
XML400 *HTTPError
JSON500 *HTTPError
XML500 *HTTPError
}
// Status returns HTTPResponse.Status
func (r GETapiv1metricsrepoOrgRepoWorkflowJobResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GETapiv1metricsrepoOrgRepoWorkflowJobResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type GETapiv1sizingrepoOrgRepoWorkflowJobResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *SizingResponse
XML200 *SizingResponse
JSON400 *HTTPError
XML400 *HTTPError
JSON500 *HTTPError
XML500 *HTTPError
}
// Status returns HTTPResponse.Status
func (r GETapiv1sizingrepoOrgRepoWorkflowJobResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GETapiv1sizingrepoOrgRepoWorkflowJobResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type POSTapiv1tokenResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *TokenResponse
XML200 *TokenResponse
JSON400 *HTTPError
XML400 *HTTPError
JSON500 *HTTPError
XML500 *HTTPError
}
// Status returns HTTPResponse.Status
func (r POSTapiv1tokenResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r POSTapiv1tokenResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type GEThealthResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *HealthResponse
XML200 *HealthResponse
JSON400 *HTTPError
XML400 *HTTPError
JSON500 *HTTPError
XML500 *HTTPError
}
// Status returns HTTPResponse.Status
func (r GEThealthResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GEThealthResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// POSTapiv1metricsWithResponse request returning *POSTapiv1metricsResponse
func (c *ClientWithResponses) POSTapiv1metricsWithResponse(ctx context.Context, params *POSTapiv1metricsParams, reqEditors ...RequestEditorFn) (*POSTapiv1metricsResponse, error) {
rsp, err := c.POSTapiv1metrics(ctx, params, reqEditors...)
if err != nil {
return nil, err
}
return ParsePOSTapiv1metricsResponse(rsp)
}
// GETapiv1metricsrepoOrgRepoWorkflowJobWithResponse request returning *GETapiv1metricsrepoOrgRepoWorkflowJobResponse
func (c *ClientWithResponses) GETapiv1metricsrepoOrgRepoWorkflowJobWithResponse(ctx context.Context, org string, repo string, workflow string, job string, params *GETapiv1metricsrepoOrgRepoWorkflowJobParams, reqEditors ...RequestEditorFn) (*GETapiv1metricsrepoOrgRepoWorkflowJobResponse, error) {
rsp, err := c.GETapiv1metricsrepoOrgRepoWorkflowJob(ctx, org, repo, workflow, job, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseGETapiv1metricsrepoOrgRepoWorkflowJobResponse(rsp)
}
// GETapiv1sizingrepoOrgRepoWorkflowJobWithResponse request returning *GETapiv1sizingrepoOrgRepoWorkflowJobResponse
func (c *ClientWithResponses) GETapiv1sizingrepoOrgRepoWorkflowJobWithResponse(ctx context.Context, org string, repo string, workflow string, job string, params *GETapiv1sizingrepoOrgRepoWorkflowJobParams, reqEditors ...RequestEditorFn) (*GETapiv1sizingrepoOrgRepoWorkflowJobResponse, error) {
rsp, err := c.GETapiv1sizingrepoOrgRepoWorkflowJob(ctx, org, repo, workflow, job, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseGETapiv1sizingrepoOrgRepoWorkflowJobResponse(rsp)
}
// POSTapiv1tokenWithBodyWithResponse request with arbitrary body returning *POSTapiv1tokenResponse
func (c *ClientWithResponses) POSTapiv1tokenWithBodyWithResponse(ctx context.Context, params *POSTapiv1tokenParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*POSTapiv1tokenResponse, error) {
rsp, err := c.POSTapiv1tokenWithBody(ctx, params, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePOSTapiv1tokenResponse(rsp)
}
// GEThealthWithResponse request returning *GEThealthResponse
func (c *ClientWithResponses) GEThealthWithResponse(ctx context.Context, params *GEThealthParams, reqEditors ...RequestEditorFn) (*GEThealthResponse, error) {
rsp, err := c.GEThealth(ctx, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseGEThealthResponse(rsp)
}
// ParsePOSTapiv1metricsResponse parses an HTTP response from a POSTapiv1metricsWithResponse call
func ParsePOSTapiv1metricsResponse(rsp *http.Response) (*POSTapiv1metricsResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &POSTapiv1metricsResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest MetricCreatedResponse
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
var dest HTTPError
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest HTTPError
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "xml") && rsp.StatusCode == 200:
var dest MetricCreatedResponse
if err := xml.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.XML200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "xml") && rsp.StatusCode == 400:
var dest HTTPError
if err := xml.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.XML400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "xml") && rsp.StatusCode == 500:
var dest HTTPError
if err := xml.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.XML500 = &dest
}
return response, nil
}
// ParseGETapiv1metricsrepoOrgRepoWorkflowJobResponse parses an HTTP response from a GETapiv1metricsrepoOrgRepoWorkflowJobWithResponse call
func ParseGETapiv1metricsrepoOrgRepoWorkflowJobResponse(rsp *http.Response) (*GETapiv1metricsrepoOrgRepoWorkflowJobResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GETapiv1metricsrepoOrgRepoWorkflowJobResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest []MetricResponse
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
var dest HTTPError
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest HTTPError
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "xml") && rsp.StatusCode == 200:
var dest []MetricResponse
if err := xml.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.XML200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "xml") && rsp.StatusCode == 400:
var dest HTTPError
if err := xml.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.XML400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "xml") && rsp.StatusCode == 500:
var dest HTTPError
if err := xml.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.XML500 = &dest
}
return response, nil
}
// ParseGETapiv1sizingrepoOrgRepoWorkflowJobResponse parses an HTTP response from a GETapiv1sizingrepoOrgRepoWorkflowJobWithResponse call
func ParseGETapiv1sizingrepoOrgRepoWorkflowJobResponse(rsp *http.Response) (*GETapiv1sizingrepoOrgRepoWorkflowJobResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GETapiv1sizingrepoOrgRepoWorkflowJobResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest SizingResponse
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
var dest HTTPError
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest HTTPError
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "xml") && rsp.StatusCode == 200:
var dest SizingResponse
if err := xml.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.XML200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "xml") && rsp.StatusCode == 400:
var dest HTTPError
if err := xml.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.XML400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "xml") && rsp.StatusCode == 500:
var dest HTTPError
if err := xml.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.XML500 = &dest
}
return response, nil
}
// ParsePOSTapiv1tokenResponse parses an HTTP response from a POSTapiv1tokenWithResponse call
func ParsePOSTapiv1tokenResponse(rsp *http.Response) (*POSTapiv1tokenResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &POSTapiv1tokenResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest TokenResponse
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
var dest HTTPError
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest HTTPError
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "xml") && rsp.StatusCode == 200:
var dest TokenResponse
if err := xml.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.XML200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "xml") && rsp.StatusCode == 400:
var dest HTTPError
if err := xml.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.XML400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "xml") && rsp.StatusCode == 500:
var dest HTTPError
if err := xml.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.XML500 = &dest
}
return response, nil
}
// ParseGEThealthResponse parses an HTTP response from a GEThealthWithResponse call
func ParseGEThealthResponse(rsp *http.Response) (*GEThealthResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GEThealthResponse{
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
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
var dest HTTPError
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest HTTPError
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "xml") && rsp.StatusCode == 200:
var dest HealthResponse
if err := xml.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.XML200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "xml") && rsp.StatusCode == 400:
var dest HTTPError
if err := xml.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.XML400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "xml") && rsp.StatusCode == 500:
var dest HTTPError
if err := xml.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.XML500 = &dest
}
return response, nil
}