UNPKG

pluto-http-client

Version:

HTTP client for NodeJS. Inspired in the Java JAX-RS spec so you can expect excellence, versatility and extensibility.

44 lines (43 loc) 1.69 kB
/// <reference types="node" /> /// <reference types="node" /> import { Marshal } from "./marshal"; import { Readable } from "stream"; import { Buffer } from "buffer"; import { MediaType } from "../core/media-type"; import { PrimitiveMultiValueMap } from "../utils/collections"; import { Unmarshal } from "./unmarshal"; export declare abstract class Entity<T> implements Marshal<T> { protected _mediaType: MediaType; constructor(_mediaType: MediaType); static json(obj?: any): Entity<string>; static form(obj: { [key: string]: string; } | PrimitiveMultiValueMap): Entity<string>; marshal(): Promise<Uint8Array | Readable>; get mediaType(): MediaType; } export declare class StringEntity extends Entity<string> implements Unmarshal<string> { private _data; constructor(_data?: string); marshal(): Promise<Uint8Array | Readable>; unmarshal(bytes: Buffer, mediaType?: MediaType): Promise<string>; } export declare class JsonEntity extends Entity<string> implements Unmarshal<any> { private _data; constructor(_data?: any); marshal(): Promise<Uint8Array | Readable>; unmarshal(bytes: Buffer, mediaType?: MediaType): Promise<any>; } export declare class BinaryEntity extends Entity<Uint8Array> implements Unmarshal<Uint8Array> { private _data; constructor(_data?: Uint8Array); marshal(): Promise<Uint8Array | Readable>; unmarshal(bytes: Buffer, mediaType?: MediaType): Promise<Uint8Array>; } export declare class FormUrlEncoded extends Entity<string> { private _entity; constructor(_entity: { [key: string]: string; } | PrimitiveMultiValueMap); marshal(): Promise<Uint8Array | Readable>; }