Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions projects/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,13 @@ type TaskListRequestFilters struct {
// specific date and time.
CompletedBefore *time.Time

// DueAfter is an optional filter to retrieve tasks due after a specific date.
DueAfter *twapi.Date

// DueBefore is an optional filter to retrieve tasks due before a specific
// date.
DueBefore *twapi.Date

// TagIDs is an optional list of tag IDs to filter tasks by tags.
TagIDs []int64

Expand Down Expand Up @@ -838,6 +845,12 @@ func (t TaskListRequestFilters) apply(req *http.Request) {
if t.CompletedBefore != nil && !t.CompletedBefore.IsZero() {
query.Set("completedBefore", t.CompletedBefore.Format(time.RFC3339))
}
if t.DueAfter != nil && !t.DueAfter.IsZero() {
query.Set("dueAfter", t.DueAfter.String())
}
if t.DueBefore != nil && !t.DueBefore.IsZero() {
query.Set("dueBefore", t.DueBefore.String())
}
if len(t.TagIDs) > 0 {
tagIDs := make([]string, len(t.TagIDs))
for i, id := range t.TagIDs {
Expand Down