@@ -185,6 +185,24 @@ type CopilotMetrics struct {
185185 CopilotDotcomPullRequests * CopilotDotcomPullRequests `json:"copilot_dotcom_pull_requests,omitempty"`
186186}
187187
188+ // CopilotMetricsReportOptions specifies the optional parameters for single-day metrics report endpoints.
189+ type CopilotMetricsReportOptions struct {
190+ Day string `url:"day"` // Required, format: YYYY-MM-DD
191+ }
192+
193+ // CopilotDailyMetricsReport represents the response from 1-day Copilot metrics report endpoints.
194+ type CopilotDailyMetricsReport struct {
195+ DownloadLinks []string `json:"download_links"`
196+ ReportDay string `json:"report_day"`
197+ }
198+
199+ // CopilotMetricsReport represents the response from 28-day Copilot metrics report endpoints.
200+ type CopilotMetricsReport struct {
201+ DownloadLinks []string `json:"download_links"`
202+ ReportStartDay string `json:"report_start_day"`
203+ ReportEndDay string `json:"report_end_day"`
204+ }
205+
188206// UnmarshalJSON implements the json.Unmarshaler interface.
189207func (cp * CopilotSeatDetails ) UnmarshalJSON (data []byte ) error {
190208 // Using an alias to avoid infinite recursion when calling json.Unmarshal
@@ -574,3 +592,195 @@ func (s *CopilotService) GetOrganizationTeamMetrics(ctx context.Context, org, te
574592
575593 return metrics , resp , nil
576594}
595+
596+ // GetEnterpriseDailyMetricsReport gets a report containing Copilot metrics for a single day for an enterprise.
597+ //
598+ // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics#get-copilot-enterprise-usage-metrics-for-a-specific-day
599+ //
600+ //meta:operation GET /enterprises/{enterprise}/copilot/metrics/reports/enterprise-1-day
601+ func (s * CopilotService ) GetEnterpriseDailyMetricsReport (ctx context.Context , enterprise string , opts * CopilotMetricsReportOptions ) (* CopilotDailyMetricsReport , * Response , error ) {
602+ u := fmt .Sprintf ("enterprises/%v/copilot/metrics/reports/enterprise-1-day" , enterprise )
603+ u , err := addOptions (u , opts )
604+ if err != nil {
605+ return nil , nil , err
606+ }
607+
608+ req , err := s .client .NewRequest ("GET" , u , nil )
609+ if err != nil {
610+ return nil , nil , err
611+ }
612+
613+ var report * CopilotDailyMetricsReport
614+ resp , err := s .client .Do (ctx , req , & report )
615+ if err != nil {
616+ return nil , resp , err
617+ }
618+
619+ return report , resp , nil
620+ }
621+
622+ // GetEnterpriseMetricsReport gets a report containing Copilot metrics for a 28-day rolling window for an enterprise.
623+ //
624+ // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics#get-copilot-enterprise-usage-metrics
625+ //
626+ //meta:operation GET /enterprises/{enterprise}/copilot/metrics/reports/enterprise-28-day/latest
627+ func (s * CopilotService ) GetEnterpriseMetricsReport (ctx context.Context , enterprise string ) (* CopilotMetricsReport , * Response , error ) {
628+ u := fmt .Sprintf ("enterprises/%v/copilot/metrics/reports/enterprise-28-day/latest" , enterprise )
629+
630+ req , err := s .client .NewRequest ("GET" , u , nil )
631+ if err != nil {
632+ return nil , nil , err
633+ }
634+
635+ var report * CopilotMetricsReport
636+ resp , err := s .client .Do (ctx , req , & report )
637+ if err != nil {
638+ return nil , resp , err
639+ }
640+
641+ return report , resp , nil
642+ }
643+
644+ // GetEnterpriseUsersDailyMetricsReport gets a report containing Copilot user metrics for a single day for an enterprise.
645+ //
646+ // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics#get-copilot-users-usage-metrics-for-a-specific-day
647+ //
648+ //meta:operation GET /enterprises/{enterprise}/copilot/metrics/reports/users-1-day
649+ func (s * CopilotService ) GetEnterpriseUsersDailyMetricsReport (ctx context.Context , enterprise string , opts * CopilotMetricsReportOptions ) (* CopilotDailyMetricsReport , * Response , error ) {
650+ u := fmt .Sprintf ("enterprises/%v/copilot/metrics/reports/users-1-day" , enterprise )
651+ u , err := addOptions (u , opts )
652+ if err != nil {
653+ return nil , nil , err
654+ }
655+
656+ req , err := s .client .NewRequest ("GET" , u , nil )
657+ if err != nil {
658+ return nil , nil , err
659+ }
660+
661+ var report * CopilotDailyMetricsReport
662+ resp , err := s .client .Do (ctx , req , & report )
663+ if err != nil {
664+ return nil , resp , err
665+ }
666+
667+ return report , resp , nil
668+ }
669+
670+ // GetEnterpriseUsersMetricsReport gets a report containing Copilot user metrics for a 28-day rolling window for an enterprise.
671+ //
672+ // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics#get-copilot-users-usage-metrics
673+ //
674+ //meta:operation GET /enterprises/{enterprise}/copilot/metrics/reports/users-28-day/latest
675+ func (s * CopilotService ) GetEnterpriseUsersMetricsReport (ctx context.Context , enterprise string ) (* CopilotMetricsReport , * Response , error ) {
676+ u := fmt .Sprintf ("enterprises/%v/copilot/metrics/reports/users-28-day/latest" , enterprise )
677+
678+ req , err := s .client .NewRequest ("GET" , u , nil )
679+ if err != nil {
680+ return nil , nil , err
681+ }
682+
683+ var report * CopilotMetricsReport
684+ resp , err := s .client .Do (ctx , req , & report )
685+ if err != nil {
686+ return nil , resp , err
687+ }
688+
689+ return report , resp , nil
690+ }
691+
692+ // GetOrganizationDailyMetricsReport gets a report containing Copilot metrics for a single day for an organization.
693+ //
694+ // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics#get-copilot-organization-usage-metrics-for-a-specific-day
695+ //
696+ //meta:operation GET /orgs/{org}/copilot/metrics/reports/organization-1-day
697+ func (s * CopilotService ) GetOrganizationDailyMetricsReport (ctx context.Context , org string , opts * CopilotMetricsReportOptions ) (* CopilotDailyMetricsReport , * Response , error ) {
698+ u := fmt .Sprintf ("orgs/%v/copilot/metrics/reports/organization-1-day" , org )
699+ u , err := addOptions (u , opts )
700+ if err != nil {
701+ return nil , nil , err
702+ }
703+
704+ req , err := s .client .NewRequest ("GET" , u , nil )
705+ if err != nil {
706+ return nil , nil , err
707+ }
708+
709+ var report * CopilotDailyMetricsReport
710+ resp , err := s .client .Do (ctx , req , & report )
711+ if err != nil {
712+ return nil , resp , err
713+ }
714+
715+ return report , resp , nil
716+ }
717+
718+ // GetOrganizationMetricsReport gets a report containing Copilot metrics for a 28-day rolling window for an organization.
719+ //
720+ // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics#get-copilot-organization-usage-metrics
721+ //
722+ //meta:operation GET /orgs/{org}/copilot/metrics/reports/organization-28-day/latest
723+ func (s * CopilotService ) GetOrganizationMetricsReport (ctx context.Context , org string ) (* CopilotMetricsReport , * Response , error ) {
724+ u := fmt .Sprintf ("orgs/%v/copilot/metrics/reports/organization-28-day/latest" , org )
725+
726+ req , err := s .client .NewRequest ("GET" , u , nil )
727+ if err != nil {
728+ return nil , nil , err
729+ }
730+
731+ var report * CopilotMetricsReport
732+ resp , err := s .client .Do (ctx , req , & report )
733+ if err != nil {
734+ return nil , resp , err
735+ }
736+
737+ return report , resp , nil
738+ }
739+
740+ // GetOrganizationUsersDailyMetricsReport gets a report containing Copilot user metrics for a single day for an organization.
741+ //
742+ // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics#get-copilot-organization-users-usage-metrics-for-a-specific-day
743+ //
744+ //meta:operation GET /orgs/{org}/copilot/metrics/reports/users-1-day
745+ func (s * CopilotService ) GetOrganizationUsersDailyMetricsReport (ctx context.Context , org string , opts * CopilotMetricsReportOptions ) (* CopilotDailyMetricsReport , * Response , error ) {
746+ u := fmt .Sprintf ("orgs/%v/copilot/metrics/reports/users-1-day" , org )
747+ u , err := addOptions (u , opts )
748+ if err != nil {
749+ return nil , nil , err
750+ }
751+
752+ req , err := s .client .NewRequest ("GET" , u , nil )
753+ if err != nil {
754+ return nil , nil , err
755+ }
756+
757+ var report * CopilotDailyMetricsReport
758+ resp , err := s .client .Do (ctx , req , & report )
759+ if err != nil {
760+ return nil , resp , err
761+ }
762+
763+ return report , resp , nil
764+ }
765+
766+ // GetOrganizationUsersMetricsReport gets a report containing Copilot user metrics for a 28-day rolling window for an organization.
767+ //
768+ // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics#get-copilot-organization-users-usage-metrics
769+ //
770+ //meta:operation GET /orgs/{org}/copilot/metrics/reports/users-28-day/latest
771+ func (s * CopilotService ) GetOrganizationUsersMetricsReport (ctx context.Context , org string ) (* CopilotMetricsReport , * Response , error ) {
772+ u := fmt .Sprintf ("orgs/%v/copilot/metrics/reports/users-28-day/latest" , org )
773+
774+ req , err := s .client .NewRequest ("GET" , u , nil )
775+ if err != nil {
776+ return nil , nil , err
777+ }
778+
779+ var report * CopilotMetricsReport
780+ resp , err := s .client .Do (ctx , req , & report )
781+ if err != nil {
782+ return nil , resp , err
783+ }
784+
785+ return report , resp , nil
786+ }
0 commit comments