-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathNativeResponseHandler.cs
35 lines (31 loc) · 1.57 KB
/
NativeResponseHandler.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Kiota.Abstractions.Serialization;
namespace Microsoft.Kiota.Abstractions
{
/// <summary>
/// Default response handler to access the native response object.
/// </summary>
public class NativeResponseHandler : IResponseHandler
{
/// <summary>
/// The value of the response
/// </summary>
public object? Value;
/// <summary>
/// The error mappings for the response to use when deserializing failed responses bodies. Where an error code like 401 applies specifically to that status code, a class code like 4XX applies to all status codes within the range if an the specific error code is not present.
/// </summary>
public Dictionary<string, ParsableFactory<IParsable>>? ErrorMappings { get; set; }
/// <inheritdoc />
public Task<ModelType?> HandleResponseAsync<NativeResponseType, ModelType>(NativeResponseType response, Dictionary<string, ParsableFactory<IParsable>>? errorMappings)
{
Value = response ?? throw new ArgumentNullException(nameof(response));
ErrorMappings = errorMappings;
return Task.FromResult(default(ModelType));
}
}
}