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
- setMessage
- setObj

## Methods

### setExitCode

- setExitCode(code: number): number

- - Defined in @zowe/imperative/src/cmd/src/doc/response/api/handler/IHandlerResponseDataApi.ts:52

  Sets the JSON response API "exitCode" property. Desired exit code for the command process

  memberof

    IHandlerResponseDataApi

  #### Parameters

  - ##### code: number

    The desired exit code

  #### Returns number

  - The code you've set

### setMessage

- setMessage(message: string, ...values: any[]): string

- - Defined in @zowe/imperative/src/cmd/src/doc/response/api/handler/IHandlerResponseDataApi.ts:43

  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

- - Defined in @zowe/imperative/src/cmd/src/doc/response/api/handler/IHandlerResponseDataApi.ts:29

  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