gitea-sdk-rs
An async Rust SDK for the Gitea REST API, with full coverage of repositories, issues, pull requests, organizations, users, admin operations, and more.
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Feature Flags
| Feature | Description |
|---|---|
rustls-tls |
Use rustls for TLS (default) |
native-tls |
Use the system native TLS backend |
stream |
Enable streaming response support |
Quick Start
use Client;
async
More examples are in the examples/ directory:
API Overview
Repository Management
ReposApi — Full repository lifecycle and contents management.
- CRUD —
create_repo,get_repo,edit_repo,delete_repo,search_repos - Branches —
list_branches,create_branch,delete_branch,list_branch_protections - Tags —
list_tags,create_tag,delete_tag,list_tag_protections - Files —
get_contents,create_file,update_file,delete_file,get_raw_file - Collaborators —
list_collaborators,add_collaborator,get_collaborator_permission - Commits —
list_commits,get_single_commit,compare_commits - Actions —
list_action_secrets,list_action_variables,create_action_secret - Wiki —
create_wiki_page,get_wiki_page,edit_wiki_page,list_wiki_pages - Misc —
list_forks,create_fork,mirror_sync,transfer_repo,get_archive
ReleasesApi — Releases and attachments.
list,create,edit,delete,get_by_tag,list_attachments,create_attachment
Issues & Pull Requests
IssuesApi — Full issue tracking with rich metadata.
- CRUD —
list_repo_issues,create_issue,edit_issue,delete_issue - Comments —
list_issue_comments,create_issue_comment,edit_issue_comment - Labels —
get_issue_labels,add_issue_labels,replace_issue_labels - Milestones —
list_repo_milestones,create_milestone,edit_milestone - Reactions —
post_issue_reaction,post_issue_comment_reaction - Dependencies —
list_issue_dependencies,create_issue_dependency - Time Tracking —
add_time,list_issue_tracked_times,list_my_tracked_times - Subscriptions —
list_issue_subscribers,add_issue_subscription - Pins —
list_repo_pinned_issues,pin_issue,unpin_issue
PullsApi — Pull request workflow.
- CRUD —
list,get,create,edit - Merge —
merge,is_merged,patch,diff - Reviews —
list_reviews,create_review,submit_review,dismiss_review - Files —
list_commits,list_files
Users & Organizations
UsersApi — User profiles, keys, and social features.
- Profile —
get,get_my_info,search,get_settings,update_settings - Keys —
list_public_keys,create_public_key,list_gpg_keys,create_gpg_key - Social —
follow,unfollow,list_followers,block_user,unblock_user - Email —
list_emails,add_email,delete_email - Tokens —
list_access_tokens,create_access_token,delete_access_token
OrgsApi — Organization and team management.
- CRUD —
list_orgs,create_org,edit_org,delete_org - Teams —
list_org_teams,create_team,add_team_member,add_team_repo - Members —
list_org_membership,set_public_org_membership - Labels —
list_org_labels,create_org_label - Actions —
list_org_action_secrets,list_org_action_variables - Blocks —
list_org_blocks,block_org_user,unblock_org_user
System & Administration
AdminApi — Server administration (requires admin privileges).
- Users —
list_users,create_user,edit_user,delete_user - Orgs —
list_orgs,create_org_for_user - Cron —
list_cron_tasks,run_cron_task - Hooks —
list_hooks,create_hook,edit_hook - Repos —
list_unadopted_repos,adopt_unadopted_repo - Badges —
list_user_badges,add_user_badges
SettingsApi — get_api_settings, get_repo_settings, get_ui_settings
MiscApi — get_version, render_markdown, list_gitignore_templates, list_license_templates, get_signing_key_gpg
Other Modules
| Module | Description |
|---|---|
HooksApi |
Webhook management for repos, orgs, and users |
NotificationsApi |
Notification inbox and read status |
ActionsApi |
Gitea Actions workflow runs and jobs |
PackagesApi |
Package registry management |
Oauth2Api |
OAuth2 application management |
StatusApi |
Commit status (CI/CD integration) |
ActivityPubApi |
ActivityPub federation endpoints |
Authentication
use Client;
// Personal access token
let client = builder
.token
.build?;
// Username and password
let client = builder
.basic_auth
.build?;
// Token with two-factor OTP
let client = builder
.token
.otp
.build?;
// Act as another user (sudo)
let client = builder
.token
.sudo
.build?;
The client is thread-safe and supports swapping credentials at runtime via set_token(), set_basic_auth(), set_otp(), and set_sudo().
Pagination
List endpoints accept option structs that embed pagination parameters:
use ListOptions;
use ListReposOptions;
let opts = ListReposOptions ;
let = client.repos.list_my_repos.await?;
Set page to Some(0) to disable pagination and fetch all results at once.
Error Handling
All API methods return Result<(T, Response)> where T is the deserialized response body and Response contains HTTP status, headers, and pagination links.
use ;
async
Minimum Rust Version
Requires Rust 1.88 or later (edition 2024).
License
Licensed under the MIT License.