Versions in this module Expand all Collapse all v1 v1.0.1 Mar 12, 2024 Changes in this version + func ContextQueryParams(c *APIContext) map[string][]string + type API struct + ContentType string + func NewAPI(prefix string) *API + func NewAPIWithBaseURL(prefix string, baseURL string) *API + func NewAPIWithResolver(prefix string, resolver URLResolver) *API + func NewAPIWithRouting(prefix string, resolver URLResolver, router routing.Routeable) *API + func (api *API) AddResource(prototype jsonapi.MarshalIdentifier, source interface{}) + func (api *API) SetContextAllocator(allocator APIContextAllocatorFunc) + func (api *API) UseMiddleware(middleware ...HandlerFunc) + func (api API) Handler() http.Handler + func (api API) Router() routing.Routeable + type APIContext struct + func (c *APIContext) Deadline() (deadline time.Time, ok bool) + func (c *APIContext) Done() <-chan struct{} + func (c *APIContext) Err() error + func (c *APIContext) Get(key string) (value interface{}, exists bool) + func (c *APIContext) Reset() + func (c *APIContext) Set(key string, value interface{}) + func (c *APIContext) Value(key interface{}) interface{} + type APIContextAllocatorFunc func(*API) APIContexter + type APIContexter interface + Get func(key string) (interface{}, bool) + Reset func() + Set func(key string, value interface{}) + type CRUD interface + type Error struct + Code string + Detail string + ID string + Links *ErrorLinks + Meta interface{} + Source *ErrorSource + Status string + Title string + type ErrorLinks struct + About string + type ErrorSource struct + Parameter string + Pointer string + type FindAll interface + FindAll func(req Request) (Responder, error) + type HTTPError struct + Errors []Error + func NewHTTPError(err error, msg string, status int) HTTPError + func (e HTTPError) Error() string + type HandlerFunc func(APIContexter, http.ResponseWriter, *http.Request) + type LinksResponder interface + Links func(*http.Request, string) jsonapi.Links + type ObjectInitializer interface + InitializeObject func(interface{}) + type PaginatedFindAll interface + PaginatedFindAll func(req Request) (totalCount uint, response Responder, err error) + type Pagination struct + First map[string]string + Last map[string]string + Next map[string]string + Prev map[string]string + type Request struct + Context APIContexter + Header http.Header + Pagination map[string]string + PlainRequest *http.Request + QueryParams map[string][]string + type RequestAwareURLResolver interface + SetRequest func(http.Request) + type ResourceCreator interface + Create func(obj interface{}, req Request) (Responder, error) + type ResourceDeleter interface + Delete func(id string, req Request) (Responder, error) + type ResourceGetter interface + FindOne func(ID string, req Request) (Responder, error) + type ResourceUpdater interface + Update func(obj interface{}, req Request) (Responder, error) + type Responder interface + Metadata func() map[string]interface{} + Result func() interface{} + StatusCode func() int + type Response struct + Code int + Meta map[string]interface{} + Pagination Pagination + Res interface{} + func (r Response) Links(req *http.Request, baseURL string) (ret jsonapi.Links) + func (r Response) Metadata() map[string]interface{} + func (r Response) Result() interface{} + func (r Response) StatusCode() int + type URLResolver interface + GetBaseURL func() string + func NewCallbackResolver(callback func(http.Request) string) URLResolver + func NewStaticResolver(baseURL string) URLResolver