Class TaskBase<TSelf, TResult>
public abstract class TaskBase<TSelf, TResult> where TSelf : TaskBase<TSelf, TResult>
Type Parameters
TSelfTResult
- Inheritance
-
objectTaskBase<TSelf, TResult>
- Derived
Properties
Api
public virtual Api Api { get; set; }
Property Value
Cts
public CancellationTokenSource Cts { get; }
Property Value
- CancellationTokenSource
IgnoreLogs
public bool IgnoreLogs { get; }
Property Value
- bool
IsCanceled
public bool IsCanceled { get; }
Property Value
- bool
IsWrapperTask
public virtual bool IsWrapperTask { get; }
Property Value
- bool
Method
public abstract string Method { get; }
Property Value
- string
RequestMimeType
public virtual MIMEType RequestMimeType { get; set; }
Property Value
- MIMEType
ResponseMimeType
public virtual MIMEType ResponseMimeType { get; set; }
Property Value
- MIMEType
Sender
public string Sender { get; }
Property Value
- string
Token
public CancellationToken Token { get; set; }
Property Value
- CancellationToken
Methods
CancelTask()
Cancels the current GENTask.
public void CancelTask()
ExecuteAsync()
Executes the task and returns the output of type TResult.
This is the main entry point for executing the task.
public virtual UniTask<TResult> ExecuteAsync()
Returns
- UniTask<TResult>
ExecuteAsyncINTERNAL()
protected abstract UniTask<TResult> ExecuteAsyncINTERNAL()
Returns
- UniTask<TResult>
ExecuteAsync<T>()
Interface method to execute the task and return a specific type. This is useful for tasks that return a specific type of output. Mainly used internally for GENSequence.
public UniTask<T> ExecuteAsync<T>()
Returns
- UniTask<T>
Type Parameters
T
Exceptions
- InvalidOperationException
SetCancellationToken(CancellationToken)
Sets a custom cancellation token for this task.
public TSelf SetCancellationToken(CancellationToken token)
Parameters
tokenCancellationToken
Returns
- TSelf
SetIgnoreLogs(bool)
Ignores logs for this task. This is useful for tasks that are not intended to produce logs or when you want to suppress logs.
public TSelf SetIgnoreLogs(bool ignoreLogs)
Parameters
ignoreLogsbool
Returns
- TSelf
SetSender(string)
Sets the sender ID for tracking or attribution purposes.
public TSelf SetSender(string sender)
Parameters
senderstring
Returns
- TSelf