@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
46 lines (45 loc) • 1.55 kB
TypeScript
import { CaseInsensitiveStringMap, MapStringTo, OptionalPropertyOf } from "../base-types";
import { RequestMessage } from "./request-message";
/**
* A response message that will be returned by {@link IInternalClient} instances.
*/
export declare class ResponseMessage<T = any> {
/**
* Headers containing additional information sent by the server.
*/
readonly responseHeaders: CaseInsensitiveStringMap<string>;
/**
* Status code indicating whether the request was successful or not.
*/
readonly statusCode: number;
/**
* A textual representation of the current status.
*/
readonly statusText?: string;
/**
* A reason explaining why the request failed.
*/
readonly reasonPhrase?: string;
/**
* The request that led to this response.
*/
readonly requestMessage?: RequestMessage;
/**
* The content (or body) that was returned.
*/
readonly content?: T;
/**
* Indicates if the response is successful.
*/
get isSuccessStatusCode(): boolean;
private constructor();
/**
* Build a response message.
* @param statusCode - HTTP status code
* @param responseHeaders - Headers containing additional information sent by the server
* @param optional - Object with more response properties (statusText, content, ...)
*/
static build<T>(statusCode: number, responseHeaders?: MapStringTo<string>, optional?: {
[key in OptionalPropertyOf<ResponseMessage>]?: any;
}): ResponseMessage<T>;
}