Struct crates_io_api::SyncClient[][src]

pub struct SyncClient { /* fields omitted */ }
Expand description

A synchronous client for the crates.io API.

Implementations

Instantiate a new client.

To respect the offical Crawler Policy, you must specify both a descriptive user agent and a rate limit interval.

At most one request will be executed in the specified duration. The guidelines suggest 1 per second or less.

Example user agent: "my_bot (my_bot.com/info)" or "my_bot (help@my_bot.com)".

let client = crates_io_api::AsyncClient::new(
  "my_bot (help@my_bot.com)",
  std::time::Duration::from_millis(1000),
)?;

Retrieve a summary containing crates.io wide information.

Retrieve information of a crate.

If you require detailed information, consider using full_crate.

Retrieve download stats for a crate.

Retrieve the owners of a crate.

Load all reverse dependencies of a crate.

Note: Since the reverse dependency endpoint requires pagination, this will result in multiple requests if the crate has more than 100 reverse dependencies.

Retrieve the authors for a crate version.

Retrieve the dependencies of a crate version.

Retrieve all available information for a crate, including download stats, owners and reverse dependencies.

The all_versions argument controls the retrieval of detailed version information. If false, only the data for the latest version will be fetched, if true, detailed information for all versions will be available.

Note: Each version requires two extra requests.

Retrieve a page of crates, optionally constrained by a query.

If you want to get all results without worrying about paging, use [all_crates].

Examples

Retrieve the first page of results for the query “api”, with 100 items per page and sorted alphabetically.


client.crates(ListOptions{
  sort: Sort::Alphabetical,
  per_page: 100,
  page: 1,
  query: Some("api".to_string()),
})?;

Retrieve all crates, optionally constrained by a query.

Note: This method fetches all pages of the result. This can result in a lot queries (100 results per query).

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more