Skip to content

v0.3.0 — human-readable response timestamps

Latest

Choose a tag to compare

@ysyneu ysyneu released this 30 May 06:53
· 16 commits to main since this release

Highlights

Response time fields now read as RFC3339 in JSON, logs, and LLM-facing output instead of opaque integers — ported from flashduty-sdk.

  • New Timestamp (Unix seconds) and TimestampMilli (milliseconds) types, both int64-based:
    • MarshalJSON → quoted RFC3339 in the local timezone.
    • UnmarshalJSON accepts either a numeric epoch or an RFC3339 string, so values round-trip cleanly.
    • Zero value stays the numeric 0 sentinel (never a 1970 date) and is dropped by omitempty.
    • String() for fmt/TOON output; Unix(), Time(), IsZero() accessors.
  • The generator detects epoch-timestamp fields by their spec description (unix/epoch/timestamp + second/milli, excluding duration/offset/elapsed) — not by name, which is an unreliable proxy.
  • Conversion is response-only: fields in request-reachable schemas keep int64, because a request marshals to the wire where the API wants a numeric epoch. 114 response fields converted; every request struct keeps int64. Verified live against the API.

⚠️ Breaking change

Response time fields change from int64 to Timestamp or TimestampMilli. Migrate with .Unix() for the raw epoch or .Time() for a time.Time.

inc := list.Items[0]
fmt.Println(inc.StartTime)          // 2026-05-30T14:37:11+08:00
epoch := inc.StartTime.Unix()       // 1779514631  (raw wire value)
t := inc.StartTime.Time()           // time.Time

Full Changelog: v0.2.1...v0.3.0