Add Object expression to API client
This commit is contained in:
parent
4857a12b79
commit
be8436730f
|
|
@ -51,6 +51,7 @@ public class ExpressionJsonConverter : JsonConverter<IExpression>
|
|||
"Literal" => typeof(LiteralExpression),
|
||||
"JavaScript" => typeof(JavaScriptExpression),
|
||||
"Liquid" => typeof(LiquidExpression),
|
||||
"Object" => typeof(ObjectExpression),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(expressionTypeName), expressionTypeName, null)
|
||||
};
|
||||
|
||||
|
|
@ -60,6 +61,7 @@ public class ExpressionJsonConverter : JsonConverter<IExpression>
|
|||
nameof(LiteralExpression) => "Literal",
|
||||
nameof(JavaScriptExpression) => "JavaScript",
|
||||
nameof(LiquidExpression) => "Liquid",
|
||||
nameof(ObjectExpression) => "Object",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(expressionType), expressionType, null)
|
||||
};
|
||||
}
|
||||
36
src/clients/Elsa.Api.Client/Expressions/ObjectExpression.cs
Normal file
36
src/clients/Elsa.Api.Client/Expressions/ObjectExpression.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System.Text.Json.Serialization;
|
||||
using Elsa.Api.Client.Contracts;
|
||||
|
||||
namespace Elsa.Api.Client.Expressions;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an object expression formatted as a string value.
|
||||
/// </summary>
|
||||
public class ObjectExpression : IExpression
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ObjectExpression"/> class.
|
||||
/// </summary>
|
||||
[JsonConstructor]
|
||||
public ObjectExpression()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ObjectExpression"/> class.
|
||||
/// </summary>
|
||||
public ObjectExpression(string? value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The literal value.
|
||||
/// </summary>
|
||||
public string? Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string representation of the expression.
|
||||
/// </summary>
|
||||
public override string ToString() => Value?.ToString() ?? "";
|
||||
}
|
||||
Loading…
Reference in a new issue