diff --git a/src/abstractions/NativeResponseWrapper.cs b/src/abstractions/NativeResponseWrapper.cs index 74e0c57..a090e59 100644 --- a/src/abstractions/NativeResponseWrapper.cs +++ b/src/abstractions/NativeResponseWrapper.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Threading; using System.Threading.Tasks; namespace Microsoft.Kiota.Abstractions @@ -30,7 +31,7 @@ public class NativeResponseWrapper Func?, Action>?, IEnumerable?, IResponseHandler, Task> originalCall, Action? q = default, Action>? h = default, - IEnumerable? o = default) where NativeResponseType : class => CallAndGetNativeTypeAsync(originalCall, q, h, o); + IEnumerable? o = default) where NativeResponseType : class => CallAndGetNativeTypeAsync((_q, _h, _o, _r, _c) => originalCall(_q, _h, _o, _r), q, h, o); /// /// Makes a request with the and instances to get a response with @@ -48,7 +49,7 @@ public class NativeResponseWrapper RequestBodyType requestBody, Action? q = default, Action>? h = default, - IEnumerable? o = default) where NativeResponseType : class => CallAndGetNativeTypeAsync(originalCall, requestBody, q, h, o); + IEnumerable? o = default) where NativeResponseType : class => CallAndGetNativeTypeAsync((_b, _q, _h, _o, _r, _c) => originalCall(_b, _q, _h, _o, _r), requestBody, q, h, o); #pragma warning restore VSTHRD200 // Use "Async" suffix for async methods /// /// Makes a request with the instance to get a response with @@ -58,15 +59,17 @@ public class NativeResponseWrapper /// The query parameters of the request /// The request headers of the request /// Request options + /// The cancellation token /// public static async Task CallAndGetNativeTypeAsync( - Func?, Action>?, IEnumerable?, IResponseHandler, Task> originalCall, + Func?, Action>?, IEnumerable?, IResponseHandler, CancellationToken, Task> originalCall, Action? q = default, Action>? h = default, - IEnumerable? o = default) where NativeResponseType : class + IEnumerable? o = default, + CancellationToken cancellationToken = default) where NativeResponseType : class { var responseHandler = new NativeResponseHandler(); - await originalCall.Invoke(q, h, o, responseHandler); + await originalCall.Invoke(q, h, o, responseHandler, cancellationToken); return responseHandler.Value as NativeResponseType; } @@ -79,15 +82,17 @@ public class NativeResponseWrapper /// The query parameters of the request /// The request headers of the request /// Request options + /// The cancellation token public static async Task CallAndGetNativeTypeAsync( - Func?, Action>?, IEnumerable?, IResponseHandler, Task> originalCall, + Func?, Action>?, IEnumerable?, IResponseHandler, CancellationToken, Task> originalCall, RequestBodyType requestBody, Action? q = default, Action>? h = default, - IEnumerable? o = default) where NativeResponseType : class + IEnumerable? o = default, + CancellationToken cancellationToken = default) where NativeResponseType : class { var responseHandler = new NativeResponseHandler(); - await originalCall.Invoke(requestBody, q, h, o, responseHandler); + await originalCall.Invoke(requestBody, q, h, o, responseHandler, cancellationToken); return responseHandler.Value as NativeResponseType; } }