The Checkvist API returns an array of tasks (containing the modified task
and potentially its subtasks) for close, reopen, and invalidate operations.
The code was incorrectly trying to decode into a single Task struct.
Changes:
- Decode response into []Task instead of Task
- Return first element (the modified task)
- Add defensive error handling for empty arrays
- Update tests to mock array responses
Fixes: checkvist-api-2zr
The Checkvist API expects due_date values without the caret (^) prefix.
The ^ prefix is only used in task content smart syntax, not in API parameters.
- Remove ^ prefix from DueToday and DueTomorrow constants
- Remove unused DueASAP and DueMonday constants
- Update DueAt() and DueInDays() to not add ^ prefix
- Update tests to expect new format
Closes checkvist-api-4pz
The Checkvist API returns due dates in slash format (2026/01/15),
but parseDueDate() only supported ISO format with dashes.
- Extend parseDueDate() to try both formats (slashes and dashes)
- Add test case for Checkvist API format parsing
- Fix TestTaskBuilder to use existing DueTomorrow constant
Closes checkvist-api-otm
- Add createTaskWrapper and updateTaskWrapper structs to wrap request
bodies in nested JSON format expected by Checkvist API
- Change JSON tag from "due" to "due_date" as required by API
- Update DueDate constants to use valid Checkvist smart syntax values
(^Today, ^Tomorrow, ^ASAP, ^Monday)
- Update tests to verify nested format and correct field names
Fixes checkvist-api-a5b
Add custom APITime type with UnmarshalJSON to handle the non-standard
date format returned by the Checkvist API ("2026/01/14 16:07:31 +0000")
instead of the expected RFC3339 format.
Changes:
- Add APITime type with custom JSON marshaling/unmarshaling in models.go
- Replace time.Time with APITime for UpdatedAt/CreatedAt fields in
Checklist, Task, and Note structs
- Add NewAPITime constructor for convenience
- Update test fixtures to use real API date format
- Add comprehensive unit tests for APITime in models_test.go
Fixes: checkvist-api-4qn
Create tasks_test.go with comprehensive tests:
- TestTasks_List: list all tasks in checklist
- TestTasks_Get: get single task by ID
- TestTasks_Create: create basic task
- TestTasks_Create_WithBuilder: create task with all options
- TestTasks_Update: update task properties
- TestTasks_Delete: delete task
- TestTasks_Close: mark task as completed
- TestTasks_Reopen: reopen closed task
- TestTasks_Invalidate: invalidate task
- TestDueDate_Parsing: table-driven due date parsing tests
- TestTaskBuilder: builder pattern validation
Add testdata/tasks/ fixtures:
- list.json: sample task list
- single.json: single task response
All 11 tests pass using httptest.Server mocking.
Closes checkvist-api-v2f