5 unstable releases
new 0.4.1 | Oct 15, 2024 |
---|---|
0.4.0 | Sep 10, 2024 |
0.3.0 | Sep 7, 2024 |
0.2.1 | Sep 5, 2024 |
0.2.0 | Sep 2, 2024 |
#1321 in Web programming
179 downloads per month
Used in gritty
165KB
3K
SLoC
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();
Dependencies
~4–14MB
~199K SLoC