Skip to main content

HttpApi

Struct HttpApi 

Source
pub struct HttpApi {
    pub(crate) http: Http,
}
Expand description

Forgejo’s HTTP implementation of Api.

Debug is derived, which stays safe because the transport’s token redacts itself.

Fields§

§http: Http

Implementations§

Source§

impl HttpApi

Source

pub(crate) async fn tag_commit( &self, repository: &RepoRef, tag: &str, ) -> Result<Option<String>, ForgeError>

The commit tag points at, with an annotated tag peeled.

Source

pub(crate) async fn release_by_tag( &self, repository: &RepoRef, tag: &str, ) -> Result<Option<ReleaseWire>, ForgeError>

Source

pub(crate) async fn create_draft_release( &self, repository: &RepoRef, tag: &str, target_commit: &str, title: &str, notes: &str, ) -> Result<u64, ForgeError>

Source

pub(crate) async fn release_assets( &self, repository: &RepoRef, release_id: u64, ) -> Result<Vec<AssetWire>, ForgeError>

Source

pub(crate) async fn upload_asset( &self, repository: &RepoRef, release_id: u64, filename: &str, bytes: Vec<u8>, ) -> Result<(), ForgeError>

Source

pub(crate) async fn delete_asset( &self, repository: &RepoRef, release_id: u64, asset_id: u64, ) -> Result<(), ForgeError>

Source

pub(crate) async fn publish_release( &self, repository: &RepoRef, release_id: u64, ) -> Result<(), ForgeError>

Source

pub(crate) async fn open_pull_request( &self, repository: &RepoRef, head: &str, ) -> Result<Option<Pull>, ForgeError>

Source

pub(crate) async fn ensure_pull_request( &self, repository: &RepoRef, head: &str, base: &str, title: &str, body: &str, ) -> Result<(), ForgeError>

Source§

impl HttpApi

Source

pub fn new(forge_url: &Url, token: Token) -> Result<Self, TransportBuildError>

Build an adapter for the Forgejo instance at forge_url.

§Errors

Fails when the HTTP stack cannot be built.

Source

pub fn with_retry(self, retry: RetryPolicy) -> Self

Replace the retry policy, which keeps tests from sleeping.

Source

async fn send_write( &self, method: Method, path: &str, body: Option<&str>, ) -> Result<(), ForgeError>

Send a write whose only Forgejo-specific status meaning is 423 (archived repository).

Source

async fn paged<T: for<'a> Facet<'a>>( &self, path: &str, ) -> Result<Vec<T>, ForgeError>

Trait Implementations§

Source§

impl AccessApi for HttpApi

Source§

async fn teams(&self, repo: &RepoRef) -> Result<Vec<Team>, ForgeError>

GET /repos/{owner}/{repo}/teams.
Source§

async fn current_user(&self) -> Result<String, ForgeError>

GET /user, the login of the authenticated user.
Source§

async fn user_teams(&self) -> Result<Vec<Team>, ForgeError>

GET /user/teams, every page.
Source§

async fn organization_teams( &self, organization: &str, ) -> Result<Vec<Team>, ForgeError>

GET /orgs/{org}/teams, every page.
Source§

async fn add_team( &self, repo: &RepoRef, team: &TeamName, _: Permission, ) -> Result<(), ForgeError>

PUT /repos/{owner}/{repo}/teams/{team}.
Source§

async fn remove_team( &self, repo: &RepoRef, team: &str, ) -> Result<(), ForgeError>

DELETE /repos/{owner}/{repo}/teams/{team}.
Source§

async fn collaborators( &self, repo: &RepoRef, ) -> Result<Vec<Collaborator>, ForgeError>

GET /repos/{owner}/{repo}/collaborators, every page, then GET /repos/{owner}/{repo}/collaborators/{collaborator}/permission for each user.
Source§

async fn add_collaborator( &self, repo: &RepoRef, user: &UserName, permission: Permission, ) -> Result<(), ForgeError>

PUT /repos/{owner}/{repo}/collaborators/{collaborator}.
Source§

async fn remove_collaborator( &self, repo: &RepoRef, user: &str, ) -> Result<(), ForgeError>

DELETE /repos/{owner}/{repo}/collaborators/{collaborator}.
Source§

impl ActionsVariablesApi for HttpApi

Source§

async fn actions_variables( &self, repo: &RepoRef, ) -> Result<Vec<ActionVariable>, ForgeError>

GET /repos/{owner}/{repo}/actions/variables, every page.
Source§

async fn create_actions_variable( &self, repo: &RepoRef, name: &str, body: &CreateVariableOption, ) -> Result<(), ForgeError>

POST /repos/{owner}/{repo}/actions/variables/{name}.
Source§

async fn update_actions_variable( &self, repo: &RepoRef, name: &str, body: &UpdateVariableOption, ) -> Result<(), ForgeError>

PUT /repos/{owner}/{repo}/actions/variables/{name}.
Source§

async fn delete_actions_variable( &self, repo: &RepoRef, name: &str, ) -> Result<(), ForgeError>

