Options
All
  • Public
  • Public/Protected
  • All
Menu

Class OnmsResult<T>

An IOnmsHTTP query result.

Type parameters

  • T

Hierarchy

  • OnmsResult

Index

Constructors

Properties

Methods

Constructors

constructor

  • new OnmsResult(data: T, message?: string, code?: number, type?: string): OnmsResult
  • Construct a new result.

    Parameters

    • data: T

      The payload of the response.

    • Optional message: string

      The status message associated with the result.

    • Optional code: number

      The response code of the response.

    • Optional type: string

      The request type of the response.

    Returns OnmsResult

Properties

code

code: number

The response code associated with this result.

data

data: T

The data, if any.

message

message: string

The status message associated with this result.

type

type: string

The request type, if any.

Methods

isSuccess

  • isSuccess(): boolean
  • Whether this result is considered successful.

    Returns boolean

Static error

  • error(message: string, code?: number): OnmsResult<any>
  • Create a new error result.

    Parameters

    • message: string
    • Optional code: number

    Returns OnmsResult<any>

Static noContent

  • Create a new "No Content" result.

    Returns OnmsResult<string>

Static ok

  • ok(response: any, message?: string, code?: number, type?: string): OnmsResult<any>
  • Create a new success result.

    Parameters

    • response: any
    • Optional message: string
    • Optional code: number
    • Optional type: string

    Returns OnmsResult<any>

Generated using TypeDoc