Documentation ¶
Index ¶
- func NewHandle(caller Caller, opts ...heartbeat.HandleOption) heartbeat.Handle
- func RenderFileExperts(d *FileExperts, out output.Output) (string, error)
- func Validate(h heartbeat.Heartbeat) bool
- func WithValidation() heartbeat.HandleOption
- type Caller
- type Data
- type Entity
- type FileExperts
- type Total
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandle ¶
func NewHandle(caller Caller, opts ...heartbeat.HandleOption) heartbeat.Handle
NewHandle creates a new Handle, which acts like a processing pipeline, with a caller eventually requesting the API.
func RenderFileExperts ¶
func RenderFileExperts(d *FileExperts, out output.Output) (string, error)
RenderFileExperts generates a text representation from file experts of the current day. If out is set to output.RawJSONOutput or output.JSONOutput, the response will be marshaled to JSON. Expects an array of users for the current day. Will return an error otherwise.
func WithValidation ¶ added in v1.78.0
func WithValidation() heartbeat.HandleOption
WithValidation initializes and returns a heartbeat handle option, which can be used in a heartbeat processing pipeline to validate the heartbeat before sending it to the API.
Types ¶
type Caller ¶
type Caller interface {
FileExperts(context.Context, []heartbeat.Heartbeat) ([]heartbeat.Result, error)
}
Caller calls wakatime api to get the file expert.
type Entity ¶
type Entity struct { Filepath string `json:"entity"` Project *string `json:"project"` ProjectRootCount *int `json:"project_root_count"` }
Entity contains the request for the file-expert endpoint.
type FileExperts ¶
type FileExperts struct {
Data []Data `json:"data"`
}
FileExperts contains the response for the file_expert endpoint.