Skip to main content

ReleaseProvider

Trait ReleaseProvider 

Source
pub trait ReleaseProvider:
    Debug
    + Send
    + Sync {
    // Required methods
    fn create<'life0, 'async_trait>(
        &'life0 self,
        args: CreateReleaseArgs,
    ) -> Pin<Box<dyn Future<Output = Result<ReleaseData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list<'life0, 'async_trait>(
        &'life0 self,
        limit: Option<u32>,
    ) -> Pin<Box<dyn Future<Output = Result<Paged<ReleaseData>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn view<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tag_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<ReleaseData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn edit<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tag_name: &'life1 str,
        args: CreateReleaseArgs,
    ) -> Pin<Box<dyn Future<Output = Result<ReleaseData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn upload_asset<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        tag_name: &'life1 str,
        file_path: &'life2 str,
        asset_name: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn download_asset<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        tag_name: &'life1 str,
        asset_name: &'life2 str,
        dest_path: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tag_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Release 操作的平台抽象。

所有平台实现(GitHub/GitLab/GitCode)都必须实现此 trait, 以提供统一的 Release 创建、列表、查看、编辑、资源上传/下载 及删除能力。

§Errors

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

Required Methods§

Source

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

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

§Errors

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

Source

fn list<'life0, 'async_trait>( &'life0 self, limit: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Paged<ReleaseData>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

列出仓库的 Release。

limit 为 None 时取至 crate::paging::DEFAULT_LIST_LIMIT。 返回的 Paged 携带截断标志。

§Errors

当平台 API 调用失败时返回错误。

Source

fn view<'life0, 'life1, 'async_trait>( &'life0 self, tag_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ReleaseData>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

查看指定 tag 的 Release 详情。

§Errors

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

Source

fn edit<'life0, 'life1, 'async_trait>( &'life0 self, tag_name: &'life1 str, args: CreateReleaseArgs, ) -> Pin<Box<dyn Future<Output = Result<ReleaseData>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

编辑指定 Release 的元数据,返回更新后的数据。

§Errors

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

Source

fn upload_asset<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, tag_name: &'life1 str, file_path: &'life2 str, asset_name: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

上传资源文件到指定 Release。

file_path 为本地文件路径,asset_name 为在 Release 中显示的资源名。

§Errors

当 Release 不存在、文件读取失败或平台 API 调用失败时返回错误。

Source

fn download_asset<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, tag_name: &'life1 str, asset_name: &'life2 str, dest_path: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

下载指定 Release 的资源文件到本地路径。

§Errors

当 Release 不存在、资源不存在或写入失败时返回错误。

Source

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

删除指定 Release。

§Errors

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

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§