Skip to content
Ona Docs

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

dateRange:
  startTime: "2024-01-01T00:00:00Z"
  endTime: "2024-02-01T00:00:00Z"
resolution: RESOLUTION_WEEKLY
projectId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
ParametersExpand Collapse
body UsageGetCoAuthorTimeSeriesParams
DateRange param.Field[DateRange]

Date range to query within.

ProjectID param.Field[string]Optional

Optional project ID to scope results.

Resolution param.Field[Resolution]Optional

Time resolution for the series data.

TeamID param.Field[string]Optional

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

UserID param.Field[string]Optional

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

ReturnsExpand Collapse
type UsageGetCoAuthorTimeSeriesResponse struct{…}
TimeSeries []CoAuthorTimeBucketOptional

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

AIRatio float64Optional

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

formatdouble
ByTool []ToolBreakdownOptional

Per-tool breakdown for this bucket.

Commits stringOptional

Number of commits attributed to this tool.

DistinctAuthors stringOptional

Distinct authors who used this tool.

LinesAdded stringOptional

Lines added by this tool.

LinesRemoved stringOptional

Lines removed by this tool.

Tool CoAuthorToolOptional

The tool these stats are for.

One of the following:
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 stringOptional

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

StartTime TimeOptional

Start of this time bucket.

formatdate-time
TotalCommits stringOptional

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

TotalLinesAdded stringOptional

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

TotalLinesRemoved stringOptional

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

GetCoAuthorTimeSeries

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)
}
{
  "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"
    }
  ]
}