|
| 1 | +// <auto-generated/> |
| 2 | +#pragma warning disable CS0618 |
| 3 | +using GitHub.Models; |
| 4 | +using Microsoft.Kiota.Abstractions.Extensions; |
| 5 | +using Microsoft.Kiota.Abstractions.Serialization; |
| 6 | +using Microsoft.Kiota.Abstractions; |
| 7 | +using System.Collections.Generic; |
| 8 | +using System.IO; |
| 9 | +using System.Threading.Tasks; |
| 10 | +using System.Threading; |
| 11 | +using System; |
| 12 | +namespace GitHub.Enterprises.Item.Copilot.Metrics |
| 13 | +{ |
| 14 | + /// <summary> |
| 15 | + /// Builds and executes requests for operations under \enterprises\{enterprise}\copilot\metrics |
| 16 | + /// </summary> |
| 17 | + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.19.0")] |
| 18 | + public partial class MetricsRequestBuilder : BaseRequestBuilder |
| 19 | + { |
| 20 | + /// <summary> |
| 21 | + /// Instantiates a new <see cref="global::GitHub.Enterprises.Item.Copilot.Metrics.MetricsRequestBuilder"/> and sets the default values. |
| 22 | + /// </summary> |
| 23 | + /// <param name="pathParameters">Path parameters for the request</param> |
| 24 | + /// <param name="requestAdapter">The request adapter to use to execute the requests.</param> |
| 25 | + public MetricsRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/enterprises/{enterprise}/copilot/metrics{?page*,per_page*,since*,until*}", pathParameters) |
| 26 | + { |
| 27 | + } |
| 28 | + /// <summary> |
| 29 | + /// Instantiates a new <see cref="global::GitHub.Enterprises.Item.Copilot.Metrics.MetricsRequestBuilder"/> and sets the default values. |
| 30 | + /// </summary> |
| 31 | + /// <param name="rawUrl">The raw URL to use for the request builder.</param> |
| 32 | + /// <param name="requestAdapter">The request adapter to use to execute the requests.</param> |
| 33 | + public MetricsRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/enterprises/{enterprise}/copilot/metrics{?page*,per_page*,since*,until*}", rawUrl) |
| 34 | + { |
| 35 | + } |
| 36 | + /// <summary> |
| 37 | + /// Use this endpoint to see a breakdown of aggregated metrics for various GitHub Copilot features. See the response schema tab for detailed metrics definitions.The response contains metrics for up to 28 days prior. Metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.To access this endpoint, the Copilot Metrics API access policy must be enabled or set to "no policy" for the enterprise within GitHub settings.Only enterprise owners and billing managers can view Copilot metrics for the enterprise.OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint. |
| 38 | + /// API method documentation <see href="https://docs.github.com/rest/copilot/copilot-metrics#get-copilot-metrics-for-an-enterprise" /> |
| 39 | + /// </summary> |
| 40 | + /// <returns>A List<global::GitHub.Models.CopilotUsageMetricsDay></returns> |
| 41 | + /// <param name="cancellationToken">Cancellation token to use when cancelling requests</param> |
| 42 | + /// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param> |
| 43 | + /// <exception cref="global::GitHub.Models.BasicError">When receiving a 403 status code</exception> |
| 44 | + /// <exception cref="global::GitHub.Models.BasicError">When receiving a 404 status code</exception> |
| 45 | + /// <exception cref="global::GitHub.Models.BasicError">When receiving a 422 status code</exception> |
| 46 | + /// <exception cref="global::GitHub.Models.BasicError">When receiving a 500 status code</exception> |
| 47 | +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER |
| 48 | +#nullable enable |
| 49 | + public async Task<List<global::GitHub.Models.CopilotUsageMetricsDay>?> GetAsync(Action<RequestConfiguration<global::GitHub.Enterprises.Item.Copilot.Metrics.MetricsRequestBuilder.MetricsRequestBuilderGetQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) |
| 50 | + { |
| 51 | +#nullable restore |
| 52 | +#else |
| 53 | + public async Task<List<global::GitHub.Models.CopilotUsageMetricsDay>> GetAsync(Action<RequestConfiguration<global::GitHub.Enterprises.Item.Copilot.Metrics.MetricsRequestBuilder.MetricsRequestBuilderGetQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default) |
| 54 | + { |
| 55 | +#endif |
| 56 | + var requestInfo = ToGetRequestInformation(requestConfiguration); |
| 57 | + var errorMapping = new Dictionary<string, ParsableFactory<IParsable>> |
| 58 | + { |
| 59 | + { "403", global::GitHub.Models.BasicError.CreateFromDiscriminatorValue }, |
| 60 | + { "404", global::GitHub.Models.BasicError.CreateFromDiscriminatorValue }, |
| 61 | + { "422", global::GitHub.Models.BasicError.CreateFromDiscriminatorValue }, |
| 62 | + { "500", global::GitHub.Models.BasicError.CreateFromDiscriminatorValue }, |
| 63 | + }; |
| 64 | + var collectionResult = await RequestAdapter.SendCollectionAsync<global::GitHub.Models.CopilotUsageMetricsDay>(requestInfo, global::GitHub.Models.CopilotUsageMetricsDay.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); |
| 65 | + return collectionResult?.AsList(); |
| 66 | + } |
| 67 | + /// <summary> |
| 68 | + /// Use this endpoint to see a breakdown of aggregated metrics for various GitHub Copilot features. See the response schema tab for detailed metrics definitions.The response contains metrics for up to 28 days prior. Metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.To access this endpoint, the Copilot Metrics API access policy must be enabled or set to "no policy" for the enterprise within GitHub settings.Only enterprise owners and billing managers can view Copilot metrics for the enterprise.OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint. |
| 69 | + /// </summary> |
| 70 | + /// <returns>A <see cref="RequestInformation"/></returns> |
| 71 | + /// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param> |
| 72 | +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER |
| 73 | +#nullable enable |
| 74 | + public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<global::GitHub.Enterprises.Item.Copilot.Metrics.MetricsRequestBuilder.MetricsRequestBuilderGetQueryParameters>>? requestConfiguration = default) |
| 75 | + { |
| 76 | +#nullable restore |
| 77 | +#else |
| 78 | + public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<global::GitHub.Enterprises.Item.Copilot.Metrics.MetricsRequestBuilder.MetricsRequestBuilderGetQueryParameters>> requestConfiguration = default) |
| 79 | + { |
| 80 | +#endif |
| 81 | + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); |
| 82 | + requestInfo.Configure(requestConfiguration); |
| 83 | + requestInfo.Headers.TryAdd("Accept", "application/json"); |
| 84 | + return requestInfo; |
| 85 | + } |
| 86 | + /// <summary> |
| 87 | + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. |
| 88 | + /// </summary> |
| 89 | + /// <returns>A <see cref="global::GitHub.Enterprises.Item.Copilot.Metrics.MetricsRequestBuilder"/></returns> |
| 90 | + /// <param name="rawUrl">The raw URL to use for the request builder.</param> |
| 91 | + public global::GitHub.Enterprises.Item.Copilot.Metrics.MetricsRequestBuilder WithUrl(string rawUrl) |
| 92 | + { |
| 93 | + return new global::GitHub.Enterprises.Item.Copilot.Metrics.MetricsRequestBuilder(rawUrl, RequestAdapter); |
| 94 | + } |
| 95 | + /// <summary> |
| 96 | + /// Use this endpoint to see a breakdown of aggregated metrics for various GitHub Copilot features. See the response schema tab for detailed metrics definitions.The response contains metrics for up to 28 days prior. Metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.To access this endpoint, the Copilot Metrics API access policy must be enabled or set to "no policy" for the enterprise within GitHub settings.Only enterprise owners and billing managers can view Copilot metrics for the enterprise.OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint. |
| 97 | + /// </summary> |
| 98 | + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.19.0")] |
| 99 | + public partial class MetricsRequestBuilderGetQueryParameters |
| 100 | + { |
| 101 | + /// <summary>The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."</summary> |
| 102 | + [QueryParameter("page")] |
| 103 | + public int? Page { get; set; } |
| 104 | + /// <summary>The number of days of metrics to display per page (max 28). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."</summary> |
| 105 | + [QueryParameter("per_page")] |
| 106 | + public int? PerPage { get; set; } |
| 107 | + /// <summary>Show usage metrics since this date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format (`YYYY-MM-DDTHH:MM:SSZ`). Maximum value is 28 days ago.</summary> |
| 108 | +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER |
| 109 | +#nullable enable |
| 110 | + [QueryParameter("since")] |
| 111 | + public string? Since { get; set; } |
| 112 | +#nullable restore |
| 113 | +#else |
| 114 | + [QueryParameter("since")] |
| 115 | + public string Since { get; set; } |
| 116 | +#endif |
| 117 | + /// <summary>Show usage metrics until this date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format (`YYYY-MM-DDTHH:MM:SSZ`) and should not preceed the `since` date if it is passed.</summary> |
| 118 | +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER |
| 119 | +#nullable enable |
| 120 | + [QueryParameter("until")] |
| 121 | + public string? Until { get; set; } |
| 122 | +#nullable restore |
| 123 | +#else |
| 124 | + [QueryParameter("until")] |
| 125 | + public string Until { get; set; } |
| 126 | +#endif |
| 127 | + } |
| 128 | + } |
| 129 | +} |
| 130 | +#pragma warning restore CS0618 |
0 commit comments