Skip to content
Ona Docs

GetCoAuthorSummary

client.Usage.GetCoAuthorSummary(ctx, body) (*UsageGetCoAuthorSummaryResponse, error)
POST/gitpod.v1.UsageService/GetCoAuthorSummary

Gets aggregated co-author summary for the organization or a specific project.

Use this method to:

  • Measure AI-assisted commits and line changes
  • Scope co-author insights to a project, user, or team
  • Compare the requested date range against the previous period

Example

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

Date range to query within.

ProjectID param.Field[string]Optional

Optional project ID to scope results.

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 UsageGetCoAuthorSummaryResponse struct{…}
Sparkline []TimeSeriesPointOptional

Sparkline data for card rendering.

Time TimeOptional

Timestamp for this data point.

formatdate-time
Value int64Optional

The numerical value for this data point.

formatint32
Summary CoAuthorSummaryOptional

Summary totals and trends for the requested date range.

ByTool []ToolBreakdownOptional

Per-tool breakdown of contribution stats.

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).

DistinctAuthorsTrend float64Optional

Fractional change in distinct_authors compared to the previous period.

formatdouble
TotalCommits stringOptional

Total number of commits in the date range.

TotalCommitsTrend float64Optional

Fractional change in total_commits compared to the previous period of equal length. Computed as (current - previous) / previous. Zero when there is no previous data.

formatdouble
TotalLinesAdded stringOptional

Total lines added across all commits.

TotalLinesAddedTrend float64Optional

Fractional change in total_lines_added compared to the previous period.

formatdouble
TotalLinesRemoved stringOptional

Total lines removed across all commits.

TotalLinesRemovedTrend float64Optional

Fractional change in total_lines_removed compared to the previous period.

formatdouble

GetCoAuthorSummary

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.GetCoAuthorSummary(context.TODO(), gitpod.UsageGetCoAuthorSummaryParams{
    DateRange: gitpod.F(shared.DateRangeParam{
      EndTime: gitpod.F(time.Now()),
      StartTime: gitpod.F(time.Now()),
    }),
    ProjectID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Sparkline)
}
{
  "sparkline": [
    {
      "time": "2019-12-27T18:11:19.117Z",
      "value": 0
    }
  ],
  "summary": {
    "byTool": [
      {
        "commits": "commits",
        "distinctAuthors": "distinctAuthors",
        "linesAdded": "linesAdded",
        "linesRemoved": "linesRemoved",
        "tool": "CO_AUTHOR_TOOL_UNSPECIFIED"
      }
    ],
    "distinctAuthors": "distinctAuthors",
    "distinctAuthorsTrend": 0,
    "totalCommits": "totalCommits",
    "totalCommitsTrend": 0,
    "totalLinesAdded": "totalLinesAdded",
    "totalLinesAddedTrend": 0,
    "totalLinesRemoved": "totalLinesRemoved",
    "totalLinesRemovedTrend": 0
  }
}
Returns Examples
{
  "sparkline": [
    {
      "time": "2019-12-27T18:11:19.117Z",
      "value": 0
    }
  ],
  "summary": {
    "byTool": [
      {
        "commits": "commits",
        "distinctAuthors": "distinctAuthors",
        "linesAdded": "linesAdded",
        "linesRemoved": "linesRemoved",
        "tool": "CO_AUTHOR_TOOL_UNSPECIFIED"
      }
    ],
    "distinctAuthors": "distinctAuthors",
    "distinctAuthorsTrend": 0,
    "totalCommits": "totalCommits",
    "totalCommitsTrend": 0,
    "totalLinesAdded": "totalLinesAdded",
    "totalLinesAddedTrend": 0,
    "totalLinesRemoved": "totalLinesRemoved",
    "totalLinesRemovedTrend": 0
  }
}