fileexperts

package
v1.90.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

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 Validate added in v1.78.0

func Validate(h heartbeat.Heartbeat) bool

Validate validates if required fields are not empty.

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(hh []heartbeat.Heartbeat) ([]heartbeat.Result, error)
}

Caller calls wakatime api to get the file expert.

type Data

type Data struct {
	Total Total `json:"total"`
	User  User  `json:"user"`
}

Data contains the file experts data.

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.

type Total

type Total struct {
	Decimal      string  `json:"decimal"`
	Digital      string  `json:"digital"`
	Text         string  `json:"text"`
	TotalSeconds float64 `json:"total_seconds"`
}

Total contains the total time spent on a file.

type User

type User struct {
	ID            string `json:"id"`
	IsCurrentUser bool   `json:"is_current_user"`
	LongName      string `json:"long_name"`
	Name          string `json:"name"`
}

User contains the user information.

Jump to

Keyboard shortcuts

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