0 purchases
crates api
Crates.io API Wrapper for Dart #
This wrapper lets you easily interact with the crates.io api.
Exposes all API types
Simple dart api
soon 100% API Coverage
Note: Before using this package you should read the Crates.io Package Policies.
Example #
See example/example.dart
import 'package:crates_api/crates_api.dart';
import 'package:crates_api/types/v1/error.dart';
void main() async {
var api = CratesAPI("crates_api.dart testing");
var versionR = api.crate("diesel").version("2.0.2");
try {
var versionMetadata = await versionR.metadata();
var versionDownloads = await versionR.downloads();
var checksum = versionMetadata.checksum;
print(
"Checksum of diesel version 2.0.2 $checksum",
);
var downloadEntry = versionDownloads[0];
var entryVersion = downloadEntry.version;
var entryDate = downloadEntry.date;
var entryDownloads = downloadEntry.downloads;
print(
"Version $entryVersion was downloaded $entryDownloads times on $entryDate");
} on APIException catch (e) {
print(e.errors.map((e) => e.detail));
}
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.