add(taskwarrior): pull implementation for new tasks
This implements the pull functionality for new tasks, which are not yet in the local taskwarrior instance created. WIP for #3.
This commit is contained in:
@@ -13,6 +13,11 @@ type PullRequest struct {
|
||||
Merged_at time.Time `json:"merged_at"`
|
||||
}
|
||||
|
||||
type IssueState string
|
||||
|
||||
const CLOSED IssueState = "closed"
|
||||
const OPEN IssueState = "open"
|
||||
|
||||
type Issue struct {
|
||||
Id uint `json:"id"`
|
||||
Url string `json:"url"`
|
||||
@@ -104,7 +109,7 @@ func (gitea *Gitea) NewIssue(repo Repository, issue Issue) (Issue, error) {
|
||||
payload["assignee"] = issue.Assignee
|
||||
payload["assignees"] = issue.Assignees
|
||||
payload["body"] = issue.Body
|
||||
payload["closed"] = issue.State == "closed"
|
||||
payload["closed"] = issue.State == string(CLOSED)
|
||||
payload["due_date"] = issue.Due_date
|
||||
payload["lables"] = issue.Labels
|
||||
payload["milestone"] = issue.Milestone.Title != ""
|
||||
|
||||
@@ -6,6 +6,8 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"gitea.yves-biener.de/yves-biener/gitwarrior/internal/taskwarrior"
|
||||
)
|
||||
|
||||
type Milestone struct {
|
||||
@@ -21,6 +23,11 @@ type Milestone struct {
|
||||
Closed_at time.Time `json:"closed_at"`
|
||||
}
|
||||
|
||||
// TODO: implement merge for milestone tasks
|
||||
func (milestone *Milestone) Merge(task taskwarrior.Task) taskwarrior.Task {
|
||||
return task
|
||||
}
|
||||
|
||||
func (gitea *Gitea) GetMilestones(repo Repository) ([]Milestone, error) {
|
||||
url := fmt.Sprintf("%s/repos/%s/milestones?state=all", gitea.Url(), repo.Full_name)
|
||||
response, err := http.Get(url)
|
||||
|
||||
Reference in New Issue
Block a user