## GetCoAuthorTimeSeries `client.Usage.GetCoAuthorTimeSeries(ctx, body) (*UsageGetCoAuthorTimeSeriesResponse, error)` **post** `/gitpod.v1.UsageService/GetCoAuthorTimeSeries` Gets co-author contribution data as a time series. Use this method to: - Chart AI-assisted commits and line changes over time - Select hourly, daily, weekly, or monthly buckets - Scope co-author insights to a project, user, or team ### Example ```yaml dateRange: startTime: "2024-01-01T00:00:00Z" endTime: "2024-02-01T00:00:00Z" resolution: RESOLUTION_WEEKLY projectId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" ``` ### Parameters - `body UsageGetCoAuthorTimeSeriesParams` - `DateRange param.Field[DateRange]` Date range to query within. - `ProjectID param.Field[string]` Optional project ID to scope results. - `Resolution param.Field[Resolution]` Time resolution for the series data. - `TeamID param.Field[string]` Optional team ID to scope results to a specific team. Mutually exclusive with user_id. - `UserID param.Field[string]` Optional user ID to scope results to a specific user. Mutually exclusive with team_id. ### Returns - `type UsageGetCoAuthorTimeSeriesResponse struct{…}` - `TimeSeries []CoAuthorTimeBucket` Time series of contribution stats, bucketed by the requested resolution. - `AIRatio float64` Ratio of AI-assisted lines added to total lines added (0.0–1.0). - `ByTool []ToolBreakdown` Per-tool breakdown for this bucket. - `Commits string` Number of commits attributed to this tool. - `DistinctAuthors string` Distinct authors who used this tool. - `LinesAdded string` Lines added by this tool. - `LinesRemoved string` Lines removed by this tool. - `Tool CoAuthorTool` The tool these stats are for. - `const CoAuthorToolUnspecified CoAuthorTool = "CO_AUTHOR_TOOL_UNSPECIFIED"` - `const CoAuthorToolNoCoauthor CoAuthorTool = "CO_AUTHOR_TOOL_NO_COAUTHOR"` - `const CoAuthorToolHumanCoauthor CoAuthorTool = "CO_AUTHOR_TOOL_HUMAN_COAUTHOR"` - `const CoAuthorToolOna CoAuthorTool = "CO_AUTHOR_TOOL_ONA"` - `const CoAuthorToolGitHubCopilot CoAuthorTool = "CO_AUTHOR_TOOL_GITHUB_COPILOT"` - `const CoAuthorToolCursor CoAuthorTool = "CO_AUTHOR_TOOL_CURSOR"` - `const CoAuthorToolOther CoAuthorTool = "CO_AUTHOR_TOOL_OTHER"` - `const CoAuthorToolClaude CoAuthorTool = "CO_AUTHOR_TOOL_CLAUDE"` - `const CoAuthorToolCodex CoAuthorTool = "CO_AUTHOR_TOOL_CODEX"` - `DistinctAuthors string` Number of distinct authors (by author_hash) in this bucket. - `StartTime Time` Start of this time bucket. - `TotalCommits string` Total number of commits in this bucket (across all tools). - `TotalLinesAdded string` Total lines added in this bucket (across all tools). - `TotalLinesRemoved string` Total lines removed in this bucket (across all tools). ### Example ```go package main import ( "context" "fmt" "time" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" "github.com/gitpod-io/gitpod-sdk-go/shared" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) response, err := client.Usage.GetCoAuthorTimeSeries(context.TODO(), gitpod.UsageGetCoAuthorTimeSeriesParams{ DateRange: gitpod.F(shared.DateRangeParam{ EndTime: gitpod.F(time.Now()), StartTime: gitpod.F(time.Now()), }), ProjectID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), Resolution: gitpod.F(gitpod.ResolutionWeekly), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.TimeSeries) } ``` #### Response ```json { "timeSeries": [ { "aiRatio": 0, "byTool": [ { "commits": "commits", "distinctAuthors": "distinctAuthors", "linesAdded": "linesAdded", "linesRemoved": "linesRemoved", "tool": "CO_AUTHOR_TOOL_UNSPECIFIED" } ], "distinctAuthors": "distinctAuthors", "startTime": "2019-12-27T18:11:19.117Z", "totalCommits": "totalCommits", "totalLinesAdded": "totalLinesAdded", "totalLinesRemoved": "totalLinesRemoved" } ] } ```