-
Notifications
You must be signed in to change notification settings - Fork 273
/
Copy pathDurableHttpRequest.cs
72 lines (62 loc) · 2.39 KB
/
DurableHttpRequest.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text.Json.Serialization;
using Microsoft.Extensions.Primitives;
namespace Microsoft.Azure.Functions.Worker.Extensions.DurableTask.Http;
/// <summary>
/// Request used to make an HTTP call through Durable Functions.
/// </summary>
public class DurableHttpRequest
{
/// <summary>
/// Initializes a new instance of the <see cref="DurableHttpRequest"/> class.
/// </summary>
public DurableHttpRequest(HttpMethod method, Uri uri)
{
this.Method = method;
this.Uri = uri;
}
/// <summary>
/// HttpMethod used in the HTTP request made by the Durable Function.
/// </summary>
[JsonPropertyName("method")]
[JsonConverter(typeof(HttpMethodConverter))]
public HttpMethod Method { get; }
/// <summary>
/// Uri used in the HTTP request made by the Durable Function.
/// </summary>
[JsonPropertyName("uri")]
public Uri Uri { get; }
/// <summary>
/// Headers passed with the HTTP request made by the Durable Function.
/// </summary>
[JsonPropertyName("headers")]
[JsonConverter(typeof(HttpHeadersConverter))]
public IDictionary<string, StringValues>? Headers { get; set; }
/// <summary>
/// Content passed with the HTTP request made by the Durable Function.
/// </summary>
[JsonPropertyName("content")]
public string? Content { get; set; }
/// <summary>
/// Specifies whether the Durable HTTP APIs should automatically
/// handle the asynchronous HTTP pattern.
/// </summary>
[JsonPropertyName("asynchronousPatternEnabled")]
public bool AsynchronousPatternEnabled { get; set; }
/// <summary>
/// Defines retry policy for handling of failures in making the HTTP Request. These could be non-successful HTTP status codes
/// in the response, a timeout in making the HTTP call, or an exception raised from the HTTP Client library.
/// </summary>
[JsonPropertyName("retryOptions")]
public HttpRetryOptions? HttpRetryOptions { get; set; }
/// <summary>
/// The total timeout for the original HTTP request and any
/// asynchronous polling.
/// </summary>
[JsonPropertyName("timeout")]
public TimeSpan? Timeout { get; set; }
}