Skip to content

Commit

Permalink
feat: Adds LicenseRequestBuilder parameters object
Browse files Browse the repository at this point in the history
  • Loading branch information
octokitbot committed Feb 29, 2024
1 parent 3876882 commit 3c87240
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
27 changes: 21 additions & 6 deletions src/GitHub/Repos/Item/Item/License/LicenseRequestBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ public class LicenseRequestBuilder : BaseRequestBuilder {
/// </summary>
/// <param name="pathParameters">Path parameters for the request</param>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
public LicenseRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/repos/{repos%2Did}/{Owner%2Did}/license", pathParameters) {
public LicenseRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/repos/{repos%2Did}/{Owner%2Did}/license{?ref*}", pathParameters) {
}
/// <summary>
/// Instantiates a new <see cref="LicenseRequestBuilder"/> and sets the default values.
/// </summary>
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
public LicenseRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/repos/{repos%2Did}/{Owner%2Did}/license", rawUrl) {
public LicenseRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/repos/{repos%2Did}/{Owner%2Did}/license{?ref*}", rawUrl) {
}
/// <summary>
/// This method returns the contents of the repository&apos;s license file, if one is detected.This endpoint supports the following custom media types. For more information, see &quot;[Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types).&quot;- **`application/vnd.github.raw+json`**: Returns the raw contents of the license.- **`application/vnd.github.html+json`**: Returns the license contents in HTML. Markup languages are rendered to HTML using GitHub&apos;s open-source [Markup library](https://github.com/github/markup).
Expand All @@ -37,10 +37,10 @@ public LicenseRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : ba
/// <exception cref="BasicError">When receiving a 404 status code</exception>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public async Task<LicenseContent?> GetAsync(Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) {
public async Task<LicenseContent?> GetAsync(Action<RequestConfiguration<LicenseRequestBuilderGetQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default) {
#nullable restore
#else
public async Task<LicenseContent> GetAsync(Action<RequestConfiguration<DefaultQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default) {
public async Task<LicenseContent> GetAsync(Action<RequestConfiguration<LicenseRequestBuilderGetQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default) {
#endif
var requestInfo = ToGetRequestInformation(requestConfiguration);
var errorMapping = new Dictionary<string, ParsableFactory<IParsable>> {
Expand All @@ -55,10 +55,10 @@ public async Task<LicenseContent> GetAsync(Action<RequestConfiguration<DefaultQu
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default) {
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<LicenseRequestBuilderGetQueryParameters>>? requestConfiguration = default) {
#nullable restore
#else
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<DefaultQueryParameters>> requestConfiguration = default) {
public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<LicenseRequestBuilderGetQueryParameters>> requestConfiguration = default) {
#endif
var requestInfo = new RequestInformation(Method.GET, UrlTemplate, PathParameters);
requestInfo.Configure(requestConfiguration);
Expand All @@ -73,5 +73,20 @@ public RequestInformation ToGetRequestInformation(Action<RequestConfiguration<De
public LicenseRequestBuilder WithUrl(string rawUrl) {
return new LicenseRequestBuilder(rawUrl, RequestAdapter);
}
/// <summary>
/// This method returns the contents of the repository&apos;s license file, if one is detected.This endpoint supports the following custom media types. For more information, see &quot;[Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types).&quot;- **`application/vnd.github.raw+json`**: Returns the raw contents of the license.- **`application/vnd.github.html+json`**: Returns the license contents in HTML. Markup languages are rendered to HTML using GitHub&apos;s open-source [Markup library](https://github.com/github/markup).
/// </summary>
public class LicenseRequestBuilderGetQueryParameters {
/// <summary>The Git reference for the results you want to list. The `ref` for a branch can be formatted either as `refs/heads/&lt;branch name&gt;` or simply `&lt;branch name&gt;`. To reference a pull request use `refs/pull/&lt;number&gt;/merge`.</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
[QueryParameter("ref")]
public string? Ref { get; set; }
#nullable restore
#else
[QueryParameter("ref")]
public string Ref { get; set; }
#endif
}
}
}
2 changes: 1 addition & 1 deletion src/GitHub/kiota-lock.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"descriptionHash": "B08FBA2F1300B895C002FBF7FF2DE059880A51C493776C0E9DE6CD689BAE01E30221383BCEE45CEAA85E38D9C7878803B7AAAA67E5766001B08C5AF6D149A580",
"descriptionHash": "A1B7C373B4D1E9519AE4255139AFA918280FCDC9FC716B326D9F7FF3E1D35841E07461776C449533C9502D021E138C7EC038E47A19879C71618D05A494C135C9",
"descriptionLocation": "../../../source-generator/schemas/downloaded.json",
"lockFileVersion": "1.0.0",
"kiotaVersion": "1.12.0-preview.202402220002",
Expand Down

0 comments on commit 3c87240

Please sign in to comment.