Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IHandlerResponseDataApi

APIs for the command handlers to construct the JSON response object for the command. The JSON response object is built/written when the "response format JSON" flag is set. The intention is to allow for structured information/data to be provided to the caller (who is requesting the JSON format of the command output) for programmatic usage of Imperative commands.

export
interface

IHandlerResponseDataApi

Hierarchy

  • IHandlerResponseDataApi

Index

Methods

setExitCode

  • setExitCode(code: number): number

setMessage

  • setMessage(message: string, ...values: any[]): string
  • Sets the JSON response API "message" property. Can optionally be logged. The intent is to provide a short summary on the response JSON object (for display and other purposes).

    memberof

    IHandlerResponseDataApi

    Parameters

    • message: string
    • Rest ...values: any[]

      Values gets passed to the method TextUtils.formatMessage. Two possible formats:

      • List of values to be inserted into the string message ("printf" style)
      • Object containing key-value pairs to be rendered in the Mustache template string message

    Returns string

setObj

  • setObj(data: any, merge?: boolean): any
  • The JSON response object for a command contains a property that is intended to contain any custom object(s)/data that the command wants to return to the caller.

    memberof

    IHandlerResponseDataApi

    Parameters

    • data: any

      The object to set in the JSON response.

    • Optional merge: boolean

      If true, will merge the object with the existing data already set.

    Returns any

    • The object.

Generated using TypeDoc