pub struct HttpApi {
pub(crate) http: Http,
}Expand description
GitHub’s HTTP implementation of super::Api.
Debug is derived, which stays safe because the transport’s token redacts
itself.
Fields§
§http: HttpImplementations§
Source§impl HttpApi
impl HttpApi
async fn read_actions<R: for<'a> Facet<'a>>( &self, repository: &RepoRef, route: &str, unavailable: Option<u16>, ) -> Result<Option<R>, ForgeError>
async fn put_actions( &self, repository: &RepoRef, route: &str, body: String, ) -> Result<(), ForgeError>
Source§impl HttpApi
impl HttpApi
pub(crate) async fn tag_commit( &self, repository: &RepoRef, tag: &str, ) -> Result<Option<String>, ForgeError>
Sourcepub(crate) async fn open_pull_request_body(
&self,
repository: &RepoRef,
head: &str,
base: &str,
) -> Result<Option<String>, ForgeError>
pub(crate) async fn open_pull_request_body( &self, repository: &RepoRef, head: &str, base: &str, ) -> Result<Option<String>, ForgeError>
Read the body of the unique open pull request for head and base.
async fn open_pull_request( &self, repository: &RepoRef, head: &str, base: &str, ) -> Result<Option<PullWire>, ForgeError>
async fn pulls( &self, repository: &RepoRef, state: &str, head: &str, base: &str, ) -> Result<Vec<PullWire>, ForgeError>
Sourcepub(crate) async fn ensure_pull_request(
&self,
repository: &RepoRef,
head: &str,
base: &str,
title: &str,
body: &str,
) -> Result<(), ForgeError>
pub(crate) async fn ensure_pull_request( &self, repository: &RepoRef, head: &str, base: &str, title: &str, body: &str, ) -> Result<(), ForgeError>
Create the proposal pull request, or update its title and body.
Sourcepub(crate) async fn release_by_tag(
&self,
repository: &RepoRef,
tag: &str,
) -> Result<Option<RemoteRelease>, ForgeError>
pub(crate) async fn release_by_tag( &self, repository: &RepoRef, tag: &str, ) -> Result<Option<RemoteRelease>, ForgeError>
Read a release by its tag.
The tag route serves only published releases and a draft has no tag
yet, so this lists the releases and matches on tag_name.
Sourcepub(crate) async fn create_draft_release(
&self,
repository: &RepoRef,
tag: &str,
target_commit: &str,
title: &str,
notes: &str,
) -> Result<u64, ForgeError>
pub(crate) async fn create_draft_release( &self, repository: &RepoRef, tag: &str, target_commit: &str, title: &str, notes: &str, ) -> Result<u64, ForgeError>
Create a draft release and return its stable ID.
Sourcepub(crate) async fn assets(
&self,
repository: &RepoRef,
release_id: u64,
) -> Result<Vec<RemoteAsset>, ForgeError>
pub(crate) async fn assets( &self, repository: &RepoRef, release_id: u64, ) -> Result<Vec<RemoteAsset>, ForgeError>
List all release assets, including size and server-reported digest.
Sourcepub(crate) async fn download_asset(
&self,
repository: &RepoRef,
asset: &RemoteAsset,
) -> Result<Vec<u8>, ForgeError>
pub(crate) async fn download_asset( &self, repository: &RepoRef, asset: &RemoteAsset, ) -> Result<Vec<u8>, ForgeError>
Download an existing asset for digest verification when GitHub omitted its server-side digest.
Only the asset route with an octet-stream Accept header serves the
assets of draft releases and private repositories. It redirects to
storage.
Sourcepub(crate) async fn upload_asset(
&self,
repository: &RepoRef,
release_id: u64,
filename: &str,
bytes: Vec<u8>,
) -> Result<(), ForgeError>
pub(crate) async fn upload_asset( &self, repository: &RepoRef, release_id: u64, filename: &str, bytes: Vec<u8>, ) -> Result<(), ForgeError>
Upload one asset to an existing draft release.
§Errors
Returns a rejection for an invalid asset filename and an unsupported error if the release is already published.
Sourcepub(crate) async fn delete_asset(
&self,
repository: &RepoRef,
asset_id: u64,
) -> Result<(), ForgeError>
pub(crate) async fn delete_asset( &self, repository: &RepoRef, asset_id: u64, ) -> Result<(), ForgeError>
Delete one release asset.
Sourcepub(crate) async fn publish_release(
&self,
repository: &RepoRef,
release_id: u64,
) -> Result<(), ForgeError>
pub(crate) async fn publish_release( &self, repository: &RepoRef, release_id: u64, ) -> Result<(), ForgeError>
Publish a fully staged draft.
§Errors
Returns an unsupported error if the release is already published.
Source§impl HttpApi
impl HttpApi
pub(super) async fn put_switch( &self, repository: &RepoRef, name: &str, enabled: bool, ) -> Result<(), ForgeError>
Source§impl HttpApi
impl HttpApi
Sourcepub fn new(base: &Url, token: Token) -> Result<Self, TransportBuildError>
pub fn new(base: &Url, token: Token) -> Result<Self, TransportBuildError>
Create a GitHub REST client rooted at base (normally
https://api.github.com).
§Errors
Returns an error if the underlying HTTP client fails to build.
Sourcepub fn with_retry(self, retry: RetryPolicy) -> Self
pub fn with_retry(self, retry: RetryPolicy) -> Self
Replace the retry policy, which keeps tests from sleeping.
async fn send<T: for<'a> Facet<'a>>( &self, method: Method, path: &str, body: Option<String>, ) -> Result<T, ForgeError>
Sourceasync fn optional<T: for<'a> Facet<'a>>(
&self,
path: &str,
) -> Result<Option<T>, ForgeError>
async fn optional<T: for<'a> Facet<'a>>( &self, path: &str, ) -> Result<Option<T>, ForgeError>
A GET that reads a missing resource as None.
async fn empty( &self, method: Method, path: &str, body: Option<String>, ) -> Result<(), ForgeError>
async fn paged<T: for<'a> Facet<'a>>( &self, path: &str, ) -> Result<Vec<T>, ForgeError>
async fn paged_in<R: for<'a> Facet<'a>, T>( &self, path: &str, page_size: usize, items: fn(R) -> Vec<T>, ) -> Result<Vec<T>, ForgeError>
Trait Implementations§
Source§impl AccessApi for HttpApi
impl AccessApi for HttpApi
Source§async fn add_collaborator(
&self,
repository: &RepoRef,
user: &UserName,
permission: &Permission,
) -> Result<(), ForgeError>
async fn add_collaborator( &self, repository: &RepoRef, user: &UserName, permission: &Permission, ) -> Result<(), ForgeError>
user the given permission, which invites them if needed.Source§async fn add_team(
&self,
repository: &RepoRef,
slug: &str,
permission: &Permission,
) -> Result<(), ForgeError>
async fn add_team( &self, repository: &RepoRef, slug: &str, permission: &Permission, ) -> Result<(), ForgeError>
Source§async fn cancel_invitation(
&self,
repository: &RepoRef,
id: u64,
) -> Result<(), ForgeError>
async fn cancel_invitation( &self, repository: &RepoRef, id: u64, ) -> Result<(), ForgeError>
id.Source§async fn collaborators(
&self,
repository: &RepoRef,
) -> Result<Vec<Collaborator>, ForgeError>
async fn collaborators( &self, repository: &RepoRef, ) -> Result<Vec<Collaborator>, ForgeError>
Source§async fn current_user(&self) -> Result<String, ForgeError>
async fn current_user(&self) -> Result<String, ForgeError>
Source§async fn user_teams(&self) -> Result<Vec<Membership>, ForgeError>
async fn user_teams(&self) -> Result<Vec<Membership>, ForgeError>
Source§async fn invitations(
&self,
repository: &RepoRef,
) -> Result<Vec<Invitation>, ForgeError>
async fn invitations( &self, repository: &RepoRef, ) -> Result<Vec<Invitation>, ForgeError>
Source§async fn organization_teams(
&self,
organization: &str,
) -> Result<Vec<Team>, ForgeError>
async fn organization_teams( &self, organization: &str, ) -> Result<Vec<Team>, ForgeError>
organization.Source§async fn owner_kind(&self, owner: &str) -> Result<OwnerKind, ForgeError>
async fn owner_kind(&self, owner: &str) -> Result<OwnerKind, ForgeError>
owner is an organization or a personal account.Source§async fn remove_collaborator(
&self,
repository: &RepoRef,
user: &UserName,
) -> Result<(), ForgeError>
async fn remove_collaborator( &self, repository: &RepoRef, user: &UserName, ) -> Result<(), ForgeError>
user’s direct grant on the repository.Source§async fn remove_team(
&self,
repository: &RepoRef,
slug: &str,
) -> Result<(), ForgeError>
async fn remove_team( &self, repository: &RepoRef, slug: &str, ) -> Result<(), ForgeError>
Source§async fn teams(&self, repository: &RepoRef) -> Result<Vec<Team>, ForgeError>
async fn teams(&self, repository: &RepoRef) -> Result<Vec<Team>, ForgeError>
Source§async fn update_invitation(
&self,
repository: &RepoRef,
id: u64,
permission: &Permission,
) -> Result<(), ForgeError>
async fn update_invitation( &self, repository: &RepoRef, id: u64, permission: &Permission, ) -> Result<(), ForgeError>
id.Source§impl ActionsApi for HttpApi
impl ActionsApi for HttpApi
Source§async fn actions_cache(
&self,
repository: &RepoRef,
) -> Result<Option<Cache>, ForgeError>
async fn actions_cache( &self, repository: &RepoRef, ) -> Result<Option<Cache>, ForgeError>
None when GitHub reports the endpoint
unavailable.Source§async fn actions_group<G: ActionsGroup>(
&self,
repository: &RepoRef,
) -> Result<Option<G>, ForgeError>
async fn actions_group<G: ActionsGroup>( &self, repository: &RepoRef, ) -> Result<Option<G>, ForgeError>
None when GitHub reports the endpoint
unavailable.Source§async fn set_actions_cache(
&self,
repository: &RepoRef,
group: &Cache,
) -> Result<(), ForgeError>
async fn set_actions_cache( &self, repository: &RepoRef, group: &Cache, ) -> Result<(), ForgeError>
Source§async fn set_actions_group<G: ActionsGroup>(
&self,
repository: &RepoRef,
group: &G,
) -> Result<(), ForgeError>
async fn set_actions_group<G: ActionsGroup>( &self, repository: &RepoRef, group: &G, ) -> Result<(), ForgeError>
Source§impl AutolinksApi for HttpApi
impl AutolinksApi for HttpApi
Source§async fn autolinks(
&self,
repository: &RepoRef,
) -> Result<Vec<Autolink>, ForgeError>
async fn autolinks( &self, repository: &RepoRef, ) -> Result<Vec<Autolink>, ForgeError>
Source§async fn create_autolink(
&self,
repository: &RepoRef,
autolink: &AutolinkBody,
) -> Result<(), ForgeError>
async fn create_autolink( &self, repository: &RepoRef, autolink: &AutolinkBody, ) -> Result<(), ForgeError>
Source§async fn delete_autolink(
&self,
repository: &RepoRef,
id: u64,
) -> Result<(), ForgeError>
async fn delete_autolink( &self, repository: &RepoRef, id: u64, ) -> Result<(), ForgeError>
id.Source§impl CustomPropertiesApi for HttpApi
impl CustomPropertiesApi for HttpApi
Source§async fn custom_property_values(
&self,
repository: &RepoRef,
) -> Result<Option<Vec<PropertyEntry>>, ForgeError>
async fn custom_property_values( &self, repository: &RepoRef, ) -> Result<Option<Vec<PropertyEntry>>, ForgeError>
None when the repository has no
custom properties endpoint.Source§async fn set_custom_property_values(
&self,
repository: &RepoRef,
entries: &[PropertyEntry],
) -> Result<(), ForgeError>
async fn set_custom_property_values( &self, repository: &RepoRef, entries: &[PropertyEntry], ) -> Result<(), ForgeError>
Source§impl EnvironmentsApi for HttpApi
impl EnvironmentsApi for HttpApi
Source§async fn branch_policies(
&self,
repository: &RepoRef,
environment: &str,
) -> Result<Vec<BranchPolicy>, ForgeError>
async fn branch_policies( &self, repository: &RepoRef, environment: &str, ) -> Result<Vec<BranchPolicy>, ForgeError>
environment.Source§async fn create_branch_policy(
&self,
repository: &RepoRef,
environment: &str,
policy: &Policy,
) -> Result<(), ForgeError>
async fn create_branch_policy( &self, repository: &RepoRef, environment: &str, policy: &Policy, ) -> Result<(), ForgeError>
environment.Source§async fn delete_branch_policy(
&self,
repository: &RepoRef,
environment: &str,
id: u64,
) -> Result<(), ForgeError>
async fn delete_branch_policy( &self, repository: &RepoRef, environment: &str, id: u64, ) -> Result<(), ForgeError>
id from environment.Source§async fn delete_environment(
&self,
repository: &RepoRef,
environment: &str,
) -> Result<(), ForgeError>
async fn delete_environment( &self, repository: &RepoRef, environment: &str, ) -> Result<(), ForgeError>
environment.Source§async fn environments(
&self,
repository: &RepoRef,
) -> Result<Vec<Environment>, ForgeError>
async fn environments( &self, repository: &RepoRef, ) -> Result<Vec<Environment>, ForgeError>
Source§async fn put_environment(
&self,
repository: &RepoRef,
environment: &str,
settings: &EnvironmentBody,
) -> Result<(), ForgeError>
async fn put_environment( &self, repository: &RepoRef, environment: &str, settings: &EnvironmentBody, ) -> Result<(), ForgeError>
environment or replace its settings.Source§impl LabelsApi for HttpApi
impl LabelsApi for HttpApi
Source§async fn create_label(
&self,
repository: &RepoRef,
name: &str,
color: &LabelColor,
description: &str,
) -> Result<(), ForgeError>
async fn create_label( &self, repository: &RepoRef, name: &str, color: &LabelColor, description: &str, ) -> Result<(), ForgeError>
name.Source§async fn delete_label(
&self,
repository: &RepoRef,
name: &str,
) -> Result<(), ForgeError>
async fn delete_label( &self, repository: &RepoRef, name: &str, ) -> Result<(), ForgeError>
name.Source§async fn labels(&self, repository: &RepoRef) -> Result<Vec<Label>, ForgeError>
async fn labels(&self, repository: &RepoRef) -> Result<Vec<Label>, ForgeError>
Source§async fn update_label(
&self,
repository: &RepoRef,
name: &str,
color: &LabelColor,
description: &str,
) -> Result<(), ForgeError>
async fn update_label( &self, repository: &RepoRef, name: &str, color: &LabelColor, description: &str, ) -> Result<(), ForgeError>
name.Source§impl PagesApi for HttpApi
impl PagesApi for HttpApi
Source§async fn create_pages(
&self,
repository: &RepoRef,
site: &PagesCreate,
) -> Result<(), ForgeError>
async fn create_pages( &self, repository: &RepoRef, site: &PagesCreate, ) -> Result<(), ForgeError>
Source§async fn delete_pages(&self, repository: &RepoRef) -> Result<(), ForgeError>
async fn delete_pages(&self, repository: &RepoRef) -> Result<(), ForgeError>
Source§async fn pages(&self, repository: &RepoRef) -> Result<Option<Pages>, ForgeError>
async fn pages(&self, repository: &RepoRef) -> Result<Option<Pages>, ForgeError>
None means the repository has no site.Source§async fn update_pages(
&self,
repository: &RepoRef,
site: &PagesUpdate,
) -> Result<(), ForgeError>
async fn update_pages( &self, repository: &RepoRef, site: &PagesUpdate, ) -> Result<(), ForgeError>
Source§impl RepositoryApi for HttpApi
impl RepositoryApi for HttpApi
Source§async fn patch_repository(
&self,
repository: &RepoRef,
patch: &RepositoryPatch,
) -> Result<(), ForgeError>
async fn patch_repository( &self, repository: &RepoRef, patch: &RepositoryPatch, ) -> Result<(), ForgeError>
Source§async fn replace_topics(
&self,
repository: &RepoRef,
topics: &[String],
) -> Result<(), ForgeError>
async fn replace_topics( &self, repository: &RepoRef, topics: &[String], ) -> Result<(), ForgeError>
Source§async fn immutable_releases(
&self,
repository: &RepoRef,
) -> Result<Option<ImmutableReleases>, ForgeError>
async fn immutable_releases( &self, repository: &RepoRef, ) -> Result<Option<ImmutableReleases>, ForgeError>
None means GitHub does not offer
it for this repository.Source§async fn set_immutable_releases(
&self,
repository: &RepoRef,
enabled: bool,
) -> Result<(), ForgeError>
async fn set_immutable_releases( &self, repository: &RepoRef, enabled: bool, ) -> Result<(), ForgeError>
Source§async fn repository(
&self,
repository: &RepoRef,
) -> Result<Repository, ForgeError>
async fn repository( &self, repository: &RepoRef, ) -> Result<Repository, ForgeError>
Source§impl RulesetsApi for HttpApi
impl RulesetsApi for HttpApi
Source§async fn create_ruleset(
&self,
repository: &RepoRef,
name: &str,
ruleset: &Definition,
) -> Result<(), ForgeError>
async fn create_ruleset( &self, repository: &RepoRef, name: &str, ruleset: &Definition, ) -> Result<(), ForgeError>
Source§async fn delete_ruleset(
&self,
repository: &RepoRef,
id: u64,
) -> Result<(), ForgeError>
async fn delete_ruleset( &self, repository: &RepoRef, id: u64, ) -> Result<(), ForgeError>
id.Source§async fn rulesets(
&self,
repository: &RepoRef,
) -> Result<Vec<Ruleset>, ForgeError>
async fn rulesets( &self, repository: &RepoRef, ) -> Result<Vec<Ruleset>, ForgeError>
Source§async fn update_ruleset(
&self,
repository: &RepoRef,
id: u64,
name: &str,
ruleset: &Definition,
unmanaged_rules: &[Value],
) -> Result<(), ForgeError>
async fn update_ruleset( &self, repository: &RepoRef, id: u64, name: &str, ruleset: &Definition, unmanaged_rules: &[Value], ) -> Result<(), ForgeError>
id with its complete desired configuration and
the live rules that the configuration cannot declare.Source§impl SecurityApi for HttpApi
impl SecurityApi for HttpApi
Source§async fn automated_security_fixes(
&self,
repository: &RepoRef,
) -> Result<Option<bool>, ForgeError>
async fn automated_security_fixes( &self, repository: &RepoRef, ) -> Result<Option<bool>, ForgeError>
None means GitHub
does not answer.Source§async fn code_scanning_default_setup(
&self,
repository: &RepoRef,
) -> Result<Option<CodeScanning>, ForgeError>
async fn code_scanning_default_setup( &self, repository: &RepoRef, ) -> Result<Option<CodeScanning>, ForgeError>
None means GitHub does not
answer.Source§async fn patch_code_scanning_default_setup(
&self,
repository: &RepoRef,
patch: &CodeScanningPatch,
) -> Result<(), ForgeError>
async fn patch_code_scanning_default_setup( &self, repository: &RepoRef, patch: &CodeScanningPatch, ) -> Result<(), ForgeError>
Source§async fn patch_security_analysis(
&self,
repository: &RepoRef,
patch: &AnalysisPatch,
) -> Result<(), ForgeError>
async fn patch_security_analysis( &self, repository: &RepoRef, patch: &AnalysisPatch, ) -> Result<(), ForgeError>
security_and_analysis properties.Source§async fn private_vulnerability_reporting(
&self,
repository: &RepoRef,
) -> Result<Option<bool>, ForgeError>
async fn private_vulnerability_reporting( &self, repository: &RepoRef, ) -> Result<Option<bool>, ForgeError>
None means
GitHub does not answer.Source§async fn set_automated_security_fixes(
&self,
repository: &RepoRef,
enabled: bool,
) -> Result<(), ForgeError>
async fn set_automated_security_fixes( &self, repository: &RepoRef, enabled: bool, ) -> Result<(), ForgeError>
Source§async fn set_private_vulnerability_reporting(
&self,
repository: &RepoRef,
enabled: bool,
) -> Result<(), ForgeError>
async fn set_private_vulnerability_reporting( &self, repository: &RepoRef, enabled: bool, ) -> Result<(), ForgeError>
Source§async fn set_vulnerability_alerts(
&self,
repository: &RepoRef,
enabled: bool,
) -> Result<(), ForgeError>
async fn set_vulnerability_alerts( &self, repository: &RepoRef, enabled: bool, ) -> Result<(), ForgeError>
Source§async fn vulnerability_alerts(
&self,
repository: &RepoRef,
) -> Result<Option<bool>, ForgeError>
async fn vulnerability_alerts( &self, repository: &RepoRef, ) -> Result<Option<bool>, ForgeError>
None means GitHub does not
answer.Source§impl VariablesApi for HttpApi
impl VariablesApi for HttpApi
Source§async fn create_variable(
&self,
repository: &RepoRef,
scope: &VariableScope,
variable: &VariableBody,
) -> Result<(), ForgeError>
async fn create_variable( &self, repository: &RepoRef, scope: &VariableScope, variable: &VariableBody, ) -> Result<(), ForgeError>
Source§async fn delete_variable(
&self,
repository: &RepoRef,
scope: &VariableScope,
name: &str,
) -> Result<(), ForgeError>
async fn delete_variable( &self, repository: &RepoRef, scope: &VariableScope, name: &str, ) -> Result<(), ForgeError>
name.Source§async fn update_variable(
&self,
repository: &RepoRef,
scope: &VariableScope,
variable: &VariableBody,
) -> Result<(), ForgeError>
async fn update_variable( &self, repository: &RepoRef, scope: &VariableScope, variable: &VariableBody, ) -> Result<(), ForgeError>
Source§async fn variables(
&self,
repository: &RepoRef,
scope: &VariableScope,
) -> Result<Vec<Variable>, ForgeError>
async fn variables( &self, repository: &RepoRef, scope: &VariableScope, ) -> Result<Vec<Variable>, ForgeError>
scope.Source§impl WebhooksApi for HttpApi
impl WebhooksApi for HttpApi
Source§async fn create_webhook(
&self,
repository: &RepoRef,
webhook: &WebhookBody,
) -> Result<(), ForgeError>
async fn create_webhook( &self, repository: &RepoRef, webhook: &WebhookBody, ) -> Result<(), ForgeError>
Source§async fn delete_webhook(
&self,
repository: &RepoRef,
id: u64,
) -> Result<(), ForgeError>
async fn delete_webhook( &self, repository: &RepoRef, id: u64, ) -> Result<(), ForgeError>
id.Source§async fn update_webhook(
&self,
repository: &RepoRef,
id: u64,
webhook: &WebhookPatch,
) -> Result<(), ForgeError>
async fn update_webhook( &self, repository: &RepoRef, id: u64, webhook: &WebhookPatch, ) -> Result<(), ForgeError>
id.