Poq.SDK.Node

Home > @poq/sdk > PoqResponse

PoqResponse class

Response wrapper to simplify error and content handling. All API clients should return such wrapper instead of original response or content.

Signature:

export declare class PoqResponse<T> 

Constructors

Constructor Modifiers Description
(constructor)(response, content)   Constructs a new instance of the PoqResponse class

Properties

Property Modifiers Type Description
content   T | null Typed content that is returned by API Client.
errorMessage   string | null Error message oriented for a developer/maintainer audience.
failure   boolean Getter returns true when status is outside range [200; 300).
message   string | null Error message oriented for an end user.
statusCode   number HTTP status code is added for extra flexibility.
success   boolean Getter returns true when status is between [200; 300).

Methods

Method Modifiers Description
from(statusCode, content) static Method creates PoqResponse from http response.
from(response, content) static  
fromFailed(response, overrides) static Methods creates response object in case error 4xx occured during request.
getHeader(name)   Method returns to get header proeprty.