A Dart/Flutter client for interacting with the Discogs API. This package provides a simple and easy-to-use interface for accessing Discogs' music database, including artists, labels, masters, releases, and search functionality that do not require user level authentication. This package does not provide any methods that requires user level authentication.
- Artist Information: Fetch details about artists and their releases.
- Label Information: Retrieve details about labels and their releases.
- Master Releases: Access master release information and versions.
- Release Details: Get detailed information about specific releases, including ratings and statistics.
- Search: Search for artists, releases, labels, and more.
- Download repository
- Run the following command in project directory
flutter pub get
To use the Discogs API, you need to obtain an API key and secret from Discogs Developer Portal.
- Sign up for a Discogs account
- Create an application under
Settings
>Developers
- Create a
.env
file in the root of your project and add your Discogs API credentials:
DISCOGS_API_KEY=<Your_Consumer_Key>
DISCOGS_API_SECRET=<Your_Consumer_Secret>
- Initialize dotenv with the
.env
file in your app before initializing DiscogsApiClient
import 'package:discogs_api_client/discogs_api_client.dart';
void main() async {
final client = DiscogsApiClient();
// Use the client to interact with the Discogs API
final artist = await client.artists.artists(108713); // Example artist ID
print(artist);
// Close the client when done
client.close();
}
final artist = await client.artists.artists(108713); // Example artist ID
print(artist);
final releases = await client.artists.artistReleases(108713); // Example artist ID
print(releases);
final searchResults = await client.search.search(query: 'Radiohead', type: 'artist');
print(searchResults);
final release = await client.releases.releases(249504); // Example release ID
print(release);
final label = await client.labels.labels(1); // Example label ID
print(label);
final master = await client.masters.masters(1000); // Example master ID
print(master);
This project includes unit tests for all clients. To run the tests, use the following command:
flutter test
-
Run all tests:
flutter test
-
Run a specific test file:
flutter test test/artist_client_test.dart
Contributions are welcome! If you find a bug or want to add a feature, please open an issue or submit a pull request.
- Fork the repository.
- Create a new branch in your own fork (
git checkout -b feature/YourFeatureName
). - Make sure you create test cases for your changes and test thoroughly. Include tests in your commit.
- Commit your changes to the new branch (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/YourFeatureName
). - Open a pull request in this repo.
This project is licensed under the MIT License. See the LICENSE file for details.
- Discogs API for providing the music database.
- Flutter for the awesome framework.