diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cab8262..5a3fa5fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.7.0] - 2023-11-07 + +### Added + +- Added methods in request information to reduce the amount of code being generated. + ## [1.6.1] - 2023-11-02 ### Changed diff --git a/src/Microsoft.Kiota.Abstractions.csproj b/src/Microsoft.Kiota.Abstractions.csproj index 5593b156..8f7c77b6 100644 --- a/src/Microsoft.Kiota.Abstractions.csproj +++ b/src/Microsoft.Kiota.Abstractions.csproj @@ -14,7 +14,7 @@ https://aka.ms/kiota/docs true true - 1.6.1 + 1.7.0 true false diff --git a/src/RequestInformation.cs b/src/RequestInformation.cs index 930f82b1..10bfdeeb 100644 --- a/src/RequestInformation.cs +++ b/src/RequestInformation.cs @@ -21,6 +21,39 @@ namespace Microsoft.Kiota.Abstractions /// public class RequestInformation { + /// + /// Creates a new instance of . + /// + public RequestInformation() + { + + } + /// + /// Creates a new instance of with the given method and url template. + /// + /// + /// + /// + public RequestInformation(Method method, string urlTemplate, IDictionary pathParameters) + { + HttpMethod = method; + UrlTemplate = urlTemplate; + PathParameters = pathParameters; + } + /// + /// Configures the current request configuration headers, query parameters, and options base on the callback provided. + /// + /// Type for the query parameters + /// Callback to configure the request + public void Configure(Action>? requestConfiguration) where T : class, new() + { + if(requestConfiguration == null) return; + var requestConfig = new RequestConfiguration(); + requestConfiguration(requestConfig); + AddQueryParameters(requestConfig.QueryParameters); + AddRequestOptions(requestConfig.Options); + AddHeaders(requestConfig.Headers); + } internal const string RawUrlKey = "request-raw-url"; private Uri? _rawUri; ///