|
| 1 | +// <auto-generated/> |
| 2 | +#pragma warning disable CS0618 |
| 3 | +using GitHub.Models; |
| 4 | +using GitHub.Orgs.Item.Rulesets.Item.History.Item; |
| 5 | +using Microsoft.Kiota.Abstractions.Extensions; |
| 6 | +using Microsoft.Kiota.Abstractions.Serialization; |
| 7 | +using Microsoft.Kiota.Abstractions; |
| 8 | +using System.Collections.Generic; |
| 9 | +using System.IO; |
| 10 | +using System.Threading.Tasks; |
| 11 | +using System.Threading; |
| 12 | +using System; |
| 13 | +namespace GitHub.Orgs.Item.Rulesets.Item.History |
| 14 | +{ |
| 15 | + /// <summary> |
| 16 | + /// Builds and executes requests for operations under \orgs\{org}\rulesets\{ruleset_id}\history |
| 17 | + /// </summary> |
| 18 | + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.19.0")] |
| 19 | + public partial class HistoryRequestBuilder : BaseRequestBuilder |
| 20 | + { |
| 21 | + /// <summary>Gets an item from the GitHub.orgs.item.rulesets.item.history.item collection</summary> |
| 22 | + /// <param name="position">The ID of the version</param> |
| 23 | + /// <returns>A <see cref="global::GitHub.Orgs.Item.Rulesets.Item.History.Item.WithVersion_ItemRequestBuilder"/></returns> |
| 24 | + public global::GitHub.Orgs.Item.Rulesets.Item.History.Item.WithVersion_ItemRequestBuilder this[int position] |
| 25 | + { |
| 26 | + get |
| 27 | + { |
| 28 | + var urlTplParams = new Dictionary<string, object>(PathParameters); |
| 29 | + urlTplParams.Add("version_id", position); |
| 30 | + return new global::GitHub.Orgs.Item.Rulesets.Item.History.Item.WithVersion_ItemRequestBuilder(urlTplParams, RequestAdapter); |
| 31 | + } |
| 32 | + } |
| 33 | + /// <summary> |
| 34 | + /// Instantiates a new <see cref="global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder"/> and sets the default values. |
| 35 | + /// </summary> |
| 36 | + /// <param name="pathParameters">Path parameters for the request</param> |
| 37 | + /// <param name="requestAdapter">The request adapter to use to execute the requests.</param> |
| 38 | + public HistoryRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/orgs/{org}/rulesets/{ruleset_id}/history{?page*,per_page*}", pathParameters) |
| 39 | + { |
| 40 | + } |
| 41 | + /// <summary> |
| 42 | + /// Instantiates a new <see cref="global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder"/> and sets the default values. |
| 43 | + /// </summary> |
| 44 | + /// <param name="rawUrl">The raw URL to use for the request builder.</param> |
| 45 | + /// <param name="requestAdapter">The request adapter to use to execute the requests.</param> |
| 46 | + public HistoryRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/orgs/{org}/rulesets/{ruleset_id}/history{?page*,per_page*}", rawUrl) |
| 47 | + { |
| 48 | + } |
| 49 | + /// <summary> |
| 50 | + /// Get the history of an organization ruleset. |
| 51 | + /// API method documentation <see href="https://docs.github.com/rest/orgs/rules#get-organization-ruleset-history" /> |
| 52 | + /// </summary> |
| 53 | + /// <returns>A List<global::GitHub.Models.RulesetVersion></returns> |
| 54 | + /// <param name="cancellationToken">Cancellation token to use when cancelling requests</param> |
| 55 | + /// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param> |
| 56 | + /// <exception cref="global::GitHub.Models.BasicError">When receiving a 404 status code</exception> |
| 57 | + /// <exception cref="global::GitHub.Models.BasicError">When receiving a 500 status code</exception> |
| 58 | +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER |
| 59 | +#nullable enable |
| 60 | + public async Task<List<global::GitHub.Models.RulesetVersion>?> GetAsync(Action<RequestConfiguration<global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder.HistoryRequestBuilderGetQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) |
| 61 | + { |
| 62 | +#nullable restore |
| 63 | +#else |
| 64 | + public async Task<List<global::GitHub.Models.RulesetVersion>> GetAsync(Action<RequestConfiguration<global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder.HistoryRequestBuilderGetQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default) |
| 65 | + { |
| 66 | +#endif |
| 67 | + var requestInfo = ToGetRequestInformation(requestConfiguration); |
| 68 | + var errorMapping = new Dictionary<string, ParsableFactory<IParsable>> |
| 69 | + { |
| 70 | + { "404", global::GitHub.Models.BasicError.CreateFromDiscriminatorValue }, |
| 71 | + { "500", global::GitHub.Models.BasicError.CreateFromDiscriminatorValue }, |
| 72 | + }; |
| 73 | + var collectionResult = await RequestAdapter.SendCollectionAsync<global::GitHub.Models.RulesetVersion>(requestInfo, global::GitHub.Models.RulesetVersion.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); |
| 74 | + return collectionResult?.AsList(); |
| 75 | + } |
| 76 | + /// <summary> |
| 77 | + /// Get the history of an organization ruleset. |
| 78 | + /// </summary> |
| 79 | + /// <returns>A <see cref="RequestInformation"/></returns> |
| 80 | + /// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param> |
| 81 | +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER |
| 82 | +#nullable enable |
| 83 | + public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder.HistoryRequestBuilderGetQueryParameters>>? requestConfiguration = default) |
| 84 | + { |
| 85 | +#nullable restore |
| 86 | +#else |
| 87 | + public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder.HistoryRequestBuilderGetQueryParameters>> requestConfiguration = default) |
| 88 | + { |
| 89 | +#endif |
| 90 | + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); |
| 91 | + requestInfo.Configure(requestConfiguration); |
| 92 | + requestInfo.Headers.TryAdd("Accept", "application/json"); |
| 93 | + return requestInfo; |
| 94 | + } |
| 95 | + /// <summary> |
| 96 | + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. |
| 97 | + /// </summary> |
| 98 | + /// <returns>A <see cref="global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder"/></returns> |
| 99 | + /// <param name="rawUrl">The raw URL to use for the request builder.</param> |
| 100 | + public global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder WithUrl(string rawUrl) |
| 101 | + { |
| 102 | + return new global::GitHub.Orgs.Item.Rulesets.Item.History.HistoryRequestBuilder(rawUrl, RequestAdapter); |
| 103 | + } |
| 104 | + /// <summary> |
| 105 | + /// Get the history of an organization ruleset. |
| 106 | + /// </summary> |
| 107 | + [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.19.0")] |
| 108 | + public partial class HistoryRequestBuilderGetQueryParameters |
| 109 | + { |
| 110 | + /// <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> |
| 111 | + [QueryParameter("page")] |
| 112 | + public int? Page { get; set; } |
| 113 | + /// <summary>The number of results per page (max 100). 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> |
| 114 | + [QueryParameter("per_page")] |
| 115 | + public int? PerPage { get; set; } |
| 116 | + } |
| 117 | + } |
| 118 | +} |
| 119 | +#pragma warning restore CS0618 |
0 commit comments