Table of Contents

Documentation / commands/CommandResult

commands/CommandResult

Classes

CommandResult<TResponse>

Represents the result from executing a ICommand.

Type Parameters

TResponse = object

Implements

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

commands/CommandResult.ts:118

Properties

correlationId

readonly correlationId: Guid

Gets the correlation identifier associated with the executed command.

Implementation of

ICommandResult.correlationId

Defined in

commands/CommandResult.ts:86

exceptionMessages

readonly exceptionMessages: string[]

Gets any exception messages that might have occurred.

Implementation of

ICommandResult.exceptionMessages

Defined in

commands/CommandResult.ts:104

exceptionStackTrace

readonly exceptionStackTrace: string

Gets the stack trace if there was an exception.

Implementation of

ICommandResult.exceptionStackTrace

Defined in

commands/CommandResult.ts:107

hasExceptions

readonly hasExceptions: boolean

Gets whether or not there are any exceptions that occurred.

Implementation of

ICommandResult.hasExceptions

Defined in

commands/CommandResult.ts:98

isAuthorized

readonly isAuthorized: boolean

Gets whether or not the command was authorized to execute.

Implementation of

ICommandResult.isAuthorized

Defined in

commands/CommandResult.ts:92

isSuccess

readonly isSuccess: boolean

Gets whether or not the command executed successfully.

Implementation of

ICommandResult.isSuccess

Defined in

commands/CommandResult.ts:89

isValid

readonly isValid: boolean

Gets whether or not the command is valid.

Implementation of

ICommandResult.isValid

Defined in

commands/CommandResult.ts:95

response?

readonly optional response: TResponse

Gets the response from the command, if any.

Implementation of

ICommandResult.response

Defined in

commands/CommandResult.ts:110

validationResults

readonly validationResults: ValidationResult[]

Gets any validation errors. If this collection is empty, there are errors.

Implementation of

ICommandResult.validationResults

Defined in

commands/CommandResult.ts:101

empty

static empty: CommandResult

Defined in

commands/CommandResult.ts:59

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

commands/CommandResult.ts:166

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

commands/CommandResult.ts:154

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

commands/CommandResult.ts:142

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

commands/CommandResult.ts:178

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

commands/CommandResult.ts:190

failed()

static failed(exceptionMessages): CommandResult

Parameters
exceptionMessages

string[]

Returns

CommandResult

Defined in

commands/CommandResult.ts:71