Commit graph

7 commits

Author SHA1 Message Date
b716d4d0fe Fix Close/Invalidate/Reopen to handle API array response
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
2026-01-15 10:48:38 +01:00
8c9f888927 Fix DueDate parsing to support Checkvist API slash format
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
2026-01-15 09:29:34 +01:00
773da6323d gofmt 2026-01-14 21:24:46 +01:00
895b76d9e1 Fix TaskBuilder parameters not sent to API
- 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
2026-01-14 19:02:34 +01:00
cb30b178be Add Filter builder, Archive/Unarchive, WithRepeat, and GoDoc examples
- Implement client-side Filter builder with tag, status, due date, and search filters
- Add unit tests for Filter with performance benchmark
- Add Archive/Unarchive methods to ChecklistService
- Add WithRepeat method to TaskBuilder for recurring tasks
- Create GoDoc examples for all major functionality
2026-01-14 14:39:27 +01:00
3aa2a284de Implement Task operations
Add tasks.go with TaskService for full task CRUD:
- client.Tasks(checklistID) returns TaskService
- List(ctx) - get all tasks in checklist
- Get(ctx, taskID) - get single task with parent hierarchy
- Create(ctx, builder) - create task using TaskBuilder
- Update(ctx, taskID, req) - update task properties
- Delete(ctx, taskID) - permanently delete task
- Close(ctx, taskID) - mark task as completed
- Reopen(ctx, taskID) - reopen closed/invalidated task
- Invalidate(ctx, taskID) - mark task as invalidated (strikethrough)

TaskBuilder fluent interface for task creation:
- NewTask(content) - create builder
- WithParent(id) - set parent for subtask
- WithPosition(pos) - set position in list
- WithDueDate(due) - set due date using DueDate type
- WithPriority(level) - set priority (0=normal, 1=highest, 2=high)
- WithTags(tags...) - set tags

Automatic DueDate parsing from DueDateRaw (ISO 8601 format).

Closes checkvist-api-rl9
2026-01-14 13:39:37 +01:00
3b076836d3 Initial commit 2026-01-14 12:42:00 +01:00