apis

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 14 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.8.0 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.8.0 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, body CreateSiteJSONRequestBody) (*http.Request, error)

NewCreateSiteRequest calls the generic CreateSite builder with application/json body

func NewCreateSiteRequestWithBody added in v0.3.0

func NewCreateSiteRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewCreateSiteRequestWithBody constructs an http.Request for the CreateSite method, with any body, and a specified content type

func NewGetSiteRequest

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

NewGetSiteRequest constructs an http.Request for the GetSite method

func NewUploadFileRequestWithBody added in v0.3.0

func NewUploadFileRequestWithBody(server string, siteId string, params *UploadFileParams, contentType string, body io.Reader) (*http.Request, error)

NewUploadFileRequestWithBody constructs an http.Request for the UploadFile method, with any body, and a specified content type

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, body CreateSiteJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

CreateSite Create a new site

Creates a new site in the builder. This will create a new site folder.

Takes a body of the `application/json` content type.

Corresponds with POST /sites (the `CreateSite` operationId).

func (*Client) CreateSiteWithBody added in v0.3.0

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

CreateSiteWithBody Create a new site

Creates a new site in the builder. This will create a new site folder.

Takes any type of body and a specified content type.

Corresponds with POST /sites (the `CreateSite` operationId).

func (*Client) GetSite

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

GetSite Get a site

Gets a site by its name.

Corresponds with GET /sites (the `GetSite` operationId).

func (*Client) UploadFileWithBody added in v0.3.0

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

UploadFileWithBody This endpoint uploads a new file to the site.

Upload a new file to the site.

Takes any type of body and a specified content type.

Corresponds with POST /sites/{siteId}/files/upload (the `UploadFile` operationId).

type ClientInterface

type ClientInterface interface {

	// GetSite Get a site
	//
	// Gets a site by its name.
	//
	// Corresponds with GET /sites (the `GetSite` operationId).
	GetSite(ctx context.Context, params *GetSiteParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CreateSiteWithBody Create a new site
	//
	// Creates a new site in the builder. This will create a new site folder.
	//
	// Takes any type of body and a specified content type.
	//
	// Corresponds with POST /sites (the `CreateSite` operationId).
	CreateSiteWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CreateSite Create a new site
	//
	// Creates a new site in the builder. This will create a new site folder.
	//
	// Takes a body of the `application/json` content type.
	//
	// Corresponds with POST /sites (the `CreateSite` operationId).
	CreateSite(ctx context.Context, body CreateSiteJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// UploadFileWithBody This endpoint uploads a new file to the site.
	//
	// Upload a new file to the site.
	//
	// Takes any type of body and a specified content type.
	//
	// Corresponds with POST /sites/{siteId}/files/upload (the `UploadFile` operationId).
	UploadFileWithBody(ctx context.Context, siteId string, params *UploadFileParams, 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) CreateSiteWithBodyWithResponse added in v0.3.0

func (c *ClientWithResponses) CreateSiteWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSiteResponse, error)

CreateSiteWithBodyWithResponse Create a new site

Creates a new site in the builder. This will create a new site folder.

Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /sites (the `CreateSite` operationId).

func (*ClientWithResponses) CreateSiteWithResponse

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

CreateSiteWithResponse Create a new site

Creates a new site in the builder. This will create a new site folder.

Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /sites (the `CreateSite` operationId).

func (*ClientWithResponses) GetSiteWithResponse

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

GetSiteWithResponse Get a site

Gets a site by its name.

Returns a wrapper object for the known response body format(s).

Corresponds with GET /sites (the `GetSite` operationId).

func (*ClientWithResponses) UploadFileWithBodyWithResponse added in v0.3.0

func (c *ClientWithResponses) UploadFileWithBodyWithResponse(ctx context.Context, siteId string, params *UploadFileParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UploadFileResponse, error)

UploadFileWithBodyWithResponse This endpoint uploads a new file to the site.

Upload a new file to the site.

Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /sites/{siteId}/files/upload (the `UploadFile` operationId).

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {

	// GetSiteWithResponse Get a site
	//
	// Gets a site by its name.
	//
	// Returns a wrapper object for the known response body format(s).
	//
	// Corresponds with GET /sites (the `GetSite` operationId).
	GetSiteWithResponse(ctx context.Context, params *GetSiteParams, reqEditors ...RequestEditorFn) (*GetSiteResponse, error)

	// CreateSiteWithBodyWithResponse Create a new site
	//
	// Creates a new site in the builder. This will create a new site folder.
	//
	// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /sites (the `CreateSite` operationId).
	CreateSiteWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSiteResponse, error)

	// CreateSiteWithResponse Create a new site
	//
	// Creates a new site in the builder. This will create a new site folder.
	//
	// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /sites (the `CreateSite` operationId).
	CreateSiteWithResponse(ctx context.Context, body CreateSiteJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSiteResponse, error)

	// UploadFileWithBodyWithResponse This endpoint uploads a new file to the site.
	//
	// Upload a new file to the site.
	//
	// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /sites/{siteId}/files/upload (the `UploadFile` operationId).
	UploadFileWithBodyWithResponse(ctx context.Context, siteId string, params *UploadFileParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UploadFileResponse, error)
}

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

type CreateSiteInputBody added in v0.3.0

type CreateSiteInputBody struct {
	// Schema A URL to the JSON Schema for this object.
	//
	// Example: https://example.com/schemas/CreateSiteInputBody.json
	Schema *string `json:"$schema,omitempty"`

	// Name The name of the site (e.g. fizzy-buzzy).
	//
	// Example: fizzy-buzzy
	Name string `json:"name"`
}

CreateSiteInputBody defines model for CreateSiteInputBody.

type CreateSiteJSONRequestBody added in v0.3.0

type CreateSiteJSONRequestBody = CreateSiteInputBody

CreateSiteJSONRequestBody defines body for CreateSite for application/json ContentType.

type CreateSiteResponse

type CreateSiteResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *Site
}

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) GetBody added in v0.3.0

