@@ -24,25 +24,25 @@ type APIStats struct {
2424
2525// APIPeriodStats is simplified version of PeriodStats for API responses
2626type APIPeriodStats struct {
27- Period string `json:"period"`
28- StartDate time.Time `json:"start_date"`
29- EndDate time.Time `json:"end_date"`
30- TotalTime float64 `json:"total_time"`
31- TotalLines int `json:"total_lines"`
32- Languages []APILanguageRanking `json:"languages"`
33- Projects []APIProjectRanking `json:"projects"`
34- Editors []APIEditorRanking `json:"editors"`
35- Files []APIFileRanking `json:"top_files"`
36- HourlyActivity []HourlyActivity `json:"hourly_activity"`
37- PeakHour int `json:"peak_hour"`
38- Sessions []APISession `json:"sessions"`
39- SessionCount int `json:"session_count"`
40- FocusScore int `json:"focus_score"`
41- DailyGoals DailyGoals `json:"daily_goals,omitempty"`
27+ Period string `json:"period"`
28+ StartDate time.Time `json:"start_date"`
29+ EndDate time.Time `json:"end_date"`
30+ TotalTime float64 `json:"total_time"`
31+ TotalLines int `json:"total_lines"`
32+ Languages []APILanguageStats `json:"languages"`
33+ Projects []APIProjectStats `json:"projects"`
34+ Editors []APIEditorStats `json:"editors"`
35+ Files []APIFileStats `json:"top_files"`
36+ HourlyActivity []HourlyActivity `json:"hourly_activity"`
37+ PeakHour int `json:"peak_hour"`
38+ Sessions []APISession `json:"sessions"`
39+ SessionCount int `json:"session_count"`
40+ FocusScore int `json:"focus_score"`
41+ DailyGoals DailyGoals `json:"daily_goals,omitempty"`
4242}
4343
44- // APILanguageRanking - simplified language stats
45- type APILanguageRanking struct {
44+ // APILanguageStats - simplified language stats
45+ type APILanguageStats struct {
4646 Name string `json:"name"`
4747 Time float64 `json:"time"`
4848 Lines int `json:"lines"`
@@ -53,8 +53,8 @@ type APILanguageRanking struct {
5353 Trending bool `json:"trending"`
5454}
5555
56- // APIProjectRanking - simplified project stats
57- type APIProjectRanking struct {
56+ // APIProjectStats - simplified project stats
57+ type APIProjectStats struct {
5858 Name string `json:"name"`
5959 Time float64 `json:"time"`
6060 Lines int `json:"lines"`
@@ -65,15 +65,15 @@ type APIProjectRanking struct {
6565 LastActive time.Time `json:"last_active"`
6666}
6767
68- // APIEditorRanking - simplified editor stats
69- type APIEditorRanking struct {
68+ // APIEditorStats - simplified editor stats
69+ type APIEditorStats struct {
7070 Name string `json:"name"`
7171 Time float64 `json:"time"`
7272 PercentTotal float64 `json:"percent_total"`
7373}
7474
75- // APIFileRanking - simplified file stats
76- type APIFileRanking struct {
75+ // APIFileStats - simplified file stats
76+ type APIFileStats struct {
7777 Name string `json:"name"`
7878 Time float64 `json:"time"`
7979 Lines int `json:"lines"`
@@ -83,13 +83,14 @@ type APIFileRanking struct {
8383
8484// APISession - simplified session without full activities array
8585type APISession struct {
86- ID string `json:"id"`
87- StartTime time.Time `json:"start_time"`
88- EndTime time.Time `json:"end_time"`
89- Duration float64 `json:"duration"`
90- Projects []string `json:"projects"`
91- Languages []string `json:"languages,omitempty"` // Top languages used in session
92- IsActive bool `json:"is_active"`
86+ ID string `json:"id"`
87+ StartTime time.Time `json:"start_time"`
88+ EndTime time.Time `json:"end_time"`
89+ Duration float64 `json:"duration"`
90+ Projects []string `json:"projects"`
91+ Languages []string `json:"languages,omitempty"` // Top languages used in session
92+ IsActive bool `json:"is_active"`
93+ BreakAfter float64 `json:"break_after,omitempty"` // Duration until next session
9394}
9495
9596type APIComparisonResult struct {
@@ -173,10 +174,10 @@ func convertPeriodToAPILight(p PeriodStats) APIPeriodStats {
173174}
174175
175176// convertLanguagesToAPI simplifies language stats
176- func convertLanguagesToAPI (langs []LanguageStats ) []APILanguageRanking {
177- result := make ([]APILanguageRanking , len (langs ))
177+ func convertLanguagesToAPI (langs []LanguageStats ) []APILanguageStats {
178+ result := make ([]APILanguageStats , len (langs ))
178179 for i , l := range langs {
179- result [i ] = APILanguageRanking {
180+ result [i ] = APILanguageStats {
180181 Name : l .Name ,
181182 Time : l .Time ,
182183 Lines : l .Lines ,
@@ -190,10 +191,10 @@ func convertLanguagesToAPI(langs []LanguageStats) []APILanguageRanking {
190191}
191192
192193// convertProjectsToAPI simplifies project stats
193- func convertProjectsToAPI (projs []ProjectStats ) []APIProjectRanking {
194- result := make ([]APIProjectRanking , len (projs ))
194+ func convertProjectsToAPI (projs []ProjectStats ) []APIProjectStats {
195+ result := make ([]APIProjectStats , len (projs ))
195196 for i , p := range projs {
196- result [i ] = APIProjectRanking {
197+ result [i ] = APIProjectStats {
197198 Name : p .Name ,
198199 Time : p .Time ,
199200 Lines : p .Lines ,
@@ -207,10 +208,10 @@ func convertProjectsToAPI(projs []ProjectStats) []APIProjectRanking {
207208}
208209
209210// convertEditorsToAPI simplifies editor stats
210- func convertEditorsToAPI (eds []EditorStats ) []APIEditorRanking {
211- result := make ([]APIEditorRanking , len (eds ))
211+ func convertEditorsToAPI (eds []EditorStats ) []APIEditorStats {
212+ result := make ([]APIEditorStats , len (eds ))
212213 for i , e := range eds {
213- result [i ] = APIEditorRanking {
214+ result [i ] = APIEditorStats {
214215 Name : e .Name ,
215216 Time : e .Time ,
216217 }
@@ -219,10 +220,10 @@ func convertEditorsToAPI(eds []EditorStats) []APIEditorRanking {
219220}
220221
221222// convertFilesToAPI simplifies file stats
222- func convertFilesToAPI (files []FileStats ) []APIFileRanking {
223- result := make ([]APIFileRanking , len (files ))
223+ func convertFilesToAPI (files []FileStats ) []APIFileStats {
224+ result := make ([]APIFileStats , len (files ))
224225 for i , f := range files {
225- result [i ] = APIFileRanking {
226+ result [i ] = APIFileStats {
226227 Name : f .Name ,
227228 Time : f .Time ,
228229 Lines : f .Lines ,
@@ -237,13 +238,14 @@ func convertSessionsToAPI(sessions []Session) []APISession {
237238
238239 for i , s := range sessions {
239240 result [i ] = APISession {
240- ID : s .ID ,
241- StartTime : s .StartTime ,
242- EndTime : s .EndTime ,
243- Duration : s .Duration ,
244- Projects : append ([]string (nil ), s .Projects ... ),
245- Languages : append ([]string (nil ), s .Languages ... ),
246- IsActive : s .IsActive ,
241+ ID : s .ID ,
242+ StartTime : s .StartTime ,
243+ EndTime : s .EndTime ,
244+ Duration : s .Duration ,
245+ Projects : append ([]string (nil ), s .Projects ... ),
246+ Languages : append ([]string (nil ), s .Languages ... ),
247+ IsActive : s .IsActive ,
248+ BreakAfter : s .BreakAfter ,
247249 }
248250 }
249251
0 commit comments