Crates.io | gitea-sdk |
lib.rs | gitea-sdk |
version | 0.4.1 |
source | src |
created_at | 2024-09-02 18:10:21.458559 |
updated_at | 2024-10-15 11:55:32.13604 |
description | An unofficial Gitea API client |
homepage | |
repository | https://github.com/benpueschel/teatime |
max_upload_size | |
id | 1360903 |
size | 2,948,318 |
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.
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();