Documentation ¶
Overview ¶
Package hourly provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.12.4 DO NOT EDIT.
Index ¶
- Constants
- func GetSwagger() (swagger *openapi3.T, err error)
- func NewCreateTokenRequest(server string, body CreateTokenJSONRequestBody) (*http.Request, error)
- func NewCreateTokenRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewListProjectsRequest(server string) (*http.Request, error)
- func NewListTimeEntriesRequest(server string, userId int, params *ListTimeEntriesParams) (*http.Request, error)
- func NewListUsersRequest(server string) (*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) CreateToken(ctx context.Context, body CreateTokenJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) CreateTokenWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) ListProjects(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) ListTimeEntries(ctx context.Context, userId int, params *ListTimeEntriesParams, ...) (*http.Response, error)
- func (c *Client) ListUsers(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) CreateTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*CreateTokenResponse, error)
- func (c *ClientWithResponses) CreateTokenWithResponse(ctx context.Context, body CreateTokenJSONRequestBody, ...) (*CreateTokenResponse, error)
- func (c *ClientWithResponses) ListProjectsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListProjectsResponse, error)
- func (c *ClientWithResponses) ListTimeEntriesWithResponse(ctx context.Context, userId int, params *ListTimeEntriesParams, ...) (*ListTimeEntriesResponse, error)
- func (c *ClientWithResponses) ListUsersWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListUsersResponse, error)
- type ClientWithResponsesInterface
- type CreateTokenJSONRequestBody
- type CreateTokenResponse
- type EchoRouter
- type Error
- type HttpRequestDoer
- type ListProjectsResponse
- type ListTimeEntriesParams
- type ListTimeEntriesResponse
- type ListUsersResponse
- type Project
- type RequestEditorFn
- type ServerInterface
- type ServerInterfaceWrapper
- type TimeEntry
- type TokenRequest
- type TokenResponse
- type User
Constants ¶
const (
BearerAuthScopes = "bearerAuth.Scopes"
)
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 NewCreateTokenRequest ¶
func NewCreateTokenRequest(server string, body CreateTokenJSONRequestBody) (*http.Request, error)
NewCreateTokenRequest calls the generic CreateToken builder with application/json body
func NewCreateTokenRequestWithBody ¶
func NewCreateTokenRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewCreateTokenRequestWithBody generates requests for CreateToken with any type of body
func NewListProjectsRequest ¶ added in v0.0.3
NewListProjectsRequest generates requests for ListProjects
func NewListTimeEntriesRequest ¶
func NewListTimeEntriesRequest(server string, userId int, params *ListTimeEntriesParams) (*http.Request, error)
NewListTimeEntriesRequest generates requests for ListTimeEntries
func NewListUsersRequest ¶
NewListUsersRequest generates requests for ListUsers
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) CreateToken ¶
func (c *Client) CreateToken(ctx context.Context, body CreateTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) CreateTokenWithBody ¶
func (*Client) ListProjects ¶ added in v0.0.3
func (*Client) ListTimeEntries ¶
func (c *Client) ListTimeEntries(ctx context.Context, userId int, params *ListTimeEntriesParams, reqEditors ...RequestEditorFn) (*http.Response, error)
type ClientInterface ¶
type ClientInterface interface { // CreateToken request with any body CreateTokenWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) CreateToken(ctx context.Context, body CreateTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // ListProjects request ListProjects(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // ListUsers request ListUsers(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // ListTimeEntries request ListTimeEntries(ctx context.Context, userId int, params *ListTimeEntriesParams, 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) CreateTokenWithBodyWithResponse ¶
func (c *ClientWithResponses) CreateTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateTokenResponse, error)
CreateTokenWithBodyWithResponse request with arbitrary body returning *CreateTokenResponse
func (*ClientWithResponses) CreateTokenWithResponse ¶
func (c *ClientWithResponses) CreateTokenWithResponse(ctx context.Context, body CreateTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateTokenResponse, error)
func (*ClientWithResponses) ListProjectsWithResponse ¶ added in v0.0.3
func (c *ClientWithResponses) ListProjectsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListProjectsResponse, error)
ListProjectsWithResponse request returning *ListProjectsResponse
func (*ClientWithResponses) ListTimeEntriesWithResponse ¶
func (c *ClientWithResponses) ListTimeEntriesWithResponse(ctx context.Context, userId int, params *ListTimeEntriesParams, reqEditors ...RequestEditorFn) (*ListTimeEntriesResponse, error)
ListTimeEntriesWithResponse request returning *ListTimeEntriesResponse
func (*ClientWithResponses) ListUsersWithResponse ¶
func (c *ClientWithResponses) ListUsersWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListUsersResponse, error)
ListUsersWithResponse request returning *ListUsersResponse
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // CreateToken request with any body CreateTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateTokenResponse, error) CreateTokenWithResponse(ctx context.Context, body CreateTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateTokenResponse, error) // ListProjects request ListProjectsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListProjectsResponse, error) // ListUsers request ListUsersWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListUsersResponse, error) // ListTimeEntries request ListTimeEntriesWithResponse(ctx context.Context, userId int, params *ListTimeEntriesParams, reqEditors ...RequestEditorFn) (*ListTimeEntriesResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type CreateTokenJSONRequestBody ¶
type CreateTokenJSONRequestBody = TokenRequest
CreateTokenJSONRequestBody defines body for CreateToken for application/json ContentType.
type CreateTokenResponse ¶
type CreateTokenResponse struct { Body []byte HTTPResponse *http.Response JSON200 *TokenResponse JSON400 *Error JSON500 *Error }
func ParseCreateTokenResponse ¶
func ParseCreateTokenResponse(rsp *http.Response) (*CreateTokenResponse, error)
ParseCreateTokenResponse parses an HTTP response from a CreateTokenWithResponse call
func (CreateTokenResponse) Status ¶
func (r CreateTokenResponse) Status() string
Status returns HTTPResponse.Status
func (CreateTokenResponse) StatusCode ¶
func (r CreateTokenResponse) 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 HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type ListProjectsResponse ¶ added in v0.0.3
type ListProjectsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]Project JSON400 *Error }
func ParseListProjectsResponse ¶ added in v0.0.3
func ParseListProjectsResponse(rsp *http.Response) (*ListProjectsResponse, error)
ParseListProjectsResponse parses an HTTP response from a ListProjectsWithResponse call
func (ListProjectsResponse) Status ¶ added in v0.0.3
func (r ListProjectsResponse) Status() string
Status returns HTTPResponse.Status
func (ListProjectsResponse) StatusCode ¶ added in v0.0.3
func (r ListProjectsResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type ListTimeEntriesParams ¶
type ListTimeEntriesParams struct { // StartDate Start date StartDate *time.Time `form:"startDate,omitempty" json:"startDate,omitempty"` // EndDate End date EndDate *time.Time `form:"endDate,omitempty" json:"endDate,omitempty"` }
ListTimeEntriesParams defines parameters for ListTimeEntries.
type ListTimeEntriesResponse ¶
type ListTimeEntriesResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]TimeEntry JSON400 *Error JSON404 *Error }
func ParseListTimeEntriesResponse ¶
func ParseListTimeEntriesResponse(rsp *http.Response) (*ListTimeEntriesResponse, error)
ParseListTimeEntriesResponse parses an HTTP response from a ListTimeEntriesWithResponse call
func (ListTimeEntriesResponse) Status ¶
func (r ListTimeEntriesResponse) Status() string
Status returns HTTPResponse.Status
func (ListTimeEntriesResponse) StatusCode ¶
func (r ListTimeEntriesResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type ListUsersResponse ¶
type ListUsersResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]User JSON400 *Error }
func ParseListUsersResponse ¶
func ParseListUsersResponse(rsp *http.Response) (*ListUsersResponse, error)
ParseListUsersResponse parses an HTTP response from a ListUsersWithResponse call
func (ListUsersResponse) Status ¶
func (r ListUsersResponse) Status() string
Status returns HTTPResponse.Status
func (ListUsersResponse) StatusCode ¶
func (r ListUsersResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type ServerInterface ¶
type ServerInterface interface { // Returns a new authentication token // (POST /api/auth/tokens) CreateToken(ctx echo.Context) error // Returns a list of projects // (GET /api/projects) ListProjects(ctx echo.Context) error // Returns a list of users // (GET /api/users) ListUsers(ctx echo.Context) error // Returns a list of time entries // (GET /api/{userId}/time_entries) ListTimeEntries(ctx echo.Context, userId int, params ListTimeEntriesParams) error }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
ServerInterfaceWrapper converts echo contexts to parameters.
func (*ServerInterfaceWrapper) CreateToken ¶
func (w *ServerInterfaceWrapper) CreateToken(ctx echo.Context) error
CreateToken converts echo context to params.
func (*ServerInterfaceWrapper) ListProjects ¶ added in v0.0.3
func (w *ServerInterfaceWrapper) ListProjects(ctx echo.Context) error
ListProjects converts echo context to params.
func (*ServerInterfaceWrapper) ListTimeEntries ¶
func (w *ServerInterfaceWrapper) ListTimeEntries(ctx echo.Context) error
ListTimeEntries converts echo context to params.
func (*ServerInterfaceWrapper) ListUsers ¶
func (w *ServerInterfaceWrapper) ListUsers(ctx echo.Context) error
ListUsers converts echo context to params.
type TimeEntry ¶
type TimeEntry struct { At string `json:"at"` Billable bool `json:"billable"` Description *string `json:"description,omitempty"` Id int `json:"id"` Project Project `json:"project"` StartedAt time.Time `json:"startedAt"` StoppedAt time.Time `json:"stoppedAt"` }
TimeEntry defines model for TimeEntry.
type TokenRequest ¶
type TokenRequest struct {
PlatformId string `json:"platformId"`
}
TokenRequest defines model for TokenRequest.
type TokenResponse ¶
type TokenResponse struct {
Token string `json:"token"`
}
TokenResponse defines model for TokenResponse.