client

package
v0.0.0-...-4e700da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package client provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.6.1-0.20260318123712-00a90b7a03f4 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCreateResourceRequest

func NewCreateResourceRequest(server string, params *CreateResourceParams, body CreateResourceJSONRequestBody) (*http.Request, error)

NewCreateResourceRequest calls the generic CreateResource builder with application/json body

func NewCreateResourceRequestWithBody

func NewCreateResourceRequestWithBody(server string, params *CreateResourceParams, contentType string, body io.Reader) (*http.Request, error)

NewCreateResourceRequestWithBody generates requests for CreateResource with any type of body

func NewDeleteResourceRequest

func NewDeleteResourceRequest(server string, resourceId ResourceIdPath) (*http.Request, error)

NewDeleteResourceRequest generates requests for DeleteResource

func NewGetHealthRequest

func NewGetHealthRequest(server string) (*http.Request, error)

NewGetHealthRequest generates requests for GetHealth

func NewGetResourceRequest

func NewGetResourceRequest(server string, resourceId ResourceIdPath) (*http.Request, error)

NewGetResourceRequest generates requests for GetResource

func NewListResourcesRequest

func NewListResourcesRequest(server string, params *ListResourcesParams) (*http.Request, error)

NewListResourcesRequest generates requests for ListResources

func NewRehydrateResourceRequest

func NewRehydrateResourceRequest(server string, resourceId ResourceIdPath, body RehydrateResourceJSONRequestBody) (*http.Request, error)

NewRehydrateResourceRequest calls the generic RehydrateResource builder with application/json body

func NewRehydrateResourceRequestWithBody

func NewRehydrateResourceRequestWithBody(server string, resourceId ResourceIdPath, contentType string, body io.Reader) (*http.Request, error)

NewRehydrateResourceRequestWithBody generates requests for RehydrateResource with any type of body

Types

type Client

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
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) CreateResource

func (c *Client) CreateResource(ctx context.Context, params *CreateResourceParams, body CreateResourceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) CreateResourceWithBody

func (c *Client) CreateResourceWithBody(ctx context.Context, params *CreateResourceParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) DeleteResource

