Documentation ¶
Index ¶
- Variables
- func AssertInlineObjectRequired(obj InlineObject) error
- func AssertModelErrorRequired(obj ModelError) error
- func AssertPublicKeyRequired(obj PublicKey) error
- func AssertRecurseInlineObjectRequired(objSlice interface{}) error
- func AssertRecurseInterfaceRequired(obj interface{}, callback func(interface{}) error) error
- func AssertRecurseModelErrorRequired(objSlice interface{}) error
- func AssertRecursePublicKeyRequired(objSlice interface{}) error
- func AssertRecurseStatusRequired(objSlice interface{}) error
- func AssertRecurseTokenRequired(objSlice interface{}) error
- func AssertRecurseUserRequired(objSlice interface{}) error
- func AssertRecurseValueRequired(value reflect.Value, callback func(interface{}) error) error
- func AssertStatusRequired(obj Status) error
- func AssertTokenRequired(obj Token) error
- func AssertUserRequired(obj User) error
- func DefaultErrorHandler(w http.ResponseWriter, r *http.Request, err error, result *ImplResponse)
- func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error
- func IsZeroValue(val interface{}) bool
- func Logger(inner http.Handler, name string) http.Handler
- func NewRouter(routers ...Router) *mux.Router
- func ReadFormFileToTempFile(r *http.Request, key string) (*os.File, error)
- func ReadFormFilesToTempFiles(r *http.Request, key string) ([]*os.File, error)
- type DefaultApiController
- func (c *DefaultApiController) ApplicationsGet(w http.ResponseWriter, r *http.Request)
- func (c *DefaultApiController) ApplicationsIdDelete(w http.ResponseWriter, r *http.Request)
- func (c *DefaultApiController) JwtPublicKeysGet(w http.ResponseWriter, r *http.Request)
- func (c *DefaultApiController) JwtRefreshPost(w http.ResponseWriter, r *http.Request)
- func (c *DefaultApiController) Routes() Routes
- func (c *DefaultApiController) StatusGet(w http.ResponseWriter, r *http.Request)
- type DefaultApiOption
- type DefaultApiRouter
- type DefaultApiService
- func (s *DefaultApiService) ApplicationsGet(ctx context.Context, apiKey string) (ImplResponse, error)
- func (s *DefaultApiService) ApplicationsIdDelete(ctx context.Context, apiKey string, id string) (ImplResponse, error)
- func (s *DefaultApiService) JwtPublicKeysGet(ctx context.Context) (ImplResponse, error)
- func (s *DefaultApiService) JwtRefreshPost(ctx context.Context, refreshToken string, accessToken string, ...) (ImplResponse, error)
- func (s *DefaultApiService) StatusGet(ctx context.Context) (ImplResponse, error)
- type DefaultApiServicer
- type ErrorHandler
- type ImplResponse
- type InlineObject
- type ModelError
- type ParsingError
- type PublicKey
- type RequiredError
- type Route
- type Router
- type Routes
- type Status
- type Token
- type User
- type UsersApiController
- func (c *UsersApiController) Routes() Routes
- func (c *UsersApiController) UsersGet(w http.ResponseWriter, r *http.Request)
- func (c *UsersApiController) UsersIdDelete(w http.ResponseWriter, r *http.Request)
- func (c *UsersApiController) UsersIdGet(w http.ResponseWriter, r *http.Request)
- func (c *UsersApiController) UsersPost(w http.ResponseWriter, r *http.Request)
- type UsersApiOption
- type UsersApiRouter
- type UsersApiService
- func (s *UsersApiService) UsersGet(ctx context.Context, apiKey string) (ImplResponse, error)
- func (s *UsersApiService) UsersIdDelete(ctx context.Context, apiKey string, id string) (ImplResponse, error)
- func (s *UsersApiService) UsersIdGet(ctx context.Context, apiKey string, id string) (ImplResponse, error)
- func (s *UsersApiService) UsersPost(ctx context.Context, apiKey string, us User) (ImplResponse, error)
- type UsersApiServicer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTypeAssertionError is thrown when type an interface does not match the asserted type ErrTypeAssertionError = errors.New("unable to assert type") )
Functions ¶
func AssertInlineObjectRequired ¶
func AssertInlineObjectRequired(obj InlineObject) error
AssertInlineObjectRequired checks if the required fields are not zero-ed
func AssertModelErrorRequired ¶
func AssertModelErrorRequired(obj ModelError) error
AssertModelErrorRequired checks if the required fields are not zero-ed
func AssertPublicKeyRequired ¶
AssertPublicKeyRequired checks if the required fields are not zero-ed
func AssertRecurseInlineObjectRequired ¶
func AssertRecurseInlineObjectRequired(objSlice interface{}) error
AssertRecurseInlineObjectRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of InlineObject (e.g. [][]InlineObject), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseInterfaceRequired ¶
AssertInterfaceRequired recursively checks each struct in a slice against the callback. This method traverse nested slices in a preorder fashion.
func AssertRecurseModelErrorRequired ¶
func AssertRecurseModelErrorRequired(objSlice interface{}) error
AssertRecurseModelErrorRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of ModelError (e.g. [][]ModelError), otherwise ErrTypeAssertionError is thrown.
func AssertRecursePublicKeyRequired ¶
func AssertRecursePublicKeyRequired(objSlice interface{}) error
AssertRecursePublicKeyRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of PublicKey (e.g. [][]PublicKey), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseStatusRequired ¶
func AssertRecurseStatusRequired(objSlice interface{}) error
AssertRecurseStatusRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Status (e.g. [][]Status), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseTokenRequired ¶
func AssertRecurseTokenRequired(objSlice interface{}) error
AssertRecurseTokenRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Token (e.g. [][]Token), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseUserRequired ¶
func AssertRecurseUserRequired(objSlice interface{}) error
AssertRecurseUserRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of User (e.g. [][]User), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseValueRequired ¶
AssertNestedValueRequired checks each struct in the nested slice against the callback. This method traverse nested slices in a preorder fashion.
func AssertStatusRequired ¶
AssertStatusRequired checks if the required fields are not zero-ed
func AssertTokenRequired ¶
AssertTokenRequired checks if the required fields are not zero-ed
func AssertUserRequired ¶
AssertUserRequired checks if the required fields are not zero-ed
func DefaultErrorHandler ¶
func DefaultErrorHandler(w http.ResponseWriter, r *http.Request, err error, result *ImplResponse)
DefaultErrorHandler defines the default logic on how to handle errors from the controller. Any errors from parsing request params will return a StatusBadRequest. Otherwise, the error code originating from the servicer will be used.
func EncodeJSONResponse ¶
func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error
EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code
func IsZeroValue ¶
func IsZeroValue(val interface{}) bool
IsZeroValue checks if the val is the zero-ed value.
func ReadFormFileToTempFile ¶
ReadFormFileToTempFile reads file data from a request form and writes it to a temporary file
Types ¶
type DefaultApiController ¶
type DefaultApiController struct {
// contains filtered or unexported fields
}
DefaultApiController binds http requests to an api service and writes the service results to the http response
func (*DefaultApiController) ApplicationsGet ¶
func (c *DefaultApiController) ApplicationsGet(w http.ResponseWriter, r *http.Request)
ApplicationsGet -
func (*DefaultApiController) ApplicationsIdDelete ¶
func (c *DefaultApiController) ApplicationsIdDelete(w http.ResponseWriter, r *http.Request)
ApplicationsIdDelete -
func (*DefaultApiController) JwtPublicKeysGet ¶
func (c *DefaultApiController) JwtPublicKeysGet(w http.ResponseWriter, r *http.Request)
JwtPublicKeysGet -
func (*DefaultApiController) JwtRefreshPost ¶
func (c *DefaultApiController) JwtRefreshPost(w http.ResponseWriter, r *http.Request)
JwtRefreshPost -
func (*DefaultApiController) Routes ¶
func (c *DefaultApiController) Routes() Routes
Routes returns all of the api route for the DefaultApiController
func (*DefaultApiController) StatusGet ¶
func (c *DefaultApiController) StatusGet(w http.ResponseWriter, r *http.Request)
StatusGet -
type DefaultApiOption ¶
type DefaultApiOption func(*DefaultApiController)
DefaultApiOption for how the controller is set up.
func WithDefaultApiErrorHandler ¶
func WithDefaultApiErrorHandler(h ErrorHandler) DefaultApiOption
WithDefaultApiErrorHandler inject ErrorHandler into controller
type DefaultApiRouter ¶
type DefaultApiRouter interface { ApplicationsGet(http.ResponseWriter, *http.Request) ApplicationsIdDelete(http.ResponseWriter, *http.Request) JwtPublicKeysGet(http.ResponseWriter, *http.Request) JwtRefreshPost(http.ResponseWriter, *http.Request) StatusGet(http.ResponseWriter, *http.Request) }
DefaultApiRouter defines the required methods for binding the api requests to a responses for the DefaultApi The DefaultApiRouter implementation should parse necessary information from the http request, pass the data to a DefaultApiServicer to perform the required actions, then write the service results to the http response.
type DefaultApiService ¶
type DefaultApiService struct {
// contains filtered or unexported fields
}
DefaultApiService is a service that implements the logic for the DefaultApiServicer This service should implement the business logic for every endpoint for the DefaultApi API. Include any external packages or services that will be required by this service.
func (*DefaultApiService) ApplicationsGet ¶
func (s *DefaultApiService) ApplicationsGet(ctx context.Context, apiKey string) (ImplResponse, error)
ApplicationsGet -
func (*DefaultApiService) ApplicationsIdDelete ¶
func (s *DefaultApiService) ApplicationsIdDelete(ctx context.Context, apiKey string, id string) (ImplResponse, error)
ApplicationsIdDelete -
func (*DefaultApiService) JwtPublicKeysGet ¶
func (s *DefaultApiService) JwtPublicKeysGet(ctx context.Context) (ImplResponse, error)
JwtPublicKeysGet -
func (*DefaultApiService) JwtRefreshPost ¶
func (s *DefaultApiService) JwtRefreshPost(ctx context.Context, refreshToken string, accessToken string, w http.ResponseWriter) (ImplResponse, error)
JwtRefreshPost -
func (*DefaultApiService) StatusGet ¶
func (s *DefaultApiService) StatusGet(ctx context.Context) (ImplResponse, error)
StatusGet -
type DefaultApiServicer ¶
type DefaultApiServicer interface { ApplicationsGet(context.Context, string) (ImplResponse, error) ApplicationsIdDelete(context.Context, string, string) (ImplResponse, error) JwtPublicKeysGet(context.Context) (ImplResponse, error) JwtRefreshPost(context.Context, string, string, http.ResponseWriter) (ImplResponse, error) StatusGet(context.Context) (ImplResponse, error) }
DefaultApiServicer defines the api actions for the DefaultApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.
func NewDefaultApiService ¶
func NewDefaultApiService(pubKey, privKey string, rtStore refreshtoken.Store) DefaultApiServicer
NewDefaultApiService creates a default api service
type ErrorHandler ¶
type ErrorHandler func(w http.ResponseWriter, r *http.Request, err error, result *ImplResponse)
ErrorHandler defines the required method for handling error. You may implement it and inject this into a controller if you would like errors to be handled differently from the DefaultErrorHandler
type ImplResponse ¶
type ImplResponse struct { Code int Body interface{} }
Implementation response defines an error code with the associated body
func Response ¶
func Response(code int, body interface{}) ImplResponse
Response return a ImplResponse struct filled
type InlineObject ¶
type InlineObject struct {
RefreshToken string `json:"refresh_token,omitempty"`
}
type ModelError ¶
type ParsingError ¶
type ParsingError struct {
Err error
}
ParsingError indicates that an error has occurred when parsing request parameters
func (*ParsingError) Error ¶
func (e *ParsingError) Error() string
func (*ParsingError) Unwrap ¶
func (e *ParsingError) Unwrap() error
type RequiredError ¶
type RequiredError struct {
Field string
}
RequiredError indicates that an error has occurred when parsing request parameters
func (*RequiredError) Error ¶
func (e *RequiredError) Error() string
type Route ¶
type Route struct { Name string Method string Pattern string HandlerFunc http.HandlerFunc }
A Route defines the parameters for an api endpoint
type Router ¶
type Router interface {
Routes() Routes
}
Router defines the required methods for retrieving api routes
func NewDefaultApiController ¶
func NewDefaultApiController(s DefaultApiServicer, opts ...DefaultApiOption) Router
NewDefaultApiController creates a default api controller
func NewUsersApiController ¶
func NewUsersApiController(s UsersApiServicer, opts ...UsersApiOption) Router
NewUsersApiController creates a default api controller
type UsersApiController ¶
type UsersApiController struct {
// contains filtered or unexported fields
}
UsersApiController binds http requests to an api service and writes the service results to the http response
func (*UsersApiController) Routes ¶
func (c *UsersApiController) Routes() Routes
Routes returns all of the api route for the UsersApiController
func (*UsersApiController) UsersGet ¶
func (c *UsersApiController) UsersGet(w http.ResponseWriter, r *http.Request)
UsersGet -
func (*UsersApiController) UsersIdDelete ¶
func (c *UsersApiController) UsersIdDelete(w http.ResponseWriter, r *http.Request)
UsersIdDelete -
func (*UsersApiController) UsersIdGet ¶
func (c *UsersApiController) UsersIdGet(w http.ResponseWriter, r *http.Request)
UsersIdGet -
func (*UsersApiController) UsersPost ¶
func (c *UsersApiController) UsersPost(w http.ResponseWriter, r *http.Request)
UsersPost -
type UsersApiOption ¶
type UsersApiOption func(*UsersApiController)
UsersApiOption for how the controller is set up.
func WithUsersApiErrorHandler ¶
func WithUsersApiErrorHandler(h ErrorHandler) UsersApiOption
WithUsersApiErrorHandler inject ErrorHandler into controller
type UsersApiRouter ¶
type UsersApiRouter interface { UsersGet(http.ResponseWriter, *http.Request) UsersIdDelete(http.ResponseWriter, *http.Request) UsersIdGet(http.ResponseWriter, *http.Request) UsersPost(http.ResponseWriter, *http.Request) }
UsersApiRouter defines the required methods for binding the api requests to a responses for the UsersApi The UsersApiRouter implementation should parse necessary information from the http request, pass the data to a UsersApiServicer to perform the required actions, then write the service results to the http response.
type UsersApiService ¶
type UsersApiService struct {
// contains filtered or unexported fields
}
UsersApiService is a service that implements the logic for the UsersApiServicer This service should implement the business logic for every endpoint for the UsersApi API. Include any external packages or services that will be required by this service.
func (*UsersApiService) UsersGet ¶
func (s *UsersApiService) UsersGet(ctx context.Context, apiKey string) (ImplResponse, error)
UsersGet -
func (*UsersApiService) UsersIdDelete ¶
func (s *UsersApiService) UsersIdDelete(ctx context.Context, apiKey string, id string) (ImplResponse, error)
UsersIdDelete -
func (*UsersApiService) UsersIdGet ¶
func (s *UsersApiService) UsersIdGet(ctx context.Context, apiKey string, id string) (ImplResponse, error)
UsersIdGet -
func (*UsersApiService) UsersPost ¶
func (s *UsersApiService) UsersPost(ctx context.Context, apiKey string, us User) (ImplResponse, error)
UsersPost -
type UsersApiServicer ¶
type UsersApiServicer interface { UsersGet(context.Context, string) (ImplResponse, error) UsersIdDelete(context.Context, string, string) (ImplResponse, error) UsersIdGet(context.Context, string, string) (ImplResponse, error) UsersPost(context.Context, string, User) (ImplResponse, error) }
UsersApiServicer defines the api actions for the UsersApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.
func NewUsersApiService ¶
func NewUsersApiService(db user.DB, apikey apikey.Store) UsersApiServicer
NewUsersApiService creates a default api service