Documentation ¶
Index ¶
- Constants
- func Bool(v bool) *bool
- func Int64(v int64) *int64
- func String(v string) *string
- type BestDay
- type Client
- type Commit
- type CommitService
- type CommitsQuery
- type CommitsResponse
- type DurationService
- type DurationsData
- type DurationsQuery
- type DurationsResponse
- type Machine
- type Machines
- type Project
- type Query
- type Repository
- type StatItem
- type StatService
- type StatsData
- type StatsQuery
- type StatsResponse
- type TimeRange
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 Client ¶
type Client struct { Commits *CommitService Durations *DurationService Stats *StatService // 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 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 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 *int64 `json:"daily_average,omitempty"` DailyAverageIncludingOtherLanguage *int64 `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 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" )