insights

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivitiesContext

type ActivitiesContext struct {
	Activities []intervals.Activity `json:"activities"`
}

type ActivityArgs

type ActivityArgs struct {
	ID               string `json:"id" jsonschema:"Intervals.icu activity id."`
	IncludeIntervals bool   `json:"include_intervals,omitempty" jsonschema:"Whether to include interval data for the activity."`
}

type CalendarArgs

type CalendarArgs struct {
	Oldest     string   `json:"oldest,omitempty" jsonschema:"Optional local start date. Defaults to today."`
	Newest     string   `json:"newest,omitempty" jsonschema:"Optional local end date. Defaults to seven days from oldest."`
	Categories []string `json:"categories,omitempty" jsonschema:"Optional Intervals event categories, for example WORKOUT or NOTES."`
}

type CalendarContext

type CalendarContext struct {
	Oldest string            `json:"oldest"`
	Newest string            `json:"newest"`
	Events []intervals.Event `json:"events"`
}

type FetchArgs

type FetchArgs struct {
	ID string `json:"id" jsonschema:"A record id returned by search, such as activity:abc, recovery:2026-06-01, or event:123."`
}

type FetchResult

type FetchResult struct {
	ID     string `json:"id"`
	Title  string `json:"title"`
	Text   string `json:"text"`
	Record any    `json:"record,omitempty"`
}

type IntervalsClient

type IntervalsClient interface {
	GetAthlete(context.Context) (*intervals.Athlete, error)
	ListActivities(context.Context, string, string, int) ([]intervals.Activity, error)
	GetActivity(context.Context, string, bool) (*intervals.Activity, error)
	GetWellness(context.Context, string) (*intervals.Wellness, error)
	GetAthleteSummary(context.Context, string, string) ([]intervals.Summary, error)
	ListEvents(context.Context, string, string, []string, int) ([]intervals.Event, error)
	GetEvent(context.Context, int) (*intervals.Event, error)
}

type NutritionContext

type NutritionContext struct {
	TotalCaloriesBurned       int    `json:"total_calories_burned,omitempty"`
	TotalCarbsUsedGrams       int    `json:"total_carbs_used_grams,omitempty"`
	TotalCarbsIngestedGrams   int    `json:"total_carbs_ingested_grams,omitempty"`
	NetCarbsUsedEstimateGrams int    `json:"net_carbs_used_estimate_grams,omitempty"`
	TotalTrainingLoad         int    `json:"total_training_load,omitempty"`
	Context                   string `json:"context"`
}

type RecentActivitiesArgs

type RecentActivitiesArgs struct {
	Oldest string `json:"oldest,omitempty" jsonschema:"Optional local start date or datetime. Defaults to 14 days ago."`
	Newest string `json:"newest,omitempty" jsonschema:"Optional local end date or datetime. Defaults to today."`
	Limit  int    `json:"limit,omitempty" jsonschema:"Maximum number of activities to return. Defaults to 10, max 50."`
}

type RecoveryArgs

type RecoveryArgs struct {
	Date string `json:"date,omitempty" jsonschema:"Optional local date in YYYY-MM-DD format. Defaults to today in the athlete timezone."`
}

type RecoveryContext

type RecoveryContext struct {
	Date     string              `json:"date"`
	Recovery *intervals.Wellness `json:"recovery,omitempty"`
	Summary  *intervals.Summary  `json:"summary,omitempty"`
	Notes    []string            `json:"notes,omitempty"`
}

type SearchArgs

type SearchArgs struct {
	Query string `` /* 129-byte string literal not displayed */
}

type SearchRecord

type SearchRecord struct {
	ID       string `json:"id"`
	Title    string `json:"title"`
	Text     string `json:"text"`
	Date     string `json:"date,omitempty"`
	Kind     string `json:"kind"`
	Metadata any    `json:"metadata,omitempty"`
}

type SearchResult

type SearchResult struct {
	Query   string         `json:"query,omitempty"`
	Results []SearchRecord `json:"results"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(client IntervalsClient) *Service

func (*Service) Activity

func (s *Service) Activity(ctx context.Context, args ActivityArgs) (*intervals.Activity, error)

func (*Service) Calendar

func (s *Service) Calendar(ctx context.Context, args CalendarArgs) (CalendarContext, error)

func (*Service) Fetch

func (s *Service) Fetch(ctx context.Context, args FetchArgs) (FetchResult, error)

func (*Service) RecentActivities

func (s *Service) RecentActivities(ctx context.Context, args RecentActivitiesArgs) (ActivitiesContext, error)

func (*Service) Recovery

func (s *Service) Recovery(ctx context.Context, args RecoveryArgs) (RecoveryContext, error)

func (*Service) Search

func (s *Service) Search(ctx context.Context, args SearchArgs) (SearchResult, error)

func (*Service) TodayContext

func (s *Service) TodayContext(ctx context.Context, args TodayArgs) (TodayContext, error)

type TodayArgs

type TodayArgs struct {
	Date string `json:"date,omitempty" jsonschema:"Optional local date in YYYY-MM-DD format. Defaults to today in the athlete timezone."`
}

type TodayContext

type TodayContext struct {
	Date          string               `json:"date"`
	Timezone      string               `json:"timezone,omitempty"`
	Athlete       *intervals.Athlete   `json:"athlete,omitempty"`
	Recovery      *intervals.Wellness  `json:"recovery,omitempty"`
	Summary       *intervals.Summary   `json:"summary,omitempty"`
	Activities    []intervals.Activity `json:"activities"`
	LastActivity  *intervals.Activity  `json:"last_activity,omitempty"`
	PlannedEvents []intervals.Event    `json:"planned_events"`
	Nutrition     NutritionContext     `json:"nutrition_context"`
	Notes         []string             `json:"notes,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL