Class FunctionCommand<TEntity, TResult>
- Namespace
- TypedRest.CommandLine.Commands.Rpc
- Assembly
- TypedRest.CommandLine.dll
Command operating on an IFunctionEndpoint<TEntity, TResult>.
public class FunctionCommand<TEntity, TResult> : EndpointCommand<IFunctionEndpoint<TEntity, TResult>>, IEndpointCommand
Type Parameters
TEntity
The type of entity the IFunctionEndpoint<TEntity, TResult> takes as input.
TResult
The type of entity the IFunctionEndpoint<TEntity, TResult> returns as a result.
- Inheritance
-
EndpointCommand<IFunctionEndpoint<TEntity, TResult>>FunctionCommand<TEntity, TResult>
- Implements
- Inherited Members
Constructors
FunctionCommand(IFunctionEndpoint<TEntity, TResult>)
Command operating on an IFunctionEndpoint<TEntity, TResult>.
public FunctionCommand(IFunctionEndpoint<TEntity, TResult> endpoint)
Parameters
endpoint
IFunctionEndpoint<TEntity, TResult>The endpoint this command operates on.
Methods
ExecuteInnerAsync(IReadOnlyList<string>, CancellationToken)
Parses command-line arguments and executes the resulting operation when no additional sub-IEndpointCommand is specified.
protected override Task ExecuteInnerAsync(IReadOnlyList<string> args, CancellationToken cancellationToken = default)
Parameters
args
IReadOnlyList<string>the console arguments.
cancellationToken
CancellationTokenUsed to cancel the request.
Returns
InputEntity(IReadOnlyList<string>)
Acquires a TEntity
from the user, e.g. by parsing the args
or via JSON on the console.
protected virtual TEntity InputEntity(IReadOnlyList<string> args)
Parameters
args
IReadOnlyList<string>
Returns
- TEntity
OutputEntity(TResult)
Outputs a TResult
to the user via the console.
protected virtual void OutputEntity(TResult entity)
Parameters
entity
TResult