[−][src]Struct gitea::Client
The gitea client that all gitea calls will go through. This wraps reqwest::Client and operates asyncronously.
Implementations
impl Client
[src]
pub fn new<T>(base_url: String, token: String, user_agent: T) -> Result<Self> where
T: Into<String>,
[src]
T: Into<String>,
Create a new API client with the given base URL, token and user agent. If you need inspiration for a user agent, try this:
const APP_USER_AGENT: &'static str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")); gitea::Client::new("https://tulpa.dev".into(), "ayylmao".into(), APP_USER_AGENT).unwrap();
pub async fn version<'_>(&'_ self) -> Result<Version>
[src]
Gets the current version of gitea.
use gitea::Result; #[tokio::main] async fn main() -> Result<()> { let cli = gitea::Client::new("https://tulpa.dev".into(), "ayylmao".into(), "test/test")?; println!("{:?}", cli.version().await?); Ok(()) }
pub async fn get_release_by_tag<'_>(
&'_ self,
owner: String,
repo: String,
tag: String
) -> Result<Release>
[src]
&'_ self,
owner: String,
repo: String,
tag: String
) -> Result<Release>
Gets a release of a repo by its tag name.
use gitea::Result; #[tokio::main] async fn main() -> Result<()> { let cli = gitea::Client::new("https://tulpa.dev".into(), "ayylmao".into(), "test/test")?; let release = cli.get_release_by_tag("cadey".into(), "gitea-release".into(), "0.3.2".into()).await; Ok(()) }
pub async fn get_repo<'_>(&'_ self, owner: String, repo: String) -> Result<Repo>
[src]
Gets a gitea repo by name.
use gitea::Result; #[tokio::main] async fn main() -> Result<()> { let cli = gitea::Client::new("https://tulpa.dev".into(), "ayylmao".into(), "test/test")?; let repo = cli.get_repo("cadey".into(), "gitea-release".into()).await; Ok(()) }
pub async fn get_releases<'_>(
&'_ self,
owner: String,
repo: String
) -> Result<Vec<Release>>
[src]
&'_ self,
owner: String,
repo: String
) -> Result<Vec<Release>>
Gets all of the releases for a given gitea repo.
use gitea::Result; #[tokio::main] async fn main() -> Result<()> { let cli = gitea::Client::new("https://tulpa.dev".into(), "ayylmao".into(), "test/test")?; let repo = cli.get_releases("cadey".into(), "gitea-release".into()).await; Ok(()) }
pub async fn create_release<'_>(
&'_ self,
owner: String,
repo: String,
cr: CreateRelease
) -> Result<Release>
[src]
&'_ self,
owner: String,
repo: String,
cr: CreateRelease
) -> Result<Release>
Creates a new gitea release.
use gitea::{CreateRelease, Result}; #[tokio::main] async fn main() -> Result<()> { let cli = gitea::Client::new("https://tulpa.dev".into(), "ayylmao".into(), "test/test")?; let repo = cli.create_release( "cadey".into(), "gitea-release".into(), CreateRelease{ body: "This is a cool release".into(), draft: false, name: "test".into(), prerelease: false, tag_name: "v4.2.0".into(), target_commitish: "HEAD".into(), }, ).await; Ok(()) }
pub async fn delete_release<'_>(
&'_ self,
owner: String,
repo: String,
tag: String
) -> Result<()>
[src]
&'_ self,
owner: String,
repo: String,
tag: String
) -> Result<()>
Deletes a given release by tag name.
use gitea::Result; #[tokio::main] async fn main() -> Result<()> { let cli = gitea::Client::new("https://tulpa.dev".into(), "ayylmao".into(), "test/test")?; let _ = cli.delete_release("cadey".into(), "gitea-release".into(), "4.2.0".into()).await; Ok(()) }
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,