Skip to main content

PlatformService

Trait PlatformService 

Source
pub trait PlatformService: Send + Sync {
    // Required methods
    fn find_existing_pr<'life0, 'life1, 'async_trait>(
        &'life0 self,
        head_branch: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<PullRequest>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_pr_with_options<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        head: &'life1 str,
        base: &'life2 str,
        title: &'life3 str,
        draft: bool,
    ) -> Pin<Box<dyn Future<Output = Result<PullRequest>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn update_pr_base<'life0, 'life1, 'async_trait>(
        &'life0 self,
        pr_number: u64,
        new_base: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<PullRequest>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn publish_pr<'life0, 'async_trait>(
        &'life0 self,
        pr_number: u64,
    ) -> Pin<Box<dyn Future<Output = Result<PullRequest>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_pr_comments<'life0, 'async_trait>(
        &'life0 self,
        pr_number: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<PrComment>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn create_pr_comment<'life0, 'life1, 'async_trait>(
        &'life0 self,
        pr_number: u64,
        body: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_pr_comment<'life0, 'life1, 'async_trait>(
        &'life0 self,
        pr_number: u64,
        comment_id: u64,
        body: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn config(&self) -> &PlatformConfig;

    // Provided method
    fn create_pr<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        head: &'life1 str,
        base: &'life2 str,
        title: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<PullRequest>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
}
Expand description

Platform service trait for PR/MR operations

This trait abstracts GitHub and GitLab operations, allowing the same submission logic to work with either platform.

Required Methods§

Source

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

Find an existing open PR for a head branch

Source

fn create_pr_with_options<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, head: &'life1 str, base: &'life2 str, title: &'life3 str, draft: bool, ) -> Pin<Box<dyn Future<Output = Result<PullRequest>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Create a new PR with explicit draft option.

Implementors must provide this method. The default create_pr method delegates here with draft: false.

Source

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

Update the base branch of an existing PR

Source

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

Publish a draft PR (convert to ready for review)

Source

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

List comments on a PR

Source

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

Create a comment on a PR

Source

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

Update an existing comment on a PR

Source

fn config(&self) -> &PlatformConfig

Get the platform configuration

Provided Methods§

Source

fn create_pr<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, head: &'life1 str, base: &'life2 str, title: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<PullRequest>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Create a new PR with default options (non-draft).

This is a convenience method that delegates to create_pr_with_options with draft: false. Implementors should override create_pr_with_options, not this method.

Implementors§