DELETE /repos/{owner}/{repo}/actions/variables/{name}.
Source§

impl BranchRulesApi for HttpApi

Source§

async fn branch_protections( &self, repo: &RepoRef, ) -> Result<Vec<BranchProtection>, ForgeError>

GET /repos/{owner}/{repo}/branch_protections.
Source§

async fn branch_protection( &self, repo: &RepoRef, rule: &str, ) -> Result<Option<BranchProtection>, ForgeError>

GET /repos/{owner}/{repo}/branch_protections/{rule}. Read more
Source§

async fn create_branch_protection( &self, repo: &RepoRef, body: &CreateBranchProtectionOption, ) -> Result<(), ForgeError>

POST /repos/{owner}/{repo}/branch_protections.
Source§

async fn patch_branch_protection( &self, repo: &RepoRef, rule: &str, body: &EditBranchProtectionOption, ) -> Result<(), ForgeError>

PATCH /repos/{owner}/{repo}/branch_protections/{rule}.
Source§

async fn delete_branch_protection( &self, repo: &RepoRef, rule: &str, ) -> Result<(), ForgeError>

DELETE /repos/{owner}/{repo}/branch_protections/{rule}.
Source§

impl Clone for HttpApi

Source§

fn clone(&self) -> HttpApi

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HttpApi

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DeployKeysApi for HttpApi

Source§

async fn deploy_keys( &self, repo: &RepoRef, ) -> Result<Vec<DeployKey>, ForgeError>

GET /repos/{owner}/{repo}/keys, every page.
Source§

async fn create_deploy_key( &self, repo: &RepoRef, body: &CreateKeyOption, ) -> Result<(), ForgeError>

POST /repos/{owner}/{repo}/keys.
Source§

async fn delete_deploy_key( &self, repo: &RepoRef, id: i64, ) -> Result<(), ForgeError>

DELETE /repos/{owner}/{repo}/keys/{id}.
Source§

impl LabelsApi for HttpApi

Source§

async fn labels(&self, repo: &RepoRef) -> Result<Vec<Label>, ForgeError>

GET /repos/{owner}/{repo}/labels, every page.
Source§

async fn create_label( &self, repo: &RepoRef, body: &CreateLabelOption, ) -> Result<(), ForgeError>

POST /repos/{owner}/{repo}/labels.
Source§

async fn patch_label( &self, repo: &RepoRef, id: i64, body: &EditLabelOption, ) -> Result<(), ForgeError>

PATCH /repos/{owner}/{repo}/labels/{id}.
Source§

async fn delete_label(&self, repo: &RepoRef, id: i64) -> Result<(), ForgeError>

DELETE /repos/{owner}/{repo}/labels/{id}.
Source§

impl RepositoryApi for HttpApi

Source§

async fn repository(&self, repo: &RepoRef) -> Result<Repository, ForgeError>

GET /repos/{owner}/{repo}.
Source§

async fn patch_repository( &self, repo: &RepoRef, body: &EditRepoOption, ) -> Result<(), ForgeError>

PATCH /repos/{owner}/{repo}.
Source§

async fn topics(&self, repo: &RepoRef) -> Result<Vec<String>, ForgeError>

GET /repos/{owner}/{repo}/topics.
Source§

async fn replace_topics( &self, repo: &RepoRef, topics: &[String], ) -> Result<(), ForgeError>

PUT /repos/{owner}/{repo}/topics.
Source§

impl TagProtectionApi for HttpApi

Source§

async fn tag_protections( &self, repo: &RepoRef, ) -> Result<Vec<TagProtection>, ForgeError>

GET /repos/{owner}/{repo}/tag_protections.
Source§

async fn create_tag_protection( &self, repo: &RepoRef, body: &CreateTagProtectionOption, ) -> Result<(), ForgeError>

POST /repos/{owner}/{repo}/tag_protections.
Source§

async fn patch_tag_protection( &self, repo: &RepoRef, id: i64, body: &EditTagProtectionOption, ) -> Result<(), ForgeError>

PATCH /repos/{owner}/{repo}/tag_protections/{id}.
Source§

async fn delete_tag_protection( &self, repo: &RepoRef, id: i64, ) -> Result<(), ForgeError>

DELETE /repos/{owner}/{repo}/tag_protections/{id}.
Source§

impl WebhooksApi for HttpApi

Source§

async fn webhooks(&self, repo: &RepoRef) -> Result<Vec<Hook>, ForgeError>

GET /repos/{owner}/{repo}/hooks, every page.
Source§

async fn create_webhook( &self, repo: &RepoRef, body: &CreateHookOption, ) -> Result<(), ForgeError>

POST /repos/{owner}/{repo}/hooks.
Source§

async fn patch_webhook( &self, repo: &RepoRef, id: i64, body: &EditHookOption, ) -> Result<(), ForgeError>

PATCH /repos/{owner}/{repo}/hooks/{id}.
Source§

async fn delete_webhook( &self, repo: &RepoRef, id: i64, ) -> Result<(), ForgeError>

DELETE /repos/{owner}/{repo}/hooks/{id}.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Api for T

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more