Skip to content
Ona Docs

GetCoAuthorTimeSeries

usage.get_co_author_time_series(UsageGetCoAuthorTimeSeriesParams**kwargs) -> UsageGetCoAuthorTimeSeriesResponse
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

dateRange:
  startTime: "2024-01-01T00:00:00Z"
  endTime: "2024-02-01T00:00:00Z"
resolution: RESOLUTION_WEEKLY
projectId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
ParametersExpand Collapse
date_range: DateRange

Date range to query within.

end_time: datetime

End time of the date range (exclusive).

formatdate-time
start_time: datetime

Start time of the date range (inclusive).

formatdate-time
project_id: Optional[str]

Optional project ID to scope results.

resolution: Optional[Resolution]

Time resolution for the series data.

One of the following:
"RESOLUTION_UNSPECIFIED"
"RESOLUTION_HOURLY"
"RESOLUTION_DAILY"
"RESOLUTION_WEEKLY"
"RESOLUTION_MONTHLY"
team_id: Optional[str]

Optional team ID to scope results to a specific team. Mutually exclusive with user_id.

user_id: Optional[str]

Optional user ID to scope results to a specific user. Mutually exclusive with team_id.

ReturnsExpand Collapse
class UsageGetCoAuthorTimeSeriesResponse:
time_series: Optional[List[CoAuthorTimeBucket]]

Time series of contribution stats, bucketed by the requested resolution.

ai_ratio: Optional[float]

Ratio of AI-assisted lines added to total lines added (0.0–1.0).

formatdouble
by_tool: Optional[List[ToolBreakdown]]

Per-tool breakdown for this bucket.

commits: Optional[str]

Number of commits attributed to this tool.

distinct_authors: Optional[str]

Distinct authors who used this tool.

lines_added: Optional[str]

Lines added by this tool.

lines_removed: Optional[str]

Lines removed by this tool.

tool: Optional[CoAuthorTool]

The tool these stats are for.

One of the following:
"CO_AUTHOR_TOOL_UNSPECIFIED"
"CO_AUTHOR_TOOL_NO_COAUTHOR"
"CO_AUTHOR_TOOL_HUMAN_COAUTHOR"
"CO_AUTHOR_TOOL_ONA"
"CO_AUTHOR_TOOL_GITHUB_COPILOT"
"CO_AUTHOR_TOOL_CURSOR"
"CO_AUTHOR_TOOL_OTHER"
"CO_AUTHOR_TOOL_CLAUDE"
"CO_AUTHOR_TOOL_CODEX"
distinct_authors: Optional[str]

Number of distinct authors (by author_hash) in this bucket.

start_time: Optional[datetime]

Start of this time bucket.

formatdate-time
total_commits: Optional[str]

Total number of commits in this bucket (across all tools).

total_lines_added: Optional[str]

Total lines added in this bucket (across all tools).

total_lines_removed: Optional[str]

Total lines removed in this bucket (across all tools).

GetCoAuthorTimeSeries

import os
from datetime import datetime
from gitpod import Gitpod

client = Gitpod(
    bearer_token=os.environ.get("GITPOD_API_KEY"),  # This is the default and can be omitted
)
response = client.usage.get_co_author_time_series(
    date_range={
        "end_time": datetime.fromisoformat("2024-02-01T00:00:00"),
        "start_time": datetime.fromisoformat("2024-01-01T00:00:00"),
    },
    project_id="d2c94c27-3b76-4a42-b88c-95a85e392c68",
    resolution="RESOLUTION_WEEKLY",
)
print(response.time_series)
{
  "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"
    }
  ]
}
Returns Examples
{
  "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"
    }
  ]
}