Documentation ¶
Index ¶
- Constants
- func Bool(v bool) *bool
- func Int64(v int64) *int64
- func String(v string) *string
- type BestDay
- type ChartData
- type Client
- type Commit
- type CommitService
- type CommitsQuery
- type CommitsResponse
- type DurationService
- type DurationsData
- type DurationsQuery
- type DurationsResponse
- type GoalsData
- type GoalsQuery
- type GoalsResponse
- type GoalsService
- type Machine
- type Machines
- type Project
- type ProjectsQuery
- type ProjectsResponse
- type ProjectsService
- type Query
- type RangeData
- type Repository
- type StatItem
- type StatService
- type StatsData
- type StatsQuery
- type StatsResponse
- type Subscribers
- type TimeRange
- type UserAgentsData
- type UserAgentsQuery
- type UserAgentsResponse
- type UserAgentsService
- type UsersData
- type UsersQuery
- type UsersResponse
- type UsersService
Constants ¶
const (
// APIBase is the URL prefix for the wakatime API
APIBase = "https://wakatime.com/api/v1/"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BestDay ¶
type BestDay struct { CreatedAt *time.Time `json:"created_at,omitempty"` Date *string `json:"date,omitempty"` ID *string `json:"id,omitempty"` ModifiedAt *time.Time `json:"modified_at,omitempty"` Text *string `json:"text,omitempty"` TotalSeconds *float64 `json:"total_seconds,omitempty"` }
BestDay is the day with most coding time.
type ChartData ¶
type ChartData struct { ActualSeconds *float64 `json:"actual_seconds,omitempty"` ActualSecondsText *string `json:"actual_seconds_text,omitempty"` GoalSeconds *int `json:"goal_seconds,omitempty"` GoalSecondsText *string `json:"goal_seconds_text,omitempty"` Range *RangeData `json:"range,omitempty"` }
ChartData defines the data of the Chart of the GoalsData
type Client ¶
type Client struct { Commits *CommitService Durations *DurationService Goals *GoalsService Projects *ProjectsService Stats *StatService UserAgents *UserAgentsService Users *UsersService // contains filtered or unexported fields }
Client defines the wakatime Client.
type Commit ¶
type Commit struct { AuthorAvatarURL *string `json:"author_avatar_url,omitempty"` AuthorDate *time.Time `json:"author_date,omitempty"` AuthorEmail *string `json:"author_email,omitempty"` AuthorHTMLURL *string `json:"author_html_url,omitempty"` AuthorID *string `json:"author_id,omitempty"` AuthorName *string `json:"author_name,omitempty"` AuthorURL *string `json:"author_url,omitempty"` AuthorUsername *string `json:"author_username,omitempty"` Branch *string `json:"branch,omitempty"` CommitterAvatarURL *string `json:"committer_avatar_url,omitempty"` CommitterDate *time.Time `json:"committer_date,omitempty"` CommitterEmail *string `json:"committer_email,omitempty"` CommitterHTMLURL *string `json:"committer_html_url,omitempty"` CommitterName *string `json:"committer_name,omitempty"` CommitterURL *string `json:"committer_url,omitempty"` CommitterUsername *string `json:"committer_username,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` Hash *string `json:"hash,omitempty"` HTMLURL *string `json:"html_url,omitempty"` HumanReadableDate *string `json:"human_readable_date,omitempty"` HumanReadableNaturalDate *string `json:"human_readable_natural_date,omitempty"` HumanReadableTotal *string `json:"human_readable_total,omitempty"` HumanReadableTotalWithSeconds *string `json:"human_readable_total_with_seconds,omitempty"` ID *string `json:"id,omitempty"` Message *string `json:"message,omitempty"` Ref *string `json:"ref,omitempty"` TotalSeconds *int64 `json:"total_seconds,omitempty"` TruncatedHash *string `json:"truncated_hash,omitempty"` URL *string `json:"url,omitempty"` }
Commit defines the commit data of the commits API response.
type CommitService ¶
type CommitService service
CommitService defines endpoint of the commits API. List of commits for a WakaTime project showing the time spent coding in each commit.
func (*CommitService) Current ¶
func (d *CommitService) Current(ctx context.Context, projectID string, query *CommitsQuery) (*CommitsResponse, error)
Current do the request of the commits API with current user.
func (*CommitService) User ¶
func (d *CommitService) User(ctx context.Context, userID, projectID string, query *CommitsQuery) (*CommitsResponse, error)
User do the request of the commits API with the given user.
type CommitsQuery ¶
CommitsQuery defines the query of the commits API.
type CommitsResponse ¶
type CommitsResponse struct { Author *string `json:"author,omitempty"` Commits []*Commit `json:"commits,omitempty"` NextPage *int64 `json:"next_page,omitempty"` NextPageURL *string `json:"next_page_url,omitempty"` Page int `json:"page,omitempty"` PrevPage *int64 `json:"prev_page,omitempty"` PrevPageURL *string `json:"prev_page_url,omitempty"` Project *Project `json:"project,omitempty"` Status *string `json:"status,omitempty"` TotalPages int `json:"total_pages,omitempty"` }
CommitsResponse defines the response of the commits API. see https://wakatime.com/developers#commits for more information.
type DurationService ¶
type DurationService service
DurationService defines endpoint of the durations API. A user's coding activity for the given day as an array of durations.
func (*DurationService) Current ¶
func (d *DurationService) Current(ctx context.Context, query *DurationsQuery) (*DurationsResponse, error)
Current do the request of the durations API with current user.
func (*DurationService) User ¶
func (d *DurationService) User(ctx context.Context, userID string, query *DurationsQuery) (*DurationsResponse, error)
User do the request of the durations API with the given user.
type DurationsData ¶
type DurationsData struct { CreatedAt *time.Time `json:"created_at,omitempty"` Cursorpos *int64 `json:"cursorpos,omitempty"` Duration *float64 `json:"duration,omitempty"` ID *string `json:"id,omitempty"` Lineno *int64 `json:"lineno,omitempty"` MachineNameID *string `json:"machine_name_id,omitempty"` Project *string `json:"project,omitempty"` Time *float64 `json:"time,omitempty"` UserID *string `json:"user_id,omitempty"` }
DurationsData defines the data of the DurationsResponse.
type DurationsQuery ¶
type DurationsQuery struct { Date *string `query:"date"` Project *string `query:"project"` Branches *string `query:"branches"` Timeouts *string `query:"timeouts"` WritesOnly *bool `query:"writes_only"` }
DurationsQuery defines the query of the durations API.
type DurationsResponse ¶
type DurationsResponse struct { Branches []*string `json:"branches,omitempty"` Data []*DurationsData `json:"data,omitempty"` End *time.Time `json:"end,omitempty"` Start *time.Time `json:"start,omitempty"` Timezone *string `json:"timezone,omitempty"` }
DurationsResponse defines the response of the durations API. see https://wakatime.com/developers#durations for more information.
type GoalsData ¶
type GoalsData struct { AverageStatus *string `json:"average_status,omitempty"` ChartData *ChartData `json:"chart_data,omitempty"` CumulativeStatus *string `json:"cumulative_status,omitempty"` Delta *string `json:"delta,omitempty"` ID *string `json:"id,omitempty"` IgnoreDays []*string `json:"ignore_days,omitempty"` ImproveByPercent *float64 `json:"improve_by_percent,omitempty"` IsEnabled *bool `json:"is_enabled,omitempty"` Languages []*string `json:"languages,omitempty"` Projects []*string `json:"projects,omitempty"` RangeText *string `json:"range_text,omitempty"` Seconds *int `json:"seconds,omitempty"` Status *string `json:"status,omitempty"` Subscribers []*Subscribers `json:"subscribers,omitempty"` Title *string `json:"title,omitempty"` Type *string `json:"type,omitempty"` }
GoalsData defines the data of the GoalsResponse.
type GoalsResponse ¶
type GoalsResponse struct { Data []*GoalsData `json:"data,omitempty"` Total *int `json:"total,omitempty"` TotalPages *int `json:"total_pages,omitempty"` }
GoalsResponse defines the response of the Goals API. see https://wakatime.com/developers#Goals for more information.
type GoalsService ¶
type GoalsService service
GoalsService defines endpoint of the Goals API. A user's coding activity for the given day as an array of Goals.
func (*GoalsService) Current ¶
func (g *GoalsService) Current(ctx context.Context, query *GoalsQuery) (*GoalsResponse, error)
Current do the request of the goals API with current user.
func (*GoalsService) User ¶
func (g *GoalsService) User(ctx context.Context, userID string, query *GoalsQuery) (*GoalsResponse, error)
User do the request of the Goals API with the given user.
type Machine ¶
type Machine struct { CreatedAt *time.Time `json:"created_at,omitempty"` ID *string `json:"id,omitempty"` IP *string `json:"ip,omitempty"` LastSeenAt *time.Time `json:"last_seen_at,omitempty"` Name *string `json:"name,omitempty"` Value *string `json:"value,omitempty"` }
Machine is the details of machine.
type Machines ¶
type Machines struct { Digital *string `json:"digital,omitempty"` Hours *int64 `json:"hours,omitempty"` Machine *Machine `json:"machine,omitempty"` Minutes *int64 `json:"minutes,omitempty"` Name *string `json:"name,omitempty"` Percent *float64 `json:"percent,omitempty"` Text *string `json:"text,omitempty"` TotalSeconds *float64 `json:"total_seconds,omitempty"` }
Machines is the stats for machines.
type Project ¶
type Project struct { CreatedAt *time.Time `json:"created_at,omitempty"` HasPublicURL *bool `json:"has_public_url,omitempty"` HTMLEscapedName *string `json:"html_escaped_name,omitempty"` HumanReadableLastHeartbeatAt *string `json:"human_readable_last_heartbeat_at,omitempty"` ID *string `json:"id,omitempty"` LastHeartbeatAt *time.Time `json:"last_heartbeat_at,omitempty"` Name *string `json:"name,omitempty"` Repository *Repository `json:"repository,omitempty"` URL *string `json:"url,omitempty"` }
Project is the project of the commit.
type ProjectsQuery ¶
type ProjectsQuery struct{}
ProjectsQuery defines the query of the Projects API.
type ProjectsResponse ¶
type ProjectsResponse struct {
Data []Project `json:"data,omitempty"`
}
ProjectsResponse defines the response of the Projects API. see https://wakatime.com/developers#Projects for more information.
type ProjectsService ¶
type ProjectsService service
ProjectsService defines endpoint of the Projects API. List of WakaTime projects for a user.
func (*ProjectsService) Current ¶
func (p *ProjectsService) Current(ctx context.Context, query *ProjectsQuery) (*ProjectsResponse, error)
Current do the request of the Projects API with current user.
func (*ProjectsService) User ¶
func (p *ProjectsService) User(ctx context.Context, userID string, query *ProjectsQuery) (*ProjectsResponse, error)
User do the request of the Projects API with the given user.
type RangeData ¶
type RangeData struct { Date *string `json:"date,omitempty"` End *string `json:"end,omitempty"` Start *string `json:"start,omitempty"` Text *string `json:"text,omitempty"` Timezone *string `json:"timezone,omitempty"` }
RangeData defines the Range of the ChartData
type Repository ¶
type Repository struct { Badge *string `json:"badge,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` DefaultBranch *string `json:"default_branch,omitempty"` Description *string `json:"description,omitempty"` ForkCount *int64 `json:"fork_count,omitempty"` FullName *string `json:"full_name,omitempty"` Homepage *string `json:"homepage,omitempty"` HTMLURL *string `json:"html_url,omitempty"` ID *string `json:"id,omitempty"` ImageIconURL *string `json:"image_icon_url,omitempty"` IsFork *bool `json:"is_fork,omitempty"` IsPrivate *bool `json:"is_private,omitempty"` LastSyncedAt *string `json:"last_synced_at,omitempty"` ModifiedAt *time.Time `json:"modified_at,omitempty"` Name *string `json:"name,omitempty"` Provider *string `json:"provider,omitempty"` StarCount *int64 `json:"star_count,omitempty"` URL *string `json:"url,omitempty"` WakatimeProjectName *string `json:"wakatime_project_name,omitempty"` WatchCount *int64 `json:"watch_count,omitempty"` }
Repository is the repository of the project.
type StatItem ¶
type StatItem struct { Digital *string `json:"digital,omitempty"` Hours *int64 `json:"hours,omitempty"` Minutes *int64 `json:"minutes,omitempty"` Name *string `json:"name,omitempty"` Percent *float64 `json:"percent,omitempty"` Text *string `json:"text,omitempty"` TotalSeconds *float64 `json:"total_seconds,omitempty"` }
StatItem is the item for a stat.
type StatService ¶
type StatService service
StatService defines endpoint of the durations API. A user's coding activity for the given time range.
func (*StatService) Current ¶
func (d *StatService) Current(ctx context.Context, timeRange TimeRange, query *StatsQuery) (*StatsResponse, error)
Current do the request of the durations API with current user.
func (*StatService) User ¶
func (d *StatService) User(ctx context.Context, userID string, timeRange TimeRange, query *StatsQuery) (*StatsResponse, error)
User do the request of the durations API with the given user.
type StatsData ¶
type StatsData struct { BestDay *BestDay `json:"best_day,omitempty"` Categories []*StatItem `json:"categories,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` DailyAverage *float64 `json:"daily_average,omitempty"` DailyAverageIncludingOtherLanguage *float64 `json:"daily_average_including_other_language,omitempty"` DaysIncludingHolidays *int64 `json:"days_including_holidays,omitempty"` DaysMinusHolidays *int64 `json:"days_minus_holidays,omitempty"` Dependencies []interface{} `json:"dependencies,omitempty"` Editors []*StatItem `json:"editors,omitempty"` End *time.Time `json:"end,omitempty"` Holidays *int64 `json:"holidays,omitempty"` HumanReadableDailyAverage *string `json:"human_readable_daily_average,omitempty"` HumanReadableDailyAverageIncludingOtherLanguage *string `json:"human_readable_daily_average_including_other_language,omitempty"` HumanReadableTotal *string `json:"human_readable_total,omitempty"` HumanReadableTotalIncludingOtherLanguage *string `json:"human_readable_total_including_other_language,omitempty"` ID *string `json:"id,omitempty"` IsAlreadyUpdating *bool `json:"is_already_updating,omitempty"` IsCodingActivityVisible *bool `json:"is_coding_activity_visible,omitempty"` IsIncludingToday *bool `json:"is_including_today,omitempty"` IsOtherUsageVisible *bool `json:"is_other_usage_visible,omitempty"` IsStuck *bool `json:"is_stuck,omitempty"` IsUpToDate *bool `json:"is_up_to_date,omitempty"` Languages []StatItem `json:"languages,omitempty"` Machines []Machines `json:"machines,omitempty"` ModifiedAt *time.Time `json:"modified_at,omitempty"` OperatingSystems []*StatItem `json:"operating_systems,omitempty"` Project *interface{} `json:"project,omitempty"` Projects []*StatItem `json:"projects,omitempty"` Range *string `json:"range,omitempty"` Start *time.Time `json:"start,omitempty"` Status *string `json:"status,omitempty"` Timeout *int64 `json:"timeout,omitempty"` Timezone *string `json:"timezone,omitempty"` TotalSeconds *float64 `json:"total_seconds,omitempty"` TotalSecondsIncludingOtherLanguage *float64 `json:"total_seconds_including_other_language,omitempty"` UserID *string `json:"user_id,omitempty"` Username *string `json:"username,omitempty"` WritesOnly *bool `json:"writes_only,omitempty"` }
StatsData defines the data of stats API response.
type StatsQuery ¶
type StatsQuery struct { Timeout *int64 `query:"timeout"` WritesOnly *bool `query:"writes_only"` Project *string `query:"project"` }
StatsQuery defines query of the stats API.
type StatsResponse ¶
type StatsResponse struct {
Data StatsData `json:"data,omitempty"`
}
StatsResponse defines the response of the stats API.
type Subscribers ¶
type Subscribers struct { Email *string `json:"email,omitempty"` EmailFrequency *string `json:"email_frequency,omitempty"` FullName *string `json:"full_name,omitempty"` UserID *string `json:"user_id,omitempty"` Username *string `json:"username,omitempty"` }
Subscribers defines the Subscribers of the GoalsData
type TimeRange ¶
type TimeRange string
TimeRange defines the string type of time range.
const ( // RangeLast7Days is the range of last 7 days RangeLast7Days TimeRange = "last_7_days" // RangeLast30Days is the range of last 30 days RangeLast30Days TimeRange = "last_30_days" // RangeLast6Months is the range of last 6 months RangeLast6Months TimeRange = "last_6_months" // RangeLastYear is the range of last year RangeLastYear TimeRange = "last_year" )
type UserAgentsData ¶
type UserAgentsData struct { ID *string `json:"id,omitempty"` Value *string `json:"value,omitempty"` Editor *string `json:"editor,omitempty"` Version *string `json:"version,omitempty"` OS *string `json:"os,omitempty"` LastSeen *string `json:"last_seen,omitempty"` CreatedAt *string `json:"created_at,omitempty"` }
UserAgentsData defines the data of the UserAgentsResponse.
type UserAgentsQuery ¶
type UserAgentsQuery struct { }
UserAgentsQuery defines the query of the userAgents API.
type UserAgentsResponse ¶
type UserAgentsResponse struct {
Data *[]UserAgentsData `json:"data,omitempty"`
}
UserAgentsResponse defines the response of the userAgents API. see https://wakatime.com/developers#userAgents for more information.
type UserAgentsService ¶
type UserAgentsService service
UserAgentsService defines endpoint of the useragents API. A single user's profile information
func (*UserAgentsService) Current ¶
func (u *UserAgentsService) Current(ctx context.Context, query *UserAgentsQuery) (*UserAgentsResponse, error)
Current do the request of the UserAgents API with current user.
func (*UserAgentsService) User ¶
func (u *UserAgentsService) User(ctx context.Context, userID string, query *UserAgentsQuery) (*UserAgentsResponse, error)
User do the request of the UserAgents API with the given user.
type UsersData ¶
type UsersData struct { ID *string `json:"id,omitempty"` HasPremiumFeatures *bool `json:"has_premium_features,omitempty"` DisplayName *string `json:"display_name,omitempty"` FullName *string `json:"full_name,omitempty"` Email *string `json:"email,omitempty"` Photo *string `json:"photo,omitempty"` IsEmailPublic *bool `json:"is_email_public,omitempty"` IsEmailConfirmed *bool `json:"is_email_confirmed,omitempty"` PublicEmail *string `json:"public_email,omitempty"` PhotoPublic *bool `json:"photo_public,omitempty"` Timezone *string `json:"timezone,omitempty"` LastHeartbeatAt *string `json:"last_heartbeat_at,omitempty"` LastPlugin *string `json:"last_plugin,omitempty"` LastPluginName *string `json:"last_plugin_name,omitempty"` LastProject *string `json:"last_project,omitempty"` Plan *string `json:"plan,omitempty"` Username *string `json:"username,omitempty"` Website *string `json:"website,omitempty"` HumanReadableWebsite *string `json:"human_readable_website,omitempty"` Location *string `json:"location,omitempty"` LoggedTimePublic *bool `json:"logged_time_public,omitempty"` LanguagesUsedPublic *bool `json:"languages_used_public,omitempty"` IsHireable *bool `json:"is_hireable,omitempty"` CreatedAt *string `json:"created_at,omitempty"` ModifiedAt *string `json:"modified_at,omitempty"` }
UsersData defines the data of the UsersResponse.
type UsersResponse ¶
type UsersResponse struct {
Data *UsersData `json:"data,omitempty"`
}
UsersResponse defines the response of the users API. see https://wakatime.com/developers#users for more information.
type UsersService ¶
type UsersService service
UsersService defines endpoint of the users API. A single user's profile information
func (*UsersService) Current ¶
func (u *UsersService) Current(ctx context.Context, query *UsersQuery) (*UsersResponse, error)
Current do the request of the Users API with current user.
func (*UsersService) User ¶
func (u *UsersService) User(ctx context.Context, userID string, query *UsersQuery) (*UsersResponse, error)
User do the request of the Users API with the given user.