Documentation / commands/CommandResult
commands/CommandResult
Classes
CommandResult<TResponse>
Represents the result from executing a ICommand.
Type Parameters
• TResponse = object
Implements
ICommandResult
<TResponse
>
Constructors
new CommandResult()
new CommandResult<
TResponse
>(result
,responseInstanceType
,isResponseTypeEnumerable
):CommandResult
<TResponse
>
Creates an instance of command result.
Parameters
result
ServerCommandResult
The JSON/any representation of the command result;
responseInstanceType
Constructor
= Object
The {@see Constructor} that represents the type of response, if any. Defaults to {@see Object}.
isResponseTypeEnumerable
boolean
Whether or not the response type is an enumerable or not.
Returns
CommandResult
<TResponse
>
Defined in
Properties
correlationId
readonly
correlationId:Guid
Gets the correlation identifier associated with the executed command.
Implementation of
Defined in
exceptionMessages
readonly
exceptionMessages:string
[]
Gets any exception messages that might have occurred.
Implementation of
ICommandResult
.exceptionMessages
Defined in
exceptionStackTrace
readonly
exceptionStackTrace:string
Gets the stack trace if there was an exception.
Implementation of
ICommandResult
.exceptionStackTrace
Defined in
hasExceptions
readonly
hasExceptions:boolean
Gets whether or not there are any exceptions that occurred.
Implementation of
Defined in
isAuthorized
readonly
isAuthorized:boolean
Gets whether or not the command was authorized to execute.
Implementation of
Defined in
isSuccess
readonly
isSuccess:boolean
Gets whether or not the command executed successfully.
Implementation of
Defined in
isValid
readonly
isValid:boolean
Gets whether or not the command is valid.
Implementation of
Defined in
response?
readonly
optional
response:TResponse
Gets the response from the command, if any.
Implementation of
Defined in
validationResults
readonly
validationResults:ValidationResult
[]
Gets any validation errors. If this collection is empty, there are errors.
Implementation of
ICommandResult
.validationResults
Defined in
empty
static
empty:CommandResult
Defined in
Methods
onException()
onException(
callback
):CommandResult
<TResponse
>
Set up a callback for when the command failed with an exception.
Parameters
callback
OnException
The callback to call when the command had an exception.
Returns
CommandResult
<TResponse
>
The instance of the command result.
Defined in
onFailed()
onFailed(
callback
):CommandResult
<TResponse
>
Set up a callback for when the command failed.
Parameters
callback
OnFailed
<TResponse
>
The callback to call when the command failed.
Returns
CommandResult
<TResponse
>
The instance of the command result.
Defined in
onSuccess()
onSuccess(
callback
):CommandResult
<TResponse
>
Set up a callback for when the command was successful.
Parameters
callback
OnSuccess
The callback to call when the command was successful.
Returns
CommandResult
<TResponse
>
The instance of the command result.
Defined in
onUnauthorized()
onUnauthorized(
callback
):CommandResult
<TResponse
>
Set up a callback for when the command was unauthorized.
Parameters
callback
OnUnauthorized
The callback to call when the command was unauthorized.
Returns
CommandResult
<TResponse
>
The instance of the command result.
Defined in
onValidationFailure()
onValidationFailure(
callback
):CommandResult
<TResponse
>
Set up a callback for when the command had validation errors.
Parameters
callback
OnValidationFailure
The callback to call when the command was invalid.
Returns
CommandResult
<TResponse
>
The instance of the command result.
Defined in
failed()
static
failed(exceptionMessages
):CommandResult
Parameters
exceptionMessages
string
[]