Documentation
¶
Overview ¶
Package types provides shared types used across the Basecamp SDK.
Package types provides shared types used across the Basecamp SDK.
Index ¶
- type Date
- func (d Date) AddDays(n int) Date
- func (d Date) AddMonths(n int) Date
- func (d Date) AddYears(n int) Date
- func (d Date) After(other Date) bool
- func (d Date) Before(other Date) bool
- func (d Date) Compare(other Date) int
- func (d Date) DaysSince(s Date) int
- func (d Date) Equal(other Date) bool
- func (d Date) GoString() string
- func (d Date) In(loc *time.Location) time.Time
- func (d Date) IsValid() bool
- func (d Date) IsZero() bool
- func (d Date) MarshalJSON() ([]byte, error)
- func (d Date) MarshalText() ([]byte, error)
- func (d Date) String() string
- func (d Date) UTC() time.Time
- func (d *Date) UnmarshalJSON(data []byte) error
- func (d *Date) UnmarshalText(data []byte) error
- func (d Date) Weekday() time.Weekday
- type FlexInt
- type FlexibleTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Date ¶
type Date struct {
Year int // Year (e.g., 2024)
Month time.Month // Month of the year (January = 1, ...)
Day int // Day of the month, starting at 1
}
Date represents a calendar date (year, month, day) without time or timezone. Use this for date-only fields like due_on and starts_on.
func (Date) Compare ¶
Compare compares d and other. Returns -1 if d < other, 0 if equal, +1 if d > other.
func (Date) In ¶
In returns the time.Time corresponding to midnight of the date in the given location.
func (Date) MarshalJSON ¶
MarshalJSON implements json.Marshaler. Zero dates marshal as null, valid dates as "YYYY-MM-DD".
func (Date) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Date) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler. Accepts "YYYY-MM-DD" strings and null.
func (*Date) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type FlexInt ¶ added in v0.4.0
type FlexInt int32
FlexInt is an int32 that unmarshals from any JSON number whose value is integral and fits in 32 bits. The BC3 API serializes pixel dimensions as floats (e.g. 1024.0); Go's encoding/json rejects those into plain int fields. FlexInt bridges this wire-format mismatch without lying in the spec.
Non-integral values (1024.5) and out-of-range values (1e20) are rejected to match the int32 schema in openapi.json.
func (FlexInt) MarshalJSON ¶ added in v0.4.0
MarshalJSON writes the value as an integer.
func (*FlexInt) UnmarshalJSON ¶ added in v0.4.0
UnmarshalJSON accepts any JSON number whose value is an integer within int32 range.
type FlexibleTime ¶ added in v0.4.0
FlexibleTime is a time.Time that can unmarshal from RFC3339, RFC3339Nano, or date-only ("2006-01-02") strings. Date-only values are treated as midnight UTC. This supports API responses where all-day schedule entries return dates without times.
func (FlexibleTime) MarshalJSON ¶ added in v0.4.0
func (ft FlexibleTime) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler for FlexibleTime. Zero times marshal as null; non-zero times use time.Time's JSON encoding.
func (*FlexibleTime) UnmarshalJSON ¶ added in v0.4.0
func (ft *FlexibleTime) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler for FlexibleTime.