gitea-sdk

Crates.iogitea-sdk
lib.rsgitea-sdk
version0.4.1
sourcesrc
created_at2024-09-02 18:10:21.458559
updated_at2024-10-15 11:55:32.13604
descriptionAn unofficial Gitea API client
homepage
repositoryhttps://github.com/benpueschel/teatime
max_upload_size
id1360903
size2,948,318
Ben PĆ¼schel (benpueschel)

documentation

README

teatime

NOTE: The crate name is now gitea-sdk because teatime was already taken on crates.io and I forgot to check for that (oops).

Teatime is a simple Gitea API client for Rust. It's goal is to give you the ability to write exactly as much code as you need to interact with the specific parts of the Gitea API you need, but no more.

Usage

The main way to interact with the Gitea API is through the Client struct. You can create a new Client by calling Client::new with the base URL of your Gitea instance and a personal token. Teatime does currently not support basic HTML or OAuth2 authentication.

Once you have obtained a Client, you can interact with the Gitea API by calling the various methods the instance provides. This example will create a new Repository and get the 10 last commits of the repository username/awesome-repo:

let client = Client::new("https://gitea.example.com".to_string(), "your-token".to_string());
// This will create a new repository with the name "my-new-repo" for the authenticated user.
let repo = client
    .user()
    .create_repo("my-new-repo")
    .send(&client)
    .await?;

let commits = client
    .repos("username", "awesome-repo")
    .get_commits()
    .limit(10)
    .send(&client)
    .await
    .unwrap();
Commit count: 78

cargo fmt