From 7c45bd0594ecc43d9beb538e35ca736cdb0a338c Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 21 Jun 2024 10:09:43 -0400 Subject: [PATCH] fix: adds missing files --- .../Item/WithReleaseNameItemRequestBuilder.cs | 93 +++++++++++++++++++ .../Item/Releases/ReleasesRequestBuilder.cs | 45 +++++++++ 2 files changed, 138 insertions(+) create mode 100644 get-started/dotnet-dependency-injection/GitHub/Repos/Item/Item/Releases/Item/WithReleaseNameItemRequestBuilder.cs create mode 100644 get-started/dotnet-dependency-injection/GitHub/Repos/Item/Item/Releases/ReleasesRequestBuilder.cs diff --git a/get-started/dotnet-dependency-injection/GitHub/Repos/Item/Item/Releases/Item/WithReleaseNameItemRequestBuilder.cs b/get-started/dotnet-dependency-injection/GitHub/Repos/Item/Item/Releases/Item/WithReleaseNameItemRequestBuilder.cs new file mode 100644 index 000000000..103963625 --- /dev/null +++ b/get-started/dotnet-dependency-injection/GitHub/Repos/Item/Item/Releases/Item/WithReleaseNameItemRequestBuilder.cs @@ -0,0 +1,93 @@ +// +using GitHub.ApiClient.Models; +using Microsoft.Kiota.Abstractions.Serialization; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; +using System; +namespace GitHub.ApiClient.Repos.Item.Item.Releases.Item +{ + /// + /// Builds and executes requests for operations under \repos\{owner}\{repo}\releases\{releaseName} + /// + public class WithReleaseNameItemRequestBuilder : BaseRequestBuilder + { + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public WithReleaseNameItemRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/repos/{owner}/{repo}/releases/{releaseName}", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public WithReleaseNameItemRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/repos/{owner}/{repo}/releases/{releaseName}", rawUrl) + { + } + /// + /// Get the latest release + /// + /// A + /// Cancellation token to use when cancelling requests + /// Configuration for the request such as headers, query parameters, and middleware options. + /// When receiving a 404 status code +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public async Task GetAsync(Action>? requestConfiguration = default, CancellationToken cancellationToken = default) + { +#nullable restore +#else + public async Task GetAsync(Action> requestConfiguration = default, CancellationToken cancellationToken = default) + { +#endif + var requestInfo = ToGetRequestInformation(requestConfiguration); + var errorMapping = new Dictionary> + { + { "404", GitHub.ApiClient.Models.Error.CreateFromDiscriminatorValue }, + }; + return await RequestAdapter.SendAsync(requestInfo, GitHub.ApiClient.Models.Release.CreateFromDiscriminatorValue, errorMapping, cancellationToken).ConfigureAwait(false); + } + /// + /// Get the latest release + /// + /// A + /// Configuration for the request such as headers, query parameters, and middleware options. +#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER +#nullable enable + public RequestInformation ToGetRequestInformation(Action>? requestConfiguration = default) + { +#nullable restore +#else + public RequestInformation ToGetRequestInformation(Action> requestConfiguration = default) + { +#endif + var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters); + requestInfo.Configure(requestConfiguration); + requestInfo.Headers.TryAdd("Accept", "application/json"); + return requestInfo; + } + /// + /// Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. + /// + /// A + /// The raw URL to use for the request builder. + public GitHub.ApiClient.Repos.Item.Item.Releases.Item.WithReleaseNameItemRequestBuilder WithUrl(string rawUrl) + { + return new GitHub.ApiClient.Repos.Item.Item.Releases.Item.WithReleaseNameItemRequestBuilder(rawUrl, RequestAdapter); + } + /// + /// Configuration for the request such as headers, query parameters, and middleware options. + /// + [Obsolete("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.")] + public class WithReleaseNameItemRequestBuilderGetRequestConfiguration : RequestConfiguration + { + } + } +} diff --git a/get-started/dotnet-dependency-injection/GitHub/Repos/Item/Item/Releases/ReleasesRequestBuilder.cs b/get-started/dotnet-dependency-injection/GitHub/Repos/Item/Item/Releases/ReleasesRequestBuilder.cs new file mode 100644 index 000000000..fbdbc6962 --- /dev/null +++ b/get-started/dotnet-dependency-injection/GitHub/Repos/Item/Item/Releases/ReleasesRequestBuilder.cs @@ -0,0 +1,45 @@ +// +using GitHub.ApiClient.Repos.Item.Item.Releases.Item; +using Microsoft.Kiota.Abstractions; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System; +namespace GitHub.ApiClient.Repos.Item.Item.Releases +{ + /// + /// Builds and executes requests for operations under \repos\{owner}\{repo}\releases + /// + public class ReleasesRequestBuilder : BaseRequestBuilder + { + /// Gets an item from the GitHub.ApiClient.repos.item.item.releases.item collection + /// The name of the release + /// A + public GitHub.ApiClient.Repos.Item.Item.Releases.Item.WithReleaseNameItemRequestBuilder this[string position] + { + get + { + var urlTplParams = new Dictionary(PathParameters); + urlTplParams.Add("releaseName", position); + return new GitHub.ApiClient.Repos.Item.Item.Releases.Item.WithReleaseNameItemRequestBuilder(urlTplParams, RequestAdapter); + } + } + /// + /// Instantiates a new and sets the default values. + /// + /// Path parameters for the request + /// The request adapter to use to execute the requests. + public ReleasesRequestBuilder(Dictionary pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/repos/{owner}/{repo}/releases", pathParameters) + { + } + /// + /// Instantiates a new and sets the default values. + /// + /// The raw URL to use for the request builder. + /// The request adapter to use to execute the requests. + public ReleasesRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/repos/{owner}/{repo}/releases", rawUrl) + { + } + } +}