## GetPrSummary `usage.get_pr_summary(UsageGetPrSummaryParams**kwargs) -> UsageGetPrSummaryResponse` **post** `/gitpod.v1.UsageService/GetPrSummary` Gets aggregated PR speed summary for the organization or a specific project. Use this method to: - Measure pull request lead time and review latency - Calculate deployment frequency from merged pull requests - Scope PR speed insights to a project, user, or team ### Example ```yaml dateRange: startTime: "2024-01-01T00:00:00Z" endTime: "2024-02-01T00:00:00Z" projectId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" ``` ### Parameters - `date_range: DateRange` Date range to query within. - `end_time: datetime` End time of the date range (exclusive). - `start_time: datetime` Start time of the date range (inclusive). - `project_id: Optional[str]` Optional project ID to scope results. - `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. ### Returns - `class UsageGetPrSummaryResponse: …` - `sparkline: Optional[List[TimeSeriesPoint]]` Sparkline data for card rendering. - `time: Optional[datetime]` Timestamp for this data point. - `value: Optional[int]` The numerical value for this data point. - `summary: Optional[PrSummary]` Summary totals and trends for the requested date range. - `deployment_frequency: Optional[float]` PRs merged to the default branch per week. - `deployment_frequency_trend: Optional[float]` Fractional change in deployment_frequency vs previous period. Computed as (current - previous) / previous. - `lead_time_seconds: Optional[float]` Median lead time for changes in seconds (first commit → merge). - `lead_time_trend: Optional[float]` Fractional change in lead_time_seconds vs previous period. Computed as (current - previous) / previous. - `prs_merged_count: Optional[str]` Total PRs merged in the date range. - `prs_merged_trend: Optional[float]` Fractional change in prs_merged_count vs previous period. Computed as (current - previous) / previous. - `time_to_first_approval_seconds: Optional[float]` Median time to first approval in seconds. Zero when no PRs in the range had approvals. - `time_to_first_approval_trend: Optional[float]` Fractional change in time_to_first_approval_seconds vs previous period. Computed as (current - previous) / previous. ### Example ```python 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_pr_summary( 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", ) print(response.sparkline) ``` #### Response ```json { "sparkline": [ { "time": "2019-12-27T18:11:19.117Z", "value": 0 } ], "summary": { "deploymentFrequency": 0, "deploymentFrequencyTrend": 0, "leadTimeSeconds": 0, "leadTimeTrend": 0, "prsMergedCount": "prsMergedCount", "prsMergedTrend": 0, "timeToFirstApprovalSeconds": 0, "timeToFirstApprovalTrend": 0 } } ```