using System.Text.Json.Serialization;
using Elsa.Workflows.Attributes;
namespace Elsa.Http.Bookmarks;
///
/// A bookmark used by the activity.
///
public record HttpEndpointBookmarkPayload
{
private readonly string _path = default!;
private readonly string _method = default!;
///
/// Initializes a new instance of the class.
///
[JsonConstructor]
public HttpEndpointBookmarkPayload()
{
}
///
/// Initializes a new instance of the class.
///
public HttpEndpointBookmarkPayload(string path, string method, bool? authorize = default, string? policy = default, TimeSpan? requestTimeout = default, long? requestSizeLimit = default)
{
Path = path;
Method = method;
Authorize = authorize;
Policy = policy;
RequestTimeout = requestTimeout;
RequestSizeLimit = requestSizeLimit;
}
///
/// Gets or sets the path of the HTTP endpoint.
///
public string Path
{
get => _path;
init => _path = value.ToLowerInvariant();
}
///
/// Gets or sets the HTTP method of the endpoint.
///
public string Method
{
get => _method;
init => _method = value.ToLowerInvariant();
}
///
/// Gets or sets the policy to use for authorization.
///
[ExcludeFromHash] public string? Policy { get; set; }
///
/// Gets or sets a value indicating whether the endpoint requires authorization.
///
[ExcludeFromHash] public bool? Authorize { get; set; }
///
/// Gets or sets the request timeout.
///
[ExcludeFromHash] public TimeSpan? RequestTimeout { get; set; }
///
/// Gets or sets the max request size in bytes.
///
[ExcludeFromHash] public long? RequestSizeLimit { get; set; }
}