Next.js version of ApiResponseBuilder class.

Hierarchy

  • ApiResponseBuilder
    • NextApiResponseBuilder

Constructors

Properties

request: IHttpRequest<any>

The underlying request context.

response: IHttpResponse

The underlying response context.

Accessors

  • get data(): Nullable<ApiResponseData>
  • Gets the data to return.

    Returns Nullable<ApiResponseData>

    The data to return.

  • get headers(): OutgoingHttpHeaders
  • Gets the current HTTP response headers to add to response.

    Returns OutgoingHttpHeaders

    The HTTP response headers.

  • get messages(): IApiResponseMessage[]
  • Get the messages to return.

    Returns IApiResponseMessage[]

    The messages to return.

  • get status(): number
  • Gets the current status code.

    Returns number

    The status code.

  • get success(): boolean
  • Gets the value for the 'success' property of the response.

    Returns boolean

    The value of 'success' property of the response.

Methods

  • Adds a message.

    Parameters

    • message: string

      The message.

    Returns this

    That instance.

  • Parameters

    • options: IAddApiResponseMessageOptions

    Returns this

  • Creates a new API response object.

    Returns IApiResponse

    The new object.

  • Sets the value for 'success' result prop to '(false)'.

    Returns this

    That instance.

  • Creates and sends an API response, based of the current object of that instance.

    Returns void

  • Sets the value for the data property.

    Parameters

    • data: Nilable<ApiResponseData>

      The new value.

    Returns this

    That instance.

  • Sets additional HTTP response headers.

    Parameters

    • headers: OutgoingHttpHeaders

      Additional HTTP response headers.

    Returns this

    That instance.

  • Sets the value for the data property as list response.

    Parameters

    • items: List

    Returns this

    That instance.

  • Parameters

    • options: IWithApiResponseListOptions<any>

    Returns this

  • Sets the response HTTP status code.

    Parameters

    • code: number

      The new value.

    Returns this

    That instance.

  • Sets the value of the 'success' property.

    Parameters

    • Optional value: boolean

      The new value.

    Returns this

    That instance.

Generated using TypeDoc