//! Method, error and parameter types for the Actions endpoint.
#![allow(
clippy::all
)]
/*
* GitHub v3 REST API
*
* GitHub's v3 REST API.
*
* OpenAPI spec version: 1.1.4
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
use serde::Deserialize;
use roctokit::adapters::{AdapterError, Client, GitHubRequest, GitHubResponseExt};
use crate::models::*;
use super::PerPage;
use std::collections::HashMap;
use serde_json::value::Value;
pub struct Actions<'api, C: Client> where AdapterError: From<<C as Client>::Err> {
client: &'api C
}
pub fn new<C: Client>(client: &C) -> Actions<C> where AdapterError: From<<C as Client>::Err> {
Actions { client }
}
/// Errors for the [Add custom labels to a self-hosted runner for an organization](Actions::add_custom_labels_to_self_hosted_runner_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsAddCustomLabelsToSelfHostedRunnerForOrgError {
#[error("Resource not found")]
Status404(BasicError),
#[error("Validation failed, or the endpoint has been spammed.")]
Status422(ValidationErrorSimple),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsAddCustomLabelsToSelfHostedRunnerForOrgError> for AdapterError {
fn from(err: ActionsAddCustomLabelsToSelfHostedRunnerForOrgError) -> Self {
let (description, status_code) = match err {
ActionsAddCustomLabelsToSelfHostedRunnerForOrgError::Status404(_) => (String::from("Resource not found"), 404),
ActionsAddCustomLabelsToSelfHostedRunnerForOrgError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
ActionsAddCustomLabelsToSelfHostedRunnerForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Add custom labels to a self-hosted runner for a repository](Actions::add_custom_labels_to_self_hosted_runner_for_repo_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsAddCustomLabelsToSelfHostedRunnerForRepoError {
#[error("Resource not found")]
Status404(BasicError),
#[error("Validation failed, or the endpoint has been spammed.")]
Status422(ValidationErrorSimple),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsAddCustomLabelsToSelfHostedRunnerForRepoError> for AdapterError {
fn from(err: ActionsAddCustomLabelsToSelfHostedRunnerForRepoError) -> Self {
let (description, status_code) = match err {
ActionsAddCustomLabelsToSelfHostedRunnerForRepoError::Status404(_) => (String::from("Resource not found"), 404),
ActionsAddCustomLabelsToSelfHostedRunnerForRepoError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
ActionsAddCustomLabelsToSelfHostedRunnerForRepoError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Add repository access to a self-hosted runner group in an organization](Actions::add_repo_access_to_self_hosted_runner_group_in_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgError> for AdapterError {
fn from(err: ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgError) -> Self {
let (description, status_code) = match err {
ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Add selected repository to an organization secret](Actions::add_selected_repo_to_org_secret_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsAddSelectedRepoToOrgSecretError {
#[error("Conflict when visibility type is not set to selected")]
Status409,
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsAddSelectedRepoToOrgSecretError> for AdapterError {
fn from(err: ActionsAddSelectedRepoToOrgSecretError) -> Self {
let (description, status_code) = match err {
ActionsAddSelectedRepoToOrgSecretError::Status409 => (String::from("Conflict when visibility type is not set to selected"), 409),
ActionsAddSelectedRepoToOrgSecretError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Add selected repository to an organization variable](Actions::add_selected_repo_to_org_variable_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsAddSelectedRepoToOrgVariableError {
#[error("Response when the visibility of the variable is not set to `selected`")]
Status409,
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsAddSelectedRepoToOrgVariableError> for AdapterError {
fn from(err: ActionsAddSelectedRepoToOrgVariableError) -> Self {
let (description, status_code) = match err {
ActionsAddSelectedRepoToOrgVariableError::Status409 => (String::from("Response when the visibility of the variable is not set to `selected`"), 409),
ActionsAddSelectedRepoToOrgVariableError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Add a self-hosted runner to a group for an organization](Actions::add_self_hosted_runner_to_group_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsAddSelfHostedRunnerToGroupForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsAddSelfHostedRunnerToGroupForOrgError> for AdapterError {
fn from(err: ActionsAddSelfHostedRunnerToGroupForOrgError) -> Self {
let (description, status_code) = match err {
ActionsAddSelfHostedRunnerToGroupForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Approve a workflow run for a fork pull request](Actions::approve_workflow_run_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsApproveWorkflowRunError {
#[error("Resource not found")]
Status404(BasicError),
#[error("Forbidden")]
Status403(BasicError),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsApproveWorkflowRunError> for AdapterError {
fn from(err: ActionsApproveWorkflowRunError) -> Self {
let (description, status_code) = match err {
ActionsApproveWorkflowRunError::Status404(_) => (String::from("Resource not found"), 404),
ActionsApproveWorkflowRunError::Status403(_) => (String::from("Forbidden"), 403),
ActionsApproveWorkflowRunError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Cancel a workflow run](Actions::cancel_workflow_run_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsCancelWorkflowRunError {
#[error("Conflict")]
Status409(BasicError),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsCancelWorkflowRunError> for AdapterError {
fn from(err: ActionsCancelWorkflowRunError) -> Self {
let (description, status_code) = match err {
ActionsCancelWorkflowRunError::Status409(_) => (String::from("Conflict"), 409),
ActionsCancelWorkflowRunError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Create an environment variable](Actions::create_environment_variable_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsCreateEnvironmentVariableError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsCreateEnvironmentVariableError> for AdapterError {
fn from(err: ActionsCreateEnvironmentVariableError) -> Self {
let (description, status_code) = match err {
ActionsCreateEnvironmentVariableError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Create a GitHub-hosted runner for an organization](Actions::create_hosted_runner_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsCreateHostedRunnerForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsCreateHostedRunnerForOrgError> for AdapterError {
fn from(err: ActionsCreateHostedRunnerForOrgError) -> Self {
let (description, status_code) = match err {
ActionsCreateHostedRunnerForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Create or update an environment secret](Actions::create_or_update_environment_secret_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsCreateOrUpdateEnvironmentSecretError {
#[error("Response when updating a secret")]
Status204,
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsCreateOrUpdateEnvironmentSecretError> for AdapterError {
fn from(err: ActionsCreateOrUpdateEnvironmentSecretError) -> Self {
let (description, status_code) = match err {
ActionsCreateOrUpdateEnvironmentSecretError::Status204 => (String::from("Response when updating a secret"), 204),
ActionsCreateOrUpdateEnvironmentSecretError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Create or update an organization secret](Actions::create_or_update_org_secret_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsCreateOrUpdateOrgSecretError {
#[error("Response when updating a secret")]
Status204,
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsCreateOrUpdateOrgSecretError> for AdapterError {
fn from(err: ActionsCreateOrUpdateOrgSecretError) -> Self {
let (description, status_code) = match err {
ActionsCreateOrUpdateOrgSecretError::Status204 => (String::from("Response when updating a secret"), 204),
ActionsCreateOrUpdateOrgSecretError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Create or update a repository secret](Actions::create_or_update_repo_secret_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsCreateOrUpdateRepoSecretError {
#[error("Response when updating a secret")]
Status204,
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsCreateOrUpdateRepoSecretError> for AdapterError {
fn from(err: ActionsCreateOrUpdateRepoSecretError) -> Self {
let (description, status_code) = match err {
ActionsCreateOrUpdateRepoSecretError::Status204 => (String::from("Response when updating a secret"), 204),
ActionsCreateOrUpdateRepoSecretError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Create an organization variable](Actions::create_org_variable_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsCreateOrgVariableError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsCreateOrgVariableError> for AdapterError {
fn from(err: ActionsCreateOrgVariableError) -> Self {
let (description, status_code) = match err {
ActionsCreateOrgVariableError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Create a registration token for an organization](Actions::create_registration_token_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsCreateRegistrationTokenForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsCreateRegistrationTokenForOrgError> for AdapterError {
fn from(err: ActionsCreateRegistrationTokenForOrgError) -> Self {
let (description, status_code) = match err {
ActionsCreateRegistrationTokenForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Create a registration token for a repository](Actions::create_registration_token_for_repo_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsCreateRegistrationTokenForRepoError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsCreateRegistrationTokenForRepoError> for AdapterError {
fn from(err: ActionsCreateRegistrationTokenForRepoError) -> Self {
let (description, status_code) = match err {
ActionsCreateRegistrationTokenForRepoError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Create a remove token for an organization](Actions::create_remove_token_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsCreateRemoveTokenForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsCreateRemoveTokenForOrgError> for AdapterError {
fn from(err: ActionsCreateRemoveTokenForOrgError) -> Self {
let (description, status_code) = match err {
ActionsCreateRemoveTokenForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Create a remove token for a repository](Actions::create_remove_token_for_repo_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsCreateRemoveTokenForRepoError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsCreateRemoveTokenForRepoError> for AdapterError {
fn from(err: ActionsCreateRemoveTokenForRepoError) -> Self {
let (description, status_code) = match err {
ActionsCreateRemoveTokenForRepoError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Create a repository variable](Actions::create_repo_variable_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsCreateRepoVariableError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsCreateRepoVariableError> for AdapterError {
fn from(err: ActionsCreateRepoVariableError) -> Self {
let (description, status_code) = match err {
ActionsCreateRepoVariableError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Create a self-hosted runner group for an organization](Actions::create_self_hosted_runner_group_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsCreateSelfHostedRunnerGroupForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsCreateSelfHostedRunnerGroupForOrgError> for AdapterError {
fn from(err: ActionsCreateSelfHostedRunnerGroupForOrgError) -> Self {
let (description, status_code) = match err {
ActionsCreateSelfHostedRunnerGroupForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Create a workflow dispatch event](Actions::create_workflow_dispatch_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsCreateWorkflowDispatchError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsCreateWorkflowDispatchError> for AdapterError {
fn from(err: ActionsCreateWorkflowDispatchError) -> Self {
let (description, status_code) = match err {
ActionsCreateWorkflowDispatchError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Delete a GitHub Actions cache for a repository (using a cache ID)](Actions::delete_actions_cache_by_id_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDeleteActionsCacheByIdError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDeleteActionsCacheByIdError> for AdapterError {
fn from(err: ActionsDeleteActionsCacheByIdError) -> Self {
let (description, status_code) = match err {
ActionsDeleteActionsCacheByIdError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Delete GitHub Actions caches for a repository (using a cache key)](Actions::delete_actions_cache_by_key_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDeleteActionsCacheByKeyError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDeleteActionsCacheByKeyError> for AdapterError {
fn from(err: ActionsDeleteActionsCacheByKeyError) -> Self {
let (description, status_code) = match err {
ActionsDeleteActionsCacheByKeyError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Delete an artifact](Actions::delete_artifact_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDeleteArtifactError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDeleteArtifactError> for AdapterError {
fn from(err: ActionsDeleteArtifactError) -> Self {
let (description, status_code) = match err {
ActionsDeleteArtifactError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Delete an environment secret](Actions::delete_environment_secret_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDeleteEnvironmentSecretError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDeleteEnvironmentSecretError> for AdapterError {
fn from(err: ActionsDeleteEnvironmentSecretError) -> Self {
let (description, status_code) = match err {
ActionsDeleteEnvironmentSecretError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Delete an environment variable](Actions::delete_environment_variable_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDeleteEnvironmentVariableError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDeleteEnvironmentVariableError> for AdapterError {
fn from(err: ActionsDeleteEnvironmentVariableError) -> Self {
let (description, status_code) = match err {
ActionsDeleteEnvironmentVariableError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Delete a GitHub-hosted runner for an organization](Actions::delete_hosted_runner_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDeleteHostedRunnerForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDeleteHostedRunnerForOrgError> for AdapterError {
fn from(err: ActionsDeleteHostedRunnerForOrgError) -> Self {
let (description, status_code) = match err {
ActionsDeleteHostedRunnerForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Delete an organization secret](Actions::delete_org_secret_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDeleteOrgSecretError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDeleteOrgSecretError> for AdapterError {
fn from(err: ActionsDeleteOrgSecretError) -> Self {
let (description, status_code) = match err {
ActionsDeleteOrgSecretError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Delete an organization variable](Actions::delete_org_variable_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDeleteOrgVariableError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDeleteOrgVariableError> for AdapterError {
fn from(err: ActionsDeleteOrgVariableError) -> Self {
let (description, status_code) = match err {
ActionsDeleteOrgVariableError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Delete a repository secret](Actions::delete_repo_secret_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDeleteRepoSecretError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDeleteRepoSecretError> for AdapterError {
fn from(err: ActionsDeleteRepoSecretError) -> Self {
let (description, status_code) = match err {
ActionsDeleteRepoSecretError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Delete a repository variable](Actions::delete_repo_variable_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDeleteRepoVariableError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDeleteRepoVariableError> for AdapterError {
fn from(err: ActionsDeleteRepoVariableError) -> Self {
let (description, status_code) = match err {
ActionsDeleteRepoVariableError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Delete a self-hosted runner from an organization](Actions::delete_self_hosted_runner_from_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDeleteSelfHostedRunnerFromOrgError {
#[error("Validation failed, or the endpoint has been spammed.")]
Status422(ValidationErrorSimple),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDeleteSelfHostedRunnerFromOrgError> for AdapterError {
fn from(err: ActionsDeleteSelfHostedRunnerFromOrgError) -> Self {
let (description, status_code) = match err {
ActionsDeleteSelfHostedRunnerFromOrgError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
ActionsDeleteSelfHostedRunnerFromOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Delete a self-hosted runner from a repository](Actions::delete_self_hosted_runner_from_repo_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDeleteSelfHostedRunnerFromRepoError {
#[error("Validation failed, or the endpoint has been spammed.")]
Status422(ValidationErrorSimple),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDeleteSelfHostedRunnerFromRepoError> for AdapterError {
fn from(err: ActionsDeleteSelfHostedRunnerFromRepoError) -> Self {
let (description, status_code) = match err {
ActionsDeleteSelfHostedRunnerFromRepoError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
ActionsDeleteSelfHostedRunnerFromRepoError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Delete a self-hosted runner group from an organization](Actions::delete_self_hosted_runner_group_from_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDeleteSelfHostedRunnerGroupFromOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDeleteSelfHostedRunnerGroupFromOrgError> for AdapterError {
fn from(err: ActionsDeleteSelfHostedRunnerGroupFromOrgError) -> Self {
let (description, status_code) = match err {
ActionsDeleteSelfHostedRunnerGroupFromOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Delete a workflow run](Actions::delete_workflow_run_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDeleteWorkflowRunError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDeleteWorkflowRunError> for AdapterError {
fn from(err: ActionsDeleteWorkflowRunError) -> Self {
let (description, status_code) = match err {
ActionsDeleteWorkflowRunError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Delete workflow run logs](Actions::delete_workflow_run_logs_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDeleteWorkflowRunLogsError {
#[error("Forbidden")]
Status403(BasicError),
#[error("Internal Error")]
Status500(BasicError),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDeleteWorkflowRunLogsError> for AdapterError {
fn from(err: ActionsDeleteWorkflowRunLogsError) -> Self {
let (description, status_code) = match err {
ActionsDeleteWorkflowRunLogsError::Status403(_) => (String::from("Forbidden"), 403),
ActionsDeleteWorkflowRunLogsError::Status500(_) => (String::from("Internal Error"), 500),
ActionsDeleteWorkflowRunLogsError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Disable a selected repository for GitHub Actions in an organization](Actions::disable_selected_repository_github_actions_organization_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDisableSelectedRepositoryGithubActionsOrganizationError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDisableSelectedRepositoryGithubActionsOrganizationError> for AdapterError {
fn from(err: ActionsDisableSelectedRepositoryGithubActionsOrganizationError) -> Self {
let (description, status_code) = match err {
ActionsDisableSelectedRepositoryGithubActionsOrganizationError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Disable a workflow](Actions::disable_workflow_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDisableWorkflowError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDisableWorkflowError> for AdapterError {
fn from(err: ActionsDisableWorkflowError) -> Self {
let (description, status_code) = match err {
ActionsDisableWorkflowError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Download an artifact](Actions::download_artifact_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDownloadArtifactError {
#[error("Response")]
Status302,
#[error("Gone")]
Status410(BasicError),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDownloadArtifactError> for AdapterError {
fn from(err: ActionsDownloadArtifactError) -> Self {
let (description, status_code) = match err {
ActionsDownloadArtifactError::Status302 => (String::from("Response"), 302),
ActionsDownloadArtifactError::Status410(_) => (String::from("Gone"), 410),
ActionsDownloadArtifactError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Download job logs for a workflow run](Actions::download_job_logs_for_workflow_run_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDownloadJobLogsForWorkflowRunError {
#[error("Response")]
Status302,
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDownloadJobLogsForWorkflowRunError> for AdapterError {
fn from(err: ActionsDownloadJobLogsForWorkflowRunError) -> Self {
let (description, status_code) = match err {
ActionsDownloadJobLogsForWorkflowRunError::Status302 => (String::from("Response"), 302),
ActionsDownloadJobLogsForWorkflowRunError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Download workflow run attempt logs](Actions::download_workflow_run_attempt_logs_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDownloadWorkflowRunAttemptLogsError {
#[error("Response")]
Status302,
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDownloadWorkflowRunAttemptLogsError> for AdapterError {
fn from(err: ActionsDownloadWorkflowRunAttemptLogsError) -> Self {
let (description, status_code) = match err {
ActionsDownloadWorkflowRunAttemptLogsError::Status302 => (String::from("Response"), 302),
ActionsDownloadWorkflowRunAttemptLogsError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Download workflow run logs](Actions::download_workflow_run_logs_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsDownloadWorkflowRunLogsError {
#[error("Response")]
Status302,
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsDownloadWorkflowRunLogsError> for AdapterError {
fn from(err: ActionsDownloadWorkflowRunLogsError) -> Self {
let (description, status_code) = match err {
ActionsDownloadWorkflowRunLogsError::Status302 => (String::from("Response"), 302),
ActionsDownloadWorkflowRunLogsError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Enable a selected repository for GitHub Actions in an organization](Actions::enable_selected_repository_github_actions_organization_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsEnableSelectedRepositoryGithubActionsOrganizationError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsEnableSelectedRepositoryGithubActionsOrganizationError> for AdapterError {
fn from(err: ActionsEnableSelectedRepositoryGithubActionsOrganizationError) -> Self {
let (description, status_code) = match err {
ActionsEnableSelectedRepositoryGithubActionsOrganizationError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Enable a workflow](Actions::enable_workflow_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsEnableWorkflowError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsEnableWorkflowError> for AdapterError {
fn from(err: ActionsEnableWorkflowError) -> Self {
let (description, status_code) = match err {
ActionsEnableWorkflowError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Force cancel a workflow run](Actions::force_cancel_workflow_run_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsForceCancelWorkflowRunError {
#[error("Conflict")]
Status409(BasicError),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsForceCancelWorkflowRunError> for AdapterError {
fn from(err: ActionsForceCancelWorkflowRunError) -> Self {
let (description, status_code) = match err {
ActionsForceCancelWorkflowRunError::Status409(_) => (String::from("Conflict"), 409),
ActionsForceCancelWorkflowRunError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Create configuration for a just-in-time runner for an organization](Actions::generate_runner_jitconfig_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGenerateRunnerJitconfigForOrgError {
#[error("Resource not found")]
Status404(BasicError),
#[error("Validation failed, or the endpoint has been spammed.")]
Status422(ValidationErrorSimple),
#[error("Conflict")]
Status409(BasicError),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGenerateRunnerJitconfigForOrgError> for AdapterError {
fn from(err: ActionsGenerateRunnerJitconfigForOrgError) -> Self {
let (description, status_code) = match err {
ActionsGenerateRunnerJitconfigForOrgError::Status404(_) => (String::from("Resource not found"), 404),
ActionsGenerateRunnerJitconfigForOrgError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
ActionsGenerateRunnerJitconfigForOrgError::Status409(_) => (String::from("Conflict"), 409),
ActionsGenerateRunnerJitconfigForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Create configuration for a just-in-time runner for a repository](Actions::generate_runner_jitconfig_for_repo_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGenerateRunnerJitconfigForRepoError {
#[error("Resource not found")]
Status404(BasicError),
#[error("Validation failed, or the endpoint has been spammed.")]
Status422(ValidationErrorSimple),
#[error("Conflict")]
Status409(BasicError),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGenerateRunnerJitconfigForRepoError> for AdapterError {
fn from(err: ActionsGenerateRunnerJitconfigForRepoError) -> Self {
let (description, status_code) = match err {
ActionsGenerateRunnerJitconfigForRepoError::Status404(_) => (String::from("Resource not found"), 404),
ActionsGenerateRunnerJitconfigForRepoError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
ActionsGenerateRunnerJitconfigForRepoError::Status409(_) => (String::from("Conflict"), 409),
ActionsGenerateRunnerJitconfigForRepoError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List GitHub Actions caches for a repository](Actions::get_actions_cache_list_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetActionsCacheListError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetActionsCacheListError> for AdapterError {
fn from(err: ActionsGetActionsCacheListError) -> Self {
let (description, status_code) = match err {
ActionsGetActionsCacheListError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get GitHub Actions cache usage for a repository](Actions::get_actions_cache_usage_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetActionsCacheUsageError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetActionsCacheUsageError> for AdapterError {
fn from(err: ActionsGetActionsCacheUsageError) -> Self {
let (description, status_code) = match err {
ActionsGetActionsCacheUsageError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List repositories with GitHub Actions cache usage for an organization](Actions::get_actions_cache_usage_by_repo_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetActionsCacheUsageByRepoForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetActionsCacheUsageByRepoForOrgError> for AdapterError {
fn from(err: ActionsGetActionsCacheUsageByRepoForOrgError) -> Self {
let (description, status_code) = match err {
ActionsGetActionsCacheUsageByRepoForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get GitHub Actions cache usage for an organization](Actions::get_actions_cache_usage_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetActionsCacheUsageForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetActionsCacheUsageForOrgError> for AdapterError {
fn from(err: ActionsGetActionsCacheUsageForOrgError) -> Self {
let (description, status_code) = match err {
ActionsGetActionsCacheUsageForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get allowed actions and reusable workflows for an organization](Actions::get_allowed_actions_organization_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetAllowedActionsOrganizationError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetAllowedActionsOrganizationError> for AdapterError {
fn from(err: ActionsGetAllowedActionsOrganizationError) -> Self {
let (description, status_code) = match err {
ActionsGetAllowedActionsOrganizationError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get allowed actions and reusable workflows for a repository](Actions::get_allowed_actions_repository_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetAllowedActionsRepositoryError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetAllowedActionsRepositoryError> for AdapterError {
fn from(err: ActionsGetAllowedActionsRepositoryError) -> Self {
let (description, status_code) = match err {
ActionsGetAllowedActionsRepositoryError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get an artifact](Actions::get_artifact_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetArtifactError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetArtifactError> for AdapterError {
fn from(err: ActionsGetArtifactError) -> Self {
let (description, status_code) = match err {
ActionsGetArtifactError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get the customization template for an OIDC subject claim for a repository](Actions::get_custom_oidc_sub_claim_for_repo_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetCustomOidcSubClaimForRepoError {
#[error("Bad Request")]
Status400(BasicError),
#[error("Resource not found")]
Status404(BasicError),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetCustomOidcSubClaimForRepoError> for AdapterError {
fn from(err: ActionsGetCustomOidcSubClaimForRepoError) -> Self {
let (description, status_code) = match err {
ActionsGetCustomOidcSubClaimForRepoError::Status400(_) => (String::from("Bad Request"), 400),
ActionsGetCustomOidcSubClaimForRepoError::Status404(_) => (String::from("Resource not found"), 404),
ActionsGetCustomOidcSubClaimForRepoError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get an environment public key](Actions::get_environment_public_key_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetEnvironmentPublicKeyError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetEnvironmentPublicKeyError> for AdapterError {
fn from(err: ActionsGetEnvironmentPublicKeyError) -> Self {
let (description, status_code) = match err {
ActionsGetEnvironmentPublicKeyError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get an environment secret](Actions::get_environment_secret_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetEnvironmentSecretError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetEnvironmentSecretError> for AdapterError {
fn from(err: ActionsGetEnvironmentSecretError) -> Self {
let (description, status_code) = match err {
ActionsGetEnvironmentSecretError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get an environment variable](Actions::get_environment_variable_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetEnvironmentVariableError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetEnvironmentVariableError> for AdapterError {
fn from(err: ActionsGetEnvironmentVariableError) -> Self {
let (description, status_code) = match err {
ActionsGetEnvironmentVariableError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get default workflow permissions for an organization](Actions::get_github_actions_default_workflow_permissions_organization_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetGithubActionsDefaultWorkflowPermissionsOrganizationError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetGithubActionsDefaultWorkflowPermissionsOrganizationError> for AdapterError {
fn from(err: ActionsGetGithubActionsDefaultWorkflowPermissionsOrganizationError) -> Self {
let (description, status_code) = match err {
ActionsGetGithubActionsDefaultWorkflowPermissionsOrganizationError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get default workflow permissions for a repository](Actions::get_github_actions_default_workflow_permissions_repository_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetGithubActionsDefaultWorkflowPermissionsRepositoryError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetGithubActionsDefaultWorkflowPermissionsRepositoryError> for AdapterError {
fn from(err: ActionsGetGithubActionsDefaultWorkflowPermissionsRepositoryError) -> Self {
let (description, status_code) = match err {
ActionsGetGithubActionsDefaultWorkflowPermissionsRepositoryError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get GitHub Actions permissions for an organization](Actions::get_github_actions_permissions_organization_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetGithubActionsPermissionsOrganizationError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetGithubActionsPermissionsOrganizationError> for AdapterError {
fn from(err: ActionsGetGithubActionsPermissionsOrganizationError) -> Self {
let (description, status_code) = match err {
ActionsGetGithubActionsPermissionsOrganizationError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get GitHub Actions permissions for a repository](Actions::get_github_actions_permissions_repository_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetGithubActionsPermissionsRepositoryError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetGithubActionsPermissionsRepositoryError> for AdapterError {
fn from(err: ActionsGetGithubActionsPermissionsRepositoryError) -> Self {
let (description, status_code) = match err {
ActionsGetGithubActionsPermissionsRepositoryError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get a GitHub-hosted runner for an organization](Actions::get_hosted_runner_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetHostedRunnerForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetHostedRunnerForOrgError> for AdapterError {
fn from(err: ActionsGetHostedRunnerForOrgError) -> Self {
let (description, status_code) = match err {
ActionsGetHostedRunnerForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get GitHub-owned images for GitHub-hosted runners in an organization](Actions::get_hosted_runners_github_owned_images_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetHostedRunnersGithubOwnedImagesForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetHostedRunnersGithubOwnedImagesForOrgError> for AdapterError {
fn from(err: ActionsGetHostedRunnersGithubOwnedImagesForOrgError) -> Self {
let (description, status_code) = match err {
ActionsGetHostedRunnersGithubOwnedImagesForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get limits on GitHub-hosted runners for an organization](Actions::get_hosted_runners_limits_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetHostedRunnersLimitsForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetHostedRunnersLimitsForOrgError> for AdapterError {
fn from(err: ActionsGetHostedRunnersLimitsForOrgError) -> Self {
let (description, status_code) = match err {
ActionsGetHostedRunnersLimitsForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get GitHub-hosted runners machine specs for an organization](Actions::get_hosted_runners_machine_specs_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetHostedRunnersMachineSpecsForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetHostedRunnersMachineSpecsForOrgError> for AdapterError {
fn from(err: ActionsGetHostedRunnersMachineSpecsForOrgError) -> Self {
let (description, status_code) = match err {
ActionsGetHostedRunnersMachineSpecsForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get partner images for GitHub-hosted runners in an organization](Actions::get_hosted_runners_partner_images_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetHostedRunnersPartnerImagesForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetHostedRunnersPartnerImagesForOrgError> for AdapterError {
fn from(err: ActionsGetHostedRunnersPartnerImagesForOrgError) -> Self {
let (description, status_code) = match err {
ActionsGetHostedRunnersPartnerImagesForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get platforms for GitHub-hosted runners in an organization](Actions::get_hosted_runners_platforms_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetHostedRunnersPlatformsForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetHostedRunnersPlatformsForOrgError> for AdapterError {
fn from(err: ActionsGetHostedRunnersPlatformsForOrgError) -> Self {
let (description, status_code) = match err {
ActionsGetHostedRunnersPlatformsForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get a job for a workflow run](Actions::get_job_for_workflow_run_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetJobForWorkflowRunError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetJobForWorkflowRunError> for AdapterError {
fn from(err: ActionsGetJobForWorkflowRunError) -> Self {
let (description, status_code) = match err {
ActionsGetJobForWorkflowRunError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get an organization public key](Actions::get_org_public_key_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetOrgPublicKeyError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetOrgPublicKeyError> for AdapterError {
fn from(err: ActionsGetOrgPublicKeyError) -> Self {
let (description, status_code) = match err {
ActionsGetOrgPublicKeyError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get an organization secret](Actions::get_org_secret_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetOrgSecretError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetOrgSecretError> for AdapterError {
fn from(err: ActionsGetOrgSecretError) -> Self {
let (description, status_code) = match err {
ActionsGetOrgSecretError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get an organization variable](Actions::get_org_variable_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetOrgVariableError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetOrgVariableError> for AdapterError {
fn from(err: ActionsGetOrgVariableError) -> Self {
let (description, status_code) = match err {
ActionsGetOrgVariableError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get pending deployments for a workflow run](Actions::get_pending_deployments_for_run_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetPendingDeploymentsForRunError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetPendingDeploymentsForRunError> for AdapterError {
fn from(err: ActionsGetPendingDeploymentsForRunError) -> Self {
let (description, status_code) = match err {
ActionsGetPendingDeploymentsForRunError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get a repository public key](Actions::get_repo_public_key_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetRepoPublicKeyError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetRepoPublicKeyError> for AdapterError {
fn from(err: ActionsGetRepoPublicKeyError) -> Self {
let (description, status_code) = match err {
ActionsGetRepoPublicKeyError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get a repository secret](Actions::get_repo_secret_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetRepoSecretError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetRepoSecretError> for AdapterError {
fn from(err: ActionsGetRepoSecretError) -> Self {
let (description, status_code) = match err {
ActionsGetRepoSecretError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get a repository variable](Actions::get_repo_variable_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetRepoVariableError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetRepoVariableError> for AdapterError {
fn from(err: ActionsGetRepoVariableError) -> Self {
let (description, status_code) = match err {
ActionsGetRepoVariableError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get the review history for a workflow run](Actions::get_reviews_for_run_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetReviewsForRunError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetReviewsForRunError> for AdapterError {
fn from(err: ActionsGetReviewsForRunError) -> Self {
let (description, status_code) = match err {
ActionsGetReviewsForRunError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get a self-hosted runner for an organization](Actions::get_self_hosted_runner_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetSelfHostedRunnerForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetSelfHostedRunnerForOrgError> for AdapterError {
fn from(err: ActionsGetSelfHostedRunnerForOrgError) -> Self {
let (description, status_code) = match err {
ActionsGetSelfHostedRunnerForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get a self-hosted runner for a repository](Actions::get_self_hosted_runner_for_repo_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetSelfHostedRunnerForRepoError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetSelfHostedRunnerForRepoError> for AdapterError {
fn from(err: ActionsGetSelfHostedRunnerForRepoError) -> Self {
let (description, status_code) = match err {
ActionsGetSelfHostedRunnerForRepoError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get a self-hosted runner group for an organization](Actions::get_self_hosted_runner_group_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetSelfHostedRunnerGroupForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetSelfHostedRunnerGroupForOrgError> for AdapterError {
fn from(err: ActionsGetSelfHostedRunnerGroupForOrgError) -> Self {
let (description, status_code) = match err {
ActionsGetSelfHostedRunnerGroupForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get a workflow](Actions::get_workflow_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetWorkflowError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetWorkflowError> for AdapterError {
fn from(err: ActionsGetWorkflowError) -> Self {
let (description, status_code) = match err {
ActionsGetWorkflowError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get the level of access for workflows outside of the repository](Actions::get_workflow_access_to_repository_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetWorkflowAccessToRepositoryError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetWorkflowAccessToRepositoryError> for AdapterError {
fn from(err: ActionsGetWorkflowAccessToRepositoryError) -> Self {
let (description, status_code) = match err {
ActionsGetWorkflowAccessToRepositoryError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get a workflow run](Actions::get_workflow_run_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetWorkflowRunError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetWorkflowRunError> for AdapterError {
fn from(err: ActionsGetWorkflowRunError) -> Self {
let (description, status_code) = match err {
ActionsGetWorkflowRunError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get a workflow run attempt](Actions::get_workflow_run_attempt_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetWorkflowRunAttemptError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetWorkflowRunAttemptError> for AdapterError {
fn from(err: ActionsGetWorkflowRunAttemptError) -> Self {
let (description, status_code) = match err {
ActionsGetWorkflowRunAttemptError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get workflow run usage](Actions::get_workflow_run_usage_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetWorkflowRunUsageError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetWorkflowRunUsageError> for AdapterError {
fn from(err: ActionsGetWorkflowRunUsageError) -> Self {
let (description, status_code) = match err {
ActionsGetWorkflowRunUsageError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Get workflow usage](Actions::get_workflow_usage_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsGetWorkflowUsageError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsGetWorkflowUsageError> for AdapterError {
fn from(err: ActionsGetWorkflowUsageError) -> Self {
let (description, status_code) = match err {
ActionsGetWorkflowUsageError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List artifacts for a repository](Actions::list_artifacts_for_repo_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListArtifactsForRepoError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListArtifactsForRepoError> for AdapterError {
fn from(err: ActionsListArtifactsForRepoError) -> Self {
let (description, status_code) = match err {
ActionsListArtifactsForRepoError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List environment secrets](Actions::list_environment_secrets_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListEnvironmentSecretsError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListEnvironmentSecretsError> for AdapterError {
fn from(err: ActionsListEnvironmentSecretsError) -> Self {
let (description, status_code) = match err {
ActionsListEnvironmentSecretsError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List environment variables](Actions::list_environment_variables_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListEnvironmentVariablesError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListEnvironmentVariablesError> for AdapterError {
fn from(err: ActionsListEnvironmentVariablesError) -> Self {
let (description, status_code) = match err {
ActionsListEnvironmentVariablesError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List GitHub-hosted runners in a group for an organization](Actions::list_github_hosted_runners_in_group_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListGithubHostedRunnersInGroupForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListGithubHostedRunnersInGroupForOrgError> for AdapterError {
fn from(err: ActionsListGithubHostedRunnersInGroupForOrgError) -> Self {
let (description, status_code) = match err {
ActionsListGithubHostedRunnersInGroupForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List GitHub-hosted runners for an organization](Actions::list_hosted_runners_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListHostedRunnersForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListHostedRunnersForOrgError> for AdapterError {
fn from(err: ActionsListHostedRunnersForOrgError) -> Self {
let (description, status_code) = match err {
ActionsListHostedRunnersForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List jobs for a workflow run](Actions::list_jobs_for_workflow_run_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListJobsForWorkflowRunError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListJobsForWorkflowRunError> for AdapterError {
fn from(err: ActionsListJobsForWorkflowRunError) -> Self {
let (description, status_code) = match err {
ActionsListJobsForWorkflowRunError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List jobs for a workflow run attempt](Actions::list_jobs_for_workflow_run_attempt_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListJobsForWorkflowRunAttemptError {
#[error("Resource not found")]
Status404(BasicError),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListJobsForWorkflowRunAttemptError> for AdapterError {
fn from(err: ActionsListJobsForWorkflowRunAttemptError) -> Self {
let (description, status_code) = match err {
ActionsListJobsForWorkflowRunAttemptError::Status404(_) => (String::from("Resource not found"), 404),
ActionsListJobsForWorkflowRunAttemptError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List labels for a self-hosted runner for an organization](Actions::list_labels_for_self_hosted_runner_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListLabelsForSelfHostedRunnerForOrgError {
#[error("Resource not found")]
Status404(BasicError),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListLabelsForSelfHostedRunnerForOrgError> for AdapterError {
fn from(err: ActionsListLabelsForSelfHostedRunnerForOrgError) -> Self {
let (description, status_code) = match err {
ActionsListLabelsForSelfHostedRunnerForOrgError::Status404(_) => (String::from("Resource not found"), 404),
ActionsListLabelsForSelfHostedRunnerForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List labels for a self-hosted runner for a repository](Actions::list_labels_for_self_hosted_runner_for_repo_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListLabelsForSelfHostedRunnerForRepoError {
#[error("Resource not found")]
Status404(BasicError),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListLabelsForSelfHostedRunnerForRepoError> for AdapterError {
fn from(err: ActionsListLabelsForSelfHostedRunnerForRepoError) -> Self {
let (description, status_code) = match err {
ActionsListLabelsForSelfHostedRunnerForRepoError::Status404(_) => (String::from("Resource not found"), 404),
ActionsListLabelsForSelfHostedRunnerForRepoError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List organization secrets](Actions::list_org_secrets_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListOrgSecretsError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListOrgSecretsError> for AdapterError {
fn from(err: ActionsListOrgSecretsError) -> Self {
let (description, status_code) = match err {
ActionsListOrgSecretsError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List organization variables](Actions::list_org_variables_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListOrgVariablesError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListOrgVariablesError> for AdapterError {
fn from(err: ActionsListOrgVariablesError) -> Self {
let (description, status_code) = match err {
ActionsListOrgVariablesError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List repository access to a self-hosted runner group in an organization](Actions::list_repo_access_to_self_hosted_runner_group_in_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListRepoAccessToSelfHostedRunnerGroupInOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListRepoAccessToSelfHostedRunnerGroupInOrgError> for AdapterError {
fn from(err: ActionsListRepoAccessToSelfHostedRunnerGroupInOrgError) -> Self {
let (description, status_code) = match err {
ActionsListRepoAccessToSelfHostedRunnerGroupInOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List repository organization secrets](Actions::list_repo_organization_secrets_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListRepoOrganizationSecretsError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListRepoOrganizationSecretsError> for AdapterError {
fn from(err: ActionsListRepoOrganizationSecretsError) -> Self {
let (description, status_code) = match err {
ActionsListRepoOrganizationSecretsError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List repository organization variables](Actions::list_repo_organization_variables_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListRepoOrganizationVariablesError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListRepoOrganizationVariablesError> for AdapterError {
fn from(err: ActionsListRepoOrganizationVariablesError) -> Self {
let (description, status_code) = match err {
ActionsListRepoOrganizationVariablesError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List repository secrets](Actions::list_repo_secrets_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListRepoSecretsError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListRepoSecretsError> for AdapterError {
fn from(err: ActionsListRepoSecretsError) -> Self {
let (description, status_code) = match err {
ActionsListRepoSecretsError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List repository variables](Actions::list_repo_variables_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListRepoVariablesError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListRepoVariablesError> for AdapterError {
fn from(err: ActionsListRepoVariablesError) -> Self {
let (description, status_code) = match err {
ActionsListRepoVariablesError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List repository workflows](Actions::list_repo_workflows_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListRepoWorkflowsError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListRepoWorkflowsError> for AdapterError {
fn from(err: ActionsListRepoWorkflowsError) -> Self {
let (description, status_code) = match err {
ActionsListRepoWorkflowsError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List runner applications for an organization](Actions::list_runner_applications_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListRunnerApplicationsForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListRunnerApplicationsForOrgError> for AdapterError {
fn from(err: ActionsListRunnerApplicationsForOrgError) -> Self {
let (description, status_code) = match err {
ActionsListRunnerApplicationsForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List runner applications for a repository](Actions::list_runner_applications_for_repo_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListRunnerApplicationsForRepoError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListRunnerApplicationsForRepoError> for AdapterError {
fn from(err: ActionsListRunnerApplicationsForRepoError) -> Self {
let (description, status_code) = match err {
ActionsListRunnerApplicationsForRepoError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List selected repositories for an organization secret](Actions::list_selected_repos_for_org_secret_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListSelectedReposForOrgSecretError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListSelectedReposForOrgSecretError> for AdapterError {
fn from(err: ActionsListSelectedReposForOrgSecretError) -> Self {
let (description, status_code) = match err {
ActionsListSelectedReposForOrgSecretError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List selected repositories for an organization variable](Actions::list_selected_repos_for_org_variable_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListSelectedReposForOrgVariableError {
#[error("Response when the visibility of the variable is not set to `selected`")]
Status409,
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListSelectedReposForOrgVariableError> for AdapterError {
fn from(err: ActionsListSelectedReposForOrgVariableError) -> Self {
let (description, status_code) = match err {
ActionsListSelectedReposForOrgVariableError::Status409 => (String::from("Response when the visibility of the variable is not set to `selected`"), 409),
ActionsListSelectedReposForOrgVariableError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List selected repositories enabled for GitHub Actions in an organization](Actions::list_selected_repositories_enabled_github_actions_organization_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationError> for AdapterError {
fn from(err: ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationError) -> Self {
let (description, status_code) = match err {
ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List self-hosted runner groups for an organization](Actions::list_self_hosted_runner_groups_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListSelfHostedRunnerGroupsForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListSelfHostedRunnerGroupsForOrgError> for AdapterError {
fn from(err: ActionsListSelfHostedRunnerGroupsForOrgError) -> Self {
let (description, status_code) = match err {
ActionsListSelfHostedRunnerGroupsForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List self-hosted runners for an organization](Actions::list_self_hosted_runners_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListSelfHostedRunnersForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListSelfHostedRunnersForOrgError> for AdapterError {
fn from(err: ActionsListSelfHostedRunnersForOrgError) -> Self {
let (description, status_code) = match err {
ActionsListSelfHostedRunnersForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List self-hosted runners for a repository](Actions::list_self_hosted_runners_for_repo_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListSelfHostedRunnersForRepoError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListSelfHostedRunnersForRepoError> for AdapterError {
fn from(err: ActionsListSelfHostedRunnersForRepoError) -> Self {
let (description, status_code) = match err {
ActionsListSelfHostedRunnersForRepoError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List self-hosted runners in a group for an organization](Actions::list_self_hosted_runners_in_group_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListSelfHostedRunnersInGroupForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListSelfHostedRunnersInGroupForOrgError> for AdapterError {
fn from(err: ActionsListSelfHostedRunnersInGroupForOrgError) -> Self {
let (description, status_code) = match err {
ActionsListSelfHostedRunnersInGroupForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List workflow run artifacts](Actions::list_workflow_run_artifacts_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListWorkflowRunArtifactsError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListWorkflowRunArtifactsError> for AdapterError {
fn from(err: ActionsListWorkflowRunArtifactsError) -> Self {
let (description, status_code) = match err {
ActionsListWorkflowRunArtifactsError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List workflow runs for a workflow](Actions::list_workflow_runs_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListWorkflowRunsError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListWorkflowRunsError> for AdapterError {
fn from(err: ActionsListWorkflowRunsError) -> Self {
let (description, status_code) = match err {
ActionsListWorkflowRunsError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [List workflow runs for a repository](Actions::list_workflow_runs_for_repo_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsListWorkflowRunsForRepoError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsListWorkflowRunsForRepoError> for AdapterError {
fn from(err: ActionsListWorkflowRunsForRepoError) -> Self {
let (description, status_code) = match err {
ActionsListWorkflowRunsForRepoError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Re-run a job from a workflow run](Actions::re_run_job_for_workflow_run_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsReRunJobForWorkflowRunError {
#[error("Forbidden")]
Status403(BasicError),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsReRunJobForWorkflowRunError> for AdapterError {
fn from(err: ActionsReRunJobForWorkflowRunError) -> Self {
let (description, status_code) = match err {
ActionsReRunJobForWorkflowRunError::Status403(_) => (String::from("Forbidden"), 403),
ActionsReRunJobForWorkflowRunError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Re-run a workflow](Actions::re_run_workflow_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsReRunWorkflowError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsReRunWorkflowError> for AdapterError {
fn from(err: ActionsReRunWorkflowError) -> Self {
let (description, status_code) = match err {
ActionsReRunWorkflowError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Re-run failed jobs from a workflow run](Actions::re_run_workflow_failed_jobs_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsReRunWorkflowFailedJobsError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsReRunWorkflowFailedJobsError> for AdapterError {
fn from(err: ActionsReRunWorkflowFailedJobsError) -> Self {
let (description, status_code) = match err {
ActionsReRunWorkflowFailedJobsError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Remove all custom labels from a self-hosted runner for an organization](Actions::remove_all_custom_labels_from_self_hosted_runner_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgError {
#[error("Resource not found")]
Status404(BasicError),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgError> for AdapterError {
fn from(err: ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgError) -> Self {
let (description, status_code) = match err {
ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgError::Status404(_) => (String::from("Resource not found"), 404),
ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Remove all custom labels from a self-hosted runner for a repository](Actions::remove_all_custom_labels_from_self_hosted_runner_for_repo_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoError {
#[error("Resource not found")]
Status404(BasicError),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoError> for AdapterError {
fn from(err: ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoError) -> Self {
let (description, status_code) = match err {
ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoError::Status404(_) => (String::from("Resource not found"), 404),
ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Remove a custom label from a self-hosted runner for an organization](Actions::remove_custom_label_from_self_hosted_runner_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgError {
#[error("Resource not found")]
Status404(BasicError),
#[error("Validation failed, or the endpoint has been spammed.")]
Status422(ValidationErrorSimple),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgError> for AdapterError {
fn from(err: ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgError) -> Self {
let (description, status_code) = match err {
ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgError::Status404(_) => (String::from("Resource not found"), 404),
ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Remove a custom label from a self-hosted runner for a repository](Actions::remove_custom_label_from_self_hosted_runner_for_repo_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoError {
#[error("Resource not found")]
Status404(BasicError),
#[error("Validation failed, or the endpoint has been spammed.")]
Status422(ValidationErrorSimple),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoError> for AdapterError {
fn from(err: ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoError) -> Self {
let (description, status_code) = match err {
ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoError::Status404(_) => (String::from("Resource not found"), 404),
ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Remove repository access to a self-hosted runner group in an organization](Actions::remove_repo_access_to_self_hosted_runner_group_in_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgError> for AdapterError {
fn from(err: ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgError) -> Self {
let (description, status_code) = match err {
ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Remove selected repository from an organization secret](Actions::remove_selected_repo_from_org_secret_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsRemoveSelectedRepoFromOrgSecretError {
#[error("Conflict when visibility type not set to selected")]
Status409,
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsRemoveSelectedRepoFromOrgSecretError> for AdapterError {
fn from(err: ActionsRemoveSelectedRepoFromOrgSecretError) -> Self {
let (description, status_code) = match err {
ActionsRemoveSelectedRepoFromOrgSecretError::Status409 => (String::from("Conflict when visibility type not set to selected"), 409),
ActionsRemoveSelectedRepoFromOrgSecretError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Remove selected repository from an organization variable](Actions::remove_selected_repo_from_org_variable_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsRemoveSelectedRepoFromOrgVariableError {
#[error("Response when the visibility of the variable is not set to `selected`")]
Status409,
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsRemoveSelectedRepoFromOrgVariableError> for AdapterError {
fn from(err: ActionsRemoveSelectedRepoFromOrgVariableError) -> Self {
let (description, status_code) = match err {
ActionsRemoveSelectedRepoFromOrgVariableError::Status409 => (String::from("Response when the visibility of the variable is not set to `selected`"), 409),
ActionsRemoveSelectedRepoFromOrgVariableError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Remove a self-hosted runner from a group for an organization](Actions::remove_self_hosted_runner_from_group_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsRemoveSelfHostedRunnerFromGroupForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsRemoveSelfHostedRunnerFromGroupForOrgError> for AdapterError {
fn from(err: ActionsRemoveSelfHostedRunnerFromGroupForOrgError) -> Self {
let (description, status_code) = match err {
ActionsRemoveSelfHostedRunnerFromGroupForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Review custom deployment protection rules for a workflow run](Actions::review_custom_gates_for_run_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsReviewCustomGatesForRunError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsReviewCustomGatesForRunError> for AdapterError {
fn from(err: ActionsReviewCustomGatesForRunError) -> Self {
let (description, status_code) = match err {
ActionsReviewCustomGatesForRunError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Review pending deployments for a workflow run](Actions::review_pending_deployments_for_run_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsReviewPendingDeploymentsForRunError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsReviewPendingDeploymentsForRunError> for AdapterError {
fn from(err: ActionsReviewPendingDeploymentsForRunError) -> Self {
let (description, status_code) = match err {
ActionsReviewPendingDeploymentsForRunError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Set allowed actions and reusable workflows for an organization](Actions::set_allowed_actions_organization_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsSetAllowedActionsOrganizationError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsSetAllowedActionsOrganizationError> for AdapterError {
fn from(err: ActionsSetAllowedActionsOrganizationError) -> Self {
let (description, status_code) = match err {
ActionsSetAllowedActionsOrganizationError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Set allowed actions and reusable workflows for a repository](Actions::set_allowed_actions_repository_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsSetAllowedActionsRepositoryError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsSetAllowedActionsRepositoryError> for AdapterError {
fn from(err: ActionsSetAllowedActionsRepositoryError) -> Self {
let (description, status_code) = match err {
ActionsSetAllowedActionsRepositoryError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Set custom labels for a self-hosted runner for an organization](Actions::set_custom_labels_for_self_hosted_runner_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsSetCustomLabelsForSelfHostedRunnerForOrgError {
#[error("Resource not found")]
Status404(BasicError),
#[error("Validation failed, or the endpoint has been spammed.")]
Status422(ValidationErrorSimple),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsSetCustomLabelsForSelfHostedRunnerForOrgError> for AdapterError {
fn from(err: ActionsSetCustomLabelsForSelfHostedRunnerForOrgError) -> Self {
let (description, status_code) = match err {
ActionsSetCustomLabelsForSelfHostedRunnerForOrgError::Status404(_) => (String::from("Resource not found"), 404),
ActionsSetCustomLabelsForSelfHostedRunnerForOrgError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
ActionsSetCustomLabelsForSelfHostedRunnerForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Set custom labels for a self-hosted runner for a repository](Actions::set_custom_labels_for_self_hosted_runner_for_repo_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsSetCustomLabelsForSelfHostedRunnerForRepoError {
#[error("Resource not found")]
Status404(BasicError),
#[error("Validation failed, or the endpoint has been spammed.")]
Status422(ValidationErrorSimple),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsSetCustomLabelsForSelfHostedRunnerForRepoError> for AdapterError {
fn from(err: ActionsSetCustomLabelsForSelfHostedRunnerForRepoError) -> Self {
let (description, status_code) = match err {
ActionsSetCustomLabelsForSelfHostedRunnerForRepoError::Status404(_) => (String::from("Resource not found"), 404),
ActionsSetCustomLabelsForSelfHostedRunnerForRepoError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
ActionsSetCustomLabelsForSelfHostedRunnerForRepoError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Set the customization template for an OIDC subject claim for a repository](Actions::set_custom_oidc_sub_claim_for_repo_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsSetCustomOidcSubClaimForRepoError {
#[error("Resource not found")]
Status404(BasicError),
#[error("Bad Request")]
Status400(BasicError),
#[error("Validation failed, or the endpoint has been spammed.")]
Status422(ValidationErrorSimple),
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsSetCustomOidcSubClaimForRepoError> for AdapterError {
fn from(err: ActionsSetCustomOidcSubClaimForRepoError) -> Self {
let (description, status_code) = match err {
ActionsSetCustomOidcSubClaimForRepoError::Status404(_) => (String::from("Resource not found"), 404),
ActionsSetCustomOidcSubClaimForRepoError::Status400(_) => (String::from("Bad Request"), 400),
ActionsSetCustomOidcSubClaimForRepoError::Status422(_) => (String::from("Validation failed, or the endpoint has been spammed."), 422),
ActionsSetCustomOidcSubClaimForRepoError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Set default workflow permissions for an organization](Actions::set_github_actions_default_workflow_permissions_organization_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsSetGithubActionsDefaultWorkflowPermissionsOrganizationError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsSetGithubActionsDefaultWorkflowPermissionsOrganizationError> for AdapterError {
fn from(err: ActionsSetGithubActionsDefaultWorkflowPermissionsOrganizationError) -> Self {
let (description, status_code) = match err {
ActionsSetGithubActionsDefaultWorkflowPermissionsOrganizationError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Set default workflow permissions for a repository](Actions::set_github_actions_default_workflow_permissions_repository_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryError {
#[error("Conflict response when changing a setting is prevented by the owning organization")]
Status409,
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryError> for AdapterError {
fn from(err: ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryError) -> Self {
let (description, status_code) = match err {
ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryError::Status409 => (String::from("Conflict response when changing a setting is prevented by the owning organization"), 409),
ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Set GitHub Actions permissions for an organization](Actions::set_github_actions_permissions_organization_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsSetGithubActionsPermissionsOrganizationError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsSetGithubActionsPermissionsOrganizationError> for AdapterError {
fn from(err: ActionsSetGithubActionsPermissionsOrganizationError) -> Self {
let (description, status_code) = match err {
ActionsSetGithubActionsPermissionsOrganizationError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Set GitHub Actions permissions for a repository](Actions::set_github_actions_permissions_repository_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsSetGithubActionsPermissionsRepositoryError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsSetGithubActionsPermissionsRepositoryError> for AdapterError {
fn from(err: ActionsSetGithubActionsPermissionsRepositoryError) -> Self {
let (description, status_code) = match err {
ActionsSetGithubActionsPermissionsRepositoryError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Set repository access for a self-hosted runner group in an organization](Actions::set_repo_access_to_self_hosted_runner_group_in_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgError> for AdapterError {
fn from(err: ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgError) -> Self {
let (description, status_code) = match err {
ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Set selected repositories for an organization secret](Actions::set_selected_repos_for_org_secret_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsSetSelectedReposForOrgSecretError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsSetSelectedReposForOrgSecretError> for AdapterError {
fn from(err: ActionsSetSelectedReposForOrgSecretError) -> Self {
let (description, status_code) = match err {
ActionsSetSelectedReposForOrgSecretError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Set selected repositories for an organization variable](Actions::set_selected_repos_for_org_variable_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsSetSelectedReposForOrgVariableError {
#[error("Response when the visibility of the variable is not set to `selected`")]
Status409,
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsSetSelectedReposForOrgVariableError> for AdapterError {
fn from(err: ActionsSetSelectedReposForOrgVariableError) -> Self {
let (description, status_code) = match err {
ActionsSetSelectedReposForOrgVariableError::Status409 => (String::from("Response when the visibility of the variable is not set to `selected`"), 409),
ActionsSetSelectedReposForOrgVariableError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Set selected repositories enabled for GitHub Actions in an organization](Actions::set_selected_repositories_enabled_github_actions_organization_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationError> for AdapterError {
fn from(err: ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationError) -> Self {
let (description, status_code) = match err {
ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Set self-hosted runners in a group for an organization](Actions::set_self_hosted_runners_in_group_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsSetSelfHostedRunnersInGroupForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsSetSelfHostedRunnersInGroupForOrgError> for AdapterError {
fn from(err: ActionsSetSelfHostedRunnersInGroupForOrgError) -> Self {
let (description, status_code) = match err {
ActionsSetSelfHostedRunnersInGroupForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Set the level of access for workflows outside of the repository](Actions::set_workflow_access_to_repository_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsSetWorkflowAccessToRepositoryError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsSetWorkflowAccessToRepositoryError> for AdapterError {
fn from(err: ActionsSetWorkflowAccessToRepositoryError) -> Self {
let (description, status_code) = match err {
ActionsSetWorkflowAccessToRepositoryError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Update an environment variable](Actions::update_environment_variable_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsUpdateEnvironmentVariableError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsUpdateEnvironmentVariableError> for AdapterError {
fn from(err: ActionsUpdateEnvironmentVariableError) -> Self {
let (description, status_code) = match err {
ActionsUpdateEnvironmentVariableError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Update a GitHub-hosted runner for an organization](Actions::update_hosted_runner_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsUpdateHostedRunnerForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsUpdateHostedRunnerForOrgError> for AdapterError {
fn from(err: ActionsUpdateHostedRunnerForOrgError) -> Self {
let (description, status_code) = match err {
ActionsUpdateHostedRunnerForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Update an organization variable](Actions::update_org_variable_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsUpdateOrgVariableError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsUpdateOrgVariableError> for AdapterError {
fn from(err: ActionsUpdateOrgVariableError) -> Self {
let (description, status_code) = match err {
ActionsUpdateOrgVariableError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Update a repository variable](Actions::update_repo_variable_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsUpdateRepoVariableError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsUpdateRepoVariableError> for AdapterError {
fn from(err: ActionsUpdateRepoVariableError) -> Self {
let (description, status_code) = match err {
ActionsUpdateRepoVariableError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Errors for the [Update a self-hosted runner group for an organization](Actions::update_self_hosted_runner_group_for_org_async()) endpoint.
#[derive(Debug, thiserror::Error)]
pub enum ActionsUpdateSelfHostedRunnerGroupForOrgError {
#[error("Status code: {}", code)]
Generic { code: u16 },
}
impl From<ActionsUpdateSelfHostedRunnerGroupForOrgError> for AdapterError {
fn from(err: ActionsUpdateSelfHostedRunnerGroupForOrgError) -> Self {
let (description, status_code) = match err {
ActionsUpdateSelfHostedRunnerGroupForOrgError::Generic { code } => (String::from("Generic"), code)
};
Self::Endpoint {
description,
status_code,
source: Some(Box::new(err))
}
}
}
/// Query parameters for the [Delete GitHub Actions caches for a repository (using a cache key)](Actions::delete_actions_cache_by_key_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsDeleteActionsCacheByKeyParams<'req> {
/// A key for identifying the cache.
key: &'req str,
/// The full Git reference for narrowing down the cache. The `ref` for a branch should be formatted as `refs/heads/<branch name>`. To reference a pull request use `refs/pull/<number>/merge`.
git_ref: Option<&'req str>
}
impl<'req> ActionsDeleteActionsCacheByKeyParams<'req> {
pub fn new() -> Self {
Self::default()
}
/// A key for identifying the cache.
pub fn key(self, key: &'req str) -> Self {
Self {
key: key,
git_ref: self.git_ref,
}
}
/// The full Git reference for narrowing down the cache. The `ref` for a branch should be formatted as `refs/heads/<branch name>`. To reference a pull request use `refs/pull/<number>/merge`.
pub fn git_ref(self, git_ref: &'req str) -> Self {
Self {
key: self.key,
git_ref: Some(git_ref),
}
}
}
/// Query parameters for the [List GitHub Actions caches for a repository](Actions::get_actions_cache_list_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsGetActionsCacheListParams<'req> {
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>,
/// The full Git reference for narrowing down the cache. The `ref` for a branch should be formatted as `refs/heads/<branch name>`. To reference a pull request use `refs/pull/<number>/merge`.
git_ref: Option<&'req str>,
/// An explicit key or prefix for identifying the cache
key: Option<&'req str>,
/// The property to sort the results by. `created_at` means when the cache was created. `last_accessed_at` means when the cache was last accessed. `size_in_bytes` is the size of the cache in bytes.
sort: Option<&'req str>,
/// The direction to sort the results by.
direction: Option<&'req str>
}
impl<'req> ActionsGetActionsCacheListParams<'req> {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
git_ref: self.git_ref,
key: self.key,
sort: self.sort,
direction: self.direction,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
git_ref: self.git_ref,
key: self.key,
sort: self.sort,
direction: self.direction,
}
}
/// The full Git reference for narrowing down the cache. The `ref` for a branch should be formatted as `refs/heads/<branch name>`. To reference a pull request use `refs/pull/<number>/merge`.
pub fn git_ref(self, git_ref: &'req str) -> Self {
Self {
per_page: self.per_page,
page: self.page,
git_ref: Some(git_ref),
key: self.key,
sort: self.sort,
direction: self.direction,
}
}
/// An explicit key or prefix for identifying the cache
pub fn key(self, key: &'req str) -> Self {
Self {
per_page: self.per_page,
page: self.page,
git_ref: self.git_ref,
key: Some(key),
sort: self.sort,
direction: self.direction,
}
}
/// The property to sort the results by. `created_at` means when the cache was created. `last_accessed_at` means when the cache was last accessed. `size_in_bytes` is the size of the cache in bytes.
pub fn sort(self, sort: &'req str) -> Self {
Self {
per_page: self.per_page,
page: self.page,
git_ref: self.git_ref,
key: self.key,
sort: Some(sort),
direction: self.direction,
}
}
/// The direction to sort the results by.
pub fn direction(self, direction: &'req str) -> Self {
Self {
per_page: self.per_page,
page: self.page,
git_ref: self.git_ref,
key: self.key,
sort: self.sort,
direction: Some(direction),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsGetActionsCacheListParams<'enc> {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List repositories with GitHub Actions cache usage for an organization](Actions::get_actions_cache_usage_by_repo_for_org_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsGetActionsCacheUsageByRepoForOrgParams {
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl ActionsGetActionsCacheUsageByRepoForOrgParams {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsGetActionsCacheUsageByRepoForOrgParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [Get a workflow run](Actions::get_workflow_run_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsGetWorkflowRunParams {
/// If `true` pull requests are omitted from the response (empty array).
exclude_pull_requests: Option<bool>
}
impl ActionsGetWorkflowRunParams {
pub fn new() -> Self {
Self::default()
}
/// If `true` pull requests are omitted from the response (empty array).
pub fn exclude_pull_requests(self, exclude_pull_requests: bool) -> Self {
Self {
exclude_pull_requests: Some(exclude_pull_requests),
}
}
}
/// Query parameters for the [Get a workflow run attempt](Actions::get_workflow_run_attempt_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsGetWorkflowRunAttemptParams {
/// If `true` pull requests are omitted from the response (empty array).
exclude_pull_requests: Option<bool>
}
impl ActionsGetWorkflowRunAttemptParams {
pub fn new() -> Self {
Self::default()
}
/// If `true` pull requests are omitted from the response (empty array).
pub fn exclude_pull_requests(self, exclude_pull_requests: bool) -> Self {
Self {
exclude_pull_requests: Some(exclude_pull_requests),
}
}
}
/// Query parameters for the [List artifacts for a repository](Actions::list_artifacts_for_repo_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListArtifactsForRepoParams<'req> {
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>,
/// The name field of an artifact. When specified, only artifacts with this name will be returned.
name: Option<&'req str>
}
impl<'req> ActionsListArtifactsForRepoParams<'req> {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
name: self.name,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
name: self.name,
}
}
/// The name field of an artifact. When specified, only artifacts with this name will be returned.
pub fn name(self, name: &'req str) -> Self {
Self {
per_page: self.per_page,
page: self.page,
name: Some(name),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListArtifactsForRepoParams<'enc> {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List environment secrets](Actions::list_environment_secrets_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListEnvironmentSecretsParams {
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl ActionsListEnvironmentSecretsParams {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListEnvironmentSecretsParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List environment variables](Actions::list_environment_variables_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListEnvironmentVariablesParams {
/// The number of results per page (max 30). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl ActionsListEnvironmentVariablesParams {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 30). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListEnvironmentVariablesParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List GitHub-hosted runners in a group for an organization](Actions::list_github_hosted_runners_in_group_for_org_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListGithubHostedRunnersInGroupForOrgParams {
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl ActionsListGithubHostedRunnersInGroupForOrgParams {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListGithubHostedRunnersInGroupForOrgParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List GitHub-hosted runners for an organization](Actions::list_hosted_runners_for_org_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListHostedRunnersForOrgParams {
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl ActionsListHostedRunnersForOrgParams {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListHostedRunnersForOrgParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List jobs for a workflow run](Actions::list_jobs_for_workflow_run_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListJobsForWorkflowRunParams<'req> {
/// Filters jobs by their `completed_at` timestamp. `latest` returns jobs from the most recent execution of the workflow run. `all` returns all jobs for a workflow run, including from old executions of the workflow run.
filter: Option<&'req str>,
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl<'req> ActionsListJobsForWorkflowRunParams<'req> {
pub fn new() -> Self {
Self::default()
}
/// Filters jobs by their `completed_at` timestamp. `latest` returns jobs from the most recent execution of the workflow run. `all` returns all jobs for a workflow run, including from old executions of the workflow run.
pub fn filter(self, filter: &'req str) -> Self {
Self {
filter: Some(filter),
per_page: self.per_page,
page: self.page,
}
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
filter: self.filter,
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
filter: self.filter,
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListJobsForWorkflowRunParams<'enc> {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List jobs for a workflow run attempt](Actions::list_jobs_for_workflow_run_attempt_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListJobsForWorkflowRunAttemptParams {
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl ActionsListJobsForWorkflowRunAttemptParams {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListJobsForWorkflowRunAttemptParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List organization secrets](Actions::list_org_secrets_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListOrgSecretsParams {
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl ActionsListOrgSecretsParams {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListOrgSecretsParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List organization variables](Actions::list_org_variables_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListOrgVariablesParams {
/// The number of results per page (max 30). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl ActionsListOrgVariablesParams {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 30). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListOrgVariablesParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List repository access to a self-hosted runner group in an organization](Actions::list_repo_access_to_self_hosted_runner_group_in_org_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListRepoAccessToSelfHostedRunnerGroupInOrgParams {
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>,
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>
}
impl ActionsListRepoAccessToSelfHostedRunnerGroupInOrgParams {
pub fn new() -> Self {
Self::default()
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
page: Some(page),
per_page: self.per_page,
}
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
page: self.page,
per_page: Some(per_page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListRepoAccessToSelfHostedRunnerGroupInOrgParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List repository organization secrets](Actions::list_repo_organization_secrets_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListRepoOrganizationSecretsParams {
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl ActionsListRepoOrganizationSecretsParams {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListRepoOrganizationSecretsParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List repository organization variables](Actions::list_repo_organization_variables_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListRepoOrganizationVariablesParams {
/// The number of results per page (max 30). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl ActionsListRepoOrganizationVariablesParams {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 30). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListRepoOrganizationVariablesParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List repository secrets](Actions::list_repo_secrets_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListRepoSecretsParams {
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl ActionsListRepoSecretsParams {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListRepoSecretsParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List repository variables](Actions::list_repo_variables_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListRepoVariablesParams {
/// The number of results per page (max 30). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl ActionsListRepoVariablesParams {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 30). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListRepoVariablesParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List repository workflows](Actions::list_repo_workflows_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListRepoWorkflowsParams {
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl ActionsListRepoWorkflowsParams {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListRepoWorkflowsParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List selected repositories for an organization secret](Actions::list_selected_repos_for_org_secret_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListSelectedReposForOrgSecretParams {
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>,
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>
}
impl ActionsListSelectedReposForOrgSecretParams {
pub fn new() -> Self {
Self::default()
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
page: Some(page),
per_page: self.per_page,
}
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
page: self.page,
per_page: Some(per_page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListSelectedReposForOrgSecretParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List selected repositories for an organization variable](Actions::list_selected_repos_for_org_variable_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListSelectedReposForOrgVariableParams {
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>,
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>
}
impl ActionsListSelectedReposForOrgVariableParams {
pub fn new() -> Self {
Self::default()
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
page: Some(page),
per_page: self.per_page,
}
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
page: self.page,
per_page: Some(per_page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListSelectedReposForOrgVariableParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List selected repositories enabled for GitHub Actions in an organization](Actions::list_selected_repositories_enabled_github_actions_organization_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationParams {
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationParams {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List self-hosted runner groups for an organization](Actions::list_self_hosted_runner_groups_for_org_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListSelfHostedRunnerGroupsForOrgParams<'req> {
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>,
/// Only return runner groups that are allowed to be used by this repository.
visible_to_repository: Option<&'req str>
}
impl<'req> ActionsListSelfHostedRunnerGroupsForOrgParams<'req> {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
visible_to_repository: self.visible_to_repository,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
visible_to_repository: self.visible_to_repository,
}
}
/// Only return runner groups that are allowed to be used by this repository.
pub fn visible_to_repository(self, visible_to_repository: &'req str) -> Self {
Self {
per_page: self.per_page,
page: self.page,
visible_to_repository: Some(visible_to_repository),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListSelfHostedRunnerGroupsForOrgParams<'enc> {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List self-hosted runners for an organization](Actions::list_self_hosted_runners_for_org_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListSelfHostedRunnersForOrgParams<'req> {
/// The name of a self-hosted runner.
name: Option<&'req str>,
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl<'req> ActionsListSelfHostedRunnersForOrgParams<'req> {
pub fn new() -> Self {
Self::default()
}
/// The name of a self-hosted runner.
pub fn name(self, name: &'req str) -> Self {
Self {
name: Some(name),
per_page: self.per_page,
page: self.page,
}
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
name: self.name,
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
name: self.name,
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListSelfHostedRunnersForOrgParams<'enc> {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List self-hosted runners for a repository](Actions::list_self_hosted_runners_for_repo_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListSelfHostedRunnersForRepoParams<'req> {
/// The name of a self-hosted runner.
name: Option<&'req str>,
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl<'req> ActionsListSelfHostedRunnersForRepoParams<'req> {
pub fn new() -> Self {
Self::default()
}
/// The name of a self-hosted runner.
pub fn name(self, name: &'req str) -> Self {
Self {
name: Some(name),
per_page: self.per_page,
page: self.page,
}
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
name: self.name,
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
name: self.name,
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListSelfHostedRunnersForRepoParams<'enc> {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List self-hosted runners in a group for an organization](Actions::list_self_hosted_runners_in_group_for_org_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListSelfHostedRunnersInGroupForOrgParams {
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>
}
impl ActionsListSelfHostedRunnersInGroupForOrgParams {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListSelfHostedRunnersInGroupForOrgParams {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List workflow run artifacts](Actions::list_workflow_run_artifacts_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListWorkflowRunArtifactsParams<'req> {
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>,
/// The name field of an artifact. When specified, only artifacts with this name will be returned.
name: Option<&'req str>
}
impl<'req> ActionsListWorkflowRunArtifactsParams<'req> {
pub fn new() -> Self {
Self::default()
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
per_page: Some(per_page),
page: self.page,
name: self.name,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
per_page: self.per_page,
page: Some(page),
name: self.name,
}
}
/// The name field of an artifact. When specified, only artifacts with this name will be returned.
pub fn name(self, name: &'req str) -> Self {
Self {
per_page: self.per_page,
page: self.page,
name: Some(name),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListWorkflowRunArtifactsParams<'enc> {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List workflow runs for a workflow](Actions::list_workflow_runs_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListWorkflowRunsParams<'req> {
/// Returns someone's workflow runs. Use the login for the user who created the `push` associated with the check suite or workflow run.
actor: Option<&'req str>,
/// Returns workflow runs associated with a branch. Use the name of the branch of the `push`.
branch: Option<&'req str>,
/// Returns workflow run triggered by the event you specify. For example, `push`, `pull_request` or `issue`. For more information, see \"[Events that trigger workflows](https://docs.github.com/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows).\"
event: Option<&'req str>,
/// Returns workflow runs with the check run `status` or `conclusion` that you specify. For example, a conclusion can be `success` or a status can be `in_progress`. Only GitHub Actions can set a status of `waiting`, `pending`, or `requested`.
status: Option<&'req str>,
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>,
/// Returns workflow runs created within the given date-time range. For more information on the syntax, see \"[Understanding the search syntax](https://docs.github.com/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#query-for-dates).\"
created: Option<chrono::DateTime<chrono::Utc>>,
/// If `true` pull requests are omitted from the response (empty array).
exclude_pull_requests: Option<bool>,
/// Returns workflow runs with the `check_suite_id` that you specify.
check_suite_id: Option<i32>,
/// Only returns workflow runs that are associated with the specified `head_sha`.
head_sha: Option<&'req str>
}
impl<'req> ActionsListWorkflowRunsParams<'req> {
pub fn new() -> Self {
Self::default()
}
/// Returns someone's workflow runs. Use the login for the user who created the `push` associated with the check suite or workflow run.
pub fn actor(self, actor: &'req str) -> Self {
Self {
actor: Some(actor),
branch: self.branch,
event: self.event,
status: self.status,
per_page: self.per_page,
page: self.page,
created: self.created,
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: self.check_suite_id,
head_sha: self.head_sha,
}
}
/// Returns workflow runs associated with a branch. Use the name of the branch of the `push`.
pub fn branch(self, branch: &'req str) -> Self {
Self {
actor: self.actor,
branch: Some(branch),
event: self.event,
status: self.status,
per_page: self.per_page,
page: self.page,
created: self.created,
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: self.check_suite_id,
head_sha: self.head_sha,
}
}
/// Returns workflow run triggered by the event you specify. For example, `push`, `pull_request` or `issue`. For more information, see \"[Events that trigger workflows](https://docs.github.com/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows).\"
pub fn event(self, event: &'req str) -> Self {
Self {
actor: self.actor,
branch: self.branch,
event: Some(event),
status: self.status,
per_page: self.per_page,
page: self.page,
created: self.created,
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: self.check_suite_id,
head_sha: self.head_sha,
}
}
/// Returns workflow runs with the check run `status` or `conclusion` that you specify. For example, a conclusion can be `success` or a status can be `in_progress`. Only GitHub Actions can set a status of `waiting`, `pending`, or `requested`.
pub fn status(self, status: &'req str) -> Self {
Self {
actor: self.actor,
branch: self.branch,
event: self.event,
status: Some(status),
per_page: self.per_page,
page: self.page,
created: self.created,
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: self.check_suite_id,
head_sha: self.head_sha,
}
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
actor: self.actor,
branch: self.branch,
event: self.event,
status: self.status,
per_page: Some(per_page),
page: self.page,
created: self.created,
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: self.check_suite_id,
head_sha: self.head_sha,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
actor: self.actor,
branch: self.branch,
event: self.event,
status: self.status,
per_page: self.per_page,
page: Some(page),
created: self.created,
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: self.check_suite_id,
head_sha: self.head_sha,
}
}
/// Returns workflow runs created within the given date-time range. For more information on the syntax, see \"[Understanding the search syntax](https://docs.github.com/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#query-for-dates).\"
pub fn created(self, created: chrono::DateTime<chrono::Utc>) -> Self {
Self {
actor: self.actor,
branch: self.branch,
event: self.event,
status: self.status,
per_page: self.per_page,
page: self.page,
created: Some(created),
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: self.check_suite_id,
head_sha: self.head_sha,
}
}
/// If `true` pull requests are omitted from the response (empty array).
pub fn exclude_pull_requests(self, exclude_pull_requests: bool) -> Self {
Self {
actor: self.actor,
branch: self.branch,
event: self.event,
status: self.status,
per_page: self.per_page,
page: self.page,
created: self.created,
exclude_pull_requests: Some(exclude_pull_requests),
check_suite_id: self.check_suite_id,
head_sha: self.head_sha,
}
}
/// Returns workflow runs with the `check_suite_id` that you specify.
pub fn check_suite_id(self, check_suite_id: i32) -> Self {
Self {
actor: self.actor,
branch: self.branch,
event: self.event,
status: self.status,
per_page: self.per_page,
page: self.page,
created: self.created,
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: Some(check_suite_id),
head_sha: self.head_sha,
}
}
/// Only returns workflow runs that are associated with the specified `head_sha`.
pub fn head_sha(self, head_sha: &'req str) -> Self {
Self {
actor: self.actor,
branch: self.branch,
event: self.event,
status: self.status,
per_page: self.per_page,
page: self.page,
created: self.created,
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: self.check_suite_id,
head_sha: Some(head_sha),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListWorkflowRunsParams<'enc> {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
/// Query parameters for the [List workflow runs for a repository](Actions::list_workflow_runs_for_repo_async()) endpoint.
#[derive(Default, Serialize)]
pub struct ActionsListWorkflowRunsForRepoParams<'req> {
/// Returns someone's workflow runs. Use the login for the user who created the `push` associated with the check suite or workflow run.
actor: Option<&'req str>,
/// Returns workflow runs associated with a branch. Use the name of the branch of the `push`.
branch: Option<&'req str>,
/// Returns workflow run triggered by the event you specify. For example, `push`, `pull_request` or `issue`. For more information, see \"[Events that trigger workflows](https://docs.github.com/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows).\"
event: Option<&'req str>,
/// Returns workflow runs with the check run `status` or `conclusion` that you specify. For example, a conclusion can be `success` or a status can be `in_progress`. Only GitHub Actions can set a status of `waiting`, `pending`, or `requested`.
status: Option<&'req str>,
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
per_page: Option<u16>,
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
page: Option<u16>,
/// Returns workflow runs created within the given date-time range. For more information on the syntax, see \"[Understanding the search syntax](https://docs.github.com/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#query-for-dates).\"
created: Option<chrono::DateTime<chrono::Utc>>,
/// If `true` pull requests are omitted from the response (empty array).
exclude_pull_requests: Option<bool>,
/// Returns workflow runs with the `check_suite_id` that you specify.
check_suite_id: Option<i32>,
/// Only returns workflow runs that are associated with the specified `head_sha`.
head_sha: Option<&'req str>
}
impl<'req> ActionsListWorkflowRunsForRepoParams<'req> {
pub fn new() -> Self {
Self::default()
}
/// Returns someone's workflow runs. Use the login for the user who created the `push` associated with the check suite or workflow run.
pub fn actor(self, actor: &'req str) -> Self {
Self {
actor: Some(actor),
branch: self.branch,
event: self.event,
status: self.status,
per_page: self.per_page,
page: self.page,
created: self.created,
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: self.check_suite_id,
head_sha: self.head_sha,
}
}
/// Returns workflow runs associated with a branch. Use the name of the branch of the `push`.
pub fn branch(self, branch: &'req str) -> Self {
Self {
actor: self.actor,
branch: Some(branch),
event: self.event,
status: self.status,
per_page: self.per_page,
page: self.page,
created: self.created,
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: self.check_suite_id,
head_sha: self.head_sha,
}
}
/// Returns workflow run triggered by the event you specify. For example, `push`, `pull_request` or `issue`. For more information, see \"[Events that trigger workflows](https://docs.github.com/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows).\"
pub fn event(self, event: &'req str) -> Self {
Self {
actor: self.actor,
branch: self.branch,
event: Some(event),
status: self.status,
per_page: self.per_page,
page: self.page,
created: self.created,
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: self.check_suite_id,
head_sha: self.head_sha,
}
}
/// Returns workflow runs with the check run `status` or `conclusion` that you specify. For example, a conclusion can be `success` or a status can be `in_progress`. Only GitHub Actions can set a status of `waiting`, `pending`, or `requested`.
pub fn status(self, status: &'req str) -> Self {
Self {
actor: self.actor,
branch: self.branch,
event: self.event,
status: Some(status),
per_page: self.per_page,
page: self.page,
created: self.created,
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: self.check_suite_id,
head_sha: self.head_sha,
}
}
/// The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn per_page(self, per_page: u16) -> Self {
Self {
actor: self.actor,
branch: self.branch,
event: self.event,
status: self.status,
per_page: Some(per_page),
page: self.page,
created: self.created,
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: self.check_suite_id,
head_sha: self.head_sha,
}
}
/// The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"
pub fn page(self, page: u16) -> Self {
Self {
actor: self.actor,
branch: self.branch,
event: self.event,
status: self.status,
per_page: self.per_page,
page: Some(page),
created: self.created,
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: self.check_suite_id,
head_sha: self.head_sha,
}
}
/// Returns workflow runs created within the given date-time range. For more information on the syntax, see \"[Understanding the search syntax](https://docs.github.com/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#query-for-dates).\"
pub fn created(self, created: chrono::DateTime<chrono::Utc>) -> Self {
Self {
actor: self.actor,
branch: self.branch,
event: self.event,
status: self.status,
per_page: self.per_page,
page: self.page,
created: Some(created),
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: self.check_suite_id,
head_sha: self.head_sha,
}
}
/// If `true` pull requests are omitted from the response (empty array).
pub fn exclude_pull_requests(self, exclude_pull_requests: bool) -> Self {
Self {
actor: self.actor,
branch: self.branch,
event: self.event,
status: self.status,
per_page: self.per_page,
page: self.page,
created: self.created,
exclude_pull_requests: Some(exclude_pull_requests),
check_suite_id: self.check_suite_id,
head_sha: self.head_sha,
}
}
/// Returns workflow runs with the `check_suite_id` that you specify.
pub fn check_suite_id(self, check_suite_id: i32) -> Self {
Self {
actor: self.actor,
branch: self.branch,
event: self.event,
status: self.status,
per_page: self.per_page,
page: self.page,
created: self.created,
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: Some(check_suite_id),
head_sha: self.head_sha,
}
}
/// Only returns workflow runs that are associated with the specified `head_sha`.
pub fn head_sha(self, head_sha: &'req str) -> Self {
Self {
actor: self.actor,
branch: self.branch,
event: self.event,
status: self.status,
per_page: self.per_page,
page: self.page,
created: self.created,
exclude_pull_requests: self.exclude_pull_requests,
check_suite_id: self.check_suite_id,
head_sha: Some(head_sha),
}
}
}
impl<'enc> From<&'enc PerPage> for ActionsListWorkflowRunsForRepoParams<'enc> {
fn from(per_page: &'enc PerPage) -> Self {
Self {
per_page: Some(per_page.per_page),
page: Some(per_page.page),
..Default::default()
}
}
}
impl<'api, C: Client> Actions<'api, C> where AdapterError: From<<C as Client>::Err> {
/// ---
///
/// # Add custom labels to a self-hosted runner for an organization
///
/// Adds custom labels to a self-hosted runner configured in an organization.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for add_custom_labels_to_self_hosted_runner_for_org](https://docs.github.com/rest/actions/self-hosted-runners#add-custom-labels-to-a-self-hosted-runner-for-an-organization)
///
/// ---
pub async fn add_custom_labels_to_self_hosted_runner_for_org_async(&self, org: &str, runner_id: i32, body: PostActionsAddCustomLabelsToSelfHostedRunnerForOrg) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/{}/labels", super::GITHUB_BASE_API_URL, org, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsAddCustomLabelsToSelfHostedRunnerForOrg>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
404 => Err(ActionsAddCustomLabelsToSelfHostedRunnerForOrgError::Status404(github_response.to_json_async().await?).into()),
422 => Err(ActionsAddCustomLabelsToSelfHostedRunnerForOrgError::Status422(github_response.to_json_async().await?).into()),
code => Err(ActionsAddCustomLabelsToSelfHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Add custom labels to a self-hosted runner for an organization
///
/// Adds custom labels to a self-hosted runner configured in an organization.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for add_custom_labels_to_self_hosted_runner_for_org](https://docs.github.com/rest/actions/self-hosted-runners#add-custom-labels-to-a-self-hosted-runner-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn add_custom_labels_to_self_hosted_runner_for_org(&self, org: &str, runner_id: i32, body: PostActionsAddCustomLabelsToSelfHostedRunnerForOrg) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/{}/labels", super::GITHUB_BASE_API_URL, org, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsAddCustomLabelsToSelfHostedRunnerForOrg>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
404 => Err(ActionsAddCustomLabelsToSelfHostedRunnerForOrgError::Status404(github_response.to_json()?).into()),
422 => Err(ActionsAddCustomLabelsToSelfHostedRunnerForOrgError::Status422(github_response.to_json()?).into()),
code => Err(ActionsAddCustomLabelsToSelfHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Add custom labels to a self-hosted runner for a repository
///
/// Adds custom labels to a self-hosted runner configured in a repository.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for add_custom_labels_to_self_hosted_runner_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#add-custom-labels-to-a-self-hosted-runner-for-a-repository)
///
/// ---
pub async fn add_custom_labels_to_self_hosted_runner_for_repo_async(&self, owner: &str, repo: &str, runner_id: i32, body: PostActionsAddCustomLabelsToSelfHostedRunnerForRepo) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/{}/labels", super::GITHUB_BASE_API_URL, owner, repo, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsAddCustomLabelsToSelfHostedRunnerForRepo>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
404 => Err(ActionsAddCustomLabelsToSelfHostedRunnerForRepoError::Status404(github_response.to_json_async().await?).into()),
422 => Err(ActionsAddCustomLabelsToSelfHostedRunnerForRepoError::Status422(github_response.to_json_async().await?).into()),
code => Err(ActionsAddCustomLabelsToSelfHostedRunnerForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Add custom labels to a self-hosted runner for a repository
///
/// Adds custom labels to a self-hosted runner configured in a repository.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for add_custom_labels_to_self_hosted_runner_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#add-custom-labels-to-a-self-hosted-runner-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn add_custom_labels_to_self_hosted_runner_for_repo(&self, owner: &str, repo: &str, runner_id: i32, body: PostActionsAddCustomLabelsToSelfHostedRunnerForRepo) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/{}/labels", super::GITHUB_BASE_API_URL, owner, repo, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsAddCustomLabelsToSelfHostedRunnerForRepo>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
404 => Err(ActionsAddCustomLabelsToSelfHostedRunnerForRepoError::Status404(github_response.to_json()?).into()),
422 => Err(ActionsAddCustomLabelsToSelfHostedRunnerForRepoError::Status422(github_response.to_json()?).into()),
code => Err(ActionsAddCustomLabelsToSelfHostedRunnerForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Add repository access to a self-hosted runner group in an organization
///
/// Adds a repository to the list of repositories that can access a self-hosted runner group. The runner group must have `visibility` set to `selected`. For more information, see "[Create a self-hosted runner group for an organization](#create-a-self-hosted-runner-group-for-an-organization)."
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for add_repo_access_to_self_hosted_runner_group_in_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#add-repository-access-to-a-self-hosted-runner-group-in-an-organization)
///
/// ---
pub async fn add_repo_access_to_self_hosted_runner_group_in_org_async(&self, org: &str, runner_group_id: i32, repository_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/repositories/{}", super::GITHUB_BASE_API_URL, org, runner_group_id, repository_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Add repository access to a self-hosted runner group in an organization
///
/// Adds a repository to the list of repositories that can access a self-hosted runner group. The runner group must have `visibility` set to `selected`. For more information, see "[Create a self-hosted runner group for an organization](#create-a-self-hosted-runner-group-for-an-organization)."
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for add_repo_access_to_self_hosted_runner_group_in_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#add-repository-access-to-a-self-hosted-runner-group-in-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn add_repo_access_to_self_hosted_runner_group_in_org(&self, org: &str, runner_group_id: i32, repository_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/repositories/{}", super::GITHUB_BASE_API_URL, org, runner_group_id, repository_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Add selected repository to an organization secret
///
/// Adds a repository to an organization secret when the `visibility` for
/// repository access is set to `selected`. For more information about setting the visibility, see [Create or
/// update an organization secret](https://docs.github.com/rest/actions/secrets#create-or-update-an-organization-secret).
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for add_selected_repo_to_org_secret](https://docs.github.com/rest/actions/secrets#add-selected-repository-to-an-organization-secret)
///
/// ---
pub async fn add_selected_repo_to_org_secret_async(&self, org: &str, secret_name: &str, repository_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/secrets/{}/repositories/{}", super::GITHUB_BASE_API_URL, org, secret_name, repository_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
409 => Err(ActionsAddSelectedRepoToOrgSecretError::Status409.into()),
code => Err(ActionsAddSelectedRepoToOrgSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Add selected repository to an organization secret
///
/// Adds a repository to an organization secret when the `visibility` for
/// repository access is set to `selected`. For more information about setting the visibility, see [Create or
/// update an organization secret](https://docs.github.com/rest/actions/secrets#create-or-update-an-organization-secret).
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for add_selected_repo_to_org_secret](https://docs.github.com/rest/actions/secrets#add-selected-repository-to-an-organization-secret)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn add_selected_repo_to_org_secret(&self, org: &str, secret_name: &str, repository_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/secrets/{}/repositories/{}", super::GITHUB_BASE_API_URL, org, secret_name, repository_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
409 => Err(ActionsAddSelectedRepoToOrgSecretError::Status409.into()),
code => Err(ActionsAddSelectedRepoToOrgSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Add selected repository to an organization variable
///
/// Adds a repository to an organization variable that is available to selected repositories.
/// Organization variables that are available to selected repositories have their `visibility` field set to `selected`.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for add_selected_repo_to_org_variable](https://docs.github.com/rest/actions/variables#add-selected-repository-to-an-organization-variable)
///
/// ---
pub async fn add_selected_repo_to_org_variable_async(&self, org: &str, name: &str, repository_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/variables/{}/repositories/{}", super::GITHUB_BASE_API_URL, org, name, repository_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
409 => Err(ActionsAddSelectedRepoToOrgVariableError::Status409.into()),
code => Err(ActionsAddSelectedRepoToOrgVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Add selected repository to an organization variable
///
/// Adds a repository to an organization variable that is available to selected repositories.
/// Organization variables that are available to selected repositories have their `visibility` field set to `selected`.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for add_selected_repo_to_org_variable](https://docs.github.com/rest/actions/variables#add-selected-repository-to-an-organization-variable)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn add_selected_repo_to_org_variable(&self, org: &str, name: &str, repository_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/variables/{}/repositories/{}", super::GITHUB_BASE_API_URL, org, name, repository_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
409 => Err(ActionsAddSelectedRepoToOrgVariableError::Status409.into()),
code => Err(ActionsAddSelectedRepoToOrgVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Add a self-hosted runner to a group for an organization
///
/// Adds a self-hosted runner to a runner group configured in an organization.
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for add_self_hosted_runner_to_group_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-organization)
///
/// ---
pub async fn add_self_hosted_runner_to_group_for_org_async(&self, org: &str, runner_group_id: i32, runner_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/runners/{}", super::GITHUB_BASE_API_URL, org, runner_group_id, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsAddSelfHostedRunnerToGroupForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Add a self-hosted runner to a group for an organization
///
/// Adds a self-hosted runner to a runner group configured in an organization.
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for add_self_hosted_runner_to_group_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn add_self_hosted_runner_to_group_for_org(&self, org: &str, runner_group_id: i32, runner_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/runners/{}", super::GITHUB_BASE_API_URL, org, runner_group_id, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsAddSelfHostedRunnerToGroupForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Approve a workflow run for a fork pull request
///
/// Approves a workflow run for a pull request from a public fork of a first time contributor. For more information, see ["Approving workflow runs from public forks](https://docs.github.com/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks)."
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for approve_workflow_run](https://docs.github.com/rest/actions/workflow-runs#approve-a-workflow-run-for-a-fork-pull-request)
///
/// ---
pub async fn approve_workflow_run_async(&self, owner: &str, repo: &str, run_id: i32) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/approve", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
404 => Err(ActionsApproveWorkflowRunError::Status404(github_response.to_json_async().await?).into()),
403 => Err(ActionsApproveWorkflowRunError::Status403(github_response.to_json_async().await?).into()),
code => Err(ActionsApproveWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Approve a workflow run for a fork pull request
///
/// Approves a workflow run for a pull request from a public fork of a first time contributor. For more information, see ["Approving workflow runs from public forks](https://docs.github.com/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks)."
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for approve_workflow_run](https://docs.github.com/rest/actions/workflow-runs#approve-a-workflow-run-for-a-fork-pull-request)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn approve_workflow_run(&self, owner: &str, repo: &str, run_id: i32) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/approve", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
404 => Err(ActionsApproveWorkflowRunError::Status404(github_response.to_json()?).into()),
403 => Err(ActionsApproveWorkflowRunError::Status403(github_response.to_json()?).into()),
code => Err(ActionsApproveWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Cancel a workflow run
///
/// Cancels a workflow run using its `id`.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for cancel_workflow_run](https://docs.github.com/rest/actions/workflow-runs#cancel-a-workflow-run)
///
/// ---
pub async fn cancel_workflow_run_async(&self, owner: &str, repo: &str, run_id: i32) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/cancel", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
409 => Err(ActionsCancelWorkflowRunError::Status409(github_response.to_json_async().await?).into()),
code => Err(ActionsCancelWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Cancel a workflow run
///
/// Cancels a workflow run using its `id`.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for cancel_workflow_run](https://docs.github.com/rest/actions/workflow-runs#cancel-a-workflow-run)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn cancel_workflow_run(&self, owner: &str, repo: &str, run_id: i32) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/cancel", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
409 => Err(ActionsCancelWorkflowRunError::Status409(github_response.to_json()?).into()),
code => Err(ActionsCancelWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create an environment variable
///
/// Create an environment variable that you can reference in a GitHub Actions workflow.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_environment_variable](https://docs.github.com/rest/actions/variables#create-an-environment-variable)
///
/// ---
pub async fn create_environment_variable_async(&self, owner: &str, repo: &str, environment_name: &str, body: PostActionsCreateEnvironmentVariable) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/environments/{}/variables", super::GITHUB_BASE_API_URL, owner, repo, environment_name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsCreateEnvironmentVariable>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateEnvironmentVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create an environment variable
///
/// Create an environment variable that you can reference in a GitHub Actions workflow.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_environment_variable](https://docs.github.com/rest/actions/variables#create-an-environment-variable)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn create_environment_variable(&self, owner: &str, repo: &str, environment_name: &str, body: PostActionsCreateEnvironmentVariable) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/environments/{}/variables", super::GITHUB_BASE_API_URL, owner, repo, environment_name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsCreateEnvironmentVariable>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateEnvironmentVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create a GitHub-hosted runner for an organization
///
/// Creates a GitHub-hosted runner for an organization.
/// OAuth tokens and personal access tokens (classic) need the `manage_runners:org` scope to use this endpoint.
///
/// [GitHub API docs for create_hosted_runner_for_org](https://docs.github.com/rest/actions/hosted-runners#create-a-github-hosted-runner-for-an-organization)
///
/// ---
pub async fn create_hosted_runner_for_org_async(&self, org: &str, body: PostActionsCreateHostedRunnerForOrg) -> Result<ActionsHostedRunner, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsCreateHostedRunnerForOrg>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create a GitHub-hosted runner for an organization
///
/// Creates a GitHub-hosted runner for an organization.
/// OAuth tokens and personal access tokens (classic) need the `manage_runners:org` scope to use this endpoint.
///
/// [GitHub API docs for create_hosted_runner_for_org](https://docs.github.com/rest/actions/hosted-runners#create-a-github-hosted-runner-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn create_hosted_runner_for_org(&self, org: &str, body: PostActionsCreateHostedRunnerForOrg) -> Result<ActionsHostedRunner, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsCreateHostedRunnerForOrg>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create or update an environment secret
///
/// Creates or updates an environment secret with an encrypted value. Encrypt your secret using
/// [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). For more information, see "[Encrypting secrets for the REST API](https://docs.github.com/rest/guides/encrypting-secrets-for-the-rest-api)."
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_or_update_environment_secret](https://docs.github.com/rest/actions/secrets#create-or-update-an-environment-secret)
///
/// ---
pub async fn create_or_update_environment_secret_async(&self, owner: &str, repo: &str, environment_name: &str, secret_name: &str, body: PutActionsCreateOrUpdateEnvironmentSecret) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/environments/{}/secrets/{}", super::GITHUB_BASE_API_URL, owner, repo, environment_name, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsCreateOrUpdateEnvironmentSecret>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
204 => Err(ActionsCreateOrUpdateEnvironmentSecretError::Status204.into()),
code => Err(ActionsCreateOrUpdateEnvironmentSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create or update an environment secret
///
/// Creates or updates an environment secret with an encrypted value. Encrypt your secret using
/// [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). For more information, see "[Encrypting secrets for the REST API](https://docs.github.com/rest/guides/encrypting-secrets-for-the-rest-api)."
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_or_update_environment_secret](https://docs.github.com/rest/actions/secrets#create-or-update-an-environment-secret)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn create_or_update_environment_secret(&self, owner: &str, repo: &str, environment_name: &str, secret_name: &str, body: PutActionsCreateOrUpdateEnvironmentSecret) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/environments/{}/secrets/{}", super::GITHUB_BASE_API_URL, owner, repo, environment_name, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsCreateOrUpdateEnvironmentSecret>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
204 => Err(ActionsCreateOrUpdateEnvironmentSecretError::Status204.into()),
code => Err(ActionsCreateOrUpdateEnvironmentSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create or update an organization secret
///
/// Creates or updates an organization secret with an encrypted value. Encrypt your secret using
/// [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). For more information, see "[Encrypting secrets for the REST API](https://docs.github.com/rest/guides/encrypting-secrets-for-the-rest-api)."
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_or_update_org_secret](https://docs.github.com/rest/actions/secrets#create-or-update-an-organization-secret)
///
/// ---
pub async fn create_or_update_org_secret_async(&self, org: &str, secret_name: &str, body: PutActionsCreateOrUpdateOrgSecret) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/secrets/{}", super::GITHUB_BASE_API_URL, org, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsCreateOrUpdateOrgSecret>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
204 => Err(ActionsCreateOrUpdateOrgSecretError::Status204.into()),
code => Err(ActionsCreateOrUpdateOrgSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create or update an organization secret
///
/// Creates or updates an organization secret with an encrypted value. Encrypt your secret using
/// [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). For more information, see "[Encrypting secrets for the REST API](https://docs.github.com/rest/guides/encrypting-secrets-for-the-rest-api)."
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_or_update_org_secret](https://docs.github.com/rest/actions/secrets#create-or-update-an-organization-secret)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn create_or_update_org_secret(&self, org: &str, secret_name: &str, body: PutActionsCreateOrUpdateOrgSecret) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/secrets/{}", super::GITHUB_BASE_API_URL, org, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsCreateOrUpdateOrgSecret>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
204 => Err(ActionsCreateOrUpdateOrgSecretError::Status204.into()),
code => Err(ActionsCreateOrUpdateOrgSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create or update a repository secret
///
/// Creates or updates a repository secret with an encrypted value. Encrypt your secret using
/// [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). For more information, see "[Encrypting secrets for the REST API](https://docs.github.com/rest/guides/encrypting-secrets-for-the-rest-api)."
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_or_update_repo_secret](https://docs.github.com/rest/actions/secrets#create-or-update-a-repository-secret)
///
/// ---
pub async fn create_or_update_repo_secret_async(&self, owner: &str, repo: &str, secret_name: &str, body: PutActionsCreateOrUpdateRepoSecret) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/secrets/{}", super::GITHUB_BASE_API_URL, owner, repo, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsCreateOrUpdateRepoSecret>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
204 => Err(ActionsCreateOrUpdateRepoSecretError::Status204.into()),
code => Err(ActionsCreateOrUpdateRepoSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create or update a repository secret
///
/// Creates or updates a repository secret with an encrypted value. Encrypt your secret using
/// [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). For more information, see "[Encrypting secrets for the REST API](https://docs.github.com/rest/guides/encrypting-secrets-for-the-rest-api)."
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_or_update_repo_secret](https://docs.github.com/rest/actions/secrets#create-or-update-a-repository-secret)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn create_or_update_repo_secret(&self, owner: &str, repo: &str, secret_name: &str, body: PutActionsCreateOrUpdateRepoSecret) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/secrets/{}", super::GITHUB_BASE_API_URL, owner, repo, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsCreateOrUpdateRepoSecret>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
204 => Err(ActionsCreateOrUpdateRepoSecretError::Status204.into()),
code => Err(ActionsCreateOrUpdateRepoSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create an organization variable
///
/// Creates an organization variable that you can reference in a GitHub Actions workflow.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_org_variable](https://docs.github.com/rest/actions/variables#create-an-organization-variable)
///
/// ---
pub async fn create_org_variable_async(&self, org: &str, body: PostActionsCreateOrgVariable) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/variables", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsCreateOrgVariable>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateOrgVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create an organization variable
///
/// Creates an organization variable that you can reference in a GitHub Actions workflow.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_org_variable](https://docs.github.com/rest/actions/variables#create-an-organization-variable)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn create_org_variable(&self, org: &str, body: PostActionsCreateOrgVariable) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/variables", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsCreateOrgVariable>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateOrgVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create a registration token for an organization
///
/// Returns a token that you can pass to the `config` script. The token expires after one hour.
///
/// For example, you can replace `TOKEN` in the following example with the registration token provided by this endpoint to configure your self-hosted runner:
///
/// ```nocompile
/// ./config.sh --url https://github.com/octo-org --token TOKEN
/// ```
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_registration_token_for_org](https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-an-organization)
///
/// ---
pub async fn create_registration_token_for_org_async(&self, org: &str) -> Result<AuthenticationToken, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/registration-token", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateRegistrationTokenForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create a registration token for an organization
///
/// Returns a token that you can pass to the `config` script. The token expires after one hour.
///
/// For example, you can replace `TOKEN` in the following example with the registration token provided by this endpoint to configure your self-hosted runner:
///
/// ```nocompile
/// ./config.sh --url https://github.com/octo-org --token TOKEN
/// ```
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_registration_token_for_org](https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn create_registration_token_for_org(&self, org: &str) -> Result<AuthenticationToken, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/registration-token", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateRegistrationTokenForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create a registration token for a repository
///
/// Returns a token that you can pass to the `config` script. The token expires after one hour.
///
/// For example, you can replace `TOKEN` in the following example with the registration token provided by this endpoint to configure your self-hosted runner:
///
/// ```nocompile
/// ./config.sh --url https://github.com/octo-org --token TOKEN
/// ```
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_registration_token_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-a-repository)
///
/// ---
pub async fn create_registration_token_for_repo_async(&self, owner: &str, repo: &str) -> Result<AuthenticationToken, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/registration-token", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateRegistrationTokenForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create a registration token for a repository
///
/// Returns a token that you can pass to the `config` script. The token expires after one hour.
///
/// For example, you can replace `TOKEN` in the following example with the registration token provided by this endpoint to configure your self-hosted runner:
///
/// ```nocompile
/// ./config.sh --url https://github.com/octo-org --token TOKEN
/// ```
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_registration_token_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn create_registration_token_for_repo(&self, owner: &str, repo: &str) -> Result<AuthenticationToken, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/registration-token", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateRegistrationTokenForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create a remove token for an organization
///
/// Returns a token that you can pass to the `config` script to remove a self-hosted runner from an organization. The token expires after one hour.
///
/// For example, you can replace `TOKEN` in the following example with the registration token provided by this endpoint to remove your self-hosted runner from an organization:
///
/// ```nocompile
/// ./config.sh remove --token TOKEN
/// ```
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_remove_token_for_org](https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-an-organization)
///
/// ---
pub async fn create_remove_token_for_org_async(&self, org: &str) -> Result<AuthenticationToken, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/remove-token", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateRemoveTokenForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create a remove token for an organization
///
/// Returns a token that you can pass to the `config` script to remove a self-hosted runner from an organization. The token expires after one hour.
///
/// For example, you can replace `TOKEN` in the following example with the registration token provided by this endpoint to remove your self-hosted runner from an organization:
///
/// ```nocompile
/// ./config.sh remove --token TOKEN
/// ```
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_remove_token_for_org](https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn create_remove_token_for_org(&self, org: &str) -> Result<AuthenticationToken, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/remove-token", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateRemoveTokenForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create a remove token for a repository
///
/// Returns a token that you can pass to the `config` script to remove a self-hosted runner from an repository. The token expires after one hour.
///
/// For example, you can replace `TOKEN` in the following example with the registration token provided by this endpoint to remove your self-hosted runner from an organization:
///
/// ```nocompile
/// ./config.sh remove --token TOKEN
/// ```
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_remove_token_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-a-repository)
///
/// ---
pub async fn create_remove_token_for_repo_async(&self, owner: &str, repo: &str) -> Result<AuthenticationToken, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/remove-token", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateRemoveTokenForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create a remove token for a repository
///
/// Returns a token that you can pass to the `config` script to remove a self-hosted runner from an repository. The token expires after one hour.
///
/// For example, you can replace `TOKEN` in the following example with the registration token provided by this endpoint to remove your self-hosted runner from an organization:
///
/// ```nocompile
/// ./config.sh remove --token TOKEN
/// ```
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_remove_token_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn create_remove_token_for_repo(&self, owner: &str, repo: &str) -> Result<AuthenticationToken, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/remove-token", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateRemoveTokenForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create a repository variable
///
/// Creates a repository variable that you can reference in a GitHub Actions workflow.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_repo_variable](https://docs.github.com/rest/actions/variables#create-a-repository-variable)
///
/// ---
pub async fn create_repo_variable_async(&self, owner: &str, repo: &str, body: PostActionsCreateRepoVariable) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/variables", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsCreateRepoVariable>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateRepoVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create a repository variable
///
/// Creates a repository variable that you can reference in a GitHub Actions workflow.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_repo_variable](https://docs.github.com/rest/actions/variables#create-a-repository-variable)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn create_repo_variable(&self, owner: &str, repo: &str, body: PostActionsCreateRepoVariable) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/variables", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsCreateRepoVariable>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateRepoVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create a self-hosted runner group for an organization
///
/// Creates a new self-hosted runner group for an organization.
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for create_self_hosted_runner_group_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-organization)
///
/// ---
pub async fn create_self_hosted_runner_group_for_org_async(&self, org: &str, body: PostActionsCreateSelfHostedRunnerGroupForOrg) -> Result<RunnerGroupsOrg, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsCreateSelfHostedRunnerGroupForOrg>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateSelfHostedRunnerGroupForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create a self-hosted runner group for an organization
///
/// Creates a new self-hosted runner group for an organization.
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for create_self_hosted_runner_group_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn create_self_hosted_runner_group_for_org(&self, org: &str, body: PostActionsCreateSelfHostedRunnerGroupForOrg) -> Result<RunnerGroupsOrg, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsCreateSelfHostedRunnerGroupForOrg>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsCreateSelfHostedRunnerGroupForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create a workflow dispatch event
///
/// You can use this endpoint to manually trigger a GitHub Actions workflow run. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`.
///
/// You must configure your GitHub Actions workflow to run when the [`workflow_dispatch` webhook](/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch) event occurs. The `inputs` are configured in the workflow file. For more information about how to configure the `workflow_dispatch` event in the workflow file, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows#workflow_dispatch)."
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_workflow_dispatch](https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event)
///
/// ---
pub async fn create_workflow_dispatch_async(&self, owner: &str, repo: &str, workflow_id: WorkflowId, body: PostActionsCreateWorkflowDispatch) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/workflows/{}/dispatches", super::GITHUB_BASE_API_URL, owner, repo, workflow_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsCreateWorkflowDispatch>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsCreateWorkflowDispatchError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create a workflow dispatch event
///
/// You can use this endpoint to manually trigger a GitHub Actions workflow run. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`.
///
/// You must configure your GitHub Actions workflow to run when the [`workflow_dispatch` webhook](/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch) event occurs. The `inputs` are configured in the workflow file. For more information about how to configure the `workflow_dispatch` event in the workflow file, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows#workflow_dispatch)."
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for create_workflow_dispatch](https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn create_workflow_dispatch(&self, owner: &str, repo: &str, workflow_id: WorkflowId, body: PostActionsCreateWorkflowDispatch) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/workflows/{}/dispatches", super::GITHUB_BASE_API_URL, owner, repo, workflow_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsCreateWorkflowDispatch>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsCreateWorkflowDispatchError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete a GitHub Actions cache for a repository (using a cache ID)
///
/// Deletes a GitHub Actions cache for a repository, using a cache ID.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_actions_cache_by_id](https://docs.github.com/rest/actions/cache#delete-a-github-actions-cache-for-a-repository-using-a-cache-id)
///
/// ---
pub async fn delete_actions_cache_by_id_async(&self, owner: &str, repo: &str, cache_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/caches/{}", super::GITHUB_BASE_API_URL, owner, repo, cache_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteActionsCacheByIdError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete a GitHub Actions cache for a repository (using a cache ID)
///
/// Deletes a GitHub Actions cache for a repository, using a cache ID.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_actions_cache_by_id](https://docs.github.com/rest/actions/cache#delete-a-github-actions-cache-for-a-repository-using-a-cache-id)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn delete_actions_cache_by_id(&self, owner: &str, repo: &str, cache_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/caches/{}", super::GITHUB_BASE_API_URL, owner, repo, cache_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteActionsCacheByIdError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete GitHub Actions caches for a repository (using a cache key)
///
/// Deletes one or more GitHub Actions caches for a repository, using a complete cache key. By default, all caches that match the provided key are deleted, but you can optionally provide a Git ref to restrict deletions to caches that match both the provided key and the Git ref.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_actions_cache_by_key](https://docs.github.com/rest/actions/cache#delete-github-actions-caches-for-a-repository-using-a-cache-key)
///
/// ---
pub async fn delete_actions_cache_by_key_async(&self, owner: &str, repo: &str, query_params: impl Into<ActionsDeleteActionsCacheByKeyParams<'api>>) -> Result<ActionsCacheList, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/caches", super::GITHUB_BASE_API_URL, owner, repo);
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(query_params.into())?);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsDeleteActionsCacheByKeyError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete GitHub Actions caches for a repository (using a cache key)
///
/// Deletes one or more GitHub Actions caches for a repository, using a complete cache key. By default, all caches that match the provided key are deleted, but you can optionally provide a Git ref to restrict deletions to caches that match both the provided key and the Git ref.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_actions_cache_by_key](https://docs.github.com/rest/actions/cache#delete-github-actions-caches-for-a-repository-using-a-cache-key)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn delete_actions_cache_by_key(&self, owner: &str, repo: &str, query_params: impl Into<ActionsDeleteActionsCacheByKeyParams<'api>>) -> Result<ActionsCacheList, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/caches", super::GITHUB_BASE_API_URL, owner, repo);
request_uri.push_str("?");
let qp: ActionsDeleteActionsCacheByKeyParams = query_params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsDeleteActionsCacheByKeyError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete an artifact
///
/// Deletes an artifact for a workflow run.
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_artifact](https://docs.github.com/rest/actions/artifacts#delete-an-artifact)
///
/// ---
pub async fn delete_artifact_async(&self, owner: &str, repo: &str, artifact_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/artifacts/{}", super::GITHUB_BASE_API_URL, owner, repo, artifact_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteArtifactError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete an artifact
///
/// Deletes an artifact for a workflow run.
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_artifact](https://docs.github.com/rest/actions/artifacts#delete-an-artifact)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn delete_artifact(&self, owner: &str, repo: &str, artifact_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/artifacts/{}", super::GITHUB_BASE_API_URL, owner, repo, artifact_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteArtifactError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete an environment secret
///
/// Deletes a secret in an environment using the secret name.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_environment_secret](https://docs.github.com/rest/actions/secrets#delete-an-environment-secret)
///
/// ---
pub async fn delete_environment_secret_async(&self, owner: &str, repo: &str, environment_name: &str, secret_name: &str) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/environments/{}/secrets/{}", super::GITHUB_BASE_API_URL, owner, repo, environment_name, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteEnvironmentSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete an environment secret
///
/// Deletes a secret in an environment using the secret name.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_environment_secret](https://docs.github.com/rest/actions/secrets#delete-an-environment-secret)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn delete_environment_secret(&self, owner: &str, repo: &str, environment_name: &str, secret_name: &str) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/environments/{}/secrets/{}", super::GITHUB_BASE_API_URL, owner, repo, environment_name, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteEnvironmentSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete an environment variable
///
/// Deletes an environment variable using the variable name.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_environment_variable](https://docs.github.com/rest/actions/variables#delete-an-environment-variable)
///
/// ---
pub async fn delete_environment_variable_async(&self, owner: &str, repo: &str, name: &str, environment_name: &str) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/environments/{}/variables/{}", super::GITHUB_BASE_API_URL, owner, repo, name, environment_name);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteEnvironmentVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete an environment variable
///
/// Deletes an environment variable using the variable name.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_environment_variable](https://docs.github.com/rest/actions/variables#delete-an-environment-variable)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn delete_environment_variable(&self, owner: &str, repo: &str, name: &str, environment_name: &str) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/environments/{}/variables/{}", super::GITHUB_BASE_API_URL, owner, repo, name, environment_name);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteEnvironmentVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete a GitHub-hosted runner for an organization
///
/// Deletes a GitHub-hosted runner for an organization.
///
/// [GitHub API docs for delete_hosted_runner_for_org](https://docs.github.com/rest/actions/hosted-runners#delete-a-github-hosted-runner-for-an-organization)
///
/// ---
pub async fn delete_hosted_runner_for_org_async(&self, org: &str, hosted_runner_id: i32) -> Result<ActionsHostedRunner, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners/{}", super::GITHUB_BASE_API_URL, org, hosted_runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsDeleteHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete a GitHub-hosted runner for an organization
///
/// Deletes a GitHub-hosted runner for an organization.
///
/// [GitHub API docs for delete_hosted_runner_for_org](https://docs.github.com/rest/actions/hosted-runners#delete-a-github-hosted-runner-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn delete_hosted_runner_for_org(&self, org: &str, hosted_runner_id: i32) -> Result<ActionsHostedRunner, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners/{}", super::GITHUB_BASE_API_URL, org, hosted_runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsDeleteHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete an organization secret
///
/// Deletes a secret in an organization using the secret name.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_org_secret](https://docs.github.com/rest/actions/secrets#delete-an-organization-secret)
///
/// ---
pub async fn delete_org_secret_async(&self, org: &str, secret_name: &str) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/secrets/{}", super::GITHUB_BASE_API_URL, org, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteOrgSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete an organization secret
///
/// Deletes a secret in an organization using the secret name.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_org_secret](https://docs.github.com/rest/actions/secrets#delete-an-organization-secret)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn delete_org_secret(&self, org: &str, secret_name: &str) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/secrets/{}", super::GITHUB_BASE_API_URL, org, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteOrgSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete an organization variable
///
/// Deletes an organization variable using the variable name.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_org_variable](https://docs.github.com/rest/actions/variables#delete-an-organization-variable)
///
/// ---
pub async fn delete_org_variable_async(&self, org: &str, name: &str) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/variables/{}", super::GITHUB_BASE_API_URL, org, name);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteOrgVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete an organization variable
///
/// Deletes an organization variable using the variable name.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_org_variable](https://docs.github.com/rest/actions/variables#delete-an-organization-variable)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn delete_org_variable(&self, org: &str, name: &str) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/variables/{}", super::GITHUB_BASE_API_URL, org, name);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteOrgVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete a repository secret
///
/// Deletes a secret in a repository using the secret name.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_repo_secret](https://docs.github.com/rest/actions/secrets#delete-a-repository-secret)
///
/// ---
pub async fn delete_repo_secret_async(&self, owner: &str, repo: &str, secret_name: &str) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/secrets/{}", super::GITHUB_BASE_API_URL, owner, repo, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteRepoSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete a repository secret
///
/// Deletes a secret in a repository using the secret name.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_repo_secret](https://docs.github.com/rest/actions/secrets#delete-a-repository-secret)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn delete_repo_secret(&self, owner: &str, repo: &str, secret_name: &str) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/secrets/{}", super::GITHUB_BASE_API_URL, owner, repo, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteRepoSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete a repository variable
///
/// Deletes a repository variable using the variable name.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_repo_variable](https://docs.github.com/rest/actions/variables#delete-a-repository-variable)
///
/// ---
pub async fn delete_repo_variable_async(&self, owner: &str, repo: &str, name: &str) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/variables/{}", super::GITHUB_BASE_API_URL, owner, repo, name);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteRepoVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete a repository variable
///
/// Deletes a repository variable using the variable name.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_repo_variable](https://docs.github.com/rest/actions/variables#delete-a-repository-variable)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn delete_repo_variable(&self, owner: &str, repo: &str, name: &str) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/variables/{}", super::GITHUB_BASE_API_URL, owner, repo, name);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteRepoVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete a self-hosted runner from an organization
///
/// Forces the removal of a self-hosted runner from an organization. You can use this endpoint to completely remove the runner when the machine you were using no longer exists.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_self_hosted_runner_from_org](https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-organization)
///
/// ---
pub async fn delete_self_hosted_runner_from_org_async(&self, org: &str, runner_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/{}", super::GITHUB_BASE_API_URL, org, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
422 => Err(ActionsDeleteSelfHostedRunnerFromOrgError::Status422(github_response.to_json_async().await?).into()),
code => Err(ActionsDeleteSelfHostedRunnerFromOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete a self-hosted runner from an organization
///
/// Forces the removal of a self-hosted runner from an organization. You can use this endpoint to completely remove the runner when the machine you were using no longer exists.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_self_hosted_runner_from_org](https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn delete_self_hosted_runner_from_org(&self, org: &str, runner_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/{}", super::GITHUB_BASE_API_URL, org, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
422 => Err(ActionsDeleteSelfHostedRunnerFromOrgError::Status422(github_response.to_json()?).into()),
code => Err(ActionsDeleteSelfHostedRunnerFromOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete a self-hosted runner from a repository
///
/// Forces the removal of a self-hosted runner from a repository. You can use this endpoint to completely remove the runner when the machine you were using no longer exists.
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_self_hosted_runner_from_repo](https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-a-repository)
///
/// ---
pub async fn delete_self_hosted_runner_from_repo_async(&self, owner: &str, repo: &str, runner_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/{}", super::GITHUB_BASE_API_URL, owner, repo, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
422 => Err(ActionsDeleteSelfHostedRunnerFromRepoError::Status422(github_response.to_json_async().await?).into()),
code => Err(ActionsDeleteSelfHostedRunnerFromRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete a self-hosted runner from a repository
///
/// Forces the removal of a self-hosted runner from a repository. You can use this endpoint to completely remove the runner when the machine you were using no longer exists.
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_self_hosted_runner_from_repo](https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn delete_self_hosted_runner_from_repo(&self, owner: &str, repo: &str, runner_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/{}", super::GITHUB_BASE_API_URL, owner, repo, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
422 => Err(ActionsDeleteSelfHostedRunnerFromRepoError::Status422(github_response.to_json()?).into()),
code => Err(ActionsDeleteSelfHostedRunnerFromRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete a self-hosted runner group from an organization
///
/// Deletes a self-hosted runner group for an organization.
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for delete_self_hosted_runner_group_from_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-organization)
///
/// ---
pub async fn delete_self_hosted_runner_group_from_org_async(&self, org: &str, runner_group_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}", super::GITHUB_BASE_API_URL, org, runner_group_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteSelfHostedRunnerGroupFromOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete a self-hosted runner group from an organization
///
/// Deletes a self-hosted runner group for an organization.
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for delete_self_hosted_runner_group_from_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn delete_self_hosted_runner_group_from_org(&self, org: &str, runner_group_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}", super::GITHUB_BASE_API_URL, org, runner_group_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteSelfHostedRunnerGroupFromOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete a workflow run
///
/// Deletes a specific workflow run.
///
/// Anyone with write access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_workflow_run](https://docs.github.com/rest/actions/workflow-runs#delete-a-workflow-run)
///
/// ---
pub async fn delete_workflow_run_async(&self, owner: &str, repo: &str, run_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete a workflow run
///
/// Deletes a specific workflow run.
///
/// Anyone with write access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_workflow_run](https://docs.github.com/rest/actions/workflow-runs#delete-a-workflow-run)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn delete_workflow_run(&self, owner: &str, repo: &str, run_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDeleteWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete workflow run logs
///
/// Deletes all logs for a workflow run.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_workflow_run_logs](https://docs.github.com/rest/actions/workflow-runs#delete-workflow-run-logs)
///
/// ---
pub async fn delete_workflow_run_logs_async(&self, owner: &str, repo: &str, run_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/logs", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
403 => Err(ActionsDeleteWorkflowRunLogsError::Status403(github_response.to_json_async().await?).into()),
500 => Err(ActionsDeleteWorkflowRunLogsError::Status500(github_response.to_json_async().await?).into()),
code => Err(ActionsDeleteWorkflowRunLogsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Delete workflow run logs
///
/// Deletes all logs for a workflow run.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for delete_workflow_run_logs](https://docs.github.com/rest/actions/workflow-runs#delete-workflow-run-logs)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn delete_workflow_run_logs(&self, owner: &str, repo: &str, run_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/logs", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
403 => Err(ActionsDeleteWorkflowRunLogsError::Status403(github_response.to_json()?).into()),
500 => Err(ActionsDeleteWorkflowRunLogsError::Status500(github_response.to_json()?).into()),
code => Err(ActionsDeleteWorkflowRunLogsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Disable a selected repository for GitHub Actions in an organization
///
/// Removes a repository from the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for disable_selected_repository_github_actions_organization](https://docs.github.com/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization)
///
/// ---
pub async fn disable_selected_repository_github_actions_organization_async(&self, org: &str, repository_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions/repositories/{}", super::GITHUB_BASE_API_URL, org, repository_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDisableSelectedRepositoryGithubActionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Disable a selected repository for GitHub Actions in an organization
///
/// Removes a repository from the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for disable_selected_repository_github_actions_organization](https://docs.github.com/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn disable_selected_repository_github_actions_organization(&self, org: &str, repository_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions/repositories/{}", super::GITHUB_BASE_API_URL, org, repository_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDisableSelectedRepositoryGithubActionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Disable a workflow
///
/// Disables a workflow and sets the `state` of the workflow to `disabled_manually`. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for disable_workflow](https://docs.github.com/rest/actions/workflows#disable-a-workflow)
///
/// ---
pub async fn disable_workflow_async(&self, owner: &str, repo: &str, workflow_id: WorkflowId) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/workflows/{}/disable", super::GITHUB_BASE_API_URL, owner, repo, workflow_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDisableWorkflowError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Disable a workflow
///
/// Disables a workflow and sets the `state` of the workflow to `disabled_manually`. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for disable_workflow](https://docs.github.com/rest/actions/workflows#disable-a-workflow)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn disable_workflow(&self, owner: &str, repo: &str, workflow_id: WorkflowId) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/workflows/{}/disable", super::GITHUB_BASE_API_URL, owner, repo, workflow_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsDisableWorkflowError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Download an artifact
///
/// Gets a redirect URL to download an archive for a repository. This URL expires after 1 minute. Look for `Location:` in
/// the response header to find the URL for the download. The `:archive_format` must be `zip`.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for download_artifact](https://docs.github.com/rest/actions/artifacts#download-an-artifact)
///
/// ---
pub async fn download_artifact_async(&self, owner: &str, repo: &str, artifact_id: i32, archive_format: &str) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/artifacts/{}/{}", super::GITHUB_BASE_API_URL, owner, repo, artifact_id, archive_format);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
302 => Err(ActionsDownloadArtifactError::Status302.into()),
410 => Err(ActionsDownloadArtifactError::Status410(github_response.to_json_async().await?).into()),
code => Err(ActionsDownloadArtifactError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Download an artifact
///
/// Gets a redirect URL to download an archive for a repository. This URL expires after 1 minute. Look for `Location:` in
/// the response header to find the URL for the download. The `:archive_format` must be `zip`.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for download_artifact](https://docs.github.com/rest/actions/artifacts#download-an-artifact)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn download_artifact(&self, owner: &str, repo: &str, artifact_id: i32, archive_format: &str) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/artifacts/{}/{}", super::GITHUB_BASE_API_URL, owner, repo, artifact_id, archive_format);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
302 => Err(ActionsDownloadArtifactError::Status302.into()),
410 => Err(ActionsDownloadArtifactError::Status410(github_response.to_json()?).into()),
code => Err(ActionsDownloadArtifactError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Download job logs for a workflow run
///
/// Gets a redirect URL to download a plain text file of logs for a workflow job. This link expires after 1 minute. Look
/// for `Location:` in the response header to find the URL for the download.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for download_job_logs_for_workflow_run](https://docs.github.com/rest/actions/workflow-jobs#download-job-logs-for-a-workflow-run)
///
/// ---
pub async fn download_job_logs_for_workflow_run_async(&self, owner: &str, repo: &str, job_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/jobs/{}/logs", super::GITHUB_BASE_API_URL, owner, repo, job_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
302 => Err(ActionsDownloadJobLogsForWorkflowRunError::Status302.into()),
code => Err(ActionsDownloadJobLogsForWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Download job logs for a workflow run
///
/// Gets a redirect URL to download a plain text file of logs for a workflow job. This link expires after 1 minute. Look
/// for `Location:` in the response header to find the URL for the download.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for download_job_logs_for_workflow_run](https://docs.github.com/rest/actions/workflow-jobs#download-job-logs-for-a-workflow-run)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn download_job_logs_for_workflow_run(&self, owner: &str, repo: &str, job_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/jobs/{}/logs", super::GITHUB_BASE_API_URL, owner, repo, job_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
302 => Err(ActionsDownloadJobLogsForWorkflowRunError::Status302.into()),
code => Err(ActionsDownloadJobLogsForWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Download workflow run attempt logs
///
/// Gets a redirect URL to download an archive of log files for a specific workflow run attempt. This link expires after
/// 1 minute. Look for `Location:` in the response header to find the URL for the download.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for download_workflow_run_attempt_logs](https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-attempt-logs)
///
/// ---
pub async fn download_workflow_run_attempt_logs_async(&self, owner: &str, repo: &str, run_id: i32, attempt_number: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/attempts/{}/logs", super::GITHUB_BASE_API_URL, owner, repo, run_id, attempt_number);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
302 => Err(ActionsDownloadWorkflowRunAttemptLogsError::Status302.into()),
code => Err(ActionsDownloadWorkflowRunAttemptLogsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Download workflow run attempt logs
///
/// Gets a redirect URL to download an archive of log files for a specific workflow run attempt. This link expires after
/// 1 minute. Look for `Location:` in the response header to find the URL for the download.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for download_workflow_run_attempt_logs](https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-attempt-logs)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn download_workflow_run_attempt_logs(&self, owner: &str, repo: &str, run_id: i32, attempt_number: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/attempts/{}/logs", super::GITHUB_BASE_API_URL, owner, repo, run_id, attempt_number);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
302 => Err(ActionsDownloadWorkflowRunAttemptLogsError::Status302.into()),
code => Err(ActionsDownloadWorkflowRunAttemptLogsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Download workflow run logs
///
/// Gets a redirect URL to download an archive of log files for a workflow run. This link expires after 1 minute. Look for
/// `Location:` in the response header to find the URL for the download.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for download_workflow_run_logs](https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-logs)
///
/// ---
pub async fn download_workflow_run_logs_async(&self, owner: &str, repo: &str, run_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/logs", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
302 => Err(ActionsDownloadWorkflowRunLogsError::Status302.into()),
code => Err(ActionsDownloadWorkflowRunLogsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Download workflow run logs
///
/// Gets a redirect URL to download an archive of log files for a workflow run. This link expires after 1 minute. Look for
/// `Location:` in the response header to find the URL for the download.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for download_workflow_run_logs](https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-logs)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn download_workflow_run_logs(&self, owner: &str, repo: &str, run_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/logs", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
302 => Err(ActionsDownloadWorkflowRunLogsError::Status302.into()),
code => Err(ActionsDownloadWorkflowRunLogsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Enable a selected repository for GitHub Actions in an organization
///
/// Adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for enable_selected_repository_github_actions_organization](https://docs.github.com/rest/actions/permissions#enable-a-selected-repository-for-github-actions-in-an-organization)
///
/// ---
pub async fn enable_selected_repository_github_actions_organization_async(&self, org: &str, repository_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions/repositories/{}", super::GITHUB_BASE_API_URL, org, repository_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsEnableSelectedRepositoryGithubActionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Enable a selected repository for GitHub Actions in an organization
///
/// Adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for enable_selected_repository_github_actions_organization](https://docs.github.com/rest/actions/permissions#enable-a-selected-repository-for-github-actions-in-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn enable_selected_repository_github_actions_organization(&self, org: &str, repository_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions/repositories/{}", super::GITHUB_BASE_API_URL, org, repository_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsEnableSelectedRepositoryGithubActionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Enable a workflow
///
/// Enables a workflow and sets the `state` of the workflow to `active`. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for enable_workflow](https://docs.github.com/rest/actions/workflows#enable-a-workflow)
///
/// ---
pub async fn enable_workflow_async(&self, owner: &str, repo: &str, workflow_id: WorkflowId) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/workflows/{}/enable", super::GITHUB_BASE_API_URL, owner, repo, workflow_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsEnableWorkflowError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Enable a workflow
///
/// Enables a workflow and sets the `state` of the workflow to `active`. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for enable_workflow](https://docs.github.com/rest/actions/workflows#enable-a-workflow)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn enable_workflow(&self, owner: &str, repo: &str, workflow_id: WorkflowId) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/workflows/{}/enable", super::GITHUB_BASE_API_URL, owner, repo, workflow_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsEnableWorkflowError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Force cancel a workflow run
///
/// Cancels a workflow run and bypasses conditions that would otherwise cause a workflow execution to continue, such as an `always()` condition on a job.
/// You should only use this endpoint to cancel a workflow run when the workflow run is not responding to [`POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel`](/rest/actions/workflow-runs#cancel-a-workflow-run).
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for force_cancel_workflow_run](https://docs.github.com/rest/actions/workflow-runs#force-cancel-a-workflow-run)
///
/// ---
pub async fn force_cancel_workflow_run_async(&self, owner: &str, repo: &str, run_id: i32) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/force-cancel", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
409 => Err(ActionsForceCancelWorkflowRunError::Status409(github_response.to_json_async().await?).into()),
code => Err(ActionsForceCancelWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Force cancel a workflow run
///
/// Cancels a workflow run and bypasses conditions that would otherwise cause a workflow execution to continue, such as an `always()` condition on a job.
/// You should only use this endpoint to cancel a workflow run when the workflow run is not responding to [`POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel`](/rest/actions/workflow-runs#cancel-a-workflow-run).
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for force_cancel_workflow_run](https://docs.github.com/rest/actions/workflow-runs#force-cancel-a-workflow-run)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn force_cancel_workflow_run(&self, owner: &str, repo: &str, run_id: i32) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/force-cancel", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
409 => Err(ActionsForceCancelWorkflowRunError::Status409(github_response.to_json()?).into()),
code => Err(ActionsForceCancelWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create configuration for a just-in-time runner for an organization
///
/// Generates a configuration that can be passed to the runner application at startup.
///
/// The authenticated user must have admin access to the organization.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for generate_runner_jitconfig_for_org](https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-organization)
///
/// ---
pub async fn generate_runner_jitconfig_for_org_async(&self, org: &str, body: PostActionsGenerateRunnerJitconfigForOrg) -> Result<PostActionsGenerateRunnerJitconfigForRepoResponse201, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/generate-jitconfig", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsGenerateRunnerJitconfigForOrg>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
404 => Err(ActionsGenerateRunnerJitconfigForOrgError::Status404(github_response.to_json_async().await?).into()),
422 => Err(ActionsGenerateRunnerJitconfigForOrgError::Status422(github_response.to_json_async().await?).into()),
409 => Err(ActionsGenerateRunnerJitconfigForOrgError::Status409(github_response.to_json_async().await?).into()),
code => Err(ActionsGenerateRunnerJitconfigForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create configuration for a just-in-time runner for an organization
///
/// Generates a configuration that can be passed to the runner application at startup.
///
/// The authenticated user must have admin access to the organization.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for generate_runner_jitconfig_for_org](https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn generate_runner_jitconfig_for_org(&self, org: &str, body: PostActionsGenerateRunnerJitconfigForOrg) -> Result<PostActionsGenerateRunnerJitconfigForRepoResponse201, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/generate-jitconfig", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsGenerateRunnerJitconfigForOrg>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
404 => Err(ActionsGenerateRunnerJitconfigForOrgError::Status404(github_response.to_json()?).into()),
422 => Err(ActionsGenerateRunnerJitconfigForOrgError::Status422(github_response.to_json()?).into()),
409 => Err(ActionsGenerateRunnerJitconfigForOrgError::Status409(github_response.to_json()?).into()),
code => Err(ActionsGenerateRunnerJitconfigForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create configuration for a just-in-time runner for a repository
///
/// Generates a configuration that can be passed to the runner application at startup.
///
/// The authenticated user must have admin access to the repository.
///
/// OAuth tokens and personal access tokens (classic) need the`repo` scope to use this endpoint.
///
/// [GitHub API docs for generate_runner_jitconfig_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-a-repository)
///
/// ---
pub async fn generate_runner_jitconfig_for_repo_async(&self, owner: &str, repo: &str, body: PostActionsGenerateRunnerJitconfigForRepo) -> Result<PostActionsGenerateRunnerJitconfigForRepoResponse201, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/generate-jitconfig", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsGenerateRunnerJitconfigForRepo>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
404 => Err(ActionsGenerateRunnerJitconfigForRepoError::Status404(github_response.to_json_async().await?).into()),
422 => Err(ActionsGenerateRunnerJitconfigForRepoError::Status422(github_response.to_json_async().await?).into()),
409 => Err(ActionsGenerateRunnerJitconfigForRepoError::Status409(github_response.to_json_async().await?).into()),
code => Err(ActionsGenerateRunnerJitconfigForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Create configuration for a just-in-time runner for a repository
///
/// Generates a configuration that can be passed to the runner application at startup.
///
/// The authenticated user must have admin access to the repository.
///
/// OAuth tokens and personal access tokens (classic) need the`repo` scope to use this endpoint.
///
/// [GitHub API docs for generate_runner_jitconfig_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn generate_runner_jitconfig_for_repo(&self, owner: &str, repo: &str, body: PostActionsGenerateRunnerJitconfigForRepo) -> Result<PostActionsGenerateRunnerJitconfigForRepoResponse201, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/generate-jitconfig", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsGenerateRunnerJitconfigForRepo>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
404 => Err(ActionsGenerateRunnerJitconfigForRepoError::Status404(github_response.to_json()?).into()),
422 => Err(ActionsGenerateRunnerJitconfigForRepoError::Status422(github_response.to_json()?).into()),
409 => Err(ActionsGenerateRunnerJitconfigForRepoError::Status409(github_response.to_json()?).into()),
code => Err(ActionsGenerateRunnerJitconfigForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List GitHub Actions caches for a repository
///
/// Lists the GitHub Actions caches for a repository.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_actions_cache_list](https://docs.github.com/rest/actions/cache#list-github-actions-caches-for-a-repository)
///
/// ---
pub async fn get_actions_cache_list_async(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsGetActionsCacheListParams<'api>>>) -> Result<ActionsCacheList, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/caches", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetActionsCacheListError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List GitHub Actions caches for a repository
///
/// Lists the GitHub Actions caches for a repository.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_actions_cache_list](https://docs.github.com/rest/actions/cache#list-github-actions-caches-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_actions_cache_list(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsGetActionsCacheListParams<'api>>>) -> Result<ActionsCacheList, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/caches", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsGetActionsCacheListParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetActionsCacheListError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get GitHub Actions cache usage for a repository
///
/// Gets GitHub Actions cache usage for a repository.
/// The data fetched using this API is refreshed approximately every 5 minutes, so values returned from this endpoint may take at least 5 minutes to get updated.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_actions_cache_usage](https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-a-repository)
///
/// ---
pub async fn get_actions_cache_usage_async(&self, owner: &str, repo: &str) -> Result<ActionsCacheUsageByRepository, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/cache/usage", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetActionsCacheUsageError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get GitHub Actions cache usage for a repository
///
/// Gets GitHub Actions cache usage for a repository.
/// The data fetched using this API is refreshed approximately every 5 minutes, so values returned from this endpoint may take at least 5 minutes to get updated.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_actions_cache_usage](https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_actions_cache_usage(&self, owner: &str, repo: &str) -> Result<ActionsCacheUsageByRepository, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/cache/usage", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetActionsCacheUsageError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List repositories with GitHub Actions cache usage for an organization
///
/// Lists repositories and their GitHub Actions cache usage for an organization.
/// The data fetched using this API is refreshed approximately every 5 minutes, so values returned from this endpoint may take at least 5 minutes to get updated.
///
/// OAuth tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint.
///
/// [GitHub API docs for get_actions_cache_usage_by_repo_for_org](https://docs.github.com/rest/actions/cache#list-repositories-with-github-actions-cache-usage-for-an-organization)
///
/// ---
pub async fn get_actions_cache_usage_by_repo_for_org_async(&self, org: &str, query_params: Option<impl Into<ActionsGetActionsCacheUsageByRepoForOrgParams>>) -> Result<GetActionsGetActionsCacheUsageByRepoForOrgResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/cache/usage-by-repository", super::GITHUB_BASE_API_URL, org);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetActionsCacheUsageByRepoForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List repositories with GitHub Actions cache usage for an organization
///
/// Lists repositories and their GitHub Actions cache usage for an organization.
/// The data fetched using this API is refreshed approximately every 5 minutes, so values returned from this endpoint may take at least 5 minutes to get updated.
///
/// OAuth tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint.
///
/// [GitHub API docs for get_actions_cache_usage_by_repo_for_org](https://docs.github.com/rest/actions/cache#list-repositories-with-github-actions-cache-usage-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_actions_cache_usage_by_repo_for_org(&self, org: &str, query_params: Option<impl Into<ActionsGetActionsCacheUsageByRepoForOrgParams>>) -> Result<GetActionsGetActionsCacheUsageByRepoForOrgResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/cache/usage-by-repository", super::GITHUB_BASE_API_URL, org);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsGetActionsCacheUsageByRepoForOrgParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetActionsCacheUsageByRepoForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get GitHub Actions cache usage for an organization
///
/// Gets the total GitHub Actions cache usage for an organization.
/// The data fetched using this API is refreshed approximately every 5 minutes, so values returned from this endpoint may take at least 5 minutes to get updated.
///
/// OAuth tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint.
///
/// [GitHub API docs for get_actions_cache_usage_for_org](https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-an-organization)
///
/// ---
pub async fn get_actions_cache_usage_for_org_async(&self, org: &str) -> Result<ActionsCacheUsageOrgEnterprise, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/cache/usage", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetActionsCacheUsageForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get GitHub Actions cache usage for an organization
///
/// Gets the total GitHub Actions cache usage for an organization.
/// The data fetched using this API is refreshed approximately every 5 minutes, so values returned from this endpoint may take at least 5 minutes to get updated.
///
/// OAuth tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint.
///
/// [GitHub API docs for get_actions_cache_usage_for_org](https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_actions_cache_usage_for_org(&self, org: &str) -> Result<ActionsCacheUsageOrgEnterprise, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/cache/usage", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetActionsCacheUsageForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get allowed actions and reusable workflows for an organization
///
/// Gets the selected actions and reusable workflows that are allowed in an organization. To use this endpoint, the organization permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for get_allowed_actions_organization](https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization)
///
/// ---
pub async fn get_allowed_actions_organization_async(&self, org: &str) -> Result<PutActionsSetAllowedActionsRepository, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions/selected-actions", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetAllowedActionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get allowed actions and reusable workflows for an organization
///
/// Gets the selected actions and reusable workflows that are allowed in an organization. To use this endpoint, the organization permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for get_allowed_actions_organization](https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_allowed_actions_organization(&self, org: &str) -> Result<PutActionsSetAllowedActionsRepository, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions/selected-actions", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetAllowedActionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get allowed actions and reusable workflows for a repository
///
/// Gets the settings for selected actions and reusable workflows that are allowed in a repository. To use this endpoint, the repository policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for a repository](#set-github-actions-permissions-for-a-repository)."
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_allowed_actions_repository](https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-a-repository)
///
/// ---
pub async fn get_allowed_actions_repository_async(&self, owner: &str, repo: &str) -> Result<PutActionsSetAllowedActionsRepository, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/permissions/selected-actions", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetAllowedActionsRepositoryError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get allowed actions and reusable workflows for a repository
///
/// Gets the settings for selected actions and reusable workflows that are allowed in a repository. To use this endpoint, the repository policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for a repository](#set-github-actions-permissions-for-a-repository)."
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_allowed_actions_repository](https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_allowed_actions_repository(&self, owner: &str, repo: &str) -> Result<PutActionsSetAllowedActionsRepository, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/permissions/selected-actions", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetAllowedActionsRepositoryError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get an artifact
///
/// Gets a specific artifact for a workflow run.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_artifact](https://docs.github.com/rest/actions/artifacts#get-an-artifact)
///
/// ---
pub async fn get_artifact_async(&self, owner: &str, repo: &str, artifact_id: i32) -> Result<Artifact, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/artifacts/{}", super::GITHUB_BASE_API_URL, owner, repo, artifact_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetArtifactError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get an artifact
///
/// Gets a specific artifact for a workflow run.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_artifact](https://docs.github.com/rest/actions/artifacts#get-an-artifact)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_artifact(&self, owner: &str, repo: &str, artifact_id: i32) -> Result<Artifact, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/artifacts/{}", super::GITHUB_BASE_API_URL, owner, repo, artifact_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetArtifactError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get the customization template for an OIDC subject claim for a repository
///
/// Gets the customization template for an OpenID Connect (OIDC) subject claim.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_custom_oidc_sub_claim_for_repo](https://docs.github.com/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-a-repository)
///
/// ---
pub async fn get_custom_oidc_sub_claim_for_repo_async(&self, owner: &str, repo: &str) -> Result<OidcCustomSubRepo, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/oidc/customization/sub", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
400 => Err(ActionsGetCustomOidcSubClaimForRepoError::Status400(github_response.to_json_async().await?).into()),
404 => Err(ActionsGetCustomOidcSubClaimForRepoError::Status404(github_response.to_json_async().await?).into()),
code => Err(ActionsGetCustomOidcSubClaimForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get the customization template for an OIDC subject claim for a repository
///
/// Gets the customization template for an OpenID Connect (OIDC) subject claim.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_custom_oidc_sub_claim_for_repo](https://docs.github.com/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_custom_oidc_sub_claim_for_repo(&self, owner: &str, repo: &str) -> Result<OidcCustomSubRepo, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/oidc/customization/sub", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
400 => Err(ActionsGetCustomOidcSubClaimForRepoError::Status400(github_response.to_json()?).into()),
404 => Err(ActionsGetCustomOidcSubClaimForRepoError::Status404(github_response.to_json()?).into()),
code => Err(ActionsGetCustomOidcSubClaimForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get an environment public key
///
/// Get the public key for an environment, which you need to encrypt environment
/// secrets. You need to encrypt a secret before you can create or update secrets.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_environment_public_key](https://docs.github.com/rest/actions/secrets#get-an-environment-public-key)
///
/// ---
pub async fn get_environment_public_key_async(&self, owner: &str, repo: &str, environment_name: &str) -> Result<ActionsPublicKey, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/environments/{}/secrets/public-key", super::GITHUB_BASE_API_URL, owner, repo, environment_name);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetEnvironmentPublicKeyError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get an environment public key
///
/// Get the public key for an environment, which you need to encrypt environment
/// secrets. You need to encrypt a secret before you can create or update secrets.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_environment_public_key](https://docs.github.com/rest/actions/secrets#get-an-environment-public-key)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_environment_public_key(&self, owner: &str, repo: &str, environment_name: &str) -> Result<ActionsPublicKey, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/environments/{}/secrets/public-key", super::GITHUB_BASE_API_URL, owner, repo, environment_name);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetEnvironmentPublicKeyError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get an environment secret
///
/// Gets a single environment secret without revealing its encrypted value.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_environment_secret](https://docs.github.com/rest/actions/secrets#get-an-environment-secret)
///
/// ---
pub async fn get_environment_secret_async(&self, owner: &str, repo: &str, environment_name: &str, secret_name: &str) -> Result<ActionsSecret, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/environments/{}/secrets/{}", super::GITHUB_BASE_API_URL, owner, repo, environment_name, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetEnvironmentSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get an environment secret
///
/// Gets a single environment secret without revealing its encrypted value.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_environment_secret](https://docs.github.com/rest/actions/secrets#get-an-environment-secret)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_environment_secret(&self, owner: &str, repo: &str, environment_name: &str, secret_name: &str) -> Result<ActionsSecret, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/environments/{}/secrets/{}", super::GITHUB_BASE_API_URL, owner, repo, environment_name, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetEnvironmentSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get an environment variable
///
/// Gets a specific variable in an environment.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_environment_variable](https://docs.github.com/rest/actions/variables#get-an-environment-variable)
///
/// ---
pub async fn get_environment_variable_async(&self, owner: &str, repo: &str, environment_name: &str, name: &str) -> Result<ActionsVariable, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/environments/{}/variables/{}", super::GITHUB_BASE_API_URL, owner, repo, environment_name, name);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetEnvironmentVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get an environment variable
///
/// Gets a specific variable in an environment.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_environment_variable](https://docs.github.com/rest/actions/variables#get-an-environment-variable)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_environment_variable(&self, owner: &str, repo: &str, environment_name: &str, name: &str) -> Result<ActionsVariable, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/environments/{}/variables/{}", super::GITHUB_BASE_API_URL, owner, repo, environment_name, name);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetEnvironmentVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get default workflow permissions for an organization
///
/// Gets the default workflow permissions granted to the `GITHUB_TOKEN` when running workflows in an organization,
/// as well as whether GitHub Actions can submit approving pull request reviews. For more information, see
/// "[Setting the permissions of the GITHUB_TOKEN for your organization](https://docs.github.com/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization#setting-the-permissions-of-the-github_token-for-your-organization)."
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for get_github_actions_default_workflow_permissions_organization](https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-an-organization)
///
/// ---
pub async fn get_github_actions_default_workflow_permissions_organization_async(&self, org: &str) -> Result<ActionsGetDefaultWorkflowPermissions, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions/workflow", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetGithubActionsDefaultWorkflowPermissionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get default workflow permissions for an organization
///
/// Gets the default workflow permissions granted to the `GITHUB_TOKEN` when running workflows in an organization,
/// as well as whether GitHub Actions can submit approving pull request reviews. For more information, see
/// "[Setting the permissions of the GITHUB_TOKEN for your organization](https://docs.github.com/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization#setting-the-permissions-of-the-github_token-for-your-organization)."
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for get_github_actions_default_workflow_permissions_organization](https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_github_actions_default_workflow_permissions_organization(&self, org: &str) -> Result<ActionsGetDefaultWorkflowPermissions, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions/workflow", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetGithubActionsDefaultWorkflowPermissionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get default workflow permissions for a repository
///
/// Gets the default workflow permissions granted to the `GITHUB_TOKEN` when running workflows in a repository,
/// as well as if GitHub Actions can submit approving pull request reviews.
/// For more information, see "[Setting the permissions of the GITHUB_TOKEN for your repository](https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#setting-the-permissions-of-the-github_token-for-your-repository)."
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_github_actions_default_workflow_permissions_repository](https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-a-repository)
///
/// ---
pub async fn get_github_actions_default_workflow_permissions_repository_async(&self, owner: &str, repo: &str) -> Result<ActionsGetDefaultWorkflowPermissions, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/permissions/workflow", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetGithubActionsDefaultWorkflowPermissionsRepositoryError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get default workflow permissions for a repository
///
/// Gets the default workflow permissions granted to the `GITHUB_TOKEN` when running workflows in a repository,
/// as well as if GitHub Actions can submit approving pull request reviews.
/// For more information, see "[Setting the permissions of the GITHUB_TOKEN for your repository](https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#setting-the-permissions-of-the-github_token-for-your-repository)."
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_github_actions_default_workflow_permissions_repository](https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_github_actions_default_workflow_permissions_repository(&self, owner: &str, repo: &str) -> Result<ActionsGetDefaultWorkflowPermissions, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/permissions/workflow", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetGithubActionsDefaultWorkflowPermissionsRepositoryError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get GitHub Actions permissions for an organization
///
/// Gets the GitHub Actions permissions policy for repositories and allowed actions and reusable workflows in an organization.
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for get_github_actions_permissions_organization](https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-an-organization)
///
/// ---
pub async fn get_github_actions_permissions_organization_async(&self, org: &str) -> Result<ActionsOrganizationPermissions, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetGithubActionsPermissionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get GitHub Actions permissions for an organization
///
/// Gets the GitHub Actions permissions policy for repositories and allowed actions and reusable workflows in an organization.
///
/// OAuth tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for get_github_actions_permissions_organization](https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_github_actions_permissions_organization(&self, org: &str) -> Result<ActionsOrganizationPermissions, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetGithubActionsPermissionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get GitHub Actions permissions for a repository
///
/// Gets the GitHub Actions permissions policy for a repository, including whether GitHub Actions is enabled and the actions and reusable workflows allowed to run in the repository.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_github_actions_permissions_repository](https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-a-repository)
///
/// ---
pub async fn get_github_actions_permissions_repository_async(&self, owner: &str, repo: &str) -> Result<ActionsRepositoryPermissions, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/permissions", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetGithubActionsPermissionsRepositoryError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get GitHub Actions permissions for a repository
///
/// Gets the GitHub Actions permissions policy for a repository, including whether GitHub Actions is enabled and the actions and reusable workflows allowed to run in the repository.
///
/// OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_github_actions_permissions_repository](https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_github_actions_permissions_repository(&self, owner: &str, repo: &str) -> Result<ActionsRepositoryPermissions, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/permissions", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetGithubActionsPermissionsRepositoryError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a GitHub-hosted runner for an organization
///
/// Gets a GitHub-hosted runner configured in an organization.
///
/// OAuth app tokens and personal access tokens (classic) need the `manage_runners:org` scope to use this endpoint.
///
/// [GitHub API docs for get_hosted_runner_for_org](https://docs.github.com/rest/actions/hosted-runners#get-a-github-hosted-runner-for-an-organization)
///
/// ---
pub async fn get_hosted_runner_for_org_async(&self, org: &str, hosted_runner_id: i32) -> Result<ActionsHostedRunner, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners/{}", super::GITHUB_BASE_API_URL, org, hosted_runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a GitHub-hosted runner for an organization
///
/// Gets a GitHub-hosted runner configured in an organization.
///
/// OAuth app tokens and personal access tokens (classic) need the `manage_runners:org` scope to use this endpoint.
///
/// [GitHub API docs for get_hosted_runner_for_org](https://docs.github.com/rest/actions/hosted-runners#get-a-github-hosted-runner-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_hosted_runner_for_org(&self, org: &str, hosted_runner_id: i32) -> Result<ActionsHostedRunner, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners/{}", super::GITHUB_BASE_API_URL, org, hosted_runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get GitHub-owned images for GitHub-hosted runners in an organization
///
/// Get the list of GitHub-owned images available for GitHub-hosted runners for an organization.
///
/// [GitHub API docs for get_hosted_runners_github_owned_images_for_org](https://docs.github.com/rest/actions/hosted-runners#get-github-owned-images-for-github-hosted-runners-in-an-organization)
///
/// ---
pub async fn get_hosted_runners_github_owned_images_for_org_async(&self, org: &str) -> Result<GetActionsGetHostedRunnersPartnerImagesForOrgResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners/images/github-owned", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetHostedRunnersGithubOwnedImagesForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get GitHub-owned images for GitHub-hosted runners in an organization
///
/// Get the list of GitHub-owned images available for GitHub-hosted runners for an organization.
///
/// [GitHub API docs for get_hosted_runners_github_owned_images_for_org](https://docs.github.com/rest/actions/hosted-runners#get-github-owned-images-for-github-hosted-runners-in-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_hosted_runners_github_owned_images_for_org(&self, org: &str) -> Result<GetActionsGetHostedRunnersPartnerImagesForOrgResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners/images/github-owned", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetHostedRunnersGithubOwnedImagesForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get limits on GitHub-hosted runners for an organization
///
/// Get the GitHub-hosted runners limits for an organization.
///
/// [GitHub API docs for get_hosted_runners_limits_for_org](https://docs.github.com/rest/actions/hosted-runners#get-limits-on-github-hosted-runners-for-an-organization)
///
/// ---
pub async fn get_hosted_runners_limits_for_org_async(&self, org: &str) -> Result<ActionsHostedRunnerLimits, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners/limits", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetHostedRunnersLimitsForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get limits on GitHub-hosted runners for an organization
///
/// Get the GitHub-hosted runners limits for an organization.
///
/// [GitHub API docs for get_hosted_runners_limits_for_org](https://docs.github.com/rest/actions/hosted-runners#get-limits-on-github-hosted-runners-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_hosted_runners_limits_for_org(&self, org: &str) -> Result<ActionsHostedRunnerLimits, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners/limits", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetHostedRunnersLimitsForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get GitHub-hosted runners machine specs for an organization
///
/// Get the list of machine specs available for GitHub-hosted runners for an organization.
///
/// [GitHub API docs for get_hosted_runners_machine_specs_for_org](https://docs.github.com/rest/actions/hosted-runners#get-github-hosted-runners-machine-specs-for-an-organization)
///
/// ---
pub async fn get_hosted_runners_machine_specs_for_org_async(&self, org: &str) -> Result<GetActionsGetHostedRunnersMachineSpecsForOrgResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners/machine-sizes", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetHostedRunnersMachineSpecsForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get GitHub-hosted runners machine specs for an organization
///
/// Get the list of machine specs available for GitHub-hosted runners for an organization.
///
/// [GitHub API docs for get_hosted_runners_machine_specs_for_org](https://docs.github.com/rest/actions/hosted-runners#get-github-hosted-runners-machine-specs-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_hosted_runners_machine_specs_for_org(&self, org: &str) -> Result<GetActionsGetHostedRunnersMachineSpecsForOrgResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners/machine-sizes", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetHostedRunnersMachineSpecsForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get partner images for GitHub-hosted runners in an organization
///
/// Get the list of partner images available for GitHub-hosted runners for an organization.
///
/// [GitHub API docs for get_hosted_runners_partner_images_for_org](https://docs.github.com/rest/actions/hosted-runners#get-partner-images-for-github-hosted-runners-in-an-organization)
///
/// ---
pub async fn get_hosted_runners_partner_images_for_org_async(&self, org: &str) -> Result<GetActionsGetHostedRunnersPartnerImagesForOrgResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners/images/partner", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetHostedRunnersPartnerImagesForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get partner images for GitHub-hosted runners in an organization
///
/// Get the list of partner images available for GitHub-hosted runners for an organization.
///
/// [GitHub API docs for get_hosted_runners_partner_images_for_org](https://docs.github.com/rest/actions/hosted-runners#get-partner-images-for-github-hosted-runners-in-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_hosted_runners_partner_images_for_org(&self, org: &str) -> Result<GetActionsGetHostedRunnersPartnerImagesForOrgResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners/images/partner", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetHostedRunnersPartnerImagesForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get platforms for GitHub-hosted runners in an organization
///
/// Get the list of platforms available for GitHub-hosted runners for an organization.
///
/// [GitHub API docs for get_hosted_runners_platforms_for_org](https://docs.github.com/rest/actions/hosted-runners#get-platforms-for-github-hosted-runners-in-an-organization)
///
/// ---
pub async fn get_hosted_runners_platforms_for_org_async(&self, org: &str) -> Result<GetActionsGetHostedRunnersPlatformsForOrgResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners/platforms", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetHostedRunnersPlatformsForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get platforms for GitHub-hosted runners in an organization
///
/// Get the list of platforms available for GitHub-hosted runners for an organization.
///
/// [GitHub API docs for get_hosted_runners_platforms_for_org](https://docs.github.com/rest/actions/hosted-runners#get-platforms-for-github-hosted-runners-in-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_hosted_runners_platforms_for_org(&self, org: &str) -> Result<GetActionsGetHostedRunnersPlatformsForOrgResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners/platforms", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetHostedRunnersPlatformsForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a job for a workflow run
///
/// Gets a specific job in a workflow run.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_job_for_workflow_run](https://docs.github.com/rest/actions/workflow-jobs#get-a-job-for-a-workflow-run)
///
/// ---
pub async fn get_job_for_workflow_run_async(&self, owner: &str, repo: &str, job_id: i32) -> Result<Job, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/jobs/{}", super::GITHUB_BASE_API_URL, owner, repo, job_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetJobForWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a job for a workflow run
///
/// Gets a specific job in a workflow run.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_job_for_workflow_run](https://docs.github.com/rest/actions/workflow-jobs#get-a-job-for-a-workflow-run)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_job_for_workflow_run(&self, owner: &str, repo: &str, job_id: i32) -> Result<Job, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/jobs/{}", super::GITHUB_BASE_API_URL, owner, repo, job_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetJobForWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get an organization public key
///
/// Gets your public key, which you need to encrypt secrets. You need to
/// encrypt a secret before you can create or update secrets.
///
/// The authenticated user must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_org_public_key](https://docs.github.com/rest/actions/secrets#get-an-organization-public-key)
///
/// ---
pub async fn get_org_public_key_async(&self, org: &str) -> Result<ActionsPublicKey, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/secrets/public-key", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetOrgPublicKeyError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get an organization public key
///
/// Gets your public key, which you need to encrypt secrets. You need to
/// encrypt a secret before you can create or update secrets.
///
/// The authenticated user must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_org_public_key](https://docs.github.com/rest/actions/secrets#get-an-organization-public-key)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_org_public_key(&self, org: &str) -> Result<ActionsPublicKey, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/secrets/public-key", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetOrgPublicKeyError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get an organization secret
///
/// Gets a single organization secret without revealing its encrypted value.
///
/// The authenticated user must have collaborator access to a repository to create, update, or read secrets
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_org_secret](https://docs.github.com/rest/actions/secrets#get-an-organization-secret)
///
/// ---
pub async fn get_org_secret_async(&self, org: &str, secret_name: &str) -> Result<OrganizationActionsSecret, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/secrets/{}", super::GITHUB_BASE_API_URL, org, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetOrgSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get an organization secret
///
/// Gets a single organization secret without revealing its encrypted value.
///
/// The authenticated user must have collaborator access to a repository to create, update, or read secrets
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_org_secret](https://docs.github.com/rest/actions/secrets#get-an-organization-secret)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_org_secret(&self, org: &str, secret_name: &str) -> Result<OrganizationActionsSecret, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/secrets/{}", super::GITHUB_BASE_API_URL, org, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetOrgSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get an organization variable
///
/// Gets a specific variable in an organization.
///
/// The authenticated user must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_org_variable](https://docs.github.com/rest/actions/variables#get-an-organization-variable)
///
/// ---
pub async fn get_org_variable_async(&self, org: &str, name: &str) -> Result<OrganizationActionsVariable, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/variables/{}", super::GITHUB_BASE_API_URL, org, name);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetOrgVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get an organization variable
///
/// Gets a specific variable in an organization.
///
/// The authenticated user must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth tokens and personal access tokens (classic) need the`admin:org` scope to use this endpoint. If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_org_variable](https://docs.github.com/rest/actions/variables#get-an-organization-variable)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_org_variable(&self, org: &str, name: &str) -> Result<OrganizationActionsVariable, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/variables/{}", super::GITHUB_BASE_API_URL, org, name);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetOrgVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get pending deployments for a workflow run
///
/// Get all deployment environments for a workflow run that are waiting for protection rules to pass.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_pending_deployments_for_run](https://docs.github.com/rest/actions/workflow-runs#get-pending-deployments-for-a-workflow-run)
///
/// ---
pub async fn get_pending_deployments_for_run_async(&self, owner: &str, repo: &str, run_id: i32) -> Result<Vec<PendingDeployment>, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/pending_deployments", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetPendingDeploymentsForRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get pending deployments for a workflow run
///
/// Get all deployment environments for a workflow run that are waiting for protection rules to pass.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_pending_deployments_for_run](https://docs.github.com/rest/actions/workflow-runs#get-pending-deployments-for-a-workflow-run)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_pending_deployments_for_run(&self, owner: &str, repo: &str, run_id: i32) -> Result<Vec<PendingDeployment>, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/pending_deployments", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetPendingDeploymentsForRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a repository public key
///
/// Gets your public key, which you need to encrypt secrets. You need to
/// encrypt a secret before you can create or update secrets.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_repo_public_key](https://docs.github.com/rest/actions/secrets#get-a-repository-public-key)
///
/// ---
pub async fn get_repo_public_key_async(&self, owner: &str, repo: &str) -> Result<ActionsPublicKey, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/secrets/public-key", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetRepoPublicKeyError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a repository public key
///
/// Gets your public key, which you need to encrypt secrets. You need to
/// encrypt a secret before you can create or update secrets.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// If the repository is private, OAuth tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_repo_public_key](https://docs.github.com/rest/actions/secrets#get-a-repository-public-key)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_repo_public_key(&self, owner: &str, repo: &str) -> Result<ActionsPublicKey, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/secrets/public-key", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetRepoPublicKeyError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a repository secret
///
/// Gets a single repository secret without revealing its encrypted value.
///
/// The authenticated user must have collaborator access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_repo_secret](https://docs.github.com/rest/actions/secrets#get-a-repository-secret)
///
/// ---
pub async fn get_repo_secret_async(&self, owner: &str, repo: &str, secret_name: &str) -> Result<ActionsSecret, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/secrets/{}", super::GITHUB_BASE_API_URL, owner, repo, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetRepoSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a repository secret
///
/// Gets a single repository secret without revealing its encrypted value.
///
/// The authenticated user must have collaborator access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_repo_secret](https://docs.github.com/rest/actions/secrets#get-a-repository-secret)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_repo_secret(&self, owner: &str, repo: &str, secret_name: &str) -> Result<ActionsSecret, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/secrets/{}", super::GITHUB_BASE_API_URL, owner, repo, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetRepoSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a repository variable
///
/// Gets a specific variable in a repository.
///
/// The authenticated user must have collaborator access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_repo_variable](https://docs.github.com/rest/actions/variables#get-a-repository-variable)
///
/// ---
pub async fn get_repo_variable_async(&self, owner: &str, repo: &str, name: &str) -> Result<ActionsVariable, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/variables/{}", super::GITHUB_BASE_API_URL, owner, repo, name);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetRepoVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a repository variable
///
/// Gets a specific variable in a repository.
///
/// The authenticated user must have collaborator access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_repo_variable](https://docs.github.com/rest/actions/variables#get-a-repository-variable)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_repo_variable(&self, owner: &str, repo: &str, name: &str) -> Result<ActionsVariable, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/variables/{}", super::GITHUB_BASE_API_URL, owner, repo, name);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetRepoVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get the review history for a workflow run
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for get_reviews_for_run](https://docs.github.com/rest/actions/workflow-runs#get-the-review-history-for-a-workflow-run)
///
/// ---
pub async fn get_reviews_for_run_async(&self, owner: &str, repo: &str, run_id: i32) -> Result<Vec<EnvironmentApprovals>, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/approvals", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetReviewsForRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get the review history for a workflow run
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for get_reviews_for_run](https://docs.github.com/rest/actions/workflow-runs#get-the-review-history-for-a-workflow-run)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_reviews_for_run(&self, owner: &str, repo: &str, run_id: i32) -> Result<Vec<EnvironmentApprovals>, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/approvals", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetReviewsForRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a self-hosted runner for an organization
///
/// Gets a specific self-hosted runner configured in an organization.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for get_self_hosted_runner_for_org](https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-organization)
///
/// ---
pub async fn get_self_hosted_runner_for_org_async(&self, org: &str, runner_id: i32) -> Result<Runner, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/{}", super::GITHUB_BASE_API_URL, org, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetSelfHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a self-hosted runner for an organization
///
/// Gets a specific self-hosted runner configured in an organization.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for get_self_hosted_runner_for_org](https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_self_hosted_runner_for_org(&self, org: &str, runner_id: i32) -> Result<Runner, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/{}", super::GITHUB_BASE_API_URL, org, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetSelfHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a self-hosted runner for a repository
///
/// Gets a specific self-hosted runner configured in a repository.
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_self_hosted_runner_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-a-repository)
///
/// ---
pub async fn get_self_hosted_runner_for_repo_async(&self, owner: &str, repo: &str, runner_id: i32) -> Result<Runner, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/{}", super::GITHUB_BASE_API_URL, owner, repo, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetSelfHostedRunnerForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a self-hosted runner for a repository
///
/// Gets a specific self-hosted runner configured in a repository.
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_self_hosted_runner_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_self_hosted_runner_for_repo(&self, owner: &str, repo: &str, runner_id: i32) -> Result<Runner, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/{}", super::GITHUB_BASE_API_URL, owner, repo, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetSelfHostedRunnerForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a self-hosted runner group for an organization
///
/// Gets a specific self-hosted runner group for an organization.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for get_self_hosted_runner_group_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-organization)
///
/// ---
pub async fn get_self_hosted_runner_group_for_org_async(&self, org: &str, runner_group_id: i32) -> Result<RunnerGroupsOrg, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}", super::GITHUB_BASE_API_URL, org, runner_group_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetSelfHostedRunnerGroupForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a self-hosted runner group for an organization
///
/// Gets a specific self-hosted runner group for an organization.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for get_self_hosted_runner_group_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_self_hosted_runner_group_for_org(&self, org: &str, runner_group_id: i32) -> Result<RunnerGroupsOrg, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}", super::GITHUB_BASE_API_URL, org, runner_group_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetSelfHostedRunnerGroupForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a workflow
///
/// Gets a specific workflow. You can replace `workflow_id` with the workflow
/// file name. For example, you could use `main.yaml`.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for get_workflow](https://docs.github.com/rest/actions/workflows#get-a-workflow)
///
/// ---
pub async fn get_workflow_async(&self, owner: &str, repo: &str, workflow_id: WorkflowId) -> Result<Workflow, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/workflows/{}", super::GITHUB_BASE_API_URL, owner, repo, workflow_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetWorkflowError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a workflow
///
/// Gets a specific workflow. You can replace `workflow_id` with the workflow
/// file name. For example, you could use `main.yaml`.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for get_workflow](https://docs.github.com/rest/actions/workflows#get-a-workflow)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_workflow(&self, owner: &str, repo: &str, workflow_id: WorkflowId) -> Result<Workflow, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/workflows/{}", super::GITHUB_BASE_API_URL, owner, repo, workflow_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetWorkflowError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get the level of access for workflows outside of the repository
///
/// Gets the level of access that workflows outside of the repository have to actions and reusable workflows in the repository.
/// This endpoint only applies to private repositories.
/// For more information, see "[Allowing access to components in a private repository](https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#allowing-access-to-components-in-a-private-repository)."
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_workflow_access_to_repository](https://docs.github.com/rest/actions/permissions#get-the-level-of-access-for-workflows-outside-of-the-repository)
///
/// ---
pub async fn get_workflow_access_to_repository_async(&self, owner: &str, repo: &str) -> Result<ActionsWorkflowAccessToRepository, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/permissions/access", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetWorkflowAccessToRepositoryError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get the level of access for workflows outside of the repository
///
/// Gets the level of access that workflows outside of the repository have to actions and reusable workflows in the repository.
/// This endpoint only applies to private repositories.
/// For more information, see "[Allowing access to components in a private repository](https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#allowing-access-to-components-in-a-private-repository)."
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for get_workflow_access_to_repository](https://docs.github.com/rest/actions/permissions#get-the-level-of-access-for-workflows-outside-of-the-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_workflow_access_to_repository(&self, owner: &str, repo: &str) -> Result<ActionsWorkflowAccessToRepository, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/permissions/access", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetWorkflowAccessToRepositoryError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a workflow run
///
/// Gets a specific workflow run.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for get_workflow_run](https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run)
///
/// ---
pub async fn get_workflow_run_async(&self, owner: &str, repo: &str, run_id: i32, query_params: Option<impl Into<ActionsGetWorkflowRunParams>>) -> Result<WorkflowRun, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/runs/{}", super::GITHUB_BASE_API_URL, owner, repo, run_id);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a workflow run
///
/// Gets a specific workflow run.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for get_workflow_run](https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_workflow_run(&self, owner: &str, repo: &str, run_id: i32, query_params: Option<impl Into<ActionsGetWorkflowRunParams>>) -> Result<WorkflowRun, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/runs/{}", super::GITHUB_BASE_API_URL, owner, repo, run_id);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsGetWorkflowRunParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a workflow run attempt
///
/// Gets a specific workflow run attempt.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for get_workflow_run_attempt](https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run-attempt)
///
/// ---
pub async fn get_workflow_run_attempt_async(&self, owner: &str, repo: &str, run_id: i32, attempt_number: i32, query_params: Option<impl Into<ActionsGetWorkflowRunAttemptParams>>) -> Result<WorkflowRun, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/runs/{}/attempts/{}", super::GITHUB_BASE_API_URL, owner, repo, run_id, attempt_number);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetWorkflowRunAttemptError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get a workflow run attempt
///
/// Gets a specific workflow run attempt.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for get_workflow_run_attempt](https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run-attempt)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_workflow_run_attempt(&self, owner: &str, repo: &str, run_id: i32, attempt_number: i32, query_params: Option<impl Into<ActionsGetWorkflowRunAttemptParams>>) -> Result<WorkflowRun, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/runs/{}/attempts/{}", super::GITHUB_BASE_API_URL, owner, repo, run_id, attempt_number);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsGetWorkflowRunAttemptParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetWorkflowRunAttemptError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get workflow run usage
///
/// > [!WARNING]
/// > This endpoint is in the process of closing down. Refer to "[Actions Get workflow usage and Get workflow run usage endpoints closing down](https://github.blog/changelog/2025-02-02-actions-get-workflow-usage-and-get-workflow-run-usage-endpoints-closing-down/)" for more information.
///
/// Gets the number of billable minutes and total run time for a specific workflow run. Billable minutes only apply to workflows in private repositories that use GitHub-hosted runners. Usage is listed for each GitHub-hosted runner operating system in milliseconds. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://docs.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)".
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for get_workflow_run_usage](https://docs.github.com/rest/actions/workflow-runs#get-workflow-run-usage)
///
/// ---
pub async fn get_workflow_run_usage_async(&self, owner: &str, repo: &str, run_id: i32) -> Result<WorkflowRunUsage, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/timing", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetWorkflowRunUsageError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get workflow run usage
///
/// > [!WARNING]
/// > This endpoint is in the process of closing down. Refer to "[Actions Get workflow usage and Get workflow run usage endpoints closing down](https://github.blog/changelog/2025-02-02-actions-get-workflow-usage-and-get-workflow-run-usage-endpoints-closing-down/)" for more information.
///
/// Gets the number of billable minutes and total run time for a specific workflow run. Billable minutes only apply to workflows in private repositories that use GitHub-hosted runners. Usage is listed for each GitHub-hosted runner operating system in milliseconds. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://docs.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)".
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for get_workflow_run_usage](https://docs.github.com/rest/actions/workflow-runs#get-workflow-run-usage)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_workflow_run_usage(&self, owner: &str, repo: &str, run_id: i32) -> Result<WorkflowRunUsage, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/timing", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetWorkflowRunUsageError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get workflow usage
///
/// > [!WARNING]
/// > This endpoint is in the process of closing down. Refer to "[Actions Get workflow usage and Get workflow run usage endpoints closing down](https://github.blog/changelog/2025-02-02-actions-get-workflow-usage-and-get-workflow-run-usage-endpoints-closing-down/)" for more information.
///
/// Gets the number of billable minutes used by a specific workflow during the current billing cycle. Billable minutes only apply to workflows in private repositories that use GitHub-hosted runners. Usage is listed for each GitHub-hosted runner operating system in milliseconds. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://docs.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)".
///
/// You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for get_workflow_usage](https://docs.github.com/rest/actions/workflows#get-workflow-usage)
///
/// ---
pub async fn get_workflow_usage_async(&self, owner: &str, repo: &str, workflow_id: WorkflowId) -> Result<WorkflowUsage, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/workflows/{}/timing", super::GITHUB_BASE_API_URL, owner, repo, workflow_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsGetWorkflowUsageError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Get workflow usage
///
/// > [!WARNING]
/// > This endpoint is in the process of closing down. Refer to "[Actions Get workflow usage and Get workflow run usage endpoints closing down](https://github.blog/changelog/2025-02-02-actions-get-workflow-usage-and-get-workflow-run-usage-endpoints-closing-down/)" for more information.
///
/// Gets the number of billable minutes used by a specific workflow during the current billing cycle. Billable minutes only apply to workflows in private repositories that use GitHub-hosted runners. Usage is listed for each GitHub-hosted runner operating system in milliseconds. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://docs.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)".
///
/// You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for get_workflow_usage](https://docs.github.com/rest/actions/workflows#get-workflow-usage)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn get_workflow_usage(&self, owner: &str, repo: &str, workflow_id: WorkflowId) -> Result<WorkflowUsage, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/workflows/{}/timing", super::GITHUB_BASE_API_URL, owner, repo, workflow_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsGetWorkflowUsageError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List artifacts for a repository
///
/// Lists all artifacts for a repository.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for list_artifacts_for_repo](https://docs.github.com/rest/actions/artifacts#list-artifacts-for-a-repository)
///
/// ---
pub async fn list_artifacts_for_repo_async(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsListArtifactsForRepoParams<'api>>>) -> Result<GetActionsListWorkflowRunArtifactsResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/artifacts", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListArtifactsForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List artifacts for a repository
///
/// Lists all artifacts for a repository.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for list_artifacts_for_repo](https://docs.github.com/rest/actions/artifacts#list-artifacts-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_artifacts_for_repo(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsListArtifactsForRepoParams<'api>>>) -> Result<GetActionsListWorkflowRunArtifactsResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/artifacts", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListArtifactsForRepoParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListArtifactsForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List environment secrets
///
/// Lists all secrets available in an environment without revealing their
/// encrypted values.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_environment_secrets](https://docs.github.com/rest/actions/secrets#list-environment-secrets)
///
/// ---
pub async fn list_environment_secrets_async(&self, owner: &str, repo: &str, environment_name: &str, query_params: Option<impl Into<ActionsListEnvironmentSecretsParams>>) -> Result<GetActionsListEnvironmentSecretsResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/environments/{}/secrets", super::GITHUB_BASE_API_URL, owner, repo, environment_name);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListEnvironmentSecretsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List environment secrets
///
/// Lists all secrets available in an environment without revealing their
/// encrypted values.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_environment_secrets](https://docs.github.com/rest/actions/secrets#list-environment-secrets)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_environment_secrets(&self, owner: &str, repo: &str, environment_name: &str, query_params: Option<impl Into<ActionsListEnvironmentSecretsParams>>) -> Result<GetActionsListEnvironmentSecretsResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/environments/{}/secrets", super::GITHUB_BASE_API_URL, owner, repo, environment_name);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListEnvironmentSecretsParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListEnvironmentSecretsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List environment variables
///
/// Lists all environment variables.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_environment_variables](https://docs.github.com/rest/actions/variables#list-environment-variables)
///
/// ---
pub async fn list_environment_variables_async(&self, owner: &str, repo: &str, environment_name: &str, query_params: Option<impl Into<ActionsListEnvironmentVariablesParams>>) -> Result<GetActionsListEnvironmentVariablesResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/environments/{}/variables", super::GITHUB_BASE_API_URL, owner, repo, environment_name);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListEnvironmentVariablesError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List environment variables
///
/// Lists all environment variables.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_environment_variables](https://docs.github.com/rest/actions/variables#list-environment-variables)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_environment_variables(&self, owner: &str, repo: &str, environment_name: &str, query_params: Option<impl Into<ActionsListEnvironmentVariablesParams>>) -> Result<GetActionsListEnvironmentVariablesResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/environments/{}/variables", super::GITHUB_BASE_API_URL, owner, repo, environment_name);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListEnvironmentVariablesParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListEnvironmentVariablesError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List GitHub-hosted runners in a group for an organization
///
/// Lists the GitHub-hosted runners in an organization group.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for list_github_hosted_runners_in_group_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#list-github-hosted-runners-in-a-group-for-an-organization)
///
/// ---
pub async fn list_github_hosted_runners_in_group_for_org_async(&self, org: &str, runner_group_id: i32, query_params: Option<impl Into<ActionsListGithubHostedRunnersInGroupForOrgParams>>) -> Result<GetActionsListGithubHostedRunnersInGroupForOrgResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/hosted-runners", super::GITHUB_BASE_API_URL, org, runner_group_id);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListGithubHostedRunnersInGroupForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List GitHub-hosted runners in a group for an organization
///
/// Lists the GitHub-hosted runners in an organization group.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for list_github_hosted_runners_in_group_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#list-github-hosted-runners-in-a-group-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_github_hosted_runners_in_group_for_org(&self, org: &str, runner_group_id: i32, query_params: Option<impl Into<ActionsListGithubHostedRunnersInGroupForOrgParams>>) -> Result<GetActionsListGithubHostedRunnersInGroupForOrgResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/hosted-runners", super::GITHUB_BASE_API_URL, org, runner_group_id);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListGithubHostedRunnersInGroupForOrgParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListGithubHostedRunnersInGroupForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List GitHub-hosted runners for an organization
///
/// Lists all GitHub-hosted runners configured in an organization.
///
/// OAuth app tokens and personal access tokens (classic) need the `manage_runner:org` scope to use this endpoint.
///
/// [GitHub API docs for list_hosted_runners_for_org](https://docs.github.com/rest/actions/hosted-runners#list-github-hosted-runners-for-an-organization)
///
/// ---
pub async fn list_hosted_runners_for_org_async(&self, org: &str, query_params: Option<impl Into<ActionsListHostedRunnersForOrgParams>>) -> Result<GetActionsListHostedRunnersForOrgResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/hosted-runners", super::GITHUB_BASE_API_URL, org);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListHostedRunnersForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List GitHub-hosted runners for an organization
///
/// Lists all GitHub-hosted runners configured in an organization.
///
/// OAuth app tokens and personal access tokens (classic) need the `manage_runner:org` scope to use this endpoint.
///
/// [GitHub API docs for list_hosted_runners_for_org](https://docs.github.com/rest/actions/hosted-runners#list-github-hosted-runners-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_hosted_runners_for_org(&self, org: &str, query_params: Option<impl Into<ActionsListHostedRunnersForOrgParams>>) -> Result<GetActionsListHostedRunnersForOrgResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/hosted-runners", super::GITHUB_BASE_API_URL, org);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListHostedRunnersForOrgParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListHostedRunnersForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List jobs for a workflow run
///
/// Lists jobs for a workflow run. You can use parameters to narrow the list of results. For more information
/// about using parameters, see [Parameters](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#parameters).
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for list_jobs_for_workflow_run](https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run)
///
/// ---
pub async fn list_jobs_for_workflow_run_async(&self, owner: &str, repo: &str, run_id: i32, query_params: Option<impl Into<ActionsListJobsForWorkflowRunParams<'api>>>) -> Result<GetActionsListJobsForWorkflowRunResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/runs/{}/jobs", super::GITHUB_BASE_API_URL, owner, repo, run_id);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListJobsForWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List jobs for a workflow run
///
/// Lists jobs for a workflow run. You can use parameters to narrow the list of results. For more information
/// about using parameters, see [Parameters](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#parameters).
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for list_jobs_for_workflow_run](https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_jobs_for_workflow_run(&self, owner: &str, repo: &str, run_id: i32, query_params: Option<impl Into<ActionsListJobsForWorkflowRunParams<'api>>>) -> Result<GetActionsListJobsForWorkflowRunResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/runs/{}/jobs", super::GITHUB_BASE_API_URL, owner, repo, run_id);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListJobsForWorkflowRunParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListJobsForWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List jobs for a workflow run attempt
///
/// Lists jobs for a specific workflow run attempt. You can use parameters to narrow the list of results. For more information
/// about using parameters, see [Parameters](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#parameters).
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for list_jobs_for_workflow_run_attempt](https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run-attempt)
///
/// ---
pub async fn list_jobs_for_workflow_run_attempt_async(&self, owner: &str, repo: &str, run_id: i32, attempt_number: i32, query_params: Option<impl Into<ActionsListJobsForWorkflowRunAttemptParams>>) -> Result<GetActionsListJobsForWorkflowRunResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/runs/{}/attempts/{}/jobs", super::GITHUB_BASE_API_URL, owner, repo, run_id, attempt_number);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
404 => Err(ActionsListJobsForWorkflowRunAttemptError::Status404(github_response.to_json_async().await?).into()),
code => Err(ActionsListJobsForWorkflowRunAttemptError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List jobs for a workflow run attempt
///
/// Lists jobs for a specific workflow run attempt. You can use parameters to narrow the list of results. For more information
/// about using parameters, see [Parameters](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#parameters).
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for list_jobs_for_workflow_run_attempt](https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run-attempt)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_jobs_for_workflow_run_attempt(&self, owner: &str, repo: &str, run_id: i32, attempt_number: i32, query_params: Option<impl Into<ActionsListJobsForWorkflowRunAttemptParams>>) -> Result<GetActionsListJobsForWorkflowRunResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/runs/{}/attempts/{}/jobs", super::GITHUB_BASE_API_URL, owner, repo, run_id, attempt_number);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListJobsForWorkflowRunAttemptParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
404 => Err(ActionsListJobsForWorkflowRunAttemptError::Status404(github_response.to_json()?).into()),
code => Err(ActionsListJobsForWorkflowRunAttemptError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List labels for a self-hosted runner for an organization
///
/// Lists all labels for a self-hosted runner configured in an organization.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for list_labels_for_self_hosted_runner_for_org](https://docs.github.com/rest/actions/self-hosted-runners#list-labels-for-a-self-hosted-runner-for-an-organization)
///
/// ---
pub async fn list_labels_for_self_hosted_runner_for_org_async(&self, org: &str, runner_id: i32) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/{}/labels", super::GITHUB_BASE_API_URL, org, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
404 => Err(ActionsListLabelsForSelfHostedRunnerForOrgError::Status404(github_response.to_json_async().await?).into()),
code => Err(ActionsListLabelsForSelfHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List labels for a self-hosted runner for an organization
///
/// Lists all labels for a self-hosted runner configured in an organization.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for list_labels_for_self_hosted_runner_for_org](https://docs.github.com/rest/actions/self-hosted-runners#list-labels-for-a-self-hosted-runner-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_labels_for_self_hosted_runner_for_org(&self, org: &str, runner_id: i32) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/{}/labels", super::GITHUB_BASE_API_URL, org, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
404 => Err(ActionsListLabelsForSelfHostedRunnerForOrgError::Status404(github_response.to_json()?).into()),
code => Err(ActionsListLabelsForSelfHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List labels for a self-hosted runner for a repository
///
/// Lists all labels for a self-hosted runner configured in a repository.
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_labels_for_self_hosted_runner_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#list-labels-for-a-self-hosted-runner-for-a-repository)
///
/// ---
pub async fn list_labels_for_self_hosted_runner_for_repo_async(&self, owner: &str, repo: &str, runner_id: i32) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/{}/labels", super::GITHUB_BASE_API_URL, owner, repo, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
404 => Err(ActionsListLabelsForSelfHostedRunnerForRepoError::Status404(github_response.to_json_async().await?).into()),
code => Err(ActionsListLabelsForSelfHostedRunnerForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List labels for a self-hosted runner for a repository
///
/// Lists all labels for a self-hosted runner configured in a repository.
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_labels_for_self_hosted_runner_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#list-labels-for-a-self-hosted-runner-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_labels_for_self_hosted_runner_for_repo(&self, owner: &str, repo: &str, runner_id: i32) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/{}/labels", super::GITHUB_BASE_API_URL, owner, repo, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
404 => Err(ActionsListLabelsForSelfHostedRunnerForRepoError::Status404(github_response.to_json()?).into()),
code => Err(ActionsListLabelsForSelfHostedRunnerForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List organization secrets
///
/// Lists all secrets available in an organization without revealing their
/// encrypted values.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for list_org_secrets](https://docs.github.com/rest/actions/secrets#list-organization-secrets)
///
/// ---
pub async fn list_org_secrets_async(&self, org: &str, query_params: Option<impl Into<ActionsListOrgSecretsParams>>) -> Result<GetActionsListOrgSecretsResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/secrets", super::GITHUB_BASE_API_URL, org);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListOrgSecretsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List organization secrets
///
/// Lists all secrets available in an organization without revealing their
/// encrypted values.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for list_org_secrets](https://docs.github.com/rest/actions/secrets#list-organization-secrets)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_org_secrets(&self, org: &str, query_params: Option<impl Into<ActionsListOrgSecretsParams>>) -> Result<GetActionsListOrgSecretsResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/secrets", super::GITHUB_BASE_API_URL, org);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListOrgSecretsParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListOrgSecretsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List organization variables
///
/// Lists all organization variables.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for list_org_variables](https://docs.github.com/rest/actions/variables#list-organization-variables)
///
/// ---
pub async fn list_org_variables_async(&self, org: &str, query_params: Option<impl Into<ActionsListOrgVariablesParams>>) -> Result<GetActionsListOrgVariablesResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/variables", super::GITHUB_BASE_API_URL, org);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListOrgVariablesError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List organization variables
///
/// Lists all organization variables.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for list_org_variables](https://docs.github.com/rest/actions/variables#list-organization-variables)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_org_variables(&self, org: &str, query_params: Option<impl Into<ActionsListOrgVariablesParams>>) -> Result<GetActionsListOrgVariablesResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/variables", super::GITHUB_BASE_API_URL, org);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListOrgVariablesParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListOrgVariablesError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List repository access to a self-hosted runner group in an organization
///
/// Lists the repositories with access to a self-hosted runner group configured in an organization.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for list_repo_access_to_self_hosted_runner_group_in_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#list-repository-access-to-a-self-hosted-runner-group-in-an-organization)
///
/// ---
pub async fn list_repo_access_to_self_hosted_runner_group_in_org_async(&self, org: &str, runner_group_id: i32, query_params: Option<impl Into<ActionsListRepoAccessToSelfHostedRunnerGroupInOrgParams>>) -> Result<GetActionsListRepoAccessToSelfHostedRunnerGroupInOrgResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/repositories", super::GITHUB_BASE_API_URL, org, runner_group_id);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListRepoAccessToSelfHostedRunnerGroupInOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List repository access to a self-hosted runner group in an organization
///
/// Lists the repositories with access to a self-hosted runner group configured in an organization.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for list_repo_access_to_self_hosted_runner_group_in_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#list-repository-access-to-a-self-hosted-runner-group-in-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_repo_access_to_self_hosted_runner_group_in_org(&self, org: &str, runner_group_id: i32, query_params: Option<impl Into<ActionsListRepoAccessToSelfHostedRunnerGroupInOrgParams>>) -> Result<GetActionsListRepoAccessToSelfHostedRunnerGroupInOrgResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/repositories", super::GITHUB_BASE_API_URL, org, runner_group_id);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListRepoAccessToSelfHostedRunnerGroupInOrgParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListRepoAccessToSelfHostedRunnerGroupInOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List repository organization secrets
///
/// Lists all organization secrets shared with a repository without revealing their encrypted
/// values.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_repo_organization_secrets](https://docs.github.com/rest/actions/secrets#list-repository-organization-secrets)
///
/// ---
pub async fn list_repo_organization_secrets_async(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsListRepoOrganizationSecretsParams>>) -> Result<GetActionsListEnvironmentSecretsResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/organization-secrets", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListRepoOrganizationSecretsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List repository organization secrets
///
/// Lists all organization secrets shared with a repository without revealing their encrypted
/// values.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_repo_organization_secrets](https://docs.github.com/rest/actions/secrets#list-repository-organization-secrets)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_repo_organization_secrets(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsListRepoOrganizationSecretsParams>>) -> Result<GetActionsListEnvironmentSecretsResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/organization-secrets", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListRepoOrganizationSecretsParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListRepoOrganizationSecretsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List repository organization variables
///
/// Lists all organization variables shared with a repository.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_repo_organization_variables](https://docs.github.com/rest/actions/variables#list-repository-organization-variables)
///
/// ---
pub async fn list_repo_organization_variables_async(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsListRepoOrganizationVariablesParams>>) -> Result<GetActionsListEnvironmentVariablesResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/organization-variables", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListRepoOrganizationVariablesError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List repository organization variables
///
/// Lists all organization variables shared with a repository.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_repo_organization_variables](https://docs.github.com/rest/actions/variables#list-repository-organization-variables)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_repo_organization_variables(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsListRepoOrganizationVariablesParams>>) -> Result<GetActionsListEnvironmentVariablesResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/organization-variables", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListRepoOrganizationVariablesParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListRepoOrganizationVariablesError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List repository secrets
///
/// Lists all secrets available in a repository without revealing their encrypted
/// values.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_repo_secrets](https://docs.github.com/rest/actions/secrets#list-repository-secrets)
///
/// ---
pub async fn list_repo_secrets_async(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsListRepoSecretsParams>>) -> Result<GetActionsListEnvironmentSecretsResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/secrets", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListRepoSecretsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List repository secrets
///
/// Lists all secrets available in a repository without revealing their encrypted
/// values.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_repo_secrets](https://docs.github.com/rest/actions/secrets#list-repository-secrets)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_repo_secrets(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsListRepoSecretsParams>>) -> Result<GetActionsListEnvironmentSecretsResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/secrets", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListRepoSecretsParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListRepoSecretsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List repository variables
///
/// Lists all repository variables.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_repo_variables](https://docs.github.com/rest/actions/variables#list-repository-variables)
///
/// ---
pub async fn list_repo_variables_async(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsListRepoVariablesParams>>) -> Result<GetActionsListEnvironmentVariablesResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/variables", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListRepoVariablesError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List repository variables
///
/// Lists all repository variables.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_repo_variables](https://docs.github.com/rest/actions/variables#list-repository-variables)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_repo_variables(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsListRepoVariablesParams>>) -> Result<GetActionsListEnvironmentVariablesResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/variables", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListRepoVariablesParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListRepoVariablesError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List repository workflows
///
/// Lists the workflows in a repository.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for list_repo_workflows](https://docs.github.com/rest/actions/workflows#list-repository-workflows)
///
/// ---
pub async fn list_repo_workflows_async(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsListRepoWorkflowsParams>>) -> Result<GetActionsListRepoWorkflowsResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/workflows", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListRepoWorkflowsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List repository workflows
///
/// Lists the workflows in a repository.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for list_repo_workflows](https://docs.github.com/rest/actions/workflows#list-repository-workflows)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_repo_workflows(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsListRepoWorkflowsParams>>) -> Result<GetActionsListRepoWorkflowsResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/workflows", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListRepoWorkflowsParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListRepoWorkflowsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List runner applications for an organization
///
/// Lists binaries for the runner application that you can download and run.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for list_runner_applications_for_org](https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-an-organization)
///
/// ---
pub async fn list_runner_applications_for_org_async(&self, org: &str) -> Result<Vec<RunnerApplication>, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/downloads", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListRunnerApplicationsForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List runner applications for an organization
///
/// Lists binaries for the runner application that you can download and run.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for list_runner_applications_for_org](https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_runner_applications_for_org(&self, org: &str) -> Result<Vec<RunnerApplication>, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/downloads", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListRunnerApplicationsForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List runner applications for a repository
///
/// Lists binaries for the runner application that you can download and run.
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_runner_applications_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-a-repository)
///
/// ---
pub async fn list_runner_applications_for_repo_async(&self, owner: &str, repo: &str) -> Result<Vec<RunnerApplication>, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/downloads", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListRunnerApplicationsForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List runner applications for a repository
///
/// Lists binaries for the runner application that you can download and run.
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_runner_applications_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_runner_applications_for_repo(&self, owner: &str, repo: &str) -> Result<Vec<RunnerApplication>, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/downloads", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListRunnerApplicationsForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List selected repositories for an organization secret
///
/// Lists all repositories that have been selected when the `visibility`
/// for repository access to a secret is set to `selected`.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for list_selected_repos_for_org_secret](https://docs.github.com/rest/actions/secrets#list-selected-repositories-for-an-organization-secret)
///
/// ---
pub async fn list_selected_repos_for_org_secret_async(&self, org: &str, secret_name: &str, query_params: Option<impl Into<ActionsListSelectedReposForOrgSecretParams>>) -> Result<GetCodespacesListRepositoriesForSecretForAuthenticatedUserResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/secrets/{}/repositories", super::GITHUB_BASE_API_URL, org, secret_name);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListSelectedReposForOrgSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List selected repositories for an organization secret
///
/// Lists all repositories that have been selected when the `visibility`
/// for repository access to a secret is set to `selected`.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for list_selected_repos_for_org_secret](https://docs.github.com/rest/actions/secrets#list-selected-repositories-for-an-organization-secret)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_selected_repos_for_org_secret(&self, org: &str, secret_name: &str, query_params: Option<impl Into<ActionsListSelectedReposForOrgSecretParams>>) -> Result<GetCodespacesListRepositoriesForSecretForAuthenticatedUserResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/secrets/{}/repositories", super::GITHUB_BASE_API_URL, org, secret_name);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListSelectedReposForOrgSecretParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListSelectedReposForOrgSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List selected repositories for an organization variable
///
/// Lists all repositories that can access an organization variable
/// that is available to selected repositories.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for list_selected_repos_for_org_variable](https://docs.github.com/rest/actions/variables#list-selected-repositories-for-an-organization-variable)
///
/// ---
pub async fn list_selected_repos_for_org_variable_async(&self, org: &str, name: &str, query_params: Option<impl Into<ActionsListSelectedReposForOrgVariableParams>>) -> Result<GetCodespacesListRepositoriesForSecretForAuthenticatedUserResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/variables/{}/repositories", super::GITHUB_BASE_API_URL, org, name);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
409 => Err(ActionsListSelectedReposForOrgVariableError::Status409.into()),
code => Err(ActionsListSelectedReposForOrgVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List selected repositories for an organization variable
///
/// Lists all repositories that can access an organization variable
/// that is available to selected repositories.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for list_selected_repos_for_org_variable](https://docs.github.com/rest/actions/variables#list-selected-repositories-for-an-organization-variable)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_selected_repos_for_org_variable(&self, org: &str, name: &str, query_params: Option<impl Into<ActionsListSelectedReposForOrgVariableParams>>) -> Result<GetCodespacesListRepositoriesForSecretForAuthenticatedUserResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/variables/{}/repositories", super::GITHUB_BASE_API_URL, org, name);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListSelectedReposForOrgVariableParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
409 => Err(ActionsListSelectedReposForOrgVariableError::Status409.into()),
code => Err(ActionsListSelectedReposForOrgVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List selected repositories enabled for GitHub Actions in an organization
///
/// Lists the selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for list_selected_repositories_enabled_github_actions_organization](https://docs.github.com/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization)
///
/// ---
pub async fn list_selected_repositories_enabled_github_actions_organization_async(&self, org: &str, query_params: Option<impl Into<ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationParams>>) -> Result<GetActionsListSelectedRepositoriesEnabledGithubActionsOrganizationResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/permissions/repositories", super::GITHUB_BASE_API_URL, org);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List selected repositories enabled for GitHub Actions in an organization
///
/// Lists the selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for list_selected_repositories_enabled_github_actions_organization](https://docs.github.com/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_selected_repositories_enabled_github_actions_organization(&self, org: &str, query_params: Option<impl Into<ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationParams>>) -> Result<GetActionsListSelectedRepositoriesEnabledGithubActionsOrganizationResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/permissions/repositories", super::GITHUB_BASE_API_URL, org);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List self-hosted runner groups for an organization
///
/// Lists all self-hosted runner groups configured in an organization and inherited from an enterprise.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for list_self_hosted_runner_groups_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-organization)
///
/// ---
pub async fn list_self_hosted_runner_groups_for_org_async(&self, org: &str, query_params: Option<impl Into<ActionsListSelfHostedRunnerGroupsForOrgParams<'api>>>) -> Result<GetActionsListSelfHostedRunnerGroupsForOrgResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/runner-groups", super::GITHUB_BASE_API_URL, org);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListSelfHostedRunnerGroupsForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List self-hosted runner groups for an organization
///
/// Lists all self-hosted runner groups configured in an organization and inherited from an enterprise.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for list_self_hosted_runner_groups_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_self_hosted_runner_groups_for_org(&self, org: &str, query_params: Option<impl Into<ActionsListSelfHostedRunnerGroupsForOrgParams<'api>>>) -> Result<GetActionsListSelfHostedRunnerGroupsForOrgResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/runner-groups", super::GITHUB_BASE_API_URL, org);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListSelfHostedRunnerGroupsForOrgParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListSelfHostedRunnerGroupsForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List self-hosted runners for an organization
///
/// Lists all self-hosted runners configured in an organization.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for list_self_hosted_runners_for_org](https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-organization)
///
/// ---
pub async fn list_self_hosted_runners_for_org_async(&self, org: &str, query_params: Option<impl Into<ActionsListSelfHostedRunnersForOrgParams<'api>>>) -> Result<GetActionsListSelfHostedRunnersForRepoResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/runners", super::GITHUB_BASE_API_URL, org);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListSelfHostedRunnersForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List self-hosted runners for an organization
///
/// Lists all self-hosted runners configured in an organization.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for list_self_hosted_runners_for_org](https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_self_hosted_runners_for_org(&self, org: &str, query_params: Option<impl Into<ActionsListSelfHostedRunnersForOrgParams<'api>>>) -> Result<GetActionsListSelfHostedRunnersForRepoResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/runners", super::GITHUB_BASE_API_URL, org);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListSelfHostedRunnersForOrgParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListSelfHostedRunnersForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List self-hosted runners for a repository
///
/// Lists all self-hosted runners configured in a repository.
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_self_hosted_runners_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-a-repository)
///
/// ---
pub async fn list_self_hosted_runners_for_repo_async(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsListSelfHostedRunnersForRepoParams<'api>>>) -> Result<GetActionsListSelfHostedRunnersForRepoResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/runners", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListSelfHostedRunnersForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List self-hosted runners for a repository
///
/// Lists all self-hosted runners configured in a repository.
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for list_self_hosted_runners_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_self_hosted_runners_for_repo(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsListSelfHostedRunnersForRepoParams<'api>>>) -> Result<GetActionsListSelfHostedRunnersForRepoResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/runners", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListSelfHostedRunnersForRepoParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListSelfHostedRunnersForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List self-hosted runners in a group for an organization
///
/// Lists self-hosted runners that are in a specific organization group.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for list_self_hosted_runners_in_group_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-organization)
///
/// ---
pub async fn list_self_hosted_runners_in_group_for_org_async(&self, org: &str, runner_group_id: i32, query_params: Option<impl Into<ActionsListSelfHostedRunnersInGroupForOrgParams>>) -> Result<GetActionsListSelfHostedRunnersInGroupForOrgResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/runners", super::GITHUB_BASE_API_URL, org, runner_group_id);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListSelfHostedRunnersInGroupForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List self-hosted runners in a group for an organization
///
/// Lists self-hosted runners that are in a specific organization group.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for list_self_hosted_runners_in_group_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_self_hosted_runners_in_group_for_org(&self, org: &str, runner_group_id: i32, query_params: Option<impl Into<ActionsListSelfHostedRunnersInGroupForOrgParams>>) -> Result<GetActionsListSelfHostedRunnersInGroupForOrgResponse200, AdapterError> {
let mut request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/runners", super::GITHUB_BASE_API_URL, org, runner_group_id);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListSelfHostedRunnersInGroupForOrgParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListSelfHostedRunnersInGroupForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List workflow run artifacts
///
/// Lists artifacts for a workflow run.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for list_workflow_run_artifacts](https://docs.github.com/rest/actions/artifacts#list-workflow-run-artifacts)
///
/// ---
pub async fn list_workflow_run_artifacts_async(&self, owner: &str, repo: &str, run_id: i32, query_params: Option<impl Into<ActionsListWorkflowRunArtifactsParams<'api>>>) -> Result<GetActionsListWorkflowRunArtifactsResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/runs/{}/artifacts", super::GITHUB_BASE_API_URL, owner, repo, run_id);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListWorkflowRunArtifactsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List workflow run artifacts
///
/// Lists artifacts for a workflow run.
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for list_workflow_run_artifacts](https://docs.github.com/rest/actions/artifacts#list-workflow-run-artifacts)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_workflow_run_artifacts(&self, owner: &str, repo: &str, run_id: i32, query_params: Option<impl Into<ActionsListWorkflowRunArtifactsParams<'api>>>) -> Result<GetActionsListWorkflowRunArtifactsResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/runs/{}/artifacts", super::GITHUB_BASE_API_URL, owner, repo, run_id);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListWorkflowRunArtifactsParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListWorkflowRunArtifactsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List workflow runs for a workflow
///
/// List all workflow runs for a workflow. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#parameters).
///
/// Anyone with read access to the repository can use this endpoint
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// This endpoint will return up to 1,000 results for each search when using the following parameters: `actor`, `branch`, `check_suite_id`, `created`, `event`, `head_sha`, `status`.
///
/// [GitHub API docs for list_workflow_runs](https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-workflow)
///
/// ---
pub async fn list_workflow_runs_async(&self, owner: &str, repo: &str, workflow_id: WorkflowId, query_params: Option<impl Into<ActionsListWorkflowRunsParams<'api>>>) -> Result<GetActionsListWorkflowRunsResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/workflows/{}/runs", super::GITHUB_BASE_API_URL, owner, repo, workflow_id);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListWorkflowRunsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List workflow runs for a workflow
///
/// List all workflow runs for a workflow. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#parameters).
///
/// Anyone with read access to the repository can use this endpoint
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// This endpoint will return up to 1,000 results for each search when using the following parameters: `actor`, `branch`, `check_suite_id`, `created`, `event`, `head_sha`, `status`.
///
/// [GitHub API docs for list_workflow_runs](https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-workflow)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_workflow_runs(&self, owner: &str, repo: &str, workflow_id: WorkflowId, query_params: Option<impl Into<ActionsListWorkflowRunsParams<'api>>>) -> Result<GetActionsListWorkflowRunsResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/workflows/{}/runs", super::GITHUB_BASE_API_URL, owner, repo, workflow_id);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListWorkflowRunsParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListWorkflowRunsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List workflow runs for a repository
///
/// Lists all workflow runs for a repository. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#parameters).
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// This endpoint will return up to 1,000 results for each search when using the following parameters: `actor`, `branch`, `check_suite_id`, `created`, `event`, `head_sha`, `status`.
///
/// [GitHub API docs for list_workflow_runs_for_repo](https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-repository)
///
/// ---
pub async fn list_workflow_runs_for_repo_async(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsListWorkflowRunsForRepoParams<'api>>>) -> Result<GetActionsListWorkflowRunsResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/runs", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
request_uri.push_str(&serde_urlencoded::to_string(params.into())?);
}
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsListWorkflowRunsForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # List workflow runs for a repository
///
/// Lists all workflow runs for a repository. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#parameters).
///
/// Anyone with read access to the repository can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// This endpoint will return up to 1,000 results for each search when using the following parameters: `actor`, `branch`, `check_suite_id`, `created`, `event`, `head_sha`, `status`.
///
/// [GitHub API docs for list_workflow_runs_for_repo](https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn list_workflow_runs_for_repo(&self, owner: &str, repo: &str, query_params: Option<impl Into<ActionsListWorkflowRunsForRepoParams<'api>>>) -> Result<GetActionsListWorkflowRunsResponse200, AdapterError> {
let mut request_uri = format!("{}/repos/{}/{}/actions/runs", super::GITHUB_BASE_API_URL, owner, repo);
if let Some(params) = query_params {
request_uri.push_str("?");
let qp: ActionsListWorkflowRunsForRepoParams = params.into();
request_uri.push_str(&serde_urlencoded::to_string(qp)?);
}
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "GET",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsListWorkflowRunsForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Re-run a job from a workflow run
///
/// Re-run a job and its dependent jobs in a workflow run.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for re_run_job_for_workflow_run](https://docs.github.com/rest/actions/workflow-runs#re-run-a-job-from-a-workflow-run)
///
/// ---
pub async fn re_run_job_for_workflow_run_async(&self, owner: &str, repo: &str, job_id: i32, body: PostActionsReRunJobForWorkflowRun) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/jobs/{}/rerun", super::GITHUB_BASE_API_URL, owner, repo, job_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsReRunJobForWorkflowRun>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
403 => Err(ActionsReRunJobForWorkflowRunError::Status403(github_response.to_json_async().await?).into()),
code => Err(ActionsReRunJobForWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Re-run a job from a workflow run
///
/// Re-run a job and its dependent jobs in a workflow run.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for re_run_job_for_workflow_run](https://docs.github.com/rest/actions/workflow-runs#re-run-a-job-from-a-workflow-run)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn re_run_job_for_workflow_run(&self, owner: &str, repo: &str, job_id: i32, body: PostActionsReRunJobForWorkflowRun) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/jobs/{}/rerun", super::GITHUB_BASE_API_URL, owner, repo, job_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsReRunJobForWorkflowRun>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
403 => Err(ActionsReRunJobForWorkflowRunError::Status403(github_response.to_json()?).into()),
code => Err(ActionsReRunJobForWorkflowRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Re-run a workflow
///
/// Re-runs your workflow run using its `id`.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for re_run_workflow](https://docs.github.com/rest/actions/workflow-runs#re-run-a-workflow)
///
/// ---
pub async fn re_run_workflow_async(&self, owner: &str, repo: &str, run_id: i32, body: PostActionsReRunWorkflow) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/rerun", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsReRunWorkflow>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsReRunWorkflowError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Re-run a workflow
///
/// Re-runs your workflow run using its `id`.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for re_run_workflow](https://docs.github.com/rest/actions/workflow-runs#re-run-a-workflow)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn re_run_workflow(&self, owner: &str, repo: &str, run_id: i32, body: PostActionsReRunWorkflow) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/rerun", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsReRunWorkflow>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsReRunWorkflowError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Re-run failed jobs from a workflow run
///
/// Re-run all of the failed jobs and their dependent jobs in a workflow run using the `id` of the workflow run.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for re_run_workflow_failed_jobs](https://docs.github.com/rest/actions/workflow-runs#re-run-failed-jobs-from-a-workflow-run)
///
/// ---
pub async fn re_run_workflow_failed_jobs_async(&self, owner: &str, repo: &str, run_id: i32, body: PostActionsReRunWorkflowFailedJobs) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/rerun-failed-jobs", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsReRunWorkflowFailedJobs>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsReRunWorkflowFailedJobsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Re-run failed jobs from a workflow run
///
/// Re-run all of the failed jobs and their dependent jobs in a workflow run using the `id` of the workflow run.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for re_run_workflow_failed_jobs](https://docs.github.com/rest/actions/workflow-runs#re-run-failed-jobs-from-a-workflow-run)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn re_run_workflow_failed_jobs(&self, owner: &str, repo: &str, run_id: i32, body: PostActionsReRunWorkflowFailedJobs) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/rerun-failed-jobs", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsReRunWorkflowFailedJobs>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsReRunWorkflowFailedJobsError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Remove all custom labels from a self-hosted runner for an organization
///
/// Remove all custom labels from a self-hosted runner configured in an
/// organization. Returns the remaining read-only labels from the runner.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for remove_all_custom_labels_from_self_hosted_runner_for_org](https://docs.github.com/rest/actions/self-hosted-runners#remove-all-custom-labels-from-a-self-hosted-runner-for-an-organization)
///
/// ---
pub async fn remove_all_custom_labels_from_self_hosted_runner_for_org_async(&self, org: &str, runner_id: i32) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/{}/labels", super::GITHUB_BASE_API_URL, org, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
404 => Err(ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgError::Status404(github_response.to_json_async().await?).into()),
code => Err(ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Remove all custom labels from a self-hosted runner for an organization
///
/// Remove all custom labels from a self-hosted runner configured in an
/// organization. Returns the remaining read-only labels from the runner.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for remove_all_custom_labels_from_self_hosted_runner_for_org](https://docs.github.com/rest/actions/self-hosted-runners#remove-all-custom-labels-from-a-self-hosted-runner-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn remove_all_custom_labels_from_self_hosted_runner_for_org(&self, org: &str, runner_id: i32) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/{}/labels", super::GITHUB_BASE_API_URL, org, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
404 => Err(ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgError::Status404(github_response.to_json()?).into()),
code => Err(ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Remove all custom labels from a self-hosted runner for a repository
///
/// Remove all custom labels from a self-hosted runner configured in a
/// repository. Returns the remaining read-only labels from the runner.
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for remove_all_custom_labels_from_self_hosted_runner_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#remove-all-custom-labels-from-a-self-hosted-runner-for-a-repository)
///
/// ---
pub async fn remove_all_custom_labels_from_self_hosted_runner_for_repo_async(&self, owner: &str, repo: &str, runner_id: i32) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/{}/labels", super::GITHUB_BASE_API_URL, owner, repo, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
404 => Err(ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoError::Status404(github_response.to_json_async().await?).into()),
code => Err(ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Remove all custom labels from a self-hosted runner for a repository
///
/// Remove all custom labels from a self-hosted runner configured in a
/// repository. Returns the remaining read-only labels from the runner.
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for remove_all_custom_labels_from_self_hosted_runner_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#remove-all-custom-labels-from-a-self-hosted-runner-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn remove_all_custom_labels_from_self_hosted_runner_for_repo(&self, owner: &str, repo: &str, runner_id: i32) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/{}/labels", super::GITHUB_BASE_API_URL, owner, repo, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
404 => Err(ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoError::Status404(github_response.to_json()?).into()),
code => Err(ActionsRemoveAllCustomLabelsFromSelfHostedRunnerForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Remove a custom label from a self-hosted runner for an organization
///
/// Remove a custom label from a self-hosted runner configured
/// in an organization. Returns the remaining labels from the runner.
///
/// This endpoint returns a `404 Not Found` status if the custom label is not
/// present on the runner.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for remove_custom_label_from_self_hosted_runner_for_org](https://docs.github.com/rest/actions/self-hosted-runners#remove-a-custom-label-from-a-self-hosted-runner-for-an-organization)
///
/// ---
pub async fn remove_custom_label_from_self_hosted_runner_for_org_async(&self, org: &str, runner_id: i32, name: &str) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/{}/labels/{}", super::GITHUB_BASE_API_URL, org, runner_id, name);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
404 => Err(ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgError::Status404(github_response.to_json_async().await?).into()),
422 => Err(ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgError::Status422(github_response.to_json_async().await?).into()),
code => Err(ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Remove a custom label from a self-hosted runner for an organization
///
/// Remove a custom label from a self-hosted runner configured
/// in an organization. Returns the remaining labels from the runner.
///
/// This endpoint returns a `404 Not Found` status if the custom label is not
/// present on the runner.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for remove_custom_label_from_self_hosted_runner_for_org](https://docs.github.com/rest/actions/self-hosted-runners#remove-a-custom-label-from-a-self-hosted-runner-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn remove_custom_label_from_self_hosted_runner_for_org(&self, org: &str, runner_id: i32, name: &str) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/{}/labels/{}", super::GITHUB_BASE_API_URL, org, runner_id, name);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
404 => Err(ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgError::Status404(github_response.to_json()?).into()),
422 => Err(ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgError::Status422(github_response.to_json()?).into()),
code => Err(ActionsRemoveCustomLabelFromSelfHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Remove a custom label from a self-hosted runner for a repository
///
/// Remove a custom label from a self-hosted runner configured
/// in a repository. Returns the remaining labels from the runner.
///
/// This endpoint returns a `404 Not Found` status if the custom label is not
/// present on the runner.
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for remove_custom_label_from_self_hosted_runner_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#remove-a-custom-label-from-a-self-hosted-runner-for-a-repository)
///
/// ---
pub async fn remove_custom_label_from_self_hosted_runner_for_repo_async(&self, owner: &str, repo: &str, runner_id: i32, name: &str) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/{}/labels/{}", super::GITHUB_BASE_API_URL, owner, repo, runner_id, name);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
404 => Err(ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoError::Status404(github_response.to_json_async().await?).into()),
422 => Err(ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoError::Status422(github_response.to_json_async().await?).into()),
code => Err(ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Remove a custom label from a self-hosted runner for a repository
///
/// Remove a custom label from a self-hosted runner configured
/// in a repository. Returns the remaining labels from the runner.
///
/// This endpoint returns a `404 Not Found` status if the custom label is not
/// present on the runner.
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for remove_custom_label_from_self_hosted_runner_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#remove-a-custom-label-from-a-self-hosted-runner-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn remove_custom_label_from_self_hosted_runner_for_repo(&self, owner: &str, repo: &str, runner_id: i32, name: &str) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/{}/labels/{}", super::GITHUB_BASE_API_URL, owner, repo, runner_id, name);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
404 => Err(ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoError::Status404(github_response.to_json()?).into()),
422 => Err(ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoError::Status422(github_response.to_json()?).into()),
code => Err(ActionsRemoveCustomLabelFromSelfHostedRunnerForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Remove repository access to a self-hosted runner group in an organization
///
/// Removes a repository from the list of selected repositories that can access a self-hosted runner group. The runner group must have `visibility` set to `selected`. For more information, see "[Create a self-hosted runner group for an organization](#create-a-self-hosted-runner-group-for-an-organization)."
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for remove_repo_access_to_self_hosted_runner_group_in_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#remove-repository-access-to-a-self-hosted-runner-group-in-an-organization)
///
/// ---
pub async fn remove_repo_access_to_self_hosted_runner_group_in_org_async(&self, org: &str, runner_group_id: i32, repository_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/repositories/{}", super::GITHUB_BASE_API_URL, org, runner_group_id, repository_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Remove repository access to a self-hosted runner group in an organization
///
/// Removes a repository from the list of selected repositories that can access a self-hosted runner group. The runner group must have `visibility` set to `selected`. For more information, see "[Create a self-hosted runner group for an organization](#create-a-self-hosted-runner-group-for-an-organization)."
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for remove_repo_access_to_self_hosted_runner_group_in_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#remove-repository-access-to-a-self-hosted-runner-group-in-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn remove_repo_access_to_self_hosted_runner_group_in_org(&self, org: &str, runner_group_id: i32, repository_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/repositories/{}", super::GITHUB_BASE_API_URL, org, runner_group_id, repository_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Remove selected repository from an organization secret
///
/// Removes a repository from an organization secret when the `visibility`
/// for repository access is set to `selected`. The visibility is set when you [Create
/// or update an organization secret](https://docs.github.com/rest/actions/secrets#create-or-update-an-organization-secret).
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for remove_selected_repo_from_org_secret](https://docs.github.com/rest/actions/secrets#remove-selected-repository-from-an-organization-secret)
///
/// ---
pub async fn remove_selected_repo_from_org_secret_async(&self, org: &str, secret_name: &str, repository_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/secrets/{}/repositories/{}", super::GITHUB_BASE_API_URL, org, secret_name, repository_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
409 => Err(ActionsRemoveSelectedRepoFromOrgSecretError::Status409.into()),
code => Err(ActionsRemoveSelectedRepoFromOrgSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Remove selected repository from an organization secret
///
/// Removes a repository from an organization secret when the `visibility`
/// for repository access is set to `selected`. The visibility is set when you [Create
/// or update an organization secret](https://docs.github.com/rest/actions/secrets#create-or-update-an-organization-secret).
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for remove_selected_repo_from_org_secret](https://docs.github.com/rest/actions/secrets#remove-selected-repository-from-an-organization-secret)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn remove_selected_repo_from_org_secret(&self, org: &str, secret_name: &str, repository_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/secrets/{}/repositories/{}", super::GITHUB_BASE_API_URL, org, secret_name, repository_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
409 => Err(ActionsRemoveSelectedRepoFromOrgSecretError::Status409.into()),
code => Err(ActionsRemoveSelectedRepoFromOrgSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Remove selected repository from an organization variable
///
/// Removes a repository from an organization variable that is
/// available to selected repositories. Organization variables that are available to
/// selected repositories have their `visibility` field set to `selected`.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for remove_selected_repo_from_org_variable](https://docs.github.com/rest/actions/variables#remove-selected-repository-from-an-organization-variable)
///
/// ---
pub async fn remove_selected_repo_from_org_variable_async(&self, org: &str, name: &str, repository_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/variables/{}/repositories/{}", super::GITHUB_BASE_API_URL, org, name, repository_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
409 => Err(ActionsRemoveSelectedRepoFromOrgVariableError::Status409.into()),
code => Err(ActionsRemoveSelectedRepoFromOrgVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Remove selected repository from an organization variable
///
/// Removes a repository from an organization variable that is
/// available to selected repositories. Organization variables that are available to
/// selected repositories have their `visibility` field set to `selected`.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for remove_selected_repo_from_org_variable](https://docs.github.com/rest/actions/variables#remove-selected-repository-from-an-organization-variable)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn remove_selected_repo_from_org_variable(&self, org: &str, name: &str, repository_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/variables/{}/repositories/{}", super::GITHUB_BASE_API_URL, org, name, repository_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
409 => Err(ActionsRemoveSelectedRepoFromOrgVariableError::Status409.into()),
code => Err(ActionsRemoveSelectedRepoFromOrgVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Remove a self-hosted runner from a group for an organization
///
/// Removes a self-hosted runner from a group configured in an organization. The runner is then returned to the default group.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for remove_self_hosted_runner_from_group_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-organization)
///
/// ---
pub async fn remove_self_hosted_runner_from_group_for_org_async(&self, org: &str, runner_group_id: i32, runner_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/runners/{}", super::GITHUB_BASE_API_URL, org, runner_group_id, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None::<C::Body>,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsRemoveSelfHostedRunnerFromGroupForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Remove a self-hosted runner from a group for an organization
///
/// Removes a self-hosted runner from a group configured in an organization. The runner is then returned to the default group.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for remove_self_hosted_runner_from_group_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn remove_self_hosted_runner_from_group_for_org(&self, org: &str, runner_group_id: i32, runner_id: i32) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/runners/{}", super::GITHUB_BASE_API_URL, org, runner_group_id, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: None,
method: "DELETE",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsRemoveSelfHostedRunnerFromGroupForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Review custom deployment protection rules for a workflow run
///
/// Approve or reject custom deployment protection rules provided by a GitHub App for a workflow run. For more information, see "[Using environments for deployment](https://docs.github.com/actions/deployment/targeting-different-environments/using-environments-for-deployment)."
///
/// > [!NOTE]
/// > GitHub Apps can only review their own custom deployment protection rules. To approve or reject pending deployments that are waiting for review from a specific person or team, see [`POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments`](/rest/actions/workflow-runs#review-pending-deployments-for-a-workflow-run).
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for review_custom_gates_for_run](https://docs.github.com/rest/actions/workflow-runs#review-custom-deployment-protection-rules-for-a-workflow-run)
///
/// ---
pub async fn review_custom_gates_for_run_async(&self, owner: &str, repo: &str, run_id: i32, body: PostActionsReviewCustomGatesForRun) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/deployment_protection_rule", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsReviewCustomGatesForRun>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsReviewCustomGatesForRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Review custom deployment protection rules for a workflow run
///
/// Approve or reject custom deployment protection rules provided by a GitHub App for a workflow run. For more information, see "[Using environments for deployment](https://docs.github.com/actions/deployment/targeting-different-environments/using-environments-for-deployment)."
///
/// > [!NOTE]
/// > GitHub Apps can only review their own custom deployment protection rules. To approve or reject pending deployments that are waiting for review from a specific person or team, see [`POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments`](/rest/actions/workflow-runs#review-pending-deployments-for-a-workflow-run).
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
///
/// [GitHub API docs for review_custom_gates_for_run](https://docs.github.com/rest/actions/workflow-runs#review-custom-deployment-protection-rules-for-a-workflow-run)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn review_custom_gates_for_run(&self, owner: &str, repo: &str, run_id: i32, body: PostActionsReviewCustomGatesForRun) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/deployment_protection_rule", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsReviewCustomGatesForRun>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsReviewCustomGatesForRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Review pending deployments for a workflow run
///
/// Approve or reject pending deployments that are waiting on approval by a required reviewer.
///
/// Required reviewers with read access to the repository contents and deployments can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for review_pending_deployments_for_run](https://docs.github.com/rest/actions/workflow-runs#review-pending-deployments-for-a-workflow-run)
///
/// ---
pub async fn review_pending_deployments_for_run_async(&self, owner: &str, repo: &str, run_id: i32, body: PostActionsReviewPendingDeploymentsForRun) -> Result<Vec<Deployment>, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/pending_deployments", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsReviewPendingDeploymentsForRun>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsReviewPendingDeploymentsForRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Review pending deployments for a workflow run
///
/// Approve or reject pending deployments that are waiting on approval by a required reviewer.
///
/// Required reviewers with read access to the repository contents and deployments can use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for review_pending_deployments_for_run](https://docs.github.com/rest/actions/workflow-runs#review-pending-deployments-for-a-workflow-run)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn review_pending_deployments_for_run(&self, owner: &str, repo: &str, run_id: i32, body: PostActionsReviewPendingDeploymentsForRun) -> Result<Vec<Deployment>, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runs/{}/pending_deployments", super::GITHUB_BASE_API_URL, owner, repo, run_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PostActionsReviewPendingDeploymentsForRun>(body)?),
method: "POST",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsReviewPendingDeploymentsForRunError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set allowed actions and reusable workflows for an organization
///
/// Sets the actions and reusable workflows that are allowed in an organization. To use this endpoint, the organization permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for set_allowed_actions_organization](https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization)
///
/// ---
pub async fn set_allowed_actions_organization_async(&self, org: &str, body: PutActionsSetAllowedActionsRepository) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions/selected-actions", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetAllowedActionsRepository>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetAllowedActionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set allowed actions and reusable workflows for an organization
///
/// Sets the actions and reusable workflows that are allowed in an organization. To use this endpoint, the organization permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for set_allowed_actions_organization](https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn set_allowed_actions_organization(&self, org: &str, body: PutActionsSetAllowedActionsRepository) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions/selected-actions", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetAllowedActionsRepository>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetAllowedActionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set allowed actions and reusable workflows for a repository
///
/// Sets the actions and reusable workflows that are allowed in a repository. To use this endpoint, the repository permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for a repository](#set-github-actions-permissions-for-a-repository)."
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for set_allowed_actions_repository](https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-a-repository)
///
/// ---
pub async fn set_allowed_actions_repository_async(&self, owner: &str, repo: &str, body: PutActionsSetAllowedActionsRepository) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/permissions/selected-actions", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetAllowedActionsRepository>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetAllowedActionsRepositoryError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set allowed actions and reusable workflows for a repository
///
/// Sets the actions and reusable workflows that are allowed in a repository. To use this endpoint, the repository permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for a repository](#set-github-actions-permissions-for-a-repository)."
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for set_allowed_actions_repository](https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn set_allowed_actions_repository(&self, owner: &str, repo: &str, body: PutActionsSetAllowedActionsRepository) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/permissions/selected-actions", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetAllowedActionsRepository>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetAllowedActionsRepositoryError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set custom labels for a self-hosted runner for an organization
///
/// Remove all previous custom labels and set the new custom labels for a specific
/// self-hosted runner configured in an organization.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for set_custom_labels_for_self_hosted_runner_for_org](https://docs.github.com/rest/actions/self-hosted-runners#set-custom-labels-for-a-self-hosted-runner-for-an-organization)
///
/// ---
pub async fn set_custom_labels_for_self_hosted_runner_for_org_async(&self, org: &str, runner_id: i32, body: PutActionsSetCustomLabelsForSelfHostedRunnerForOrg) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/{}/labels", super::GITHUB_BASE_API_URL, org, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetCustomLabelsForSelfHostedRunnerForOrg>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
404 => Err(ActionsSetCustomLabelsForSelfHostedRunnerForOrgError::Status404(github_response.to_json_async().await?).into()),
422 => Err(ActionsSetCustomLabelsForSelfHostedRunnerForOrgError::Status422(github_response.to_json_async().await?).into()),
code => Err(ActionsSetCustomLabelsForSelfHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set custom labels for a self-hosted runner for an organization
///
/// Remove all previous custom labels and set the new custom labels for a specific
/// self-hosted runner configured in an organization.
///
/// Authenticated users must have admin access to the organization to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for set_custom_labels_for_self_hosted_runner_for_org](https://docs.github.com/rest/actions/self-hosted-runners#set-custom-labels-for-a-self-hosted-runner-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn set_custom_labels_for_self_hosted_runner_for_org(&self, org: &str, runner_id: i32, body: PutActionsSetCustomLabelsForSelfHostedRunnerForOrg) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runners/{}/labels", super::GITHUB_BASE_API_URL, org, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetCustomLabelsForSelfHostedRunnerForOrg>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
404 => Err(ActionsSetCustomLabelsForSelfHostedRunnerForOrgError::Status404(github_response.to_json()?).into()),
422 => Err(ActionsSetCustomLabelsForSelfHostedRunnerForOrgError::Status422(github_response.to_json()?).into()),
code => Err(ActionsSetCustomLabelsForSelfHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set custom labels for a self-hosted runner for a repository
///
/// Remove all previous custom labels and set the new custom labels for a specific
/// self-hosted runner configured in a repository.
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for set_custom_labels_for_self_hosted_runner_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#set-custom-labels-for-a-self-hosted-runner-for-a-repository)
///
/// ---
pub async fn set_custom_labels_for_self_hosted_runner_for_repo_async(&self, owner: &str, repo: &str, runner_id: i32, body: PutActionsSetCustomLabelsForSelfHostedRunnerForRepo) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/{}/labels", super::GITHUB_BASE_API_URL, owner, repo, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetCustomLabelsForSelfHostedRunnerForRepo>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
404 => Err(ActionsSetCustomLabelsForSelfHostedRunnerForRepoError::Status404(github_response.to_json_async().await?).into()),
422 => Err(ActionsSetCustomLabelsForSelfHostedRunnerForRepoError::Status422(github_response.to_json_async().await?).into()),
code => Err(ActionsSetCustomLabelsForSelfHostedRunnerForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set custom labels for a self-hosted runner for a repository
///
/// Remove all previous custom labels and set the new custom labels for a specific
/// self-hosted runner configured in a repository.
///
/// Authenticated users must have admin access to the repository to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for set_custom_labels_for_self_hosted_runner_for_repo](https://docs.github.com/rest/actions/self-hosted-runners#set-custom-labels-for-a-self-hosted-runner-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn set_custom_labels_for_self_hosted_runner_for_repo(&self, owner: &str, repo: &str, runner_id: i32, body: PutActionsSetCustomLabelsForSelfHostedRunnerForRepo) -> Result<DeleteActionsRemoveCustomLabelFromSelfHostedRunnerForRepoResponse200, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/runners/{}/labels", super::GITHUB_BASE_API_URL, owner, repo, runner_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetCustomLabelsForSelfHostedRunnerForRepo>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
404 => Err(ActionsSetCustomLabelsForSelfHostedRunnerForRepoError::Status404(github_response.to_json()?).into()),
422 => Err(ActionsSetCustomLabelsForSelfHostedRunnerForRepoError::Status422(github_response.to_json()?).into()),
code => Err(ActionsSetCustomLabelsForSelfHostedRunnerForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set the customization template for an OIDC subject claim for a repository
///
/// Sets the customization template and `opt-in` or `opt-out` flag for an OpenID Connect (OIDC) subject claim for a repository.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for set_custom_oidc_sub_claim_for_repo](https://docs.github.com/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-a-repository)
///
/// ---
pub async fn set_custom_oidc_sub_claim_for_repo_async(&self, owner: &str, repo: &str, body: ActionsOidcSubjectCustomizationForARepository) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/oidc/customization/sub", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<ActionsOidcSubjectCustomizationForARepository>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
404 => Err(ActionsSetCustomOidcSubClaimForRepoError::Status404(github_response.to_json_async().await?).into()),
400 => Err(ActionsSetCustomOidcSubClaimForRepoError::Status400(github_response.to_json_async().await?).into()),
422 => Err(ActionsSetCustomOidcSubClaimForRepoError::Status422(github_response.to_json_async().await?).into()),
code => Err(ActionsSetCustomOidcSubClaimForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set the customization template for an OIDC subject claim for a repository
///
/// Sets the customization template and `opt-in` or `opt-out` flag for an OpenID Connect (OIDC) subject claim for a repository.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for set_custom_oidc_sub_claim_for_repo](https://docs.github.com/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn set_custom_oidc_sub_claim_for_repo(&self, owner: &str, repo: &str, body: ActionsOidcSubjectCustomizationForARepository) -> Result<EmptyObject, AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/oidc/customization/sub", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<ActionsOidcSubjectCustomizationForARepository>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
404 => Err(ActionsSetCustomOidcSubClaimForRepoError::Status404(github_response.to_json()?).into()),
400 => Err(ActionsSetCustomOidcSubClaimForRepoError::Status400(github_response.to_json()?).into()),
422 => Err(ActionsSetCustomOidcSubClaimForRepoError::Status422(github_response.to_json()?).into()),
code => Err(ActionsSetCustomOidcSubClaimForRepoError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set default workflow permissions for an organization
///
/// Sets the default workflow permissions granted to the `GITHUB_TOKEN` when running workflows in an organization, and sets if GitHub Actions
/// can submit approving pull request reviews. For more information, see
/// "[Setting the permissions of the GITHUB_TOKEN for your organization](https://docs.github.com/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization#setting-the-permissions-of-the-github_token-for-your-organization)."
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for set_github_actions_default_workflow_permissions_organization](https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-an-organization)
///
/// ---
pub async fn set_github_actions_default_workflow_permissions_organization_async(&self, org: &str, body: PutActionsSetGithubActionsDefaultWorkflowPermissionsRepository) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions/workflow", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetGithubActionsDefaultWorkflowPermissionsRepository>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetGithubActionsDefaultWorkflowPermissionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set default workflow permissions for an organization
///
/// Sets the default workflow permissions granted to the `GITHUB_TOKEN` when running workflows in an organization, and sets if GitHub Actions
/// can submit approving pull request reviews. For more information, see
/// "[Setting the permissions of the GITHUB_TOKEN for your organization](https://docs.github.com/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization#setting-the-permissions-of-the-github_token-for-your-organization)."
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for set_github_actions_default_workflow_permissions_organization](https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn set_github_actions_default_workflow_permissions_organization(&self, org: &str, body: PutActionsSetGithubActionsDefaultWorkflowPermissionsRepository) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions/workflow", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetGithubActionsDefaultWorkflowPermissionsRepository>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetGithubActionsDefaultWorkflowPermissionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set default workflow permissions for a repository
///
/// Sets the default workflow permissions granted to the `GITHUB_TOKEN` when running workflows in a repository, and sets if GitHub Actions
/// can submit approving pull request reviews.
/// For more information, see "[Setting the permissions of the GITHUB_TOKEN for your repository](https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#setting-the-permissions-of-the-github_token-for-your-repository)."
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for set_github_actions_default_workflow_permissions_repository](https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-a-repository)
///
/// ---
pub async fn set_github_actions_default_workflow_permissions_repository_async(&self, owner: &str, repo: &str, body: PutActionsSetGithubActionsDefaultWorkflowPermissionsRepository) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/permissions/workflow", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetGithubActionsDefaultWorkflowPermissionsRepository>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
409 => Err(ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryError::Status409.into()),
code => Err(ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set default workflow permissions for a repository
///
/// Sets the default workflow permissions granted to the `GITHUB_TOKEN` when running workflows in a repository, and sets if GitHub Actions
/// can submit approving pull request reviews.
/// For more information, see "[Setting the permissions of the GITHUB_TOKEN for your repository](https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#setting-the-permissions-of-the-github_token-for-your-repository)."
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for set_github_actions_default_workflow_permissions_repository](https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn set_github_actions_default_workflow_permissions_repository(&self, owner: &str, repo: &str, body: PutActionsSetGithubActionsDefaultWorkflowPermissionsRepository) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/permissions/workflow", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetGithubActionsDefaultWorkflowPermissionsRepository>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
409 => Err(ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryError::Status409.into()),
code => Err(ActionsSetGithubActionsDefaultWorkflowPermissionsRepositoryError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set GitHub Actions permissions for an organization
///
/// Sets the GitHub Actions permissions policy for repositories and allowed actions and reusable workflows in an organization.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for set_github_actions_permissions_organization](https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-an-organization)
///
/// ---
pub async fn set_github_actions_permissions_organization_async(&self, org: &str, body: PutActionsSetGithubActionsPermissionsOrganization) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetGithubActionsPermissionsOrganization>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetGithubActionsPermissionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set GitHub Actions permissions for an organization
///
/// Sets the GitHub Actions permissions policy for repositories and allowed actions and reusable workflows in an organization.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for set_github_actions_permissions_organization](https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn set_github_actions_permissions_organization(&self, org: &str, body: PutActionsSetGithubActionsPermissionsOrganization) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetGithubActionsPermissionsOrganization>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetGithubActionsPermissionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set GitHub Actions permissions for a repository
///
/// Sets the GitHub Actions permissions policy for enabling GitHub Actions and allowed actions and reusable workflows in the repository.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for set_github_actions_permissions_repository](https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-a-repository)
///
/// ---
pub async fn set_github_actions_permissions_repository_async(&self, owner: &str, repo: &str, body: PutActionsSetGithubActionsPermissionsRepository) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/permissions", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetGithubActionsPermissionsRepository>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetGithubActionsPermissionsRepositoryError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set GitHub Actions permissions for a repository
///
/// Sets the GitHub Actions permissions policy for enabling GitHub Actions and allowed actions and reusable workflows in the repository.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for set_github_actions_permissions_repository](https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-a-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn set_github_actions_permissions_repository(&self, owner: &str, repo: &str, body: PutActionsSetGithubActionsPermissionsRepository) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/permissions", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetGithubActionsPermissionsRepository>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetGithubActionsPermissionsRepositoryError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set repository access for a self-hosted runner group in an organization
///
/// Replaces the list of repositories that have access to a self-hosted runner group configured in an organization.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for set_repo_access_to_self_hosted_runner_group_in_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#set-repository-access-for-a-self-hosted-runner-group-in-an-organization)
///
/// ---
pub async fn set_repo_access_to_self_hosted_runner_group_in_org_async(&self, org: &str, runner_group_id: i32, body: PutActionsSetRepoAccessToSelfHostedRunnerGroupInOrg) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/repositories", super::GITHUB_BASE_API_URL, org, runner_group_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetRepoAccessToSelfHostedRunnerGroupInOrg>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set repository access for a self-hosted runner group in an organization
///
/// Replaces the list of repositories that have access to a self-hosted runner group configured in an organization.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for set_repo_access_to_self_hosted_runner_group_in_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#set-repository-access-for-a-self-hosted-runner-group-in-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn set_repo_access_to_self_hosted_runner_group_in_org(&self, org: &str, runner_group_id: i32, body: PutActionsSetRepoAccessToSelfHostedRunnerGroupInOrg) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/repositories", super::GITHUB_BASE_API_URL, org, runner_group_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetRepoAccessToSelfHostedRunnerGroupInOrg>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set selected repositories for an organization secret
///
/// Replaces all repositories for an organization secret when the `visibility`
/// for repository access is set to `selected`. The visibility is set when you [Create
/// or update an organization secret](https://docs.github.com/rest/actions/secrets#create-or-update-an-organization-secret).
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for set_selected_repos_for_org_secret](https://docs.github.com/rest/actions/secrets#set-selected-repositories-for-an-organization-secret)
///
/// ---
pub async fn set_selected_repos_for_org_secret_async(&self, org: &str, secret_name: &str, body: PutActionsSetSelectedReposForOrgSecret) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/secrets/{}/repositories", super::GITHUB_BASE_API_URL, org, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetSelectedReposForOrgSecret>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetSelectedReposForOrgSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set selected repositories for an organization secret
///
/// Replaces all repositories for an organization secret when the `visibility`
/// for repository access is set to `selected`. The visibility is set when you [Create
/// or update an organization secret](https://docs.github.com/rest/actions/secrets#create-or-update-an-organization-secret).
///
/// Authenticated users must have collaborator access to a repository to create, update, or read secrets.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for set_selected_repos_for_org_secret](https://docs.github.com/rest/actions/secrets#set-selected-repositories-for-an-organization-secret)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn set_selected_repos_for_org_secret(&self, org: &str, secret_name: &str, body: PutActionsSetSelectedReposForOrgSecret) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/secrets/{}/repositories", super::GITHUB_BASE_API_URL, org, secret_name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetSelectedReposForOrgSecret>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetSelectedReposForOrgSecretError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set selected repositories for an organization variable
///
/// Replaces all repositories for an organization variable that is available
/// to selected repositories. Organization variables that are available to selected
/// repositories have their `visibility` field set to `selected`.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for set_selected_repos_for_org_variable](https://docs.github.com/rest/actions/variables#set-selected-repositories-for-an-organization-variable)
///
/// ---
pub async fn set_selected_repos_for_org_variable_async(&self, org: &str, name: &str, body: PutActionsSetSelectedReposForOrgVariable) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/variables/{}/repositories", super::GITHUB_BASE_API_URL, org, name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetSelectedReposForOrgVariable>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
409 => Err(ActionsSetSelectedReposForOrgVariableError::Status409.into()),
code => Err(ActionsSetSelectedReposForOrgVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set selected repositories for an organization variable
///
/// Replaces all repositories for an organization variable that is available
/// to selected repositories. Organization variables that are available to selected
/// repositories have their `visibility` field set to `selected`.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for set_selected_repos_for_org_variable](https://docs.github.com/rest/actions/variables#set-selected-repositories-for-an-organization-variable)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn set_selected_repos_for_org_variable(&self, org: &str, name: &str, body: PutActionsSetSelectedReposForOrgVariable) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/variables/{}/repositories", super::GITHUB_BASE_API_URL, org, name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetSelectedReposForOrgVariable>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
409 => Err(ActionsSetSelectedReposForOrgVariableError::Status409.into()),
code => Err(ActionsSetSelectedReposForOrgVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set selected repositories enabled for GitHub Actions in an organization
///
/// Replaces the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
///
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for set_selected_repositories_enabled_github_actions_organization](https://docs.github.com/rest/actions/permissions#set-selected-repositories-enabled-for-github-actions-in-an-organization)
///
/// ---
pub async fn set_selected_repositories_enabled_github_actions_organization_async(&self, org: &str, body: PutActionsSetSelectedRepositoriesEnabledGithubActionsOrganization) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions/repositories", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetSelectedRepositoriesEnabledGithubActionsOrganization>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set selected repositories enabled for GitHub Actions in an organization
///
/// Replaces the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."
///
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for set_selected_repositories_enabled_github_actions_organization](https://docs.github.com/rest/actions/permissions#set-selected-repositories-enabled-for-github-actions-in-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn set_selected_repositories_enabled_github_actions_organization(&self, org: &str, body: PutActionsSetSelectedRepositoriesEnabledGithubActionsOrganization) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/permissions/repositories", super::GITHUB_BASE_API_URL, org);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetSelectedRepositoriesEnabledGithubActionsOrganization>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set self-hosted runners in a group for an organization
///
/// Replaces the list of self-hosted runners that are part of an organization runner group.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for set_self_hosted_runners_in_group_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-organization)
///
/// ---
pub async fn set_self_hosted_runners_in_group_for_org_async(&self, org: &str, runner_group_id: i32, body: PutActionsSetSelfHostedRunnersInGroupForOrg) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/runners", super::GITHUB_BASE_API_URL, org, runner_group_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetSelfHostedRunnersInGroupForOrg>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetSelfHostedRunnersInGroupForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set self-hosted runners in a group for an organization
///
/// Replaces the list of self-hosted runners that are part of an organization runner group.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for set_self_hosted_runners_in_group_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn set_self_hosted_runners_in_group_for_org(&self, org: &str, runner_group_id: i32, body: PutActionsSetSelfHostedRunnersInGroupForOrg) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}/runners", super::GITHUB_BASE_API_URL, org, runner_group_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PutActionsSetSelfHostedRunnersInGroupForOrg>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetSelfHostedRunnersInGroupForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set the level of access for workflows outside of the repository
///
/// Sets the level of access that workflows outside of the repository have to actions and reusable workflows in the repository.
/// This endpoint only applies to private repositories.
/// For more information, see "[Allowing access to components in a private repository](https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#allowing-access-to-components-in-a-private-repository)".
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for set_workflow_access_to_repository](https://docs.github.com/rest/actions/permissions#set-the-level-of-access-for-workflows-outside-of-the-repository)
///
/// ---
pub async fn set_workflow_access_to_repository_async(&self, owner: &str, repo: &str, body: ActionsWorkflowAccessToRepository) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/permissions/access", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<ActionsWorkflowAccessToRepository>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetWorkflowAccessToRepositoryError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Set the level of access for workflows outside of the repository
///
/// Sets the level of access that workflows outside of the repository have to actions and reusable workflows in the repository.
/// This endpoint only applies to private repositories.
/// For more information, see "[Allowing access to components in a private repository](https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#allowing-access-to-components-in-a-private-repository)".
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for set_workflow_access_to_repository](https://docs.github.com/rest/actions/permissions#set-the-level-of-access-for-workflows-outside-of-the-repository)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn set_workflow_access_to_repository(&self, owner: &str, repo: &str, body: ActionsWorkflowAccessToRepository) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/permissions/access", super::GITHUB_BASE_API_URL, owner, repo);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<ActionsWorkflowAccessToRepository>(body)?),
method: "PUT",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsSetWorkflowAccessToRepositoryError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Update an environment variable
///
/// Updates an environment variable that you can reference in a GitHub Actions workflow.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for update_environment_variable](https://docs.github.com/rest/actions/variables#update-an-environment-variable)
///
/// ---
pub async fn update_environment_variable_async(&self, owner: &str, repo: &str, name: &str, environment_name: &str, body: PatchActionsUpdateEnvironmentVariable) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/environments/{}/variables/{}", super::GITHUB_BASE_API_URL, owner, repo, name, environment_name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PatchActionsUpdateEnvironmentVariable>(body)?),
method: "PATCH",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsUpdateEnvironmentVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Update an environment variable
///
/// Updates an environment variable that you can reference in a GitHub Actions workflow.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for update_environment_variable](https://docs.github.com/rest/actions/variables#update-an-environment-variable)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn update_environment_variable(&self, owner: &str, repo: &str, name: &str, environment_name: &str, body: PatchActionsUpdateEnvironmentVariable) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/environments/{}/variables/{}", super::GITHUB_BASE_API_URL, owner, repo, name, environment_name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PatchActionsUpdateEnvironmentVariable>(body)?),
method: "PATCH",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsUpdateEnvironmentVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Update a GitHub-hosted runner for an organization
///
/// Updates a GitHub-hosted runner for an organization.
/// OAuth app tokens and personal access tokens (classic) need the `manage_runners:org` scope to use this endpoint.
///
/// [GitHub API docs for update_hosted_runner_for_org](https://docs.github.com/rest/actions/hosted-runners#update-a-github-hosted-runner-for-an-organization)
///
/// ---
pub async fn update_hosted_runner_for_org_async(&self, org: &str, hosted_runner_id: i32, body: PatchActionsUpdateHostedRunnerForOrg) -> Result<ActionsHostedRunner, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners/{}", super::GITHUB_BASE_API_URL, org, hosted_runner_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PatchActionsUpdateHostedRunnerForOrg>(body)?),
method: "PATCH",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsUpdateHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Update a GitHub-hosted runner for an organization
///
/// Updates a GitHub-hosted runner for an organization.
/// OAuth app tokens and personal access tokens (classic) need the `manage_runners:org` scope to use this endpoint.
///
/// [GitHub API docs for update_hosted_runner_for_org](https://docs.github.com/rest/actions/hosted-runners#update-a-github-hosted-runner-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn update_hosted_runner_for_org(&self, org: &str, hosted_runner_id: i32, body: PatchActionsUpdateHostedRunnerForOrg) -> Result<ActionsHostedRunner, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/hosted-runners/{}", super::GITHUB_BASE_API_URL, org, hosted_runner_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PatchActionsUpdateHostedRunnerForOrg>(body)?),
method: "PATCH",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsUpdateHostedRunnerForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Update an organization variable
///
/// Updates an organization variable that you can reference in a GitHub Actions workflow.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for update_org_variable](https://docs.github.com/rest/actions/variables#update-an-organization-variable)
///
/// ---
pub async fn update_org_variable_async(&self, org: &str, name: &str, body: PatchActionsUpdateOrgVariable) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/variables/{}", super::GITHUB_BASE_API_URL, org, name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PatchActionsUpdateOrgVariable>(body)?),
method: "PATCH",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsUpdateOrgVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Update an organization variable
///
/// Updates an organization variable that you can reference in a GitHub Actions workflow.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. If the repository is private, the `repo` scope is also required.
///
/// [GitHub API docs for update_org_variable](https://docs.github.com/rest/actions/variables#update-an-organization-variable)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn update_org_variable(&self, org: &str, name: &str, body: PatchActionsUpdateOrgVariable) -> Result<(), AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/variables/{}", super::GITHUB_BASE_API_URL, org, name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PatchActionsUpdateOrgVariable>(body)?),
method: "PATCH",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsUpdateOrgVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Update a repository variable
///
/// Updates a repository variable that you can reference in a GitHub Actions workflow.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for update_repo_variable](https://docs.github.com/rest/actions/variables#update-a-repository-variable)
///
/// ---
pub async fn update_repo_variable_async(&self, owner: &str, repo: &str, name: &str, body: PatchActionsUpdateRepoVariable) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/variables/{}", super::GITHUB_BASE_API_URL, owner, repo, name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PatchActionsUpdateRepoVariable>(body)?),
method: "PATCH",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsUpdateRepoVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Update a repository variable
///
/// Updates a repository variable that you can reference in a GitHub Actions workflow.
///
/// Authenticated users must have collaborator access to a repository to create, update, or read variables.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// [GitHub API docs for update_repo_variable](https://docs.github.com/rest/actions/variables#update-a-repository-variable)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn update_repo_variable(&self, owner: &str, repo: &str, name: &str, body: PatchActionsUpdateRepoVariable) -> Result<(), AdapterError> {
let request_uri = format!("{}/repos/{}/{}/actions/variables/{}", super::GITHUB_BASE_API_URL, owner, repo, name);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PatchActionsUpdateRepoVariable>(body)?),
method: "PATCH",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(())
} else {
match github_response.status_code() {
code => Err(ActionsUpdateRepoVariableError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Update a self-hosted runner group for an organization
///
/// Updates the `name` and `visibility` of a self-hosted runner group in an organization.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for update_self_hosted_runner_group_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-organization)
///
/// ---
pub async fn update_self_hosted_runner_group_for_org_async(&self, org: &str, runner_group_id: i32, body: PatchActionsUpdateSelfHostedRunnerGroupForOrg) -> Result<RunnerGroupsOrg, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}", super::GITHUB_BASE_API_URL, org, runner_group_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PatchActionsUpdateSelfHostedRunnerGroupForOrg>(body)?),
method: "PATCH",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch_async(request).await?;
// --
if github_response.is_success() {
Ok(github_response.to_json_async().await?)
} else {
match github_response.status_code() {
code => Err(ActionsUpdateSelfHostedRunnerGroupForOrgError::Generic { code }.into()),
}
}
}
/// ---
///
/// # Update a self-hosted runner group for an organization
///
/// Updates the `name` and `visibility` of a self-hosted runner group in an organization.
///
/// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
///
/// [GitHub API docs for update_self_hosted_runner_group_for_org](https://docs.github.com/rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-organization)
///
/// ---
#[cfg(not(target_arch = "wasm32"))]
pub fn update_self_hosted_runner_group_for_org(&self, org: &str, runner_group_id: i32, body: PatchActionsUpdateSelfHostedRunnerGroupForOrg) -> Result<RunnerGroupsOrg, AdapterError> {
let request_uri = format!("{}/orgs/{}/actions/runner-groups/{}", super::GITHUB_BASE_API_URL, org, runner_group_id);
let req = GitHubRequest {
uri: request_uri,
body: Some(C::from_json::<PatchActionsUpdateSelfHostedRunnerGroupForOrg>(body)?),
method: "PATCH",
headers: vec![]
};
let request = self.client.build(req)?;
// --
let github_response = self.client.fetch(request)?;
// --
if github_response.is_success() {
Ok(github_response.to_json()?)
} else {
match github_response.status_code() {
code => Err(ActionsUpdateSelfHostedRunnerGroupForOrgError::Generic { code }.into()),
}
}
}
}