apis

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

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

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.1 DO NOT EDIT.

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

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.1 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSpec

func GetSpec() (swagger *openapi3.T, err error)

GetSpec returns the OpenAPI specification corresponding to the generated code in this file. External references in the spec are resolved through PathToRawSpec; externally-referenced files must be embedded in their corresponding Go packages (via the import-mapping feature). URL-based external refs are not supported.

func GetSpecJSON

func GetSpecJSON() ([]byte, error)

GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI specification: decompressed but not unmarshaled. External references are not resolved here; the bytes are the spec exactly as embedded by codegen. The result is cached at package init time, so repeated calls are cheap.

func GetSwagger deprecated

func GetSwagger() (*openapi3.T, error)

GetSwagger returns the OpenAPI specification corresponding to the generated code in this file.

Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger to openapi3.T. Use GetSpec instead. This wrapper is retained for backwards compatibility.

func NewCreateSiteRequest

func NewCreateSiteRequest(server string, siteName string) (*http.Request, error)

NewCreateSiteRequest generates requests for CreateSite

func NewGetSiteRequest

func NewGetSiteRequest(server string, siteName string) (*http.Request, error)

NewGetSiteRequest generates requests for GetSite

func NewPutSiteFileRequestWithBody

func NewPutSiteFileRequestWithBody(server string, siteName string, path string, contentType string, body io.Reader) (*http.Request, error)

NewPutSiteFileRequestWithBody generates requests for PutSiteFile with any type of body

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

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) CreateSite

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

func (*Client) GetSite

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

func (*Client) PutSiteFileWithBody

func (c *Client) PutSiteFileWithBody(ctx context.Context, siteName string, path string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

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

	// CreateSite request
	CreateSite(ctx context.Context, siteName string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// PutSiteFileWithBody request with any body
	PutSiteFileWithBody(ctx context.Context, siteName string, path string, contentType string, body io.Reader, 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) CreateSiteWithResponse

func (c *ClientWithResponses) CreateSiteWithResponse(ctx context.Context, siteName string, reqEditors ...RequestEditorFn) (*CreateSiteResponse, error)

CreateSiteWithResponse request returning *CreateSiteResponse

func (*ClientWithResponses) GetSiteWithResponse

func (c *ClientWithResponses) GetSiteWithResponse(ctx context.Context, siteName string, reqEditors ...RequestEditorFn) (*GetSiteResponse, error)

GetSiteWithResponse request returning *GetSiteResponse

func (*ClientWithResponses) PutSiteFileWithBodyWithResponse

func (c *ClientWithResponses) PutSiteFileWithBodyWithResponse(ctx context.Context, siteName string, path string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutSiteFileResponse, error)

PutSiteFileWithBodyWithResponse request with arbitrary body returning *PutSiteFileResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetSiteWithResponse request
	GetSiteWithResponse(ctx context.Context, siteName string, reqEditors ...RequestEditorFn) (*GetSiteResponse, error)

	// CreateSiteWithResponse request
	CreateSiteWithResponse(ctx context.Context, siteName string, reqEditors ...RequestEditorFn) (*CreateSiteResponse, error)

	// PutSiteFileWithBodyWithResponse request with any body
	PutSiteFileWithBodyWithResponse(ctx context.Context, siteName string, path string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutSiteFileResponse, error)
}

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

type CreateSiteResponse

type CreateSiteResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

func ParseCreateSiteResponse

func ParseCreateSiteResponse(rsp *http.Response) (*CreateSiteResponse, error)

ParseCreateSiteResponse parses an HTTP response from a CreateSiteWithResponse call

func (CreateSiteResponse) ContentType

func (r CreateSiteResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (CreateSiteResponse) Status

func (r CreateSiteResponse) Status() string

Status returns HTTPResponse.Status

func (CreateSiteResponse) StatusCode

func (r CreateSiteResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ErrorDetail

type ErrorDetail struct {
	// Location Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'
	Location *string `json:"location,omitempty"`

	// Message Error message text
	Message *string `json:"message,omitempty"`

	// Value The value at the given location
	Value interface{} `json:"value,omitempty"`
}

ErrorDetail defines model for ErrorDetail.

type ErrorModel

type ErrorModel struct {
	// Schema A URL to the JSON Schema for this object.
	Schema *string `json:"$schema,omitempty"`

	// Detail A human-readable explanation specific to this occurrence of the problem.
	Detail *string `json:"detail,omitempty"`

	// Errors Optional list of individual error details
	Errors *[]ErrorDetail `json:"errors,omitempty"`

	// Instance A URI reference that identifies the specific occurrence of the problem.
	Instance *string `json:"instance,omitempty"`

	// Status HTTP status code
	Status *int64 `json:"status,omitempty"`

	// Title A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
	Title *string `json:"title,omitempty"`

	// Type A URI reference to human-readable documentation for the error.
	Type *string `json:"type,omitempty"`
}

ErrorModel defines model for ErrorModel.

type GetSiteResponse

type GetSiteResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

func ParseGetSiteResponse

func ParseGetSiteResponse(rsp *http.Response) (*GetSiteResponse, error)

ParseGetSiteResponse parses an HTTP response from a GetSiteWithResponse call

func (GetSiteResponse) ContentType

func (r GetSiteResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetSiteResponse) Status

func (r GetSiteResponse) Status() string

Status returns HTTPResponse.Status

func (GetSiteResponse) StatusCode

func (r GetSiteResponse) 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 PutSiteFileResponse

type PutSiteFileResponse struct {
	Body                          []byte
	HTTPResponse                  *http.Response
	ApplicationproblemJSONDefault *ErrorModel
}

func ParsePutSiteFileResponse

func ParsePutSiteFileResponse(rsp *http.Response) (*PutSiteFileResponse, error)

ParsePutSiteFileResponse parses an HTTP response from a PutSiteFileWithResponse call

func (PutSiteFileResponse) ContentType

func (r PutSiteFileResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (PutSiteFileResponse) Status

func (r PutSiteFileResponse) Status() string

Status returns HTTPResponse.Status

func (PutSiteFileResponse) StatusCode

func (r PutSiteFileResponse) 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