Skip to main content

Class TaskArgumentsAccessor

Provides an easy accessor for task arguments.

Assembly: Taskurai.dll
Declaration
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.

Declaration
public TaskArgument this[string name] { get; }

Methods

GetArgument(string)

Gets the argument by its name.

Declaration
public TaskArgument GetArgument(string name)
Returns

Taskurai.Models.TaskArgument: The argument if found; otherwise, null.

Parameters
TypeNameDescription
System.StringnameThe name of the argument.

GetStateReference(string)

Gets the argument state reference by its name.

Declaration
public StateReference GetStateReference(string name)
Returns

Taskurai.Models.StateReference: The argument state reference if found; otherwise, null.

Parameters
TypeNameDescription
System.StringnameThe 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.

Declaration
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
TypeNameDescription
System.StringnameThe name of the argument.
System.Text.Json.JsonSerializerOptionsoptionsThe System.Text.Json.JsonSerializerOptions to use when serializing to JSON.
<T>defaultValueThe default value to return if the argument is not found.
Type Parameters
NameDescription
TThe 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.

Declaration
public string ToString(string name)
Returns

System.String: The value of the argument value as string if found; otherwise, otherwise, null.

Parameters
TypeNameDescription
System.StringnameThe 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.

Declaration
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
TypeNameDescription
Taskurai.Models.TaskArgumentargumentThe argument.
System.Text.Json.JsonSerializerOptionsoptionsThe System.Text.Json.JsonSerializerOptions to use when serializing to JSON.
<T>defaultValueThe default value to return if the argument is not found.
Type Parameters
NameDescription
TThe type to deserialized the argument's value to.

GetArgumentsByType<T>(string)

Gets all argument values that match the specified type.

Declaration
public TaskArgument[] GetArgumentsByType<T>(string type)
Returns

Taskurai.Models.TaskArgument[]: An array of arguments.

Parameters
TypeNameDescription
System.StringtypeType of the argument
Type Parameters
  • T

GetStateReferencesByType<T>(string)

Gets all argument state references that match the specified type.

Declaration
public StateReference[] GetStateReferencesByType<T>(string type)
Returns

Taskurai.Models.StateReference[]: An array of state references.

Parameters
TypeNameDescription
System.StringtypeType 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.

Declaration
public T[] GetValuesByType<T>(string type, JsonSerializerOptions options = null)
Returns

<T>[]: An array of argument values deserialized to the specified type T.

Parameters
TypeNameDescription
System.StringtypeType of the argument
System.Text.Json.JsonSerializerOptionsoptionsThe System.Text.Json.JsonSerializerOptions to use when serializing to JSON.
Type Parameters
NameDescription
TThe type to deserialized the argument's value to.

GetEnumerator()

Returns an enumerator that iterates through the collection of Taskurai.Models.TaskArgument.

Declaration
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