api

package
v0.0.0-...-93229be Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen version v1.11.1-0.20220912230023-4a1477f6a8ba DO NOT EDIT.

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

Code generated by github.com/deepmap/oapi-codegen version v1.11.1-0.20220912230023-4a1477f6a8ba DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

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

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

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 ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type GetProject200RequestBodyResponse

type GetProject200RequestBodyResponse struct {
	Body          io.Reader
	ContentLength int64
}

func (GetProject200RequestBodyResponse) VisitGetProjectResponse

func (response GetProject200RequestBodyResponse) VisitGetProjectResponse(w http.ResponseWriter) error

type GetProject404Response

type GetProject404Response struct {
}

func (GetProject404Response) VisitGetProjectResponse

func (response GetProject404Response) VisitGetProjectResponse(w http.ResponseWriter) error

type GetProjectParams

type GetProjectParams struct {
	// ProjectName The name of the project to retrieve.
	ProjectName string `json:"projectName"`
}

GetProjectParams defines parameters for GetProject.

type GetProjectRequestObject

type GetProjectRequestObject struct {
	Params GetProjectParams
}

type GetProjectResponseObject

type GetProjectResponseObject interface {
	VisitGetProjectResponse(w http.ResponseWriter) error
}

type GetProjectdefaultJSONResponse

type GetProjectdefaultJSONResponse struct {
	Body       ProblemDetails
	StatusCode int
}

func (GetProjectdefaultJSONResponse) VisitGetProjectResponse

func (response GetProjectdefaultJSONResponse) VisitGetProjectResponse(w http.ResponseWriter) error

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type PostProject201TextResponse

type PostProject201TextResponse string

func (PostProject201TextResponse) VisitPostProjectResponse

func (response PostProject201TextResponse) VisitPostProjectResponse(w http.ResponseWriter) error

type PostProjectJSONRequestBody

type PostProjectJSONRequestBody = Project

PostProjectJSONRequestBody defines body for PostProject for application/json ContentType.

type PostProjectRequestObject

type PostProjectRequestObject struct {
	Body *PostProjectJSONRequestBody
}

type PostProjectResponseObject

type PostProjectResponseObject interface {
	VisitPostProjectResponse(w http.ResponseWriter) error
}

type PostProjectdefaultJSONResponse

type PostProjectdefaultJSONResponse struct {
	Body       ProblemDetails
	StatusCode int
}

func (PostProjectdefaultJSONResponse) VisitPostProjectResponse

func (response PostProjectdefaultJSONResponse) VisitPostProjectResponse(w http.ResponseWriter) error

type ProblemDetails

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

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

	// Status The HTTP status code ([RFC7231], Section 6) generated by the origin server for this occurrence of the problem.
	Status *int `json:"status,omitempty"`

	// Title A short, human-readable summary of the problem type.
	Title *string `json:"title,omitempty"`

	// Type A URI reference [RFC3986] that identifies the problem type.
	Type                 *string                `json:"type,omitempty"`
	AdditionalProperties map[string]interface{} `json:"-"`
}

ProblemDetails defines model for ProblemDetails.

func (ProblemDetails) Get

func (a ProblemDetails) Get(fieldName string) (value interface{}, found bool)

Getter for additional properties for ProblemDetails. Returns the specified element and whether it was found

func (ProblemDetails) MarshalJSON

func (a ProblemDetails) MarshalJSON() ([]byte, error)

Override default JSON handling for ProblemDetails to handle AdditionalProperties

func (*ProblemDetails) Set

func (a *ProblemDetails) Set(fieldName string, value interface{})

Setter for additional properties for ProblemDetails

func (*ProblemDetails) UnmarshalJSON

func (a *ProblemDetails) UnmarshalJSON(b []byte) error

Override default JSON handling for ProblemDetails to handle AdditionalProperties

type Project

type Project struct {
	// Description Project description
	Description *string `json:"description,omitempty"`

	// Name Project name. Must be unique across all projects.
	Name *string `json:"name,omitempty"`
}

Project defines model for Project.

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ServerInterface

type ServerInterface interface {
	// Retrieve a project by name.
	// (GET /project)
	GetProject(w http.ResponseWriter, r *http.Request, params GetProjectParams)
	// Create or update a project's metadata.
	// (POST /project)
	PostProject(w http.ResponseWriter, r *http.Request)
}

ServerInterface represents all server handlers.

func NewStrictHandler

func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface

func NewStrictHandlerWithOptions

func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictHTTPServerOptions) ServerInterface

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) GetProject

func (siw *ServerInterfaceWrapper) GetProject(w http.ResponseWriter, r *http.Request)

GetProject operation middleware

func (*ServerInterfaceWrapper) PostProject

func (siw *ServerInterfaceWrapper) PostProject(w http.ResponseWriter, r *http.Request)

PostProject operation middleware

type StrictHTTPServerOptions

type StrictHTTPServerOptions struct {
	RequestErrorHandlerFunc  func(w http.ResponseWriter, r *http.Request, err error)
	ResponseErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type StrictHandlerFunc

type StrictHandlerFunc func(ctx context.Context, w http.ResponseWriter, r *http.Request, args interface{}) (interface{}, error)

type StrictMiddlewareFunc

type StrictMiddlewareFunc func(f StrictHandlerFunc, operationID string) StrictHandlerFunc

type StrictServerInterface

type StrictServerInterface interface {
	// Retrieve a project by name.
	// (GET /project)
	GetProject(ctx context.Context, request GetProjectRequestObject) (GetProjectResponseObject, error)
	// Create or update a project's metadata.
	// (POST /project)
	PostProject(ctx context.Context, request PostProjectRequestObject) (PostProjectResponseObject, error)
}

StrictServerInterface represents all server handlers.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

Jump to

Keyboard shortcuts

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