Documentation
¶
Overview ¶
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.13.4 DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func NewGetLatestRoundIDRequest(server string) (*http.Request, error)
- func NewGetRoundRoundIDRequest(server string, roundID string) (*http.Request, error)
- func NewPostRoundRequest(server string, body PostRoundJSONRequestBody) (*http.Request, error)
- func NewPostRoundRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewPutRoundRoundIDScoreRequest(server string, roundID string, body PutRoundRoundIDScoreJSONRequestBody) (*http.Request, error)
- func NewPutRoundRoundIDScoreRequestWithBody(server string, roundID 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 Client
- func (c *Client) CreateRound(ctx context.Context, req RoundRequest) (*CreatedRound, error)
- func (c *Client) GetLatestRoundID(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetRound(ctx context.Context, id uuid.UUID) (*Round, error)
- func (c *Client) GetRoundRoundID(ctx context.Context, roundID string, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) PostRound(ctx context.Context, body PostRoundJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) PostRoundWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) PutRoundRoundIDScore(ctx context.Context, roundID string, body PutRoundRoundIDScoreJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) PutRoundRoundIDScoreWithBody(ctx context.Context, roundID string, contentType string, body io.Reader, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) GetLatestRoundIDWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetLatestRoundIDResponse, error)
- func (c *ClientWithResponses) GetRoundRoundIDWithResponse(ctx context.Context, roundID string, reqEditors ...RequestEditorFn) (*GetRoundRoundIDResponse, error)
- func (c *ClientWithResponses) PostRoundWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*PostRoundResponse, error)
- func (c *ClientWithResponses) PostRoundWithResponse(ctx context.Context, body PostRoundJSONRequestBody, ...) (*PostRoundResponse, error)
- func (c *ClientWithResponses) PutRoundRoundIDScoreWithBodyWithResponse(ctx context.Context, roundID string, contentType string, body io.Reader, ...) (*PutRoundRoundIDScoreResponse, error)
- func (c *ClientWithResponses) PutRoundRoundIDScoreWithResponse(ctx context.Context, roundID string, body PutRoundRoundIDScoreJSONRequestBody, ...) (*PutRoundRoundIDScoreResponse, error)
- type ClientWithResponsesInterface
- type Course
- type CreatedRound
- type EchoRouter
- type GetLatestRoundIDResponse
- type GetRoundRoundIDResponse
- type Hole
- type HoleNumber
- type HoleScore
- type HttpRequestDoer
- type PlayerData
- type PlayerGroup
- type PlayerScore
- type PlayerScoreEvent
- type PostRoundJSONRequestBody
- type PostRoundResponse
- type PutRoundRoundIDScoreJSONRequestBody
- type PutRoundRoundIDScoreResponse
- type RequestEditorFn
- type Round
- type RoundID
- type RoundPlayerData
- type RoundPlayers
- type RoundRequest
- type RoundTitle
- type ServerInterface
- type ServerInterfaceWrapper
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 NewGetLatestRoundIDRequest ¶
NewGetLatestRoundIDRequest generates requests for GetLatestRoundID
func NewGetRoundRoundIDRequest ¶
NewGetRoundRoundIDRequest generates requests for GetRoundRoundID
func NewPostRoundRequest ¶
func NewPostRoundRequest(server string, body PostRoundJSONRequestBody) (*http.Request, error)
NewPostRoundRequest calls the generic PostRound builder with application/json body
func NewPostRoundRequestWithBody ¶
func NewPostRoundRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewPostRoundRequestWithBody generates requests for PostRound with any type of body
func NewPutRoundRoundIDScoreRequest ¶
func NewPutRoundRoundIDScoreRequest(server string, roundID string, body PutRoundRoundIDScoreJSONRequestBody) (*http.Request, error)
NewPutRoundRoundIDScoreRequest calls the generic PutRoundRoundIDScore builder with application/json body
func NewPutRoundRoundIDScoreRequestWithBody ¶
func NewPutRoundRoundIDScoreRequestWithBody(server string, roundID string, contentType string, body io.Reader) (*http.Request, error)
NewPutRoundRoundIDScoreRequestWithBody generates requests for PutRoundRoundIDScore 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 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) CreateRound ¶
func (c *Client) CreateRound(ctx context.Context, req RoundRequest) (*CreatedRound, error)
func (*Client) GetLatestRoundID ¶
func (*Client) GetRoundRoundID ¶
func (*Client) PostRound ¶
func (c *Client) PostRound(ctx context.Context, body PostRoundJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) PostRoundWithBody ¶
func (*Client) PutRoundRoundIDScore ¶
func (c *Client) PutRoundRoundIDScore(ctx context.Context, roundID string, body PutRoundRoundIDScoreJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
type ClientInterface ¶
type ClientInterface interface {
// GetLatestRoundID request
GetLatestRoundID(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// PostRoundWithBody request with any body
PostRoundWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PostRound(ctx context.Context, body PostRoundJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetRoundRoundID request
GetRoundRoundID(ctx context.Context, roundID string, reqEditors ...RequestEditorFn) (*http.Response, error)
// PutRoundRoundIDScoreWithBody request with any body
PutRoundRoundIDScoreWithBody(ctx context.Context, roundID string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PutRoundRoundIDScore(ctx context.Context, roundID string, body PutRoundRoundIDScoreJSONRequestBody, 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) GetLatestRoundIDWithResponse ¶
func (c *ClientWithResponses) GetLatestRoundIDWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetLatestRoundIDResponse, error)
GetLatestRoundIDWithResponse request returning *GetLatestRoundIDResponse
func (*ClientWithResponses) GetRoundRoundIDWithResponse ¶
func (c *ClientWithResponses) GetRoundRoundIDWithResponse(ctx context.Context, roundID string, reqEditors ...RequestEditorFn) (*GetRoundRoundIDResponse, error)
GetRoundRoundIDWithResponse request returning *GetRoundRoundIDResponse
func (*ClientWithResponses) PostRoundWithBodyWithResponse ¶
func (c *ClientWithResponses) PostRoundWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostRoundResponse, error)
PostRoundWithBodyWithResponse request with arbitrary body returning *PostRoundResponse
func (*ClientWithResponses) PostRoundWithResponse ¶
func (c *ClientWithResponses) PostRoundWithResponse(ctx context.Context, body PostRoundJSONRequestBody, reqEditors ...RequestEditorFn) (*PostRoundResponse, error)
func (*ClientWithResponses) PutRoundRoundIDScoreWithBodyWithResponse ¶
func (c *ClientWithResponses) PutRoundRoundIDScoreWithBodyWithResponse(ctx context.Context, roundID string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutRoundRoundIDScoreResponse, error)
PutRoundRoundIDScoreWithBodyWithResponse request with arbitrary body returning *PutRoundRoundIDScoreResponse
func (*ClientWithResponses) PutRoundRoundIDScoreWithResponse ¶
func (c *ClientWithResponses) PutRoundRoundIDScoreWithResponse(ctx context.Context, roundID string, body PutRoundRoundIDScoreJSONRequestBody, reqEditors ...RequestEditorFn) (*PutRoundRoundIDScoreResponse, error)
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface {
// GetLatestRoundIDWithResponse request
GetLatestRoundIDWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetLatestRoundIDResponse, error)
// PostRoundWithBodyWithResponse request with any body
PostRoundWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostRoundResponse, error)
PostRoundWithResponse(ctx context.Context, body PostRoundJSONRequestBody, reqEditors ...RequestEditorFn) (*PostRoundResponse, error)
// GetRoundRoundIDWithResponse request
GetRoundRoundIDWithResponse(ctx context.Context, roundID string, reqEditors ...RequestEditorFn) (*GetRoundRoundIDResponse, error)
// PutRoundRoundIDScoreWithBodyWithResponse request with any body
PutRoundRoundIDScoreWithBodyWithResponse(ctx context.Context, roundID string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutRoundRoundIDScoreResponse, error)
PutRoundRoundIDScoreWithResponse(ctx context.Context, roundID string, body PutRoundRoundIDScoreJSONRequestBody, reqEditors ...RequestEditorFn) (*PutRoundRoundIDScoreResponse, error)
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type Course ¶
type Course struct {
Holes []Hole `dynamodbav:"h" json:"holes"`
Name string `dynamodbav:"n" json:"name"`
Tees *string `dynamodbav:"t" json:"tees,omitempty"`
}
Course defines model for Course.
type CreatedRound ¶
type CreatedRound struct {
Id RoundID `dynamodbav:"id" json:"id"`
}
CreatedRound defines model for CreatedRound.
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 GetLatestRoundIDResponse ¶
func ParseGetLatestRoundIDResponse ¶
func ParseGetLatestRoundIDResponse(rsp *http.Response) (*GetLatestRoundIDResponse, error)
ParseGetLatestRoundIDResponse parses an HTTP response from a GetLatestRoundIDWithResponse call
func (GetLatestRoundIDResponse) Status ¶
func (r GetLatestRoundIDResponse) Status() string
Status returns HTTPResponse.Status
func (GetLatestRoundIDResponse) StatusCode ¶
func (r GetLatestRoundIDResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type GetRoundRoundIDResponse ¶
func ParseGetRoundRoundIDResponse ¶
func ParseGetRoundRoundIDResponse(rsp *http.Response) (*GetRoundRoundIDResponse, error)
ParseGetRoundRoundIDResponse parses an HTTP response from a GetRoundRoundIDWithResponse call
func (GetRoundRoundIDResponse) Status ¶
func (r GetRoundRoundIDResponse) Status() string
Status returns HTTPResponse.Status
func (GetRoundRoundIDResponse) StatusCode ¶
func (r GetRoundRoundIDResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type Hole ¶
type Hole struct {
DistanceYards *int `dynamodbav:"d" json:"distanceYards,omitempty"`
Hole HoleNumber `dynamodbav:"n" json:"hole"`
Par int `dynamodbav:"p" json:"par"`
StrokeIndex *int `dynamodbav:"si" json:"strokeIndex,omitempty"`
}
Hole defines model for Hole.
type HoleScore ¶
type HoleScore struct {
Hole HoleNumber `dynamodbav:"n" json:"hole"`
Score int `dynamodbav:"s" json:"score"`
}
HoleScore defines model for HoleScore.
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type PlayerData ¶
type PlayerData struct {
Name string `dynamodbav:"n" json:"name"`
}
PlayerData defines model for PlayerData.
type PlayerScoreEvent ¶
type PlayerScoreEvent struct {
Hole HoleNumber `dynamodbav:"n" json:"hole"`
PlayerIndex int `json:"playerIndex"`
Score int `dynamodbav:"s" json:"score"`
}
PlayerScoreEvent defines model for PlayerScoreEvent.
type PostRoundJSONRequestBody ¶
type PostRoundJSONRequestBody = RoundRequest
PostRoundJSONRequestBody defines body for PostRound for application/json ContentType.
type PostRoundResponse ¶
type PostRoundResponse struct {
Body []byte
HTTPResponse *http.Response
JSON201 *CreatedRound
}
func ParsePostRoundResponse ¶
func ParsePostRoundResponse(rsp *http.Response) (*PostRoundResponse, error)
ParsePostRoundResponse parses an HTTP response from a PostRoundWithResponse call
func (PostRoundResponse) Status ¶
func (r PostRoundResponse) Status() string
Status returns HTTPResponse.Status
func (PostRoundResponse) StatusCode ¶
func (r PostRoundResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type PutRoundRoundIDScoreJSONRequestBody ¶
type PutRoundRoundIDScoreJSONRequestBody = PlayerScoreEvent
PutRoundRoundIDScoreJSONRequestBody defines body for PutRoundRoundIDScore for application/json ContentType.
type PutRoundRoundIDScoreResponse ¶
func ParsePutRoundRoundIDScoreResponse ¶
func ParsePutRoundRoundIDScoreResponse(rsp *http.Response) (*PutRoundRoundIDScoreResponse, error)
ParsePutRoundRoundIDScoreResponse parses an HTTP response from a PutRoundRoundIDScoreWithResponse call
func (PutRoundRoundIDScoreResponse) Status ¶
func (r PutRoundRoundIDScoreResponse) Status() string
Status returns HTTPResponse.Status
func (PutRoundRoundIDScoreResponse) StatusCode ¶
func (r PutRoundRoundIDScoreResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type Round ¶
type Round struct {
Course Course `dynamodbav:"c" json:"course"`
Id RoundID `dynamodbav:"id" json:"id"`
Players RoundPlayers `dynamodbav:"rp" json:"players"`
Title RoundTitle `dynamodbav:"t" json:"title"`
}
Round defines model for Round.
type RoundPlayerData ¶
type RoundPlayerData struct {
Name string `dynamodbav:"n" json:"name"`
Scores PlayerScore `dynamodbav:"ps" json:"scores"`
}
RoundPlayerData defines model for RoundPlayerData.
type RoundPlayers ¶
type RoundPlayers = []RoundPlayerData
RoundPlayers defines model for RoundPlayers.
type RoundRequest ¶
type RoundRequest struct {
Course Course `dynamodbav:"c" json:"course"`
Players PlayerGroup `dynamodbav:"pg" json:"players"`
Title *RoundTitle `dynamodbav:"t" json:"title,omitempty"`
}
RoundRequest defines model for RoundRequest.
type ServerInterface ¶
type ServerInterface interface {
// (GET /latest/roundID)
GetLatestRoundID(ctx echo.Context) error
// (POST /round)
PostRound(ctx echo.Context) error
// (GET /round/{roundID})
GetRoundRoundID(ctx echo.Context, roundID string) error
// (PUT /round/{roundID}/score)
PutRoundRoundIDScore(ctx echo.Context, roundID string) error
}
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
ServerInterfaceWrapper converts echo contexts to parameters.
func (*ServerInterfaceWrapper) GetLatestRoundID ¶
func (w *ServerInterfaceWrapper) GetLatestRoundID(ctx echo.Context) error
GetLatestRoundID converts echo context to params.
func (*ServerInterfaceWrapper) GetRoundRoundID ¶
func (w *ServerInterfaceWrapper) GetRoundRoundID(ctx echo.Context) error
GetRoundRoundID converts echo context to params.
func (*ServerInterfaceWrapper) PostRound ¶
func (w *ServerInterfaceWrapper) PostRound(ctx echo.Context) error
PostRound converts echo context to params.
func (*ServerInterfaceWrapper) PutRoundRoundIDScore ¶
func (w *ServerInterfaceWrapper) PutRoundRoundIDScore(ctx echo.Context) error
PutRoundRoundIDScore converts echo context to params.