Documentation ¶
Index ¶
- Constants
- func NewID() string
- func SendAPI(w http.ResponseWriter, r *http.Request)
- func SendAPIV1(w http.ResponseWriter, r *http.Request)
- func SendNotFound(w http.ResponseWriter, r *http.Request)
- func SendPanic(w http.ResponseWriter, r *http.Request)
- func SendUnauthorized(w http.ResponseWriter, r *http.Request, message string)
- type CollectionMetadata
- type Dinosaur
- type DinosaurIndex
- type DinosaurList
- type DinosaurPatchRequest
- type Error
- type Event
- type EventIndex
- type EventList
- type EventType
- type Meta
- type Metadata
- type PagingMeta
- type VersionMetadata
Constants ¶
View Source
const ErrorType = "Error"
ErrorType is the name of the type used to report errors.
Variables ¶
This section is empty.
Functions ¶
func SendAPI ¶
func SendAPI(w http.ResponseWriter, r *http.Request)
SendAPI sends API documentation response.
func SendAPIV1 ¶
func SendAPIV1(w http.ResponseWriter, r *http.Request)
SendAPIV1 sends API version v1 documentation response.
func SendNotFound ¶
func SendNotFound(w http.ResponseWriter, r *http.Request)
SendNotFound sends a 404 response with some details about the non existing resource.
func SendPanic ¶
func SendPanic(w http.ResponseWriter, r *http.Request)
SendPanic sends a panic error response to the client, but it doesn't end the process.
func SendUnauthorized ¶
func SendUnauthorized(w http.ResponseWriter, r *http.Request, message string)
Types ¶
type CollectionMetadata ¶
type CollectionMetadata struct { ID string `json:"id"` HREF string `json:"href"` Kind string `json:"kind"` }
CollectionMetadata represents a collection.
type DinosaurIndex ¶
type DinosaurList ¶
type DinosaurList []*Dinosaur
func (DinosaurList) Index ¶
func (l DinosaurList) Index() DinosaurIndex
type DinosaurPatchRequest ¶
type DinosaurPatchRequest struct {
Species *string `json:"species,omitempty"`
}
type Error ¶
type Error struct { Type string `json:"type,omitempty"` ID string `json:"id,omitempty"` HREF string `json:"href,omitempty"` Code string `json:"code,omitempty"` Reason string `json:"reason,omitempty"` }
Error represents an error reported by the API.
type Event ¶
type EventIndex ¶
type EventList ¶
type EventList []*Event
func (EventList) Index ¶
func (l EventList) Index() EventIndex
type Meta ¶
type Meta struct { ID string CreatedAt time.Time UpdatedAt time.Time DeletedAt gorm.DeletedAt `gorm:"index"` }
Meta is base model definition, embedded in all kinds
type Metadata ¶
type Metadata struct { ID string `json:"id"` HREF string `json:"href"` Kind string `json:"kind"` Versions []VersionMetadata `json:"versions"` }
Metadata api metadata.
type VersionMetadata ¶
type VersionMetadata struct { ID string `json:"id"` HREF string `json:"href"` Kind string `json:"kind"` Collections []CollectionMetadata `json:"collections"` }
VersionMetadata represents a version.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.