subspace-client-github 0.1.0

Subspace Framework GitHub client: REST and GraphQL types and requests. Internal crate; apps depend on `subspace-framework`.
Documentation
//! GitHub Actions, deployments and releases REST client.
//!
//! Calls are synchronous and bounded. Dashboard callers run them off the UI
//! thread. Workflow YAML parsing is pure and reports unsupported or malformed
//! definitions as [`Definition::Unreadable`].

mod client;
mod definition;
mod model;
mod request;
mod workflow;

pub use definition::{match_job_dependencies, parse_workflow_definition};
pub use model::*;

/// GitHub Actions operations using the shared client's credentials and transport.
pub trait ActionsApi {
    fn actions_workflows(
        &self,
        login: &str,
        repo: &str,
    ) -> Result<Page<Workflow>, subspace_core::http::Error>;
    fn actions_runs(
        &self,
        login: &str,
        repo: &str,
        filters: &RunFilters,
    ) -> Result<Page<WorkflowRun>, subspace_core::http::Error>;
    fn actions_run(
        &self,
        login: &str,
        repo: &str,
        run_id: u64,
    ) -> Result<WorkflowRun, subspace_core::http::Error>;
    fn actions_jobs(
        &self,
        login: &str,
        repo: &str,
        run_id: u64,
    ) -> Result<Page<Job>, subspace_core::http::Error>;
    fn actions_job_log(
        &self,
        login: &str,
        repo: &str,
        job_id: u64,
    ) -> Result<JobLog, subspace_core::http::Error>;
    fn actions_workflow_definition(
        &self,
        login: &str,
        repo: &str,
        sha: &str,
        path: &str,
    ) -> Result<Definition<WorkflowDefinition>, subspace_core::http::Error>;
    fn actions_pending_deployments(
        &self,
        login: &str,
        repo: &str,
        run_id: u64,
    ) -> Result<Vec<PendingDeployment>, subspace_core::http::Error>;
    fn actions_environments(
        &self,
        login: &str,
        repo: &str,
    ) -> Result<Page<Environment>, subspace_core::http::Error>;
    fn actions_deployments(
        &self,
        login: &str,
        repo: &str,
        environment: Option<&str>,
    ) -> Result<Page<Deployment>, subspace_core::http::Error>;
    fn actions_latest_deployment(
        &self,
        login: &str,
        repo: &str,
        environment: &str,
    ) -> Result<Option<Deployment>, subspace_core::http::Error> {
        self.actions_deployments(login, repo, Some(environment))
            .map(|page| page.items.into_iter().next())
    }
    fn actions_releases(
        &self,
        login: &str,
        repo: &str,
    ) -> Result<Page<Release>, subspace_core::http::Error>;
    fn actions_tags(
        &self,
        login: &str,
        repo: &str,
    ) -> Result<Page<TagRef>, subspace_core::http::Error>;
    fn dispatch_workflow(
        &self,
        login: &str,
        request: &DispatchRequest<'_>,
    ) -> Result<(), subspace_core::http::Error>;
    fn rerun_workflow(
        &self,
        login: &str,
        repo: &str,
        run_id: u64,
    ) -> Result<(), subspace_core::http::Error>;
    fn rerun_failed_jobs(
        &self,
        login: &str,
        repo: &str,
        run_id: u64,
    ) -> Result<(), subspace_core::http::Error>;
    fn cancel_workflow(
        &self,
        login: &str,
        repo: &str,
        run_id: u64,
    ) -> Result<(), subspace_core::http::Error>;
    fn review_pending_deployments(
        &self,
        login: &str,
        request: &ReviewPendingRequest<'_>,
    ) -> Result<(), subspace_core::http::Error>;
}

#[cfg(test)]
mod tests;