Skip to content

Commit 3f48b94

Browse files
authored
Merge pull request #145 from microsoft/feature/generator-reduction
feature/generator reduction
2 parents 76b514b + b7f247a commit 3f48b94

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.7.0] - 2023-11-07
11+
12+
### Added
13+
14+
- Added methods in request information to reduce the amount of code being generated.
15+
1016
## [1.6.1] - 2023-11-02
1117

1218
### Changed

src/Microsoft.Kiota.Abstractions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<PackageProjectUrl>https://aka.ms/kiota/docs</PackageProjectUrl>
1515
<EmbedUntrackedSources>true</EmbedUntrackedSources>
1616
<Deterministic>true</Deterministic>
17-
<VersionPrefix>1.6.1</VersionPrefix>
17+
<VersionPrefix>1.7.0</VersionPrefix>
1818
<VersionSuffix></VersionSuffix>
1919
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2020
<SignAssembly>false</SignAssembly>

src/RequestInformation.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,39 @@ namespace Microsoft.Kiota.Abstractions
2121
/// </summary>
2222
public class RequestInformation
2323
{
24+
/// <summary>
25+
/// Creates a new instance of <see cref="RequestInformation"/>.
26+
/// </summary>
27+
public RequestInformation()
28+
{
29+
30+
}
31+
/// <summary>
32+
/// Creates a new instance of <see cref="RequestInformation"/> with the given method and url template.
33+
/// </summary>
34+
/// <param name="method"></param>
35+
/// <param name="urlTemplate"></param>
36+
/// <param name="pathParameters"></param>
37+
public RequestInformation(Method method, string urlTemplate, IDictionary<string, object> pathParameters)
38+
{
39+
HttpMethod = method;
40+
UrlTemplate = urlTemplate;
41+
PathParameters = pathParameters;
42+
}
43+
/// <summary>
44+
/// Configures the current request configuration headers, query parameters, and options base on the callback provided.
45+
/// </summary>
46+
/// <typeparam name="T">Type for the query parameters</typeparam>
47+
/// <param name="requestConfiguration">Callback to configure the request</param>
48+
public void Configure<T>(Action<RequestConfiguration<T>>? requestConfiguration) where T : class, new()
49+
{
50+
if(requestConfiguration == null) return;
51+
var requestConfig = new RequestConfiguration<T>();
52+
requestConfiguration(requestConfig);
53+
AddQueryParameters(requestConfig.QueryParameters);
54+
AddRequestOptions(requestConfig.Options);
55+
AddHeaders(requestConfig.Headers);
56+
}
2457
internal const string RawUrlKey = "request-raw-url";
2558
private Uri? _rawUri;
2659
/// <summary>

0 commit comments

Comments
 (0)