Documentation
¶
Overview ¶
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func NewCreateCacheEntryRequest(server string, body CreateCacheEntryJSONRequestBody) (*http.Request, error)
- func NewCreateCacheEntryRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewGetCacheEntryByKeyRequest(server string, key string) (*http.Request, error)
- func NewUpdateCacheEntryRequest(server string, body UpdateCacheEntryJSONRequestBody) (*http.Request, error)
- func NewUpdateCacheEntryRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- func RegisterHandlers(router EchoRouter, si ServerInterface)
- func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
- type CacheDownloadInstruction
- type CacheEntry
- type CacheEntryCreateRequest
- type CacheEntryCreateResponse
- type CacheEntryGetResponse
- type CacheEntryUpdateRequest
- type CacheEntryUpdateResponse
- type CachePartETag
- type CacheUploadInstruction
- type Client
- func (c *Client) CreateCacheEntry(ctx context.Context, body CreateCacheEntryJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) CreateCacheEntryWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) GetCacheEntryByKey(ctx context.Context, key string, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) UpdateCacheEntry(ctx context.Context, body UpdateCacheEntryJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) UpdateCacheEntryWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) CreateCacheEntryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*CreateCacheEntryResponse, error)
- func (c *ClientWithResponses) CreateCacheEntryWithResponse(ctx context.Context, body CreateCacheEntryJSONRequestBody, ...) (*CreateCacheEntryResponse, error)
- func (c *ClientWithResponses) GetCacheEntryByKeyWithResponse(ctx context.Context, key string, reqEditors ...RequestEditorFn) (*GetCacheEntryByKeyResponse, error)
- func (c *ClientWithResponses) UpdateCacheEntryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*UpdateCacheEntryResponse, error)
- func (c *ClientWithResponses) UpdateCacheEntryWithResponse(ctx context.Context, body UpdateCacheEntryJSONRequestBody, ...) (*UpdateCacheEntryResponse, error)
- type ClientWithResponsesInterface
- type CreateCacheEntryJSONRequestBody
- type CreateCacheEntryResponse
- type EchoRouter
- type Error
- type GetCacheEntryByKeyResponse
- type HttpRequestDoer
- type Offset
- type RequestEditorFn
- type ServerInterface
- type ServerInterfaceWrapper
- type UpdateCacheEntryJSONRequestBody
- type UpdateCacheEntryResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
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 NewCreateCacheEntryRequest ¶
func NewCreateCacheEntryRequest(server string, body CreateCacheEntryJSONRequestBody) (*http.Request, error)
NewCreateCacheEntryRequest calls the generic CreateCacheEntry builder with application/json body
func NewCreateCacheEntryRequestWithBody ¶
func NewCreateCacheEntryRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewCreateCacheEntryRequestWithBody generates requests for CreateCacheEntry with any type of body
func NewGetCacheEntryByKeyRequest ¶
NewGetCacheEntryByKeyRequest generates requests for GetCacheEntryByKey
func NewUpdateCacheEntryRequest ¶
func NewUpdateCacheEntryRequest(server string, body UpdateCacheEntryJSONRequestBody) (*http.Request, error)
NewUpdateCacheEntryRequest calls the generic UpdateCacheEntry builder with application/json body
func NewUpdateCacheEntryRequestWithBody ¶
func NewUpdateCacheEntryRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewUpdateCacheEntryRequestWithBody generates requests for UpdateCacheEntry with any type of body
func PathToRawSpec ¶
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func RegisterHandlers ¶
func RegisterHandlers(router EchoRouter, si ServerInterface)
RegisterHandlers adds each server route to the EchoRouter.
func RegisterHandlersWithBaseURL ¶
func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.
Types ¶
type CacheDownloadInstruction ¶
type CacheDownloadInstruction struct {
// Key Key of the cache entry
Key string `json:"key"`
// Method HTTP method
Method string `json:"method"`
Offset *Offset `json:"offset,omitempty"`
// Url URL
Url string `json:"url"`
}
CacheDownloadInstruction defines model for CacheDownloadInstruction.
type CacheEntry ¶
type CacheEntry struct {
// Compression Compression algorithm
Compression string `json:"compression"`
// FileSize Size of the cache entry in bytes
FileSize int64 `json:"file_size"`
// Key Key of the cache entry
Key string `json:"key"`
// Sha256sum SHA256 checksum of the cache entry
Sha256sum string `json:"sha256sum"`
// Url URL to upload the cache entry
Url *string `json:"url,omitempty"`
}
CacheEntry defines model for CacheEntry.
type CacheEntryCreateRequest ¶
type CacheEntryCreateRequest struct {
CacheEntry CacheEntry `json:"cache_entry"`
// MultipartSupported multipart supported
MultipartSupported bool `json:"multipart_supported"`
}
CacheEntryCreateRequest defines model for CacheEntryCreateRequest.
type CacheEntryCreateResponse ¶
type CacheEntryCreateResponse struct {
// Id Upload ID
Id string `json:"id"`
UploadInstructions []CacheUploadInstruction `json:"upload_instructions"`
}
CacheEntryCreateResponse defines model for CacheEntryCreateResponse.
type CacheEntryGetResponse ¶
type CacheEntryGetResponse struct {
CacheEntry CacheEntry `json:"cache_entry"`
DownloadInstructions []CacheDownloadInstruction `json:"download_instructions"`
}
CacheEntryGetResponse defines model for CacheEntryGetResponse.
type CacheEntryUpdateRequest ¶
type CacheEntryUpdateRequest struct {
// Id Upload ID
Id string `json:"id"`
// Key Key of the cache entry
Key string `json:"key"`
MultipartEtags []CachePartETag `json:"multipart_etags"`
}
CacheEntryUpdateRequest defines model for CacheEntryUpdateRequest.
type CacheEntryUpdateResponse ¶
type CacheEntryUpdateResponse struct {
// Id Response ID
Id string `json:"id"`
}
CacheEntryUpdateResponse defines model for CacheEntryUpdateResponse.
type CachePartETag ¶
type CachePartETag struct {
// Etag ETag
Etag string `json:"etag"`
// Part Part index
Part int32 `json:"part"`
}
CachePartETag Part index and ETag
type CacheUploadInstruction ¶
type CacheUploadInstruction struct {
// Key Key of the cache entry
Key string `json:"key"`
// Method HTTP method
Method string `json:"method"`
Offset *Offset `json:"offset,omitempty"`
// Url URL
Url string `json:"url"`
}
CacheUploadInstruction defines model for CacheUploadInstruction.
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) CreateCacheEntry ¶
func (c *Client) CreateCacheEntry(ctx context.Context, body CreateCacheEntryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) CreateCacheEntryWithBody ¶
func (*Client) GetCacheEntryByKey ¶
func (*Client) UpdateCacheEntry ¶
func (c *Client) UpdateCacheEntry(ctx context.Context, body UpdateCacheEntryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
type ClientInterface ¶
type ClientInterface interface {
// CreateCacheEntryWithBody request with any body
CreateCacheEntryWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
CreateCacheEntry(ctx context.Context, body CreateCacheEntryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// UpdateCacheEntryWithBody request with any body
UpdateCacheEntryWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
UpdateCacheEntry(ctx context.Context, body UpdateCacheEntryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetCacheEntryByKey request
GetCacheEntryByKey(ctx context.Context, key string, reqEditors ...RequestEditorFn) (*http.Response, error)
}
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
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) CreateCacheEntryWithBodyWithResponse ¶
func (c *ClientWithResponses) CreateCacheEntryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateCacheEntryResponse, error)
CreateCacheEntryWithBodyWithResponse request with arbitrary body returning *CreateCacheEntryResponse
func (*ClientWithResponses) CreateCacheEntryWithResponse ¶
func (c *ClientWithResponses) CreateCacheEntryWithResponse(ctx context.Context, body CreateCacheEntryJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateCacheEntryResponse, error)
func (*ClientWithResponses) GetCacheEntryByKeyWithResponse ¶
func (c *ClientWithResponses) GetCacheEntryByKeyWithResponse(ctx context.Context, key string, reqEditors ...RequestEditorFn) (*GetCacheEntryByKeyResponse, error)
GetCacheEntryByKeyWithResponse request returning *GetCacheEntryByKeyResponse
func (*ClientWithResponses) UpdateCacheEntryWithBodyWithResponse ¶
func (c *ClientWithResponses) UpdateCacheEntryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateCacheEntryResponse, error)
UpdateCacheEntryWithBodyWithResponse request with arbitrary body returning *UpdateCacheEntryResponse
func (*ClientWithResponses) UpdateCacheEntryWithResponse ¶
func (c *ClientWithResponses) UpdateCacheEntryWithResponse(ctx context.Context, body UpdateCacheEntryJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateCacheEntryResponse, error)
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface {
// CreateCacheEntryWithBodyWithResponse request with any body
CreateCacheEntryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateCacheEntryResponse, error)
CreateCacheEntryWithResponse(ctx context.Context, body CreateCacheEntryJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateCacheEntryResponse, error)
// UpdateCacheEntryWithBodyWithResponse request with any body
UpdateCacheEntryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateCacheEntryResponse, error)
UpdateCacheEntryWithResponse(ctx context.Context, body UpdateCacheEntryJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateCacheEntryResponse, error)
// GetCacheEntryByKeyWithResponse request
GetCacheEntryByKeyWithResponse(ctx context.Context, key string, reqEditors ...RequestEditorFn) (*GetCacheEntryByKeyResponse, error)
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type CreateCacheEntryJSONRequestBody ¶
type CreateCacheEntryJSONRequestBody = CacheEntryCreateRequest
CreateCacheEntryJSONRequestBody defines body for CreateCacheEntry for application/json ContentType.
type CreateCacheEntryResponse ¶
type CreateCacheEntryResponse struct {
Body []byte
HTTPResponse *http.Response
JSON201 *CacheEntryCreateResponse
JSONDefault *Error
}
func ParseCreateCacheEntryResponse ¶
func ParseCreateCacheEntryResponse(rsp *http.Response) (*CreateCacheEntryResponse, error)
ParseCreateCacheEntryResponse parses an HTTP response from a CreateCacheEntryWithResponse call
func (CreateCacheEntryResponse) Status ¶
func (r CreateCacheEntryResponse) Status() string
Status returns HTTPResponse.Status
func (CreateCacheEntryResponse) StatusCode ¶
func (r CreateCacheEntryResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type EchoRouter ¶
type EchoRouter interface {
CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}
This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration
type Error ¶
type Error struct {
// Code Error code
Code int32 `json:"code"`
// Message Error message
Message string `json:"message"`
}
Error defines model for Error.
type GetCacheEntryByKeyResponse ¶
type GetCacheEntryByKeyResponse struct {
Body []byte
HTTPResponse *http.Response
JSON201 *CacheEntryGetResponse
JSONDefault *Error
}
func ParseGetCacheEntryByKeyResponse ¶
func ParseGetCacheEntryByKeyResponse(rsp *http.Response) (*GetCacheEntryByKeyResponse, error)
ParseGetCacheEntryByKeyResponse parses an HTTP response from a GetCacheEntryByKeyWithResponse call
func (GetCacheEntryByKeyResponse) Status ¶
func (r GetCacheEntryByKeyResponse) Status() string
Status returns HTTPResponse.Status
func (GetCacheEntryByKeyResponse) StatusCode ¶
func (r GetCacheEntryByKeyResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type Offset ¶
type Offset struct {
// End End position of the part
End int64 `json:"end"`
// Part Part number
Part int32 `json:"part"`
// Start Start position of the part
Start int64 `json:"start"`
}
Offset defines model for Offset.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type ServerInterface ¶
type ServerInterface interface {
// Creates a cache entry
// (POST /v1/cache)
CreateCacheEntry(ctx echo.Context) error
// Updates a cache entry
// (PUT /v1/cache)
UpdateCacheEntry(ctx echo.Context) error
// Get a cache entry by key
// (GET /v1/cache/{key})
GetCacheEntryByKey(ctx echo.Context, key string) error
}
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
ServerInterfaceWrapper converts echo contexts to parameters.
func (*ServerInterfaceWrapper) CreateCacheEntry ¶
func (w *ServerInterfaceWrapper) CreateCacheEntry(ctx echo.Context) error
CreateCacheEntry converts echo context to params.
func (*ServerInterfaceWrapper) GetCacheEntryByKey ¶
func (w *ServerInterfaceWrapper) GetCacheEntryByKey(ctx echo.Context) error
GetCacheEntryByKey converts echo context to params.
func (*ServerInterfaceWrapper) UpdateCacheEntry ¶
func (w *ServerInterfaceWrapper) UpdateCacheEntry(ctx echo.Context) error
UpdateCacheEntry converts echo context to params.
type UpdateCacheEntryJSONRequestBody ¶
type UpdateCacheEntryJSONRequestBody = CacheEntryUpdateRequest
UpdateCacheEntryJSONRequestBody defines body for UpdateCacheEntry for application/json ContentType.
type UpdateCacheEntryResponse ¶
type UpdateCacheEntryResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *CacheEntryUpdateResponse
JSONDefault *Error
}
func ParseUpdateCacheEntryResponse ¶
func ParseUpdateCacheEntryResponse(rsp *http.Response) (*UpdateCacheEntryResponse, error)
ParseUpdateCacheEntryResponse parses an HTTP response from a UpdateCacheEntryWithResponse call
func (UpdateCacheEntryResponse) Status ¶
func (r UpdateCacheEntryResponse) Status() string
Status returns HTTPResponse.Status
func (UpdateCacheEntryResponse) StatusCode ¶
func (r UpdateCacheEntryResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode