Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adamsky/consecrates
Tiny but virtuous crates.io client
https://github.com/adamsky/consecrates
api client crates-io
Last synced: 26 days ago
JSON representation
Tiny but virtuous crates.io client
- Host: GitHub
- URL: https://github.com/adamsky/consecrates
- Owner: adamsky
- License: mit
- Created: 2021-02-12T22:52:47.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-10-15T21:29:49.000Z (3 months ago)
- Last Synced: 2024-11-20T19:49:44.850Z (about 2 months ago)
- Topics: api, client, crates-io
- Language: Rust
- Homepage:
- Size: 19.5 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# consecrates
Tiny but virtuous [crates.io](https://crates.io) API client.
The main aim of this library is to provide an easy way to query crates
information without bringing in too many dependencies.It's loosely modeled after the
[crates_io_api](https://crates.io/crates/crates_io_api) crate. Main differences
include:
- about 70% cut in the number of dependencies
- no async
- no multi-request client methods like `full_crate` or
`all_crates`
- ability to use `category` and `keyword` specifiers for querying crates
- ability to convert simple string composite queries such as
`api category=web keyword=crates sort=update` into valid query objects## Using
Paste the following into your project's `Cargo.toml` file:
```toml
consecrates = "0.1.1"
```Create a new client and issue a query:
```rust,no_run
let client = Client::new("my_app (github.com/me/me_app)");
let crates = client
.get_crates(Query {
string: Some("net".to_string()),
category: Some(Category::GameDevelopment),
sort: Some(Sorting::RecentUpdates),
..Default::default()
})
.expect("failed getting crates");
println!("{:?}", crates);
```## Crawler policy
Please consult the
[official crawler policy](https://crates.io/policies#crawlers) before using
this library. Rate limiting is fixed at the lowest tolerated value. When
creating a client you will need to input a proper user-agent string.