Skip to main content

ReviewProvider

Trait ReviewProvider 

Source
pub trait ReviewProvider:
    Debug
    + Send
    + Sync {
    // Required methods
    fn comment<'life0, 'life1, 'async_trait>(
        &'life0 self,
        pr_number: u64,
        body: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<ReviewData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn approve<'life0, 'life1, 'async_trait>(
        &'life0 self,
        pr_number: u64,
        body: Option<&'life1 str>,
    ) -> Pin<Box<dyn Future<Output = Result<ReviewData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn request_changes<'life0, 'life1, 'async_trait>(
        &'life0 self,
        pr_number: u64,
        body: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<ReviewData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn submit_review<'life0, 'life1, 'async_trait>(
        &'life0 self,
        pr_number: u64,
        event: ReviewState,
        body: Option<&'life1 str>,
    ) -> Pin<Box<dyn Future<Output = Result<ReviewData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Review 操作的平台抽象。

所有平台实现(GitHub/GitLab/GitCode)都必须实现此 trait, 以提供统一的代码审查评论、批准、要求修改及提交审查能力。

§Errors

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

Required Methods§

Source

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

在指定 PR 上发表评论。

§Errors

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

Source

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

批准指定 PR。

body 为可选的批准说明。

§Errors

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

Source

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

要求对指定 PR 进行修改。

body 为修改要求的说明。

§Errors

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

Source

fn submit_review<'life0, 'life1, 'async_trait>( &'life0 self, pr_number: u64, event: ReviewState, body: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<ReviewData>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

提交一次完整的 Review。

event 指定提交的最终结论(批准/要求修改/仅评论), body 为可选的总结说明。

§Errors

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

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§