crates_api 1.0.0 copy "crates_api: ^1.0.0" to clipboard
crates_api: ^1.0.0 copied to clipboard

Simple Dart package to access the crates.io api.

pub package package publisher

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));
  }
}
0
likes
100
pub points
0%
popularity

Publisher

unverified uploader

Simple Dart package to access the crates.io api.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

http, json_annotation

More

Packages that depend on crates_api