-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3acbb1e
commit 512e1e9
Showing
11 changed files
with
437 additions
and
409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package lidarr | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"golift.io/starr" | ||
) | ||
|
||
// MetadataProfile is the /api/v1/metadataprofile endpoint. | ||
type MetadataProfile struct { | ||
Name string `json:"name"` | ||
ID int64 `json:"id"` | ||
PrimaryAlbumTypes []*AlbumType `json:"primaryAlbumTypes"` | ||
SecondaryAlbumTypes []*AlbumType `json:"secondaryAlbumTypes"` | ||
ReleaseStatuses []*ReleaseStatus `json:"releaseStatuses"` | ||
} | ||
|
||
// AlbumType is part of MetadataProfile. | ||
type AlbumType struct { | ||
AlbumType *starr.Value `json:"albumType"` | ||
Allowed bool `json:"allowed"` | ||
} | ||
|
||
// ReleaseStatus is part of MetadataProfile. | ||
type ReleaseStatus struct { | ||
ReleaseStatus *starr.Value `json:"releaseStatus"` | ||
Allowed bool `json:"allowed"` | ||
} | ||
|
||
// GetMetadataProfiles returns the metadata profiles. | ||
func (l *Lidarr) GetMetadataProfiles() ([]*MetadataProfile, error) { | ||
return l.GetMetadataProfilesContext(context.Background()) | ||
} | ||
|
||
// GetMetadataProfilesContext returns the metadata profiles. | ||
func (l *Lidarr) GetMetadataProfilesContext(ctx context.Context) ([]*MetadataProfile, error) { | ||
var profiles []*MetadataProfile | ||
|
||
_, err := l.GetInto(ctx, "v1/metadataprofile", nil, &profiles) | ||
if err != nil { | ||
return nil, fmt.Errorf("api.Get(metadataprofile): %w", err) | ||
} | ||
|
||
return profiles, nil | ||
} |
Oops, something went wrong.