···66 "os"
77 "runtime"
88 "strings"
99+ "time"
9101011 "github.com/spf13/cobra"
1112 "github.com/taciturnaxolotl/akami/styles"
···105106 c.Println("\nSending one quick heartbeat to make sure everything is ship shape and then you should be good to go!")
106107107108 err = client.SendHeartbeat(wakatime.Heartbeat{
108108- Entity: "/home/kierank/Projects/akami/wakatime/main.go",
109109- Type: "file",
110110- Project: "akami",
111111- Language: "Go",
112109 Branch: "main",
113110 Category: "coding",
111111+ CursorPos: 1,
112112+ Entity: user_dir + "/akami.txt",
113113+ Type: "file",
114114 IsWrite: true,
115115- LineCount: 197,
116116- ProjectRootCount: 5,
117117- Dependencies: []string{"bytes", "encoding/base64", "encoding/json", "net/http", "runtime", "time"},
118118- Time: 1750643351,
115115+ Language: "Go",
116116+ LineNo: 1,
117117+ LineCount: 4,
118118+ Project: "example",
119119+ ProjectRootCount: 3,
120120+ Time: float64(time.Now().Unix()),
119121 })
120122 if err != nil {
121123 return errors.New("oh dear; looks like something went wrong when sending that heartbeat. " + styles.Bad.Render("Full error: \""+strings.TrimSpace(err.Error())+"\""))
+5-1
wakatime/main.go
···8787 Category string `json:"category,omitempty"`
8888 // LineCount is the optional number of lines in the file
8989 LineCount int `json:"lines,omitempty"`
9090+ // LineNo is the current line number
9191+ LineNo int `json:"lineno,omitempty"`
9292+ // CursorPos is the current column of text the cursor is on
9393+ CursorPos int `json:"cursorpos,omitempty"`
9094 // UserAgent is the optional user agent string
9195 UserAgent string `json:"user_agent,omitempty"`
9296 // EntityType is the optional entity type (usually redundant with Type)
···127131 return fmt.Errorf("%w: %v", ErrMarshalingHeartbeat, err)
128132 }
129133130130- req, err := http.NewRequest("POST", c.APIURL+"/users/current/heartbeats", bytes.NewBuffer(data))
134134+ req, err := http.NewRequest("GET", fmt.Sprintf("%s/users/current/statusbar/today", c.APIURL), bytes.NewBuffer(data))
131135 if err != nil {
132136 return fmt.Errorf("%w: %v", ErrCreatingRequest, err)
133137 }