func (r CreateSiteResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (CreateSiteResponse) GetJSON200 added in v0.3.0

func (r CreateSiteResponse) GetJSON200() *Site

GetJSON200 returns the response for an HTTP 200 `application/json` response

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 DeletedAt added in v0.3.0

type DeletedAt struct {
	Time  time.Time `json:"Time"`
	Valid bool      `json:"Valid"`
}

DeletedAt defines model for DeletedAt.

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.
	//
	// Example: https://example.com/schemas/ErrorModel.json
	Schema *string `json:"$schema,omitempty"`

	// Detail A human-readable explanation specific to this occurrence of the problem.
	//
	// Example: Property foo is required but is missing.
	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.
	//
	// Example: https://example.com/error-log/abc123
	Instance *string `json:"instance,omitempty"`

	// Status HTTP status code
	//
	// Example: 400
	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.
	//
	// Example: Bad Request
	Title *string `json:"title,omitempty"`

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

ErrorModel defines model for ErrorModel.

type GetSiteOutputBody added in v0.3.0

type GetSiteOutputBody struct {
	// Schema A URL to the JSON Schema for this object.
	//
	// Example: https://example.com/schemas/GetSiteOutputBody.json
	Schema *string `json:"$schema,omitempty"`
	Site   Site    `json:"site"`
}

GetSiteOutputBody defines model for GetSiteOutputBody.

type GetSiteParams added in v0.3.0

type GetSiteParams struct {
	// Name The name of the site.
	Name string `form:"name" json:"name"`
}

GetSiteParams defines parameters for GetSite.

type GetSiteResponse

type GetSiteResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *GetSiteOutputBody
}

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) GetBody added in v0.3.0

func (r GetSiteResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (GetSiteResponse) GetJSON200 added in v0.3.0

func (r GetSiteResponse) GetJSON200() *GetSiteOutputBody

GetJSON200 returns the response for an HTTP 200 `application/json` response

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 RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

type Site added in v0.3.0

type Site struct {
	// Schema A URL to the JSON Schema for this object.
	//
	// Example: https://example.com/schemas/Site.json
	Schema    *string   `json:"$schema,omitempty"`
	CreatedAt time.Time `json:"createdAt"`
	DeletedAt DeletedAt `json:"deletedAt"`

	// Id Example: 6c785b65-e689-4653-ae78-81621226c48c
	Id string `json:"id"`

	// Name Example: fizzy-buzzy
	Name      string    `json:"name"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Site defines model for Site.

type UploadFileParams added in v0.3.0

type UploadFileParams struct {
	// FileName The name of the file.
	FileName string `form:"fileName" json:"fileName"`
}

UploadFileParams defines parameters for UploadFile.

type UploadFileResponse added in v0.3.0

type UploadFileResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *string
	// ApplicationproblemJSONDefault the response for an HTTP default `application/problem+json` response
	ApplicationproblemJSONDefault *ErrorModel
}

func ParseUploadFileResponse added in v0.3.0

func ParseUploadFileResponse(rsp *http.Response) (*UploadFileResponse, error)

ParseUploadFileResponse parses an HTTP response from a UploadFileWithResponse call

func (UploadFileResponse) ContentType added in v0.3.0

func (r UploadFileResponse) ContentType() string

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

func (UploadFileResponse) GetApplicationproblemJSONDefault added in v0.3.0

func (r UploadFileResponse) GetApplicationproblemJSONDefault() *ErrorModel

GetApplicationproblemJSONDefault returns the response for an HTTP default `application/problem+json` response

func (UploadFileResponse) GetBody added in v0.3.0

func (r UploadFileResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (UploadFileResponse) GetJSON200 added in v0.3.0

func (r UploadFileResponse) GetJSON200() *string

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (UploadFileResponse) Status added in v0.3.0

func (r UploadFileResponse) Status() string

Status returns HTTPResponse.Status

func (UploadFileResponse) StatusCode added in v0.3.0

func (r UploadFileResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

Jump to

Keyboard shortcuts

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