Client

Trait Client 

Source
pub trait Client: Send + Sync {
Show 19 methods // Required methods fn set_token(&mut self, token: &str) -> Result<(), Error>; fn set_proxy(&mut self, proxy: &str) -> Result<(), Error>; fn get_user_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<UserInfo, Error>> + 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, Error>> + 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, Error>> + 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, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_org_info<'life0, 'life1, 'async_trait>( &'life0 self, org_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<OrgInfo, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_org_repos<'life0, 'life1, 'async_trait>( &'life0 self, org_name: &'life1 str, options: Option<OrgRepoListOptions>, ) -> Pin<Box<dyn Future<Output = Result<Vec<RepoInfo>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_org_avatar_url<'life0, 'life1, 'async_trait>( &'life0 self, org_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + 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, Error>> + 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>, Error>> + 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>, Error>> + 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, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn get_commit_infos<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, repo_path: (&'life1 str, &'life2 str), option: Option<CommitListOptions>, ) -> Pin<Box<dyn Future<Output = Result<Vec<CommitInfo>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait; fn add_repo_collaborator<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo_path: (&'life1 str, &'life2 str), user_name: &'life3 str, permission: Option<CollaboratorPermission>, ) -> Pin<Box<dyn Future<Output = Result<CollaboratorResult, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn create_issue<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, repo_path: (&'life1 str, &'life2 str), title: &'life3 str, body: Option<&'life4 str>, option: Option<CreateIssueOptions>, ) -> Pin<Box<dyn Future<Output = Result<IssueInfo, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Self: 'async_trait; fn get_issue_info<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo_path: (&'life1 str, &'life2 str), issue_number: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<IssueInfo, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn get_issue_list<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, repo_path: (&'life1 str, &'life2 str), options: Option<IssueListOptions>, ) -> Pin<Box<dyn Future<Output = Result<Vec<IssueInfo>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait; fn update_issue<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo_path: (&'life1 str, &'life2 str), issue_number: &'life3 str, options: Option<UpdateIssueOptions>, ) -> Pin<Box<dyn Future<Output = Result<IssueInfo, Error>> + 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<(), Error>

设置访问令牌

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

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

设置代理

§参数
  • 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, Error>> + 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, Error>> + 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, Error>> + 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, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

获取指定用户贡献数据

Source

fn get_org_info<'life0, 'life1, 'async_trait>( &'life0 self, org_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<OrgInfo, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

获取组织信息

§参数
  • org_name - 组织名
Source

fn get_org_repos<'life0, 'life1, 'async_trait>( &'life0 self, org_name: &'life1 str, options: Option<OrgRepoListOptions>, ) -> Pin<Box<dyn Future<Output = Result<Vec<RepoInfo>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

获取组织仓库信息列表

§参数
Source

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

获取组织头像URL

§参数
  • org_name - 组织名
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, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

获取仓库信息

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

fn get_user_repos<'life0, 'async_trait>( &'life0 self, option: Option<ReposListOptions>, ) -> Pin<Box<dyn Future<Output = Result<Vec<RepoInfo>, Error>> + 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>, Error>> + 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, Error>> + 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, 默认为最新提交
Source

fn get_commit_infos<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, repo_path: (&'life1 str, &'life2 str), option: Option<CommitListOptions>, ) -> Pin<Box<dyn Future<Output = Result<Vec<CommitInfo>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

获取仓库所有提交信息

§参数
  • repo_path - 仓库路径,格式为 (owner, repo)
  • option - 获取提交列表选项, 详见 CommitListOptions
Source

fn add_repo_collaborator<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo_path: (&'life1 str, &'life2 str), user_name: &'life3 str, permission: Option<CollaboratorPermission>, ) -> Pin<Box<dyn Future<Output = Result<CollaboratorResult, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

添加仓库协作者, 如果仓库属于某个组织下的则为外部协作者

§参数
  • repo_path - 仓库路径,格式为 (owner, repo)
  • user_name - 协作者用户名
  • permission - 协作者权限, 默认为 Pull, 可选值为 Admin, Push, Pull
Source

fn create_issue<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, repo_path: (&'life1 str, &'life2 str), title: &'life3 str, body: Option<&'life4 str>, option: Option<CreateIssueOptions>, ) -> Pin<Box<dyn Future<Output = Result<IssueInfo, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Self: 'async_trait,

创建一个issue

§参数
  • repo_path - 仓库路径,格式为 (owner, repo)
  • title - issue标题
  • body - issue内容
  • option - 创建issue选项, 详见 CreateIssueOptions
Source

fn get_issue_info<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo_path: (&'life1 str, &'life2 str), issue_number: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<IssueInfo, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

获取issue信息

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

fn get_issue_list<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, repo_path: (&'life1 str, &'life2 str), options: Option<IssueListOptions>, ) -> Pin<Box<dyn Future<Output = Result<Vec<IssueInfo>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

获取仓库所有issue信息

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

fn update_issue<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo_path: (&'life1 str, &'life2 str), issue_number: &'life3 str, options: Option<UpdateIssueOptions>, ) -> Pin<Box<dyn Future<Output = Result<IssueInfo, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

更新issue信息

§参数
  • repo_path - 仓库路径,格式为 (owner, repo)
  • issue_number - issue编号
  • options - 更新issue选项, 详见 UpdateIssueOptions

Implementors§