Skip to main content

Provider

Trait Provider 

Source
pub trait Provider: Send + Sync {
    // Required methods
    fn kind(&self) -> ProviderKind;
    fn display_name(&self) -> &str;
    fn validate_credentials<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_username<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_organizations<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Org>, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_org_repos<'life0, 'life1, 'async_trait>(
        &'life0 self,
        org: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Repo>, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_user_repos<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Repo>, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_rate_limit<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<RateLimitInfo, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn discover_repos<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        options: &'life1 DiscoveryOptions,
        progress: &'life2 dyn DiscoveryProgress,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedRepo>, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_clone_url(&self, repo: &Repo, prefer_ssh: bool) -> String;
}
Expand description

The core trait that all providers must implement.

This trait defines the interface for interacting with Git hosting providers like GitHub, GitLab, and Bitbucket.

Required Methods§

Source

fn kind(&self) -> ProviderKind

Returns the provider kind (GitHub, GitLab, etc.).

Source

fn display_name(&self) -> &str

Returns the display name for this provider instance.

Source

fn validate_credentials<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Validates that the credentials are valid.

Source

fn get_username<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the authenticated user’s username.

Source

fn get_organizations<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Org>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetches all organizations the user belongs to.

Source

fn get_org_repos<'life0, 'life1, 'async_trait>( &'life0 self, org: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Repo>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetches all repositories for a specific organization.

Source

fn get_user_repos<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Repo>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetches the user’s personal repositories (not org repos).

Source

fn get_rate_limit<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<RateLimitInfo, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns current rate limit information.

Source

fn discover_repos<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, options: &'life1 DiscoveryOptions, progress: &'life2 dyn DiscoveryProgress, ) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedRepo>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

High-level discovery that returns all repos with filtering.

Source

fn get_clone_url(&self, repo: &Repo, prefer_ssh: bool) -> String

Returns the clone URL for a repo (SSH or HTTPS based on preference).

Implementors§