1.8 KiB
1.8 KiB
name, description
| name | description |
|---|---|
| gitea-api-client | Use when implementing or modifying Gitea API requests, pagination, authentication, DTOs, errors, or HTTP retry behavior. |
Gitea API client
- Assume Gitea REST API v1 (OpenAPI documented by Gitea); use documented paths:
/user/orgs,/orgs/{org}/repos, and/user/reposwhen personal repositories are enabled. - Send the token only in the server-side
Authorization: token …header; never echo it or include it in exceptions. - Paginate with bounded
pageandlimitparameters and stop only when a page is shorter than the requested limit. - Use
java.net.http.HttpClientwith explicit connect and request timeouts. - Do not automatically retry non-idempotent operations. If retries are added for GET, cap attempts and honor
Retry-Afterwhen valid. - Map 401 to invalid token, 403 to insufficient Gitea access, 404 to missing organization/resource, 429 to rate limit, and 5xx/network failures to temporary service errors.
- Parse only fields needed by the UI; handle absent optional branch fields safely.
- Validate configured base URL and disable redirects to prevent token forwarding to another host.
Checklist
- Token remains server side and is redacted.
- Pagination bounded and tested.
- Timeouts and status mappings are explicit.
- Redirects disabled; base URL validated.
Sources
- Gitea API documentation: https://docs.gitea.com/api/ (API 28.2.0 consulted 2026-10-28)
- Gitea user/org operations: https://docs.gitea.com/api/1.26/operations/tags/organization/ (consulted 2026-10-28)
- Java HttpClient: https://docs.oracle.com/en/java/javase/17/docs/api/java.net.http/java/net/http/HttpClient.html (consulted 2026-10-28)
Not verified
- Deployment-specific Gitea version is unspecified; current endpoint compatibility across older Gitea versions must be checked against the test instance.