Skip to content

Commit 45574f4

Browse files
feat: Remove the beta endpoint for Copilot usage (#3354)
1 parent 717e93f commit 45574f4

4 files changed

Lines changed: 0 additions & 979 deletions

File tree

github/copilot.go

Lines changed: 0 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -66,39 +66,6 @@ type SeatCancellations struct {
6666
SeatsCancelled int `json:"seats_cancelled"`
6767
}
6868

69-
// CopilotUsageSummaryListOptions represents the optional parameters to the CopilotService.GetOrganizationUsage method.
70-
type CopilotUsageSummaryListOptions struct {
71-
Since *time.Time `url:"since,omitempty"`
72-
Until *time.Time `url:"until,omitempty"`
73-
74-
ListOptions
75-
}
76-
77-
// CopilotUsageBreakdown represents the breakdown of Copilot usage for a specific language and editor.
78-
type CopilotUsageBreakdown struct {
79-
Language string `json:"language"`
80-
Editor string `json:"editor"`
81-
SuggestionsCount int64 `json:"suggestions_count"`
82-
AcceptancesCount int64 `json:"acceptances_count"`
83-
LinesSuggested int64 `json:"lines_suggested"`
84-
LinesAccepted int64 `json:"lines_accepted"`
85-
ActiveUsers int `json:"active_users"`
86-
}
87-
88-
// CopilotUsageSummary represents the daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDE across an organization.
89-
type CopilotUsageSummary struct {
90-
Day string `json:"day"`
91-
TotalSuggestionsCount int64 `json:"total_suggestions_count"`
92-
TotalAcceptancesCount int64 `json:"total_acceptances_count"`
93-
TotalLinesSuggested int64 `json:"total_lines_suggested"`
94-
TotalLinesAccepted int64 `json:"total_lines_accepted"`
95-
TotalActiveUsers int64 `json:"total_active_users"`
96-
TotalChatAcceptances int64 `json:"total_chat_acceptances"`
97-
TotalChatTurns int64 `json:"total_chat_turns"`
98-
TotalActiveChatUsers int `json:"total_active_chat_users"`
99-
Breakdown []*CopilotUsageBreakdown `json:"breakdown"`
100-
}
101-
10269
// CopilotMetricsListOptions represents the optional parameters to the CopilotService get metrics methods.
10370
type CopilotMetricsListOptions struct {
10471
Since *time.Time `url:"since,omitempty"`
@@ -498,110 +465,6 @@ func (s *CopilotService) GetSeatDetails(ctx context.Context, org, user string) (
498465
return seatDetails, resp, nil
499466
}
500467

501-
// GetOrganizationUsage gets daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDE across an organization.
502-
//
503-
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage#get-a-summary-of-copilot-usage-for-organization-members
504-
//
505-
//meta:operation GET /orgs/{org}/copilot/usage
506-
func (s *CopilotService) GetOrganizationUsage(ctx context.Context, org string, opts *CopilotUsageSummaryListOptions) ([]*CopilotUsageSummary, *Response, error) {
507-
u := fmt.Sprintf("orgs/%v/copilot/usage", org)
508-
u, err := addOptions(u, opts)
509-
if err != nil {
510-
return nil, nil, err
511-
}
512-
513-
req, err := s.client.NewRequest("GET", u, nil)
514-
if err != nil {
515-
return nil, nil, err
516-
}
517-
518-
var usage []*CopilotUsageSummary
519-
resp, err := s.client.Do(ctx, req, &usage)
520-
if err != nil {
521-
return nil, resp, err
522-
}
523-
524-
return usage, resp, nil
525-
}
526-
527-
// GetEnterpriseUsage gets daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDE across an enterprise.
528-
//
529-
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage#get-a-summary-of-copilot-usage-for-enterprise-members
530-
//
531-
//meta:operation GET /enterprises/{enterprise}/copilot/usage
532-
func (s *CopilotService) GetEnterpriseUsage(ctx context.Context, enterprise string, opts *CopilotUsageSummaryListOptions) ([]*CopilotUsageSummary, *Response, error) {
533-
u := fmt.Sprintf("enterprises/%v/copilot/usage", enterprise)
534-
u, err := addOptions(u, opts)
535-
if err != nil {
536-
return nil, nil, err
537-
}
538-
539-
req, err := s.client.NewRequest("GET", u, nil)
540-
if err != nil {
541-
return nil, nil, err
542-
}
543-
544-
var usage []*CopilotUsageSummary
545-
resp, err := s.client.Do(ctx, req, &usage)
546-
if err != nil {
547-
return nil, resp, err
548-
}
549-
550-
return usage, resp, nil
551-
}
552-
553-
// GetEnterpriseTeamUsage gets daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDE for a team in the enterprise.
554-
//
555-
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage#get-a-summary-of-copilot-usage-for-an-enterprise-team
556-
//
557-
//meta:operation GET /enterprises/{enterprise}/team/{team_slug}/copilot/usage
558-
func (s *CopilotService) GetEnterpriseTeamUsage(ctx context.Context, enterprise, team string, opts *CopilotUsageSummaryListOptions) ([]*CopilotUsageSummary, *Response, error) {
559-
u := fmt.Sprintf("enterprises/%v/team/%v/copilot/usage", enterprise, team)
560-
u, err := addOptions(u, opts)
561-
if err != nil {
562-
return nil, nil, err
563-
}
564-
565-
req, err := s.client.NewRequest("GET", u, nil)
566-
if err != nil {
567-
return nil, nil, err
568-
}
569-
570-
var usage []*CopilotUsageSummary
571-
resp, err := s.client.Do(ctx, req, &usage)
572-
if err != nil {
573-
return nil, resp, err
574-
}
575-
576-
return usage, resp, nil
577-
}
578-
579-
// GetOrganizationTeamUsage gets daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDE for a team in the organization.
580-
//
581-
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage#get-a-summary-of-copilot-usage-for-a-team
582-
//
583-
//meta:operation GET /orgs/{org}/team/{team_slug}/copilot/usage
584-
func (s *CopilotService) GetOrganizationTeamUsage(ctx context.Context, org, team string, opts *CopilotUsageSummaryListOptions) ([]*CopilotUsageSummary, *Response, error) {
585-
u := fmt.Sprintf("orgs/%v/team/%v/copilot/usage", org, team)
586-
u, err := addOptions(u, opts)
587-
if err != nil {
588-
return nil, nil, err
589-
}
590-
591-
req, err := s.client.NewRequest("GET", u, nil)
592-
if err != nil {
593-
return nil, nil, err
594-
}
595-
596-
var usage []*CopilotUsageSummary
597-
resp, err := s.client.Do(ctx, req, &usage)
598-
if err != nil {
599-
return nil, resp, err
600-
}
601-
602-
return usage, resp, nil
603-
}
604-
605468
// GetEnterpriseMetrics gets Copilot usage metrics for an enterprise.
606469
//
607470
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-metrics#get-copilot-metrics-for-an-enterprise

0 commit comments

Comments
 (0)