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 NewCreateRoundRequest(server string, body CreateRoundJSONRequestBody) (*http.Request, error)
- func NewCreateRoundRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewGetLatestRoundIDRequest(server string) (*http.Request, error)
- func NewGetRoundRequest(server string, roundID string) (*http.Request, error)
- func NewSendScoreRequest(server string, roundID string, body SendScoreJSONRequestBody) (*http.Request, error)
- func NewSendScoreRequestWithBody(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, body CreateRoundJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) CreateRoundWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) GetLatestRoundID(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetRound(ctx context.Context, roundID string, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) SendScore(ctx context.Context, roundID string, body SendScoreJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) SendScoreWithBody(ctx context.Context, roundID string, contentType string, body io.Reader, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) CreateRoundWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*CreateRoundResponse, error)
- func (c *ClientWithResponses) CreateRoundWithResponse(ctx context.Context, body CreateRoundJSONRequestBody, ...) (*CreateRoundResponse, error)
- func (c *ClientWithResponses) GetLatestRoundIDWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetLatestRoundIDResponse, error)
- func (c *ClientWithResponses) GetRoundWithResponse(ctx context.Context, roundID string, reqEditors ...RequestEditorFn) (*GetRoundResponse, error)
- func (c *ClientWithResponses) SendScoreWithBodyWithResponse(ctx context.Context, roundID string, contentType string, body io.Reader, ...) (*SendScoreResponse, error)
- func (c *ClientWithResponses) SendScoreWithResponse(ctx context.Context, roundID string, body SendScoreJSONRequestBody, ...) (*SendScoreResponse, error)
- type ClientWithResponsesInterface
- type Course
- type CreateRoundJSONRequestBody
- type CreateRoundResponse
- type CreatedRound
- type EchoRouter
- type GetLatestRoundIDResponse
- type GetRoundResponse
- type Hole
- type HoleNumber
- type HoleScore
- type HttpRequestDoer
- type PlayerData
- type PlayerGroup
- type PlayerScore
- type PlayerScoreEvent
- type RequestEditorFn
- type Round
- type RoundID
- type RoundPlayerData
- type RoundPlayers
- type RoundRequest
- type RoundTitle
- type SendScoreJSONRequestBody
- type SendScoreResponse
- 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 NewCreateRoundRequest ¶ added in v0.1.2
func NewCreateRoundRequest(server string, body CreateRoundJSONRequestBody) (*http.Request, error)
NewCreateRoundRequest calls the generic CreateRound builder with application/json body
func NewCreateRoundRequestWithBody ¶ added in v0.1.2
func NewCreateRoundRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewCreateRoundRequestWithBody generates requests for CreateRound with any type of body
func NewGetLatestRoundIDRequest ¶
NewGetLatestRoundIDRequest generates requests for GetLatestRoundID
func NewGetRoundRequest ¶ added in v0.1.2
NewGetRoundRequest generates requests for GetRound
func NewSendScoreRequest ¶ added in v0.1.2
func NewSendScoreRequest(server string, roundID string, body SendScoreJSONRequestBody) (*http.Request, error)
NewSendScoreRequest calls the generic SendScore builder with application/json body
func NewSendScoreRequestWithBody ¶ added in v0.1.2
func NewSendScoreRequestWithBody(server string, roundID string, contentType string, body io.Reader) (*http.Request, error)
NewSendScoreRequestWithBody generates requests for SendScore 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, body CreateRoundJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) CreateRoundWithBody ¶ added in v0.1.2
func (*Client) GetLatestRoundID ¶
type ClientInterface ¶
type ClientInterface interface { // GetLatestRoundID request GetLatestRoundID(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // CreateRoundWithBody request with any body CreateRoundWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) CreateRound(ctx context.Context, body CreateRoundJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetRound request GetRound(ctx context.Context, roundID string, reqEditors ...RequestEditorFn) (*http.Response, error) // SendScoreWithBody request with any body SendScoreWithBody(ctx context.Context, roundID string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) SendScore(ctx context.Context, roundID string, body SendScoreJSONRequestBody, 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) CreateRoundWithBodyWithResponse ¶ added in v0.1.2
func (c *ClientWithResponses) CreateRoundWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateRoundResponse, error)
CreateRoundWithBodyWithResponse request with arbitrary body returning *CreateRoundResponse
func (*ClientWithResponses) CreateRoundWithResponse ¶ added in v0.1.2
func (c *ClientWithResponses) CreateRoundWithResponse(ctx context.Context, body CreateRoundJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateRoundResponse, error)
func (*ClientWithResponses) GetLatestRoundIDWithResponse ¶
func (c *ClientWithResponses) GetLatestRoundIDWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetLatestRoundIDResponse, error)
GetLatestRoundIDWithResponse request returning *GetLatestRoundIDResponse
func (*ClientWithResponses) GetRoundWithResponse ¶ added in v0.1.2
func (c *ClientWithResponses) GetRoundWithResponse(ctx context.Context, roundID string, reqEditors ...RequestEditorFn) (*GetRoundResponse, error)
GetRoundWithResponse request returning *GetRoundResponse
func (*ClientWithResponses) SendScoreWithBodyWithResponse ¶ added in v0.1.2
func (c *ClientWithResponses) SendScoreWithBodyWithResponse(ctx context.Context, roundID string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SendScoreResponse, error)
SendScoreWithBodyWithResponse request with arbitrary body returning *SendScoreResponse
func (*ClientWithResponses) SendScoreWithResponse ¶ added in v0.1.2
func (c *ClientWithResponses) SendScoreWithResponse(ctx context.Context, roundID string, body SendScoreJSONRequestBody, reqEditors ...RequestEditorFn) (*SendScoreResponse, error)
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // GetLatestRoundIDWithResponse request GetLatestRoundIDWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetLatestRoundIDResponse, error) // CreateRoundWithBodyWithResponse request with any body CreateRoundWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateRoundResponse, error) CreateRoundWithResponse(ctx context.Context, body CreateRoundJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateRoundResponse, error) // GetRoundWithResponse request GetRoundWithResponse(ctx context.Context, roundID string, reqEditors ...RequestEditorFn) (*GetRoundResponse, error) // SendScoreWithBodyWithResponse request with any body SendScoreWithBodyWithResponse(ctx context.Context, roundID string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SendScoreResponse, error) SendScoreWithResponse(ctx context.Context, roundID string, body SendScoreJSONRequestBody, reqEditors ...RequestEditorFn) (*SendScoreResponse, 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 CreateRoundJSONRequestBody ¶ added in v0.1.2
type CreateRoundJSONRequestBody = RoundRequest
CreateRoundJSONRequestBody defines body for CreateRound for application/json ContentType.
type CreateRoundResponse ¶ added in v0.1.2
type CreateRoundResponse struct { Body []byte HTTPResponse *http.Response JSON201 *CreatedRound }
func ParseCreateRoundResponse ¶ added in v0.1.2
func ParseCreateRoundResponse(rsp *http.Response) (*CreateRoundResponse, error)
ParseCreateRoundResponse parses an HTTP response from a CreateRoundWithResponse call
func (CreateRoundResponse) Status ¶ added in v0.1.2
func (r CreateRoundResponse) Status() string
Status returns HTTPResponse.Status
func (CreateRoundResponse) StatusCode ¶ added in v0.1.2
func (r CreateRoundResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
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 GetRoundResponse ¶ added in v0.1.2
func ParseGetRoundResponse ¶ added in v0.1.2
func ParseGetRoundResponse(rsp *http.Response) (*GetRoundResponse, error)
ParseGetRoundResponse parses an HTTP response from a GetRoundWithResponse call
func (GetRoundResponse) Status ¶ added in v0.1.2
func (r GetRoundResponse) Status() string
Status returns HTTPResponse.Status
func (GetRoundResponse) StatusCode ¶ added in v0.1.2
func (r GetRoundResponse) 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 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 SendScoreJSONRequestBody ¶ added in v0.1.2
type SendScoreJSONRequestBody = PlayerScoreEvent
SendScoreJSONRequestBody defines body for SendScore for application/json ContentType.
type SendScoreResponse ¶ added in v0.1.2
func ParseSendScoreResponse ¶ added in v0.1.2
func ParseSendScoreResponse(rsp *http.Response) (*SendScoreResponse, error)
ParseSendScoreResponse parses an HTTP response from a SendScoreWithResponse call
func (SendScoreResponse) Status ¶ added in v0.1.2
func (r SendScoreResponse) Status() string
Status returns HTTPResponse.Status
func (SendScoreResponse) StatusCode ¶ added in v0.1.2
func (r SendScoreResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type ServerInterface ¶
type ServerInterface interface { // Gets the latest round ID // (GET /latest/roundID) GetLatestRoundID(ctx echo.Context) error // Creates a new round // (POST /round) CreateRound(ctx echo.Context) error // Gets round information // (GET /round/{roundID}) GetRound(ctx echo.Context, roundID string) error // Send a score event // (PUT /round/{roundID}/score) SendScore(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) CreateRound ¶ added in v0.1.2
func (w *ServerInterfaceWrapper) CreateRound(ctx echo.Context) error
CreateRound converts echo context to params.
func (*ServerInterfaceWrapper) GetLatestRoundID ¶
func (w *ServerInterfaceWrapper) GetLatestRoundID(ctx echo.Context) error
GetLatestRoundID converts echo context to params.
func (*ServerInterfaceWrapper) GetRound ¶ added in v0.1.2
func (w *ServerInterfaceWrapper) GetRound(ctx echo.Context) error
GetRound converts echo context to params.
func (*ServerInterfaceWrapper) SendScore ¶ added in v0.1.2
func (w *ServerInterfaceWrapper) SendScore(ctx echo.Context) error
SendScore converts echo context to params.