Client

Trait Client 

Source
pub trait Client: Send + Sync {
    // Required methods
    fn set_token(&mut self, token: &str) -> Result<(), CoreError>;
    fn set_proxy(&mut self, proxy: &str) -> Result<(), CoreError>;
    fn get_user_info<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<UserInfo, CoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn get_user_info_with_name<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<UserInfo, CoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn get_user_avatar_url<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<String, CoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn get_user_contribution<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<ContributionResult, CoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn get_repo_info<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        repo_path: (&'life1 str, &'life2 str),
    ) -> Pin<Box<dyn Future<Output = Result<RepoInfo, CoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn get_default_branch<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        repo_path: (&'life1 str, &'life2 str),
        use_token: Option<bool>,
    ) -> Pin<Box<dyn Future<Output = Result<String, CoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn get_user_repos<'life0, 'async_trait>(
        &'life0 self,
        option: Option<ReposListOptions>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<RepoInfo>, CoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn get_user_repos_with_name<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_name: &'life1 str,
        option: Option<ReposListOptions>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<RepoInfo>, CoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn get_commit_info<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        repo_path: (&'life1 str, &'life2 str),
        sha: Option<&'life3 str>,
    ) -> Pin<Box<dyn Future<Output = Result<CommitInfo, CoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             Self: 'async_trait;
}

Required Methods§

Source

fn set_token(&mut self, token: &str) -> Result<(), CoreError>

设置token

§参数
  • token - token
§示例
client.set_token("token").unwrap();
Source

fn set_proxy(&mut self, proxy: &str) -> Result<(), CoreError>

设置代理

§参数
  • proxy - 代理字符串
§示例
client.set_proxy("http://127.0.0.1:7890").unwrap();
Source

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

获取当前授权用户信息

Source

fn get_user_info_with_name<'life0, 'life1, 'async_trait>( &'life0 self, user_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<UserInfo, CoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

根据用户名获取用户信息

§参数
  • user_name - 用户名
Source

fn get_user_avatar_url<'life0, 'life1, 'async_trait>( &'life0 self, user_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, CoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

获取用户头像URL

§参数
  • user_name - 用户名
Source

fn get_user_contribution<'life0, 'life1, 'async_trait>( &'life0 self, user_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ContributionResult, CoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

获取指定用户贡献数据

Source

fn get_repo_info<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, repo_path: (&'life1 str, &'life2 str), ) -> Pin<Box<dyn Future<Output = Result<RepoInfo, CoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

获取仓库信息

§参数
  • repo_path - 仓库路径,格式为 (owner, repo)
Source

fn get_default_branch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, repo_path: (&'life1 str, &'life2 str), use_token: Option<bool>, ) -> Pin<Box<dyn Future<Output = Result<String, CoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

获取仓库默认分支

§参数
  • repo_path - 仓库路径,格式为 (owner, repo)
  • use_token - 是否使用token获取仓库默认分支, 默认为 false
§说明
  • use_tokentrue 时, 会走OPENAPI获取仓库默认分支, 否则走WEBAPI获取仓库默认分支
Source

fn get_user_repos<'life0, 'async_trait>( &'life0 self, option: Option<ReposListOptions>, ) -> Pin<Box<dyn Future<Output = Result<Vec<RepoInfo>, CoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

获取用户仓库信息列表

§参数
Source

fn get_user_repos_with_name<'life0, 'life1, 'async_trait>( &'life0 self, user_name: &'life1 str, option: Option<ReposListOptions>, ) -> Pin<Box<dyn Future<Output = Result<Vec<RepoInfo>, CoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

根据用户名获取用户仓库信息列表

§参数
  • user_name - 用户名
  • option - 获取仓库列表选项, 详见 ReposListOptions
Source

fn get_commit_info<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo_path: (&'life1 str, &'life2 str), sha: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<CommitInfo, CoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

获取仓库提交信息

§参数
  • repo_path - 仓库路径,格式为 (owner, repo)
  • sha - 提交ID, 默认为最新提交

Implementors§