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: HttpImplementations§
Source§impl HttpApi
impl HttpApi
Sourcepub(crate) async fn tag_commit(
&self,
repository: &RepoRef,
tag: &str,
) -> Result<Option<String>, ForgeError>
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.
pub(crate) async fn release_by_tag( &self, repository: &RepoRef, tag: &str, ) -> Result<Option<ReleaseWire>, ForgeError>
pub(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 release_assets( &self, repository: &RepoRef, release_id: u64, ) -> Result<Vec<AssetWire>, ForgeError>
pub(crate) async fn upload_asset( &self, repository: &RepoRef, release_id: u64, filename: &str, bytes: Vec<u8>, ) -> Result<(), ForgeError>
pub(crate) async fn delete_asset( &self, repository: &RepoRef, release_id: u64, asset_id: u64, ) -> Result<(), ForgeError>
pub(crate) async fn publish_release( &self, repository: &RepoRef, release_id: u64, ) -> Result<(), ForgeError>
pub(crate) async fn open_pull_request( &self, repository: &RepoRef, head: &str, ) -> Result<Option<Pull>, ForgeError>
pub(crate) async fn ensure_pull_request( &self, repository: &RepoRef, head: &str, base: &str, title: &str, body: &str, ) -> Result<(), ForgeError>
Source§impl HttpApi
impl HttpApi
Sourcepub fn new(forge_url: &Url, token: Token) -> Result<Self, TransportBuildError>
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.
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.
Sourceasync fn send_write(
&self,
method: Method,
path: &str,
body: Option<&str>,
) -> Result<(), ForgeError>
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).
async fn paged<T: for<'a> Facet<'a>>( &self, path: &str, ) -> Result<Vec<T>, ForgeError>
Trait Implementations§
Source§impl AccessApi for HttpApi
impl AccessApi for HttpApi
Source§async fn teams(&self, repo: &RepoRef) -> Result<Vec<Team>, ForgeError>
async fn teams(&self, repo: &RepoRef) -> Result<Vec<Team>, ForgeError>
GET /repos/{owner}/{repo}/teams.Source§async fn current_user(&self) -> Result<String, ForgeError>
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>
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>
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>
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>
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>
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>
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>
async fn remove_collaborator( &self, repo: &RepoRef, user: &str, ) -> Result<(), ForgeError>
DELETE /repos/{owner}/{repo}/collaborators/{collaborator}.Source§impl ActionsVariablesApi for HttpApi
impl ActionsVariablesApi for HttpApi
Source§async fn actions_variables(
&self,
repo: &RepoRef,
) -> Result<Vec<ActionVariable>, ForgeError>
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>
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>
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>
async fn delete_actions_variable( &self, repo: &RepoRef, name: &str, ) -> Result<(), ForgeError>
DELETE /repos/{owner}/{repo}/actions/variables/{name}.Source§impl BranchRulesApi for HttpApi
impl BranchRulesApi for HttpApi
Source§async fn branch_protections(
&self,
repo: &RepoRef,
) -> Result<Vec<BranchProtection>, ForgeError>
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>
async fn branch_protection( &self, repo: &RepoRef, rule: &str, ) -> Result<Option<BranchProtection>, ForgeError>
GET /repos/{owner}/{repo}/branch_protections/{rule}. Read moreSource§async fn create_branch_protection(
&self,
repo: &RepoRef,
body: &CreateBranchProtectionOption,
) -> Result<(), ForgeError>
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>
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>
async fn delete_branch_protection( &self, repo: &RepoRef, rule: &str, ) -> Result<(), ForgeError>
DELETE /repos/{owner}/{repo}/branch_protections/{rule}.Source§impl DeployKeysApi for HttpApi
impl DeployKeysApi for HttpApi
Source§async fn deploy_keys(
&self,
repo: &RepoRef,
) -> Result<Vec<DeployKey>, ForgeError>
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>
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>
async fn delete_deploy_key( &self, repo: &RepoRef, id: i64, ) -> Result<(), ForgeError>
DELETE /repos/{owner}/{repo}/keys/{id}.Source§impl LabelsApi for HttpApi
impl LabelsApi for HttpApi
Source§async fn labels(&self, repo: &RepoRef) -> Result<Vec<Label>, ForgeError>
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>
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>
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>
async fn delete_label(&self, repo: &RepoRef, id: i64) -> Result<(), ForgeError>
DELETE /repos/{owner}/{repo}/labels/{id}.Source§impl RepositoryApi for HttpApi
impl RepositoryApi for HttpApi
Source§async fn repository(&self, repo: &RepoRef) -> Result<Repository, ForgeError>
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>
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>
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>
async fn replace_topics( &self, repo: &RepoRef, topics: &[String], ) -> Result<(), ForgeError>
PUT /repos/{owner}/{repo}/topics.Source§impl TagProtectionApi for HttpApi
impl TagProtectionApi for HttpApi
Source§async fn tag_protections(
&self,
repo: &RepoRef,
) -> Result<Vec<TagProtection>, ForgeError>
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>
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>
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>
async fn delete_tag_protection( &self, repo: &RepoRef, id: i64, ) -> Result<(), ForgeError>
DELETE /repos/{owner}/{repo}/tag_protections/{id}.Source§impl WebhooksApi for HttpApi
impl WebhooksApi for HttpApi
Source§async fn webhooks(&self, repo: &RepoRef) -> Result<Vec<Hook>, ForgeError>
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>
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>
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>
async fn delete_webhook( &self, repo: &RepoRef, id: i64, ) -> Result<(), ForgeError>
DELETE /repos/{owner}/{repo}/hooks/{id}.Auto Trait Implementations§
impl !RefUnwindSafe for HttpApi
impl !UnwindSafe for HttpApi
impl Freeze for HttpApi
impl Send for HttpApi
impl Sync for HttpApi
impl Unpin for HttpApi
impl UnsafeUnpin for HttpApi
Blanket Implementations§
impl<T> Api for Twhere
T: AccessApi + ActionsVariablesApi + BranchRulesApi + DeployKeysApi + LabelsApi + RepositoryApi + TagProtectionApi + WebhooksApi + Send + Sync,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more