Skip to main content

RepologyClient

Struct RepologyClient 

Source
pub struct RepologyClient { /* private fields */ }
Expand description

Async client for the Repology API.

Constructed via RepologyClient::new or RepologyClient::builder. Enforces rate limiting (1 request/sec by default) as required by the Repology API policy.

Implementations§

Source§

impl RepologyClient

Source

pub fn new() -> Result<Self>

Create a new client with default settings.

Uses a User-Agent of repology-rs/{version}, the default base URL, and 1 request/sec rate limiting.

§Examples
let client = repology::RepologyClient::new()?;
Source§

impl RepologyClient

Source

pub fn builder() -> RepologyClientBuilder

Create a client with custom configuration.

§Examples
let client = repology::RepologyClient::builder()
    .user_agent("my-app/1.0 (https://github.com/me/my-app)")
    .build()?;
Source§

impl RepologyClient

Source

pub async fn project(&self, name: &str) -> Result<Vec<Package>>

Fetch all packages for a single project by name.

Source

pub async fn projects( &self, filter: &ProjectFilter, ) -> Result<HashMap<String, Vec<Package>>>

Fetch all projects matching the given filter, automatically paginating through every page.

For large result sets, prefer projects_iter to avoid loading everything into memory at once.

Source

pub fn projects_iter<'a>( &'a self, filter: &'a ProjectFilter, ) -> Pin<Box<dyn Stream<Item = Result<(String, Vec<Package>)>> + 'a>>

Returns a Stream that automatically paginates through all projects matching the given filter, yielding (project_name, packages) pairs.

Uses projects_page under the hood.

Source

pub async fn projects_page( &self, filter: &ProjectFilter, cursor: Option<&str>, ) -> Result<HashMap<String, Vec<Package>>>

Fetch a single page of projects (up to ~200).

Pass None for the first page, then pass the last project name from the previous page as the cursor to get the next page.

Source

pub async fn repository_problems( &self, repository: &str, ) -> Result<Vec<Problem>>

Fetch all problems for a repository, automatically paginating.

For large result sets, prefer repository_problems_iter.

Source

pub fn repository_problems_iter<'a>( &'a self, repository: &'a str, ) -> Pin<Box<dyn Stream<Item = Result<Problem>> + 'a>>

Returns a Stream that automatically paginates through all problems for a repository.

Uses repository_problems_page under the hood.

Source

pub async fn repository_problems_page( &self, repository: &str, cursor: Option<&str>, ) -> Result<Vec<Problem>>

Fetch a single page of problems for a repository.

Pass None for the first page, then pass the last project_name from the previous page as the cursor to get the next page.

Source

pub async fn maintainer_problems( &self, maintainer: &str, repository: &str, ) -> Result<Vec<Problem>>

Fetch all problems for a maintainer in a repository, automatically paginating.

For large result sets, prefer maintainer_problems_iter.

Source

pub fn maintainer_problems_iter<'a>( &'a self, maintainer: &'a str, repository: &'a str, ) -> Pin<Box<dyn Stream<Item = Result<Problem>> + 'a>>

Returns a Stream that automatically paginates through all problems for a maintainer in a repository.

Uses maintainer_problems_page under the hood.

Source

pub async fn maintainer_problems_page( &self, maintainer: &str, repository: &str, cursor: Option<&str>, ) -> Result<Vec<Problem>>

Fetch a single page of problems for a maintainer in a repository.

Pass None for the first page, then pass the last project_name from the previous page as the cursor to get the next page.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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