func (c *Client) DeleteResource(ctx context.Context, resourceId ResourceIdPath, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetHealth

func (c *Client) GetHealth(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetResource

func (c *Client) GetResource(ctx context.Context, resourceId ResourceIdPath, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ListResources

func (c *Client) ListResources(ctx context.Context, params *ListResourcesParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) RehydrateResource

func (c *Client) RehydrateResource(ctx context.Context, resourceId ResourceIdPath, body RehydrateResourceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) RehydrateResourceWithBody

func (c *Client) RehydrateResourceWithBody(ctx context.Context, resourceId ResourceIdPath, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetHealth request
	GetHealth(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ListResources request
	ListResources(ctx context.Context, params *ListResourcesParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CreateResourceWithBody request with any body
	CreateResourceWithBody(ctx context.Context, params *CreateResourceParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	CreateResource(ctx context.Context, params *CreateResourceParams, body CreateResourceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// DeleteResource request
	DeleteResource(ctx context.Context, resourceId ResourceIdPath, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetResource request
	GetResource(ctx context.Context, resourceId ResourceIdPath, reqEditors ...RequestEditorFn) (*http.Response, error)

	// RehydrateResourceWithBody request with any body
	RehydrateResourceWithBody(ctx context.Context, resourceId ResourceIdPath, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	RehydrateResource(ctx context.Context, resourceId ResourceIdPath, body RehydrateResourceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) CreateResourceWithBodyWithResponse

func (c *ClientWithResponses) CreateResourceWithBodyWithResponse(ctx context.Context, params *CreateResourceParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateResourceResponse, error)

CreateResourceWithBodyWithResponse request with arbitrary body returning *CreateResourceResponse

func (*ClientWithResponses) CreateResourceWithResponse

func (c *ClientWithResponses) CreateResourceWithResponse(ctx context.Context, params *CreateResourceParams, body CreateResourceJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateResourceResponse, error)

func (*ClientWithResponses) DeleteResourceWithResponse

func (c *ClientWithResponses) DeleteResourceWithResponse(ctx context.Context, resourceId ResourceIdPath, reqEditors ...RequestEditorFn) (*DeleteResourceResponse, error)

DeleteResourceWithResponse request returning *DeleteResourceResponse

func (*ClientWithResponses) GetHealthWithResponse

func (c *ClientWithResponses) GetHealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetHealthResponse, error)

GetHealthWithResponse request returning *GetHealthResponse

func (*ClientWithResponses) GetResourceWithResponse

func (c *ClientWithResponses) GetResourceWithResponse(ctx context.Context, resourceId ResourceIdPath, reqEditors ...RequestEditorFn) (*GetResourceResponse, error)

GetResourceWithResponse request returning *GetResourceResponse

func (*ClientWithResponses) ListResourcesWithResponse

func (c *ClientWithResponses) ListResourcesWithResponse(ctx context.Context, params *ListResourcesParams, reqEditors ...RequestEditorFn) (*ListResourcesResponse, error)

ListResourcesWithResponse request returning *ListResourcesResponse

func (*ClientWithResponses) RehydrateResourceWithBodyWithResponse

func (c *ClientWithResponses) RehydrateResourceWithBodyWithResponse(ctx context.Context, resourceId ResourceIdPath, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RehydrateResourceResponse, error)

RehydrateResourceWithBodyWithResponse request with arbitrary body returning *RehydrateResourceResponse

func (*ClientWithResponses) RehydrateResourceWithResponse

func (c *ClientWithResponses) RehydrateResourceWithResponse(ctx context.Context, resourceId ResourceIdPath, body RehydrateResourceJSONRequestBody, reqEditors ...RequestEditorFn) (*RehydrateResourceResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetHealthWithResponse request
	GetHealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetHealthResponse, error)

	// ListResourcesWithResponse request
	ListResourcesWithResponse(ctx context.Context, params *ListResourcesParams, reqEditors ...RequestEditorFn) (*ListResourcesResponse, error)

	// CreateResourceWithBodyWithResponse request with any body
	CreateResourceWithBodyWithResponse(ctx context.Context, params *CreateResourceParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateResourceResponse, error)

	CreateResourceWithResponse(ctx context.Context, params *CreateResourceParams, body CreateResourceJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateResourceResponse, error)

	// DeleteResourceWithResponse request
	DeleteResourceWithResponse(ctx context.Context, resourceId ResourceIdPath, reqEditors ...RequestEditorFn) (*DeleteResourceResponse, error)

	// GetResourceWithResponse request
	GetResourceWithResponse(ctx context.Context, resourceId ResourceIdPath, reqEditors ...RequestEditorFn) (*GetResourceResponse, error)

	// RehydrateResourceWithBodyWithResponse request with any body
	RehydrateResourceWithBodyWithResponse(ctx context.Context, resourceId ResourceIdPath, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RehydrateResourceResponse, error)

	RehydrateResourceWithResponse(ctx context.Context, resourceId ResourceIdPath, body RehydrateResourceJSONRequestBody, reqEditors ...RequestEditorFn) (*RehydrateResourceResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type CreateResourceResponse

type CreateResourceResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	JSON201                       *Resource
	ApplicationproblemJSON400     *Error
	ApplicationproblemJSON406     *Error
	ApplicationproblemJSON409     *Error
	ApplicationproblemJSON422     *Error
	ApplicationproblemJSONDefault *Error
}

func ParseCreateResourceResponse

func ParseCreateResourceResponse(rsp *http.Response) (*CreateResourceResponse, error)

ParseCreateResourceResponse parses an HTTP response from a CreateResourceWithResponse call

func (CreateResourceResponse) Status

func (r CreateResourceResponse) Status() string

Status returns HTTPResponse.Status

func (CreateResourceResponse) StatusCode

func (r CreateResourceResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type DeleteResourceResponse

type DeleteResourceResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	ApplicationproblemJSON400     *Error
	ApplicationproblemJSON404     *Error
	ApplicationproblemJSON422     *Error
	ApplicationproblemJSONDefault *Error
}

func ParseDeleteResourceResponse

func ParseDeleteResourceResponse(rsp *http.Response) (*DeleteResourceResponse, error)

ParseDeleteResourceResponse parses an HTTP response from a DeleteResourceWithResponse call

func (DeleteResourceResponse) Status

func (r DeleteResourceResponse) Status() string

Status returns HTTPResponse.Status

func (DeleteResourceResponse) StatusCode

func (r DeleteResourceResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetHealthResponse

type GetHealthResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Health
}

func ParseGetHealthResponse

func ParseGetHealthResponse(rsp *http.Response) (*GetHealthResponse, error)

ParseGetHealthResponse parses an HTTP response from a GetHealthWithResponse call

func (GetHealthResponse) Status

func (r GetHealthResponse) Status() string

Status returns HTTPResponse.Status

func (GetHealthResponse) StatusCode

func (r GetHealthResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetResourceResponse

type GetResourceResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	JSON200                       *Resource
	ApplicationproblemJSON400     *Error
	ApplicationproblemJSON404     *Error
	ApplicationproblemJSONDefault *Error
}

func ParseGetResourceResponse

func ParseGetResourceResponse(rsp *http.Response) (*GetResourceResponse, error)

ParseGetResourceResponse parses an HTTP response from a GetResourceWithResponse call

func (GetResourceResponse) Status

func (r GetResourceResponse) Status() string

Status returns HTTPResponse.Status

func (GetResourceResponse) StatusCode

func (r GetResourceResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type ListResourcesResponse

type ListResourcesResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	JSON200                       *ResourceList
	ApplicationproblemJSON400     *Error
	ApplicationproblemJSONDefault *Error
}

func ParseListResourcesResponse

func ParseListResourcesResponse(rsp *http.Response) (*ListResourcesResponse, error)

ParseListResourcesResponse parses an HTTP response from a ListResourcesWithResponse call

func (ListResourcesResponse) Status

func (r ListResourcesResponse) Status() string

Status returns HTTPResponse.Status

func (ListResourcesResponse) StatusCode

func (r ListResourcesResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type RehydrateResourceResponse

type RehydrateResourceResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	JSON200                       *Resource
	ApplicationproblemJSON400     *Error
	ApplicationproblemJSON404     *Error
	ApplicationproblemJSON406     *Error
	ApplicationproblemJSON409     *Error
	ApplicationproblemJSON422     *Error
	ApplicationproblemJSONDefault *Error
}

func ParseRehydrateResourceResponse

func ParseRehydrateResourceResponse(rsp *http.Response) (*RehydrateResourceResponse, error)

ParseRehydrateResourceResponse parses an HTTP response from a RehydrateResourceWithResponse call

func (RehydrateResourceResponse) Status

func (r RehydrateResourceResponse) Status() string

Status returns HTTPResponse.Status

func (RehydrateResourceResponse) StatusCode

func (r RehydrateResourceResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL