Struct consecrates::Client[][src]

pub struct Client { /* fields omitted */ }

API client abstraction.

Implementations

impl Client[src]

pub fn new(user_agent: &str) -> Self[src]

Creates a new client with the given user agent string.

User-agent requirement

crates.io requires the requests to include a user-agent header. Here are a few examples of proper user-agent strings you can use:

my_crawler (my_crawler.com/info)
my_crawler (help@my_crawler.com)
my_crawler (github.com/me/my_crawler)

pub fn new_with_base_url(base_url: &str, user_agent: &str) -> Self[src]

Creates a new client with the given base url and user agent string.

pub fn get_crates(&self, query: Query) -> Result<Crates>[src]

Gets a page of crates, using a set of query options.

pub fn try_get_crates(&self, query: Query) -> Result<Crates>[src]

Tries to get a page of crates, using a set of query options.

pub fn get_crate(&self, crate_id: &str) -> Result<Crate>[src]

Gets information about a particular crate.

pub fn try_get_crate(&self, crate_id: &str) -> Result<Crate>[src]

Tries to get information about a particular crate.

pub fn get_crate_version(
    &self,
    crate_id: &str,
    crate_version: &str
) -> Result<Version>
[src]

Gets crate information for a particular version of the given crate.

pub fn try_get_crate_version(
    &self,
    crate_id: &str,
    crate_version: &str
) -> Result<Version>
[src]

Tries to get crate information for a particular version of the given crate.

pub fn get_crate_downloads(&self, crate_id: &str) -> Result<Downloads>[src]

Gets information about the download stats for the given crate.

pub fn try_get_crate_downloads(&self, crate_id: &str) -> Result<Downloads>[src]

Tries to get information about the download stats for the given crate.

pub fn get_crate_dependencies(
    &self,
    crate_id: &str,
    crate_version: &str
) -> Result<Dependencies>
[src]

Gets a list of dependencies for a particular version of the given crate.

pub fn try_get_crate_dependencies(
    &self,
    crate_id: &str,
    crate_version: &str
) -> Result<Dependencies>
[src]

Tries to get a list of dependencies for a particular version of the given crate.

pub fn get_crate_owners(&self, crate_id: &str) -> Result<Owners>[src]

Gets information about the owners of the given crate.

pub fn try_get_crate_owners(&self, crate_id: &str) -> Result<Owners>[src]

Tries to get information about the owners of the given crate.

pub fn get_crate_authors(
    &self,
    crate_id: &str,
    crate_version: &str
) -> Result<Authors>
[src]

Gets information about the authors for a particular version of the given crate.

pub fn try_get_crate_authors(
    &self,
    crate_id: &str,
    crate_version: &str
) -> Result<Authors>
[src]

Tries to get information about the authors for a particular version of the given crate.

pub fn get_crate_readme(
    &self,
    crate_id: &str,
    crate_version: &str
) -> Result<String>
[src]

Gets the readme for a particular version of the given crate.

pub fn try_get_crate_readme(
    &self,
    crate_id: &str,
    crate_version: &str
) -> Result<String>
[src]

Tries to get the readme for a particular version of the given crate.

pub fn get_registry_summary(&self) -> Result<Summary>[src]

Gets registry-wide summary.

pub fn try_get_registry_summary(&self) -> Result<Summary>[src]

Tries to get registry-wide summary.

pub fn get_category(&self, query: Query) -> Result<Category>[src]

Gets information about a category.

Query details

This function accepts a Query object but can only use it's string or category fields.

pub fn try_get_category(&self, query: Query) -> Result<Category>[src]

Tries to get information about a category.

Query details

This function accepts a Query object but can only use it's string or category fields.

pub fn get_categories(&self, query: Query) -> Result<Categories>[src]

Gets a paged list of categories available with the registry.

Query details

This function accepts a Query object but can only use it's page and per_page fields.

pub fn try_get_categories(&self, query: Query) -> Result<Categories>[src]

Tries to get a paged list of categories available with the registry.

Query details

This function accepts a Query object but can only use it's page and per_page fields.

pub fn get_keyword(&self, query: Query) -> Result<Keyword>[src]

Gets information about a category.

Query details

This function accepts a Query object but can only use it's string or keyword fields.

pub fn try_get_keyword(&self, query: Query) -> Result<Keyword>[src]

Tries to get information about a category.

Query details

This function accepts a Query object but can only use it's string or keyword fields.

pub fn get_keywords(&self, query: Query) -> Result<Keywords>[src]

Gets a paged list of keywords used by crates within the registry.

Query details

This function accepts a Query object but can only use it's page and per_page fields.

pub fn try_get_keywords(&self, query: Query) -> Result<Keywords>[src]

Tries to get a paged list of keywords used by crates within the registry.

Query details

This function accepts a Query object but can only use it's page and per_page fields.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.