Skip to main content

IssueProvider

Trait IssueProvider 

Source
pub trait IssueProvider:
    Debug
    + Send
    + Sync {
    // Required methods
    fn create<'life0, 'async_trait>(
        &'life0 self,
        args: CreateIssueArgs,
    ) -> Pin<Box<dyn Future<Output = Result<IssueData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list<'life0, 'async_trait>(
        &'life0 self,
        args: ListIssueArgs,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<IssueData>>> + 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<IssueData>> + 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<IssueData>> + 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<IssueData>> + 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 add_labels<'life0, 'life1, 'async_trait>(
        &'life0 self,
        number: u64,
        labels: &'life1 [String],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn remove_label<'life0, 'life1, 'async_trait>(
        &'life0 self,
        number: u64,
        label: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Issue 操作的平台抽象。

所有平台实现(GitHub/GitLab/GitCode)都必须实现此 trait, 以提供统一的 Issue 创建、列表、查看、关闭、评论及标签管理能力。

§Errors

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

Required Methods§

Source

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

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

§Errors

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

Source

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

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

§Errors

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

Source

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

查看指定编号的 Issue 详情。

§Errors

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

Source

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

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

§Errors

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

Source

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

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

§Errors

当 Issue 不存在或平台 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,

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

§Errors

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

Source

fn add_labels<'life0, 'life1, 'async_trait>( &'life0 self, number: u64, labels: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

为指定 Issue 添加标签。

§Errors

当 Issue 不存在、标签列表为空或平台 API 调用失败时返回错误。

Source

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

从指定 Issue 移除一个标签。

§Errors

当 Issue 不存在、标签不存在或平台 API 调用失败时返回错误。

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§