Commit graph

6 commits

Author SHA1 Message Date
d92a1b90c2 Fix Task.tasks field type: rename Children []*Task to ChildIDs []int
The Checkvist API returns the 'tasks' field as an array of child task IDs
(integers), not as full Task objects. This was causing JSON unmarshal errors.

BREAKING CHANGE: Task.Children []*Task renamed to Task.ChildIDs []int
2026-01-18 14:41:42 +01:00
ff67719aed Fix DueDate format: remove caret prefix for API compatibility
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
2026-01-15 10:18:01 +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
e4862b8e9b Fix date parsing for Checkvist API format
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
2026-01-14 18:10:02 +01:00
61431dfaeb Implement data models for Checkvist API entities
Add models.go with all data structures:
- Checklist struct with fields for ID, Name, Public, Archived, etc.
- Task struct with full task data including status, priority, due dates
- TaskStatus enum (StatusOpen, StatusClosed, StatusInvalidated)
- Note struct for task comments
- User struct for user information
- Tags type as map[string]bool for efficient lookup
- DueDate struct with smart syntax support and constructors
  (DueAt, DueString, DueInDays) and constants (DueToday, DueTomorrow,
  DueNextWeek, DueNextMonth)

Closes checkvist-api-e9p
2026-01-14 13:22:29 +01:00
3b076836d3 Initial commit 2026-01-14 12:42:00 +01:00