Files
unkinben 1b4448afb4
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
Add teabot daemon implementation
teabot watches Gitea repos and dispatches one-shot Claude Code sessions in
Docker containers to work issues and review PRs, acting as configurable bot
personalities.

Claude-Session: https://claude.ai/code/session_015ur3i7D2azsMAWTSVABApv
2026-07-26 23:36:21 +10:00

68 lines
2.1 KiB
Go

// Package gitea is a small read-mostly client for the Gitea REST API covering
// the endpoints teabot needs: listing issues, pull requests, and comments.
package gitea
import "time"
// User is the subset of a Gitea user teabot cares about.
type User struct {
Login string `json:"login"`
ID int64 `json:"id"`
}
// Issue represents a Gitea issue. Gitea's issues endpoint also returns pull
// requests; the PullRequest field is non-nil for those.
type Issue struct {
ID int64 `json:"id"`
Index int64 `json:"number"`
Title string `json:"title"`
Body string `json:"body"`
State string `json:"state"`
Poster User `json:"user"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
HTMLURL string `json:"html_url"`
PullRequest *PullRequestRef `json:"pull_request,omitempty"`
}
// IsPull reports whether this issue is actually a pull request.
func (i Issue) IsPull() bool { return i.PullRequest != nil }
// PullRequestRef is the marker Gitea attaches to issues that are PRs.
type PullRequestRef struct {
Merged bool `json:"merged"`
}
// PullRequest represents a Gitea pull request.
type PullRequest struct {
ID int64 `json:"id"`
Index int64 `json:"number"`
Title string `json:"title"`
Body string `json:"body"`
State string `json:"state"`
Poster User `json:"user"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
HTMLURL string `json:"html_url"`
Head Branch `json:"head"`
Base Branch `json:"base"`
}
// Branch is one side of a pull request.
type Branch struct {
Ref string `json:"ref"`
Sha string `json:"sha"`
}
// Comment is a comment on an issue or pull request.
type Comment struct {
ID int64 `json:"id"`
Body string `json:"body"`
Poster User `json:"user"`
Created time.Time `json:"created_at"`
Updated time.Time `json:"updated_at"`
HTMLURL string `json:"html_url"`
IssueURL string `json:"issue_url"`
PRURL string `json:"pull_request_url"`
}