Skip to main content

HostingPlatform

Trait HostingPlatform 

Source
pub trait HostingPlatform: Send + Sync {
Show 21 methods // Required methods fn platform_type(&self) -> PlatformType; fn get_token<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, PlatformError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn create_pull_request<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, head: &'life3 str, base: &'life4 str, title: &'life5 str, body: Option<&'life6 str>, draft: bool, ) -> Pin<Box<dyn Future<Output = Result<PRCreateResult, PlatformError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, 'life6: 'async_trait; fn get_pull_request<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, pull_number: u64, ) -> Pin<Box<dyn Future<Output = Result<PullRequest, PlatformError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn update_pull_request_body<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, pull_number: u64, body: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<(), PlatformError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn merge_pull_request<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, pull_number: u64, method: Option<MergeMethod>, delete_branch: bool, ) -> Pin<Box<dyn Future<Output = Result<bool, PlatformError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn find_pr_by_branch<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, branch: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Option<PRCreateResult>, PlatformError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn is_pull_request_approved<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, pull_number: u64, ) -> Pin<Box<dyn Future<Output = Result<bool, PlatformError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_pull_request_reviews<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, pull_number: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<PRReview>, PlatformError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_status_checks<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, ref_name: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<StatusCheckResult, PlatformError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn get_allowed_merge_methods<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<AllowedMergeMethods, PlatformError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_pull_request_diff<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, pull_number: u64, ) -> Pin<Box<dyn Future<Output = Result<String, PlatformError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn parse_repo_url(&self, url: &str) -> Option<ParsedRepoInfo>; fn matches_url(&self, url: &str) -> bool; // Provided methods fn create_repository<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, owner: &'life1 str, name: &'life2 str, description: Option<&'life3 str>, private: bool, ) -> Pin<Box<dyn Future<Output = Result<String, PlatformError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait { ... } fn delete_repository<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, owner: &'life1 str, name: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), PlatformError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn update_branch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _owner: &'life1 str, _repo: &'life2 str, _pull_number: u64, ) -> Pin<Box<dyn Future<Output = Result<bool, PlatformError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn enable_auto_merge<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _owner: &'life1 str, _repo: &'life2 str, _pull_number: u64, _method: Option<MergeMethod>, ) -> Pin<Box<dyn Future<Output = Result<bool, PlatformError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn create_release<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>( &'life0 self, _owner: &'life1 str, _repo: &'life2 str, _tag: &'life3 str, _name: &'life4 str, _body: Option<&'life5 str>, _target_commitish: &'life6 str, _draft: bool, _prerelease: bool, ) -> Pin<Box<dyn Future<Output = Result<ReleaseResult, PlatformError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, 'life6: 'async_trait { ... } fn generate_linked_pr_comment(&self, links: &[LinkedPRRef]) -> String { ... } fn parse_linked_pr_comment(&self, body: &str) -> Vec<LinkedPRRef> { ... }
}
Expand description

Interface for hosting platform adapters Each platform (GitHub, GitLab, Azure DevOps) implements this trait

Required Methods§

Source

fn platform_type(&self) -> PlatformType

Platform type identifier

Source

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

Get authentication token for API calls

Source

fn create_pull_request<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, head: &'life3 str, base: &'life4 str, title: &'life5 str, body: Option<&'life6 str>, draft: bool, ) -> Pin<Box<dyn Future<Output = Result<PRCreateResult, PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, 'life6: 'async_trait,

Create a pull request

Source

fn get_pull_request<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, pull_number: u64, ) -> Pin<Box<dyn Future<Output = Result<PullRequest, PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get pull request details

Source

fn update_pull_request_body<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, pull_number: u64, body: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<(), PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Update pull request body

Source

fn merge_pull_request<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, pull_number: u64, method: Option<MergeMethod>, delete_branch: bool, ) -> Pin<Box<dyn Future<Output = Result<bool, PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Merge a pull request

Source

fn find_pr_by_branch<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, branch: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Option<PRCreateResult>, PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Find an open PR by branch name

Source

fn is_pull_request_approved<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, pull_number: u64, ) -> Pin<Box<dyn Future<Output = Result<bool, PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Check if PR is approved

Source

fn get_pull_request_reviews<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, pull_number: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<PRReview>, PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get reviews for a PR

Source

fn get_status_checks<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, ref_name: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<StatusCheckResult, PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Get CI/CD status checks for a commit

Source

fn get_allowed_merge_methods<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<AllowedMergeMethods, PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get allowed merge methods for a repository

Source

fn get_pull_request_diff<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, owner: &'life1 str, repo: &'life2 str, pull_number: u64, ) -> Pin<Box<dyn Future<Output = Result<String, PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get the diff for a pull request

Source

fn parse_repo_url(&self, url: &str) -> Option<ParsedRepoInfo>

Parse a git URL to extract owner/repo information

Source

fn matches_url(&self, url: &str) -> bool

Check if a URL belongs to this platform

Provided Methods§

Source

fn create_repository<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, owner: &'life1 str, name: &'life2 str, description: Option<&'life3 str>, private: bool, ) -> Pin<Box<dyn Future<Output = Result<String, PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Create a new repository on the platform

This is an optional operation - platforms may not support it or the user may not have permission. Returns the clone URL of the created repository.

Source

fn delete_repository<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, owner: &'life1 str, name: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete a repository from the platform

This is a destructive operation and should be used with caution. Mainly useful for testing cleanup.

Source

fn update_branch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _owner: &'life1 str, _repo: &'life2 str, _pull_number: u64, ) -> Pin<Box<dyn Future<Output = Result<bool, PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Update a pull request branch (merge base into head)

Returns Ok(true) if the branch was updated, Ok(false) if already up to date. Returns Err if the update failed (e.g., conflicts).

Source

fn enable_auto_merge<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _owner: &'life1 str, _repo: &'life2 str, _pull_number: u64, _method: Option<MergeMethod>, ) -> Pin<Box<dyn Future<Output = Result<bool, PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Enable auto-merge for a pull request

The PR will be automatically merged when all required checks pass. Returns Ok(true) if auto-merge was enabled.

Source

fn create_release<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>( &'life0 self, _owner: &'life1 str, _repo: &'life2 str, _tag: &'life3 str, _name: &'life4 str, _body: Option<&'life5 str>, _target_commitish: &'life6 str, _draft: bool, _prerelease: bool, ) -> Pin<Box<dyn Future<Output = Result<ReleaseResult, PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, 'life6: 'async_trait,

Create a release on the platform with a tag

Creates a git tag and a release (e.g., GitHub Release) on the repository. Returns the release URL and metadata.

Source

fn generate_linked_pr_comment(&self, links: &[LinkedPRRef]) -> String

Generate HTML comment for linked PR tracking

Source

fn parse_linked_pr_comment(&self, body: &str) -> Vec<LinkedPRRef>

Parse linked PR references from PR body

Implementors§