Skip to main content

PrProvider

Trait PrProvider 

Source
pub trait PrProvider:
    Debug
    + Send
    + Sync {
    // Required methods
    fn create<'life0, 'async_trait>(
        &'life0 self,
        args: CreatePrArgs,
    ) -> Pin<Box<dyn Future<Output = Result<PrData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list<'life0, 'async_trait>(
        &'life0 self,
        args: ListPrArgs,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<PrData>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn view<'life0, 'async_trait>(
        &'life0 self,
        number: u64,
    ) -> Pin<Box<dyn Future<Output = Result<PrData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn close<'life0, 'async_trait>(
        &'life0 self,
        number: u64,
    ) -> Pin<Box<dyn Future<Output = Result<PrData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn reopen<'life0, 'async_trait>(
        &'life0 self,
        number: u64,
    ) -> Pin<Box<dyn Future<Output = Result<PrData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn comment<'life0, 'life1, 'async_trait>(
        &'life0 self,
        number: u64,
        body: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<CommentData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn merge<'life0, 'async_trait>(
        &'life0 self,
        number: u64,
        strategy: Option<MergeStrategy>,
    ) -> Pin<Box<dyn Future<Output = Result<MergeResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn checkout<'life0, 'async_trait>(
        &'life0 self,
        number: u64,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn mark_ready<'life0, 'async_trait>(
        &'life0 self,
        number: u64,
    ) -> Pin<Box<dyn Future<Output = Result<PrData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn mark_wip<'life0, 'async_trait>(
        &'life0 self,
        number: u64,
    ) -> Pin<Box<dyn Future<Output = Result<PrData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn sync_branch<'life0, 'async_trait>(
        &'life0 self,
        number: u64,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

PR 操作的平台抽象。

所有平台实现(GitHub/GitLab/GitCode)都必须实现此 trait, 以提供统一的 PR 创建、列表、查看、关闭、合并、检出等能力。

§Errors

所有方法在平台调用失败、反序列化失败或鉴权失败时返回 CoreError。

Required Methods§

Source

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

创建一条新 PR,返回平台生成的完整数据。

§Errors

当平台 API 调用失败或参数非法时返回错误。

Source

fn list<'life0, 'async_trait>( &'life0 self, args: ListPrArgs, ) -> Pin<Box<dyn Future<Output = Result<Vec<PrData>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

根据过滤条件列出 PR 列表。

§Errors

当平台 API 调用失败或过滤条件非法时返回错误。

Source

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

查看指定编号的 PR 详情。

§Errors

当 PR 不存在或平台 API 调用失败时返回错误。

Source

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

关闭指定编号的 PR,返回更新后的数据。

§Errors

当 PR 不存在或平台 API 调用失败时返回错误。

Source

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

重新打开指定编号的 PR,返回更新后的数据。

§Errors

当 PR 不存在或平台 API 调用失败时返回错误。

Source

fn comment<'life0, 'life1, 'async_trait>( &'life0 self, number: u64, body: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<CommentData>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

在指定 PR 上添加评论,返回新建评论的数据。

§Errors

当 PR 不存在、body 为空或平台 API 调用失败时返回错误。

Source

fn merge<'life0, 'async_trait>( &'life0 self, number: u64, strategy: Option<MergeStrategy>, ) -> Pin<Box<dyn Future<Output = Result<MergeResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

合并指定编号的 PR,返回合并结果。

strategy 指定合并策略(merge/squash/rebase)。 未指定时使用平台默认策略。

§Errors

当 PR 不存在、无法合并或平台 API 调用失败时返回错误。

Source

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

在本地检出指定 PR 的分支。

§Errors

当 PR 不存在或 git 操作失败时返回错误。

Source

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

将草稿 PR 标记为可审查状态(ready for review)。

§Errors

当 PR 不存在、不是草稿或平台 API 调用失败时返回错误。

Source

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

将 PR 标记为草稿状态(work in progress)。

§Errors

当 PR 不存在或平台 API 调用失败时返回错误。

Source

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

同步 PR 分支(将 base 分支的最新变更合入 head 分支)。

§Errors

当 PR 不存在或同步失败时返回错误。

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§