Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
796bff1c6c | |||
![]() |
f16388f238 |
@@ -105,6 +105,8 @@ func request(path string, params url.Values, resp interface{}) error {
|
|||||||
switch response.StatusCode {
|
switch response.StatusCode {
|
||||||
case http.StatusUnauthorized:
|
case http.StatusUnauthorized:
|
||||||
return ErrUnauthorized
|
return ErrUnauthorized
|
||||||
|
case http.StatusTooManyRequests:
|
||||||
|
return ErrTooManyRequests
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unknown error: %s", response.Status)
|
return fmt.Errorf("unknown error: %s", response.Status)
|
||||||
}
|
}
|
||||||
|
@@ -16,10 +16,11 @@ func (e *Error) Error() string {
|
|||||||
|
|
||||||
// APIErrors
|
// APIErrors
|
||||||
var (
|
var (
|
||||||
ErrUnauthorized = &Error{"authentication required"}
|
|
||||||
ErrCurrencyNotSupported = &Error{"currency does not supported"}
|
ErrCurrencyNotSupported = &Error{"currency does not supported"}
|
||||||
ErrUserAgentInvalid = &Error{"invalid user-agent"}
|
|
||||||
ErrInvalidReleaseID = &Error{"invalid release id"}
|
ErrInvalidReleaseID = &Error{"invalid release id"}
|
||||||
ErrInvalidSortKey = &Error{"invalid sort key"}
|
ErrInvalidSortKey = &Error{"invalid sort key"}
|
||||||
ErrInvalidUsername = &Error{"invalid username"}
|
ErrInvalidUsername = &Error{"invalid username"}
|
||||||
|
ErrTooManyRequests = &Error{"too many requests"}
|
||||||
|
ErrUnauthorized = &Error{"authentication required"}
|
||||||
|
ErrUserAgentInvalid = &Error{"invalid user-agent"}
|
||||||
)
|
)
|
||||||
|
@@ -67,7 +67,7 @@ type CollectionItemSource struct {
|
|||||||
DateAdded string `json:"date_added"`
|
DateAdded string `json:"date_added"`
|
||||||
FolderID int `json:"folder_id,omitempty"`
|
FolderID int `json:"folder_id,omitempty"`
|
||||||
InstanceID int `json:"instance_id"`
|
InstanceID int `json:"instance_id"`
|
||||||
Notes string `json:"notes,omitempty"`
|
Notes []Note `json:"notes,omitempty"`
|
||||||
Rating int `json:"rating"`
|
Rating int `json:"rating"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,6 +88,12 @@ type BasicInformation struct {
|
|||||||
Year int `json:"year"`
|
Year int `json:"year"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note ...
|
||||||
|
type Note struct {
|
||||||
|
ID int `json:"field_id"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
// CollectionItems list of items in a user’s collection
|
// CollectionItems list of items in a user’s collection
|
||||||
type CollectionItems struct {
|
type CollectionItems struct {
|
||||||
Pagination Page `json:"pagination"`
|
Pagination Page `json:"pagination"`
|
||||||
|
Reference in New Issue
Block a user