Documentation
¶
Overview ¶
Package domain defines the main constructs for managing daily work schedules.
Package calendar provides functionality related to managing days and time segments within those days.
A person is the entity for which we associate their Calendars, Working days, Holidays and preferred working hours.
Index ¶
- Constants
- func FreeTime()
- func PrintOpenSlots(slots []OpenSlot)
- type Attendee
- type AttendeeAvailability
- type DateTimeTimeZone
- type Day
- type EmailAddress
- type ErrDayAlreadyExists
- type ErrDayNotFound
- type ErrInvalidSegmentRange
- type ErrSegmentOutsideOfDay
- type Expansion
- type ExternalID
- type FindMeetingTimesRequest
- type FindMeetingTimesResponse
- type MeResponse
- type MeetingTimeSuggestion
- type OpenSlot
- type Person
- type Segment
- type SuggestionQuality
- type TimeConstraint
- type TimeSlot
Constants ¶
const ( // WorkDay indicates a day where work activities occur. WorkDay = iota // NonWorkingDay indicates a day free from work activities. NonWorkingDay )
Variables ¶
This section is empty.
Functions ¶
func PrintOpenSlots ¶
func PrintOpenSlots(slots []OpenSlot)
PrintOpenSlots prints the open slots for a given day.
Types ¶
type Attendee ¶
type Attendee struct { Type string `json:"type"` EmailAddress EmailAddress `json:"emailAddress"` }
type AttendeeAvailability ¶
type DateTimeTimeZone ¶
type Day ¶
type Day struct { ID uuid.UUID // Date specifies the calendar date for the work day, excluding the time details. Date time.Time // Start marks the beginning of the work day. Start time.Time // End signifies the conclusion of the work day. End time.Time // Segments represents chunks of time within the day. These can be continuous or // can overlap (e.g., due to double bookings). A day may also have no segments. Segments []Segment }
Day represents a specific date where work activities might take place. It includes details like start and end times of work, and is influenced by factors such as a person's calendar entries, public holidays, and preferred working hours.
TODO: Updating the start or end time of a day may invalidate existing segments.
func (*Day) AddSegment ¶
AddSegment attaches a new time segment to the current day.
func (*Day) ClearSegments ¶
func (d *Day) ClearSegments()
ClearSegments removes all segments from the day.
func (*Day) RemoveSegment ¶
RemoveSegment removes a segment from the day.
func (*Day) UpdateSegment ¶
UpdateSegment updates a segment in the day.
type EmailAddress ¶
type ErrDayAlreadyExists ¶
ErrDayAlreadyExists indicates that a day already exists for a specific date.
func (ErrDayAlreadyExists) Error ¶
func (e ErrDayAlreadyExists) Error() string
Error returns a string representation of ErrDayAlreadyExists.
type ErrDayNotFound ¶
ErrDayNotFound indicates that a day was not found for a specific date.
func (ErrDayNotFound) Error ¶
func (e ErrDayNotFound) Error() string
Error returns a string representation of ErrDayNotFound.
type ErrInvalidSegmentRange ¶
ErrInvalidSegmentRange indicates that the start and end times of a segment are not valid. For example, when the start time is after the end time.
func (ErrInvalidSegmentRange) Error ¶
func (e ErrInvalidSegmentRange) Error() string
Error returns a string representation of ErrInvalidSegmentRange. It checks if the start time is after the end time, if so, it provides an appropriate error message. Otherwise, it indicates a generic invalid range error.
type ErrSegmentOutsideOfDay ¶
ErrSegmentOutsideOfDay indicates that a time segment is outside the boundaries of a day. This error is used when trying to associate a segment with a day and the segment's time range does not fit within the day's time range.
func (ErrSegmentOutsideOfDay) Error ¶
func (e ErrSegmentOutsideOfDay) Error() string
Error checks which part of the segment is outside of the day's boundaries and returns the appropriate error message.
type Expansion ¶
type Expansion struct { NumberOfTimeSuggestions int `json:"numberOfTimeSuggestions"` MaximumNonWorkHoursSuggestionsPerDay int `json:"maximumNonWorkHoursSuggestionsPerDay"` MaximumSuggestionsPerDay int `json:"maximumSuggestionsPerDay"` MinimumSuggestionQuality SuggestionQuality `json:"minimumSuggestionQuality"` }
type ExternalID ¶ added in v0.0.19
type FindMeetingTimesRequest ¶
type FindMeetingTimesRequest struct { Attendees []Attendee `json:"attendees"` TimeConstraint TimeConstraint `json:"timeConstraint"` //LocationConstraint LocationConstraint `json:"locationConstraint"` IsOrganizerOptional bool `json:"isOrganizerOptional"` //SuggestedTimeSuggestionExpansion Expansion `json:"suggestedTimeSuggestionExpansion"` MaxCandidates int `json:"maxCandidates"` MeetingDuration string `json:"meetingDuration"` ReturnSuggestionReasons bool `json:"returnSuggestionReasons"` MinimumAttendeePercentage int `json:"minimumAttendeePercentage"` }
type FindMeetingTimesResponse ¶
type FindMeetingTimesResponse struct { MeetingTimeSuggestions []MeetingTimeSuggestion `json:"meetingTimeSuggestions"` EmptySuggestionsReason string `json:"emptySuggestionsReason"` }
type MeResponse ¶
type MeetingTimeSuggestion ¶
type MeetingTimeSuggestion struct { Confidence float32 `json:"confidence"` OrganizerAvailability string `json:"organizerAvailability"` SuggestionReason string `json:"suggestionReason"` AttendeeAvailability []AttendeeAvailability `json:"attendeeAvailability"` MeetingTimeSlot TimeSlot `json:"meetingTimeSlot"` }
type OpenSlot ¶
func FindOpenSlots ¶
type Person ¶
type Person struct { ID uuid.UUID Name string Email string // This is the ID of the person in the external system (e.g. Google, Azure AD). ExternalIDs []ExternalID // This is a flag to indicate if this is the person who is currently logged in. IsSignedOnUser bool // Collection of days associated with this person. Days []Day }
type Segment ¶
type Segment struct { ID uuid.UUID // Description offers more details about the segment's nature. Description string // Start indicates when the segment begins, and it should fall within the encompassing day's duration. Start time.Time // End indicates when the segment concludes, and it should also stay within the day's limits. End time.Time // IsWorkingTime denotes whether the segment represents productive work time or a break. IsWorkingTime bool }
Segment defines a time interval within a day, representing either working or non-working hours.
type SuggestionQuality ¶
type TimeConstraint ¶
type TimeConstraint struct {
Timeslots []TimeSlot `json:"timeslots"`
}
type TimeSlot ¶
type TimeSlot struct { Start DateTimeTimeZone `json:"start"` End DateTimeTimeZone `json:"end"` }