add(gitea-api): issues and milestones getters

This implements the api getters for extracting the issues and milestones
for a given gitea repository. WIP for #1.
This commit is contained in:
2023-10-17 23:15:29 +02:00
parent 65eec9a2f6
commit 398b6a1992
7 changed files with 200 additions and 2 deletions

View File

@@ -1,5 +1,39 @@
package main
func main() {
import (
"fmt"
"os"
"gitea.yves-biener.de/yves-biener/gitwarrior/internal/gitea"
)
func main() {
repository := gitea.NewRepository("gitwarrior", "yves-biener")
server := gitea.NewGitea("https://gitea.yves-biener.de")
issues, err := server.GetIssues(repository)
if err != nil {
fmt.Fprintln(os.Stderr, err)
}
milestones, err := server.GetMilestones(repository)
if err != nil {
fmt.Fprintln(os.Stderr, err)
}
for _, issue := range issues {
fmt.Printf("%#v\n", issue)
}
fmt.Println("---")
for _, issue := range milestones {
fmt.Printf("%#v\n", issue)
}
// necessary configurations (see config file gitw.json)
// - access code for gitea
// - configuration for taskwarrior settings?
// cli actions and parameters
// - action: diff (i.e. what has changed between the current state of the taskwarrior tasks and the git issues / milestones)
// - action: status (are there changes between the taskwarrior tasks and the gitea issues / milestones, that would require a sync)
// - action: sync (synch diffs between taskwarrior tasks and gitea issues / milestones)
// - parameter: --dry-run (do only show changes that would be applied but do not apply them)
}