Class TaskArgumentsAccessor
Provides an easy accessor for task arguments.
Assembly: Taskurai.dll
public class TaskArgumentsAccessor : IEnumerable<TaskArgument>, IEnumerable
Implements:
System.Collections.Generic.IEnumerable<Taskurai.Models.TaskArgument>, System.Collections.IEnumerable
Properties
this[string]
Gets the argument by its name.
public TaskArgument this[string name] { get; }
Methods
GetArgument(string)
Gets the argument by its name.
public TaskArgument GetArgument(string name)
Returns
Taskurai.Models.TaskArgument: The argument if found; otherwise, null.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | name | The name of the argument. |
GetStateReference(string)
Gets the argument state reference by its name.
public StateReference GetStateReference(string name)
Returns
Taskurai.Models.StateReference: The argument state reference if found; otherwise, null.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | name | The name of the argument. |
GetValue<T>(string, JsonSerializerOptions, T)
Gets the argument value by its name and attempts to deserialized it to the specified type.
When the argument is a secret reference, the secret value is retrieved.
When the argument is a state reference, an exception is thrown.
public T GetValue<T>(string name, JsonSerializerOptions options = null, T defaultValue = default)
Returns
<T>: The value of the argument deserialized to specified type T if found; otherwise, the default value.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | name | The name of the argument. |
System.Text.Json.JsonSerializerOptions | options | The System.Text.Json.JsonSerializerOptions to use when serializing to JSON. |
<T> | defaultValue | The default value to return if the argument is not found. |
Type Parameters
| Name | Description |
|---|---|
T | The type to deserialized the argument's value to. |
ToString(string)
Gets the argument string value by its name and attempts to deserialized it to the specified type.
When the argument is a secret reference, the secret value is retrieved.
When the argument is a state reference, an exception is thrown.
public string ToString(string name)
Returns
System.String: The value of the argument value as string if found; otherwise, otherwise, null.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | name | The name of the argument. |
GetValue<T>(TaskArgument, JsonSerializerOptions, T)
Gets the argument value and attempts to deserialized it to the specified type.
When the argument is a secret reference, the secret value is retrieved.
When the argument is a state reference, an exception is thrown.
protected T GetValue<T>(TaskArgument argument, JsonSerializerOptions options = null, T defaultValue = default)
Returns
<T>: The value of the argument deserialized to specified type T if found; otherwise, the default value.
Parameters
| Type | Name | Description |
|---|---|---|
| Taskurai.Models.TaskArgument | argument | The argument. |
System.Text.Json.JsonSerializerOptions | options | The System.Text.Json.JsonSerializerOptions to use when serializing to JSON. |
<T> | defaultValue | The default value to return if the argument is not found. |
Type Parameters
| Name | Description |
|---|---|
T | The type to deserialized the argument's value to. |
GetArgumentsByType<T>(string)
Gets all argument values that match the specified type.
public TaskArgument[] GetArgumentsByType<T>(string type)
Returns
Taskurai.Models.TaskArgument[]: An array of arguments.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | type | Type of the argument |
Type Parameters
T
GetStateReferencesByType<T>(string)
Gets all argument state references that match the specified type.
public StateReference[] GetStateReferencesByType<T>(string type)
Returns
Taskurai.Models.StateReference[]: An array of state references.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | type | Type of the argument |
Type Parameters
T
GetValuesByType<T>(string, JsonSerializerOptions)
Gets all argument values that match the specified type.
When the argument is a secret reference, the secret value is retrieved and deserialized to the specified type.
When the argument is a state reference, an exception is thrown.
public T[] GetValuesByType<T>(string type, JsonSerializerOptions options = null)
Returns
<T>[]: An array of argument values deserialized to the specified type T.
Parameters
| Type | Name | Description |
|---|---|---|
System.String | type | Type of the argument |
System.Text.Json.JsonSerializerOptions | options | The System.Text.Json.JsonSerializerOptions to use when serializing to JSON. |
Type Parameters
| Name | Description |
|---|---|
T | The type to deserialized the argument's value to. |
GetEnumerator()
Returns an enumerator that iterates through the collection of Taskurai.Models.TaskArgument.
public IEnumerator<TaskArgument> GetEnumerator()
Returns
System.Collections.Generic.IEnumerator<Taskurai.Models.TaskArgument>: An enumerator for the collection of arguments.
Implements
System.Collections.Generic.IEnumerable<Taskurai.Models.TaskArgument>System.Collections.IEnumerable