UNPKG

ketting

Version:

Opiniated HATEAOS / Rest client.

55 lines (54 loc) 1.15 kB
import { BaseState } from './base-state'; /** * Represents a resource state in the HAL format */ export declare class CjState<T = any> extends BaseState<T> { serializeBody(): string; clone(): CjState<T>; } /** * Turns a HTTP response into a CjState */ export declare const factory: (uri: string, response: Response) => Promise<CjState<CjCollection>>; declare type CjCollection = { version?: string; href?: string; links?: CjLink[]; items?: CjItem[]; queries?: CjQuery[]; template?: CjTemplate; error?: CjError; }; declare type CjError = { title?: string; code?: string; message?: string; }; declare type CjTemplate = { data?: CjProperty[]; }; declare type CjItem = { href?: string; data?: CjProperty[]; links?: CjLink[]; }; declare type CjProperty = { name: string; value?: string; prompt?: string; }; declare type CjQuery = { href: string; rel: string; name?: string; prompt?: string; data?: CjProperty[]; }; declare type CjLink = { href: string; rel: string; name?: string; render?: 'image' | 'link'; prompt?: string; }; export {};