Skip to content

Commit

Permalink
Merge pull request #145 from microsoft/feature/generator-reduction
Browse files Browse the repository at this point in the history
feature/generator reduction
  • Loading branch information
baywet authored Nov 8, 2023
2 parents 76b514b + b7f247a commit 3f48b94
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Kiota.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageProjectUrl>https://aka.ms/kiota/docs</PackageProjectUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<Deterministic>true</Deterministic>
<VersionPrefix>1.6.1</VersionPrefix>
<VersionPrefix>1.7.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<SignAssembly>false</SignAssembly>
Expand Down
33 changes: 33 additions & 0 deletions src/RequestInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,39 @@ namespace Microsoft.Kiota.Abstractions
/// </summary>
public class RequestInformation
{
/// <summary>
/// Creates a new instance of <see cref="RequestInformation"/>.
/// </summary>
public RequestInformation()
{

}
/// <summary>
/// Creates a new instance of <see cref="RequestInformation"/> with the given method and url template.
/// </summary>
/// <param name="method"></param>
/// <param name="urlTemplate"></param>
/// <param name="pathParameters"></param>
public RequestInformation(Method method, string urlTemplate, IDictionary<string, object> pathParameters)
{
HttpMethod = method;
UrlTemplate = urlTemplate;
PathParameters = pathParameters;
}
/// <summary>
/// Configures the current request configuration headers, query parameters, and options base on the callback provided.
/// </summary>
/// <typeparam name="T">Type for the query parameters</typeparam>
/// <param name="requestConfiguration">Callback to configure the request</param>
public void Configure<T>(Action<RequestConfiguration<T>>? requestConfiguration) where T : class, new()
{
if(requestConfiguration == null) return;
var requestConfig = new RequestConfiguration<T>();
requestConfiguration(requestConfig);
AddQueryParameters(requestConfig.QueryParameters);
AddRequestOptions(requestConfig.Options);
AddHeaders(requestConfig.Headers);
}
internal const string RawUrlKey = "request-raw-url";
private Uri? _rawUri;
/// <summary>
Expand Down

0 comments on commit 3f48b94

Please sign in to comment.