Class FunctionDelegate<TArgument, TResult>
Provides an abstract base class for implementing function delegates with specific argument and result types.
Inheritance
object
FunctionDelegate<TArgument, TResult>
Implements
Namespace: Glitch9.AIDevKit
Assembly: .dll
Syntax
public abstract class FunctionDelegate<TArgument, TResult> : IFunctionDelegate
Type Parameters
Name | Description |
---|---|
TArgument | The type of the function argument. |
TResult | The type of the function result. |
Properties
DefaultResult
Gets or sets the default result to be used in case of failure.
Declaration
public TResult DefaultResult { get; set; }
Property Value
Type | Description |
---|---|
TResult |
FunctionName
Gets or sets the name of the function.
Declaration
public string FunctionName { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
Invoke(string)
Executes the function with the provided argument.
Declaration
public UniTask<Result<string>> Invoke(string argument)
Parameters
Type | Name | Description |
---|---|---|
string | argument | The serialized argument for the function. |
Returns
Type | Description |
---|---|
UniTask<Result<string>> | A task representing the asynchronous operation, with a result containing the serialized function result. |
Invoke(TArgument)
Executes the function with the specified argument.
Declaration
public abstract UniTask<TResult> Invoke(TArgument argument)
Parameters
Type | Name | Description |
---|---|---|
TArgument | argument | The deserialized argument for the function. |
Returns
Type | Description |
---|---|
UniTask<TResult> | A task representing the asynchronous operation, with a result containing the function result. |