| | | 1 | | using System.Text.Json; |
| | | 2 | | using Elsa.Api.Client.HttpMessageHandlers; |
| | | 3 | | using Microsoft.Extensions.DependencyInjection; |
| | | 4 | | using Polly; |
| | | 5 | | |
| | | 6 | | namespace Elsa.Api.Client.Options; |
| | | 7 | | |
| | | 8 | | /// <summary> |
| | | 9 | | /// Represents options for building an Elsa API client. |
| | | 10 | | /// </summary> |
| | | 11 | | public class ElsaClientBuilderOptions |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Gets or sets the base address of the Elsa server. |
| | | 15 | | /// </summary> |
| | 0 | 16 | | public Uri BaseAddress { get; set; } = default!; |
| | | 17 | | |
| | | 18 | | /// <summary> |
| | | 19 | | /// Gets or sets the API key function to use when authenticating with the Elsa server. |
| | | 20 | | /// </summary> |
| | 0 | 21 | | public string? ApiKey { get; set; } |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// A <see cref="DelegatingHandler"/> type that can be used to authenticate with the Elsa server. |
| | | 25 | | /// Defaults to <see cref="ApiKeyHttpMessageHandler"/>. |
| | | 26 | | /// </summary> |
| | 0 | 27 | | public Type AuthenticationHandler { get; set; } = typeof(ApiKeyHttpMessageHandler); |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Gets or sets a delegate that can be used to configure the HTTP client. |
| | | 31 | | /// </summary> |
| | 0 | 32 | | public Action<IServiceProvider, HttpClient>? ConfigureHttpClient { get; set; } |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// Gets or sets a delegate that can be used to configure the HTTP client builder. |
| | | 36 | | /// </summary> |
| | 0 | 37 | | public Action<IHttpClientBuilder> ConfigureHttpClientBuilder { get; set; } = _ => { }; |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Gets or sets a delegate that can be used to configure the retry policy. |
| | | 41 | | /// </summary> |
| | 0 | 42 | | public Action<IHttpClientBuilder>? ConfigureRetryPolicy { get; set; } = builder => builder.AddTransientHttpErrorPoli |
| | | 43 | | |
| | | 44 | | /// <summary> |
| | | 45 | | /// Gets or sets a delegate that can be used to configure the JSON serializer options. |
| | | 46 | | /// </summary> |
| | 0 | 47 | | public Action<IServiceProvider, JsonSerializerOptions>? ConfigureJsonSerializerOptions { get; set; } |
| | | 48 | | } |