Compare commits

...

5 Commits

Author SHA1 Message Date
David 796bff1c6c properly parse notes array on folder collections (#1)
Co-authored-by: David Ashby <delta.mu.alpha@gmail.com>
Reviewed-on: #1
2022-03-13 21:13:19 +00:00
Artem Piskun f16388f238
Handle TooManyRequests error (#53) 2021-12-09 14:38:29 +03:00
Artem Piskun 52eff84151
Artist's groups omitempty (#52) 2021-12-09 14:25:59 +03:00
Eugene Simonov 03267ade9d
Parse artist groups (#50)
Co-authored-by: Eugene Simonov <eugene.simonov@evergen.com.au>
2021-12-09 14:23:15 +03:00
Artem Piskun 729681251c
Version rise up (#49) 2021-09-07 11:10:44 +03:00
6 changed files with 15 additions and 5 deletions

View File

@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.17
- name: Build
run: go build -v ./...

View File

@ -15,4 +15,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.37
version: v1.41.1

View File

@ -119,6 +119,7 @@ type Artist struct {
ResourceURL string `json:"resource_url"`
URI string `json:"uri"`
URLs []string `json:"urls"`
Groups []Member `json:"groups,omitempty"`
DataQuality string `json:"data_quality"`
}

View File

@ -105,6 +105,8 @@ func request(path string, params url.Values, resp interface{}) error {
switch response.StatusCode {
case http.StatusUnauthorized:
return ErrUnauthorized
case http.StatusTooManyRequests:
return ErrTooManyRequests
default:
return fmt.Errorf("unknown error: %s", response.Status)
}

View File

@ -16,10 +16,11 @@ func (e *Error) Error() string {
// APIErrors
var (
ErrUnauthorized = &Error{"authentication required"}
ErrCurrencyNotSupported = &Error{"currency does not supported"}
ErrUserAgentInvalid = &Error{"invalid user-agent"}
ErrInvalidReleaseID = &Error{"invalid release id"}
ErrInvalidSortKey = &Error{"invalid sort key"}
ErrInvalidUsername = &Error{"invalid username"}
ErrTooManyRequests = &Error{"too many requests"}
ErrUnauthorized = &Error{"authentication required"}
ErrUserAgentInvalid = &Error{"invalid user-agent"}
)

View File

@ -67,7 +67,7 @@ type CollectionItemSource struct {
DateAdded string `json:"date_added"`
FolderID int `json:"folder_id,omitempty"`
InstanceID int `json:"instance_id"`
Notes string `json:"notes,omitempty"`
Notes []Note `json:"notes,omitempty"`
Rating int `json:"rating"`
}
@ -88,6 +88,12 @@ type BasicInformation struct {
Year int `json:"year"`
}
// Note ...
type Note struct {
ID int `json:"field_id"`
Value string `json:"value"`
}
// CollectionItems list of items in a users collection
type CollectionItems struct {
Pagination Page `json:"pagination"`