Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { CharacterEndpoint string // Define the character endpoint. maybe remove and find more elegant solution for testing. // contains filtered or unexported fields }
API defines the client for connecting to the Marvel API.
func NewMarvelAPI ¶
NewMarvelAPI creates the new client with the http client.
func (*API) Characters ¶
func (api *API) Characters(criteria *Criteria) (*CharactersResultWrapper, *ErrorResult, error)
Characters returns the API response for getting characters, an error from the API result, or a system-related error.
func (*API) TotalCharacters ¶
TotalCharacters gets the total characters in the APi.
type Character ¶
type Character struct { ID int `json:"id"` Name string `json:"name"` Description string `json:"description"` Thumbnail struct { Path string `json:"path"` Extension string `json:"extension"` } `json:"thumbnail"` URLs []struct { Type string `json:"type"` URL string `json:"url"` } `json:"urls"` Comics struct { Available int `json:"available"` } `json:"comics"` }
Character defines the struct for a Marvel character from their API.
type CharactersResultContainer ¶
CharactersResultContainer is the result for multiple characters returned.
type CharactersResultWrapper ¶
type CharactersResultWrapper struct { Result CharactersResultContainer `json:"data"` }
CharactersResultWrapper - ....yet another wrapper. :/
type Container ¶
type Container struct { Offset int `json:"offset"` Limit int `json:"limit"` Total int `json:"total"` Count int `json:"count"` }
Container is a container for meta results returned.
type ErrorResult ¶
ErrorResult - Marvel *sometimes* returns a completely different JSON structure if is an error. But for invalid input or 409's they return a regular result.