UNPKG

@stackend/api

Version:

JS bindings to api.stackend.com

63 lines 1.94 kB
import { Parameters, XcapJsonResult } from './index'; /** * Content type for json data * @type {string} */ export declare const CONTENT_TYPE_JSON = "application/json"; /** * Content type for form data * @type {string} */ export declare const CONTENT_TYPE_X_WWW_FORM_URLENCODED = "application/x-www-form-urlencoded"; /** * Url encode a parameter object. * @param parameters * @returns {String} */ export declare function urlEncodeParameters(parameters: Parameters | null | undefined): string; /** * Append to the query string * @param url * @param queryString * @return {String} */ export declare function appendQueryString(url: string, queryString: string): string; export interface LoadJsonResult { status: number; error?: string; response: Response | null; json?: XcapJsonResult; } export declare const DEFAULT_OPTIONS: RequestInit; /** * Load an url as json. Supports GET and POST (using application/x-www-form-urlencoded or a json body) * * @param url {String} * @param method {String} Optional method string. * @param parameters {Object} Parameters * @param body Optional body content. May be an object or string. * @param bodyContentType Mime type of the body content (optional) * @param xpressToken * @param cookie Optional cookie string * @constructor */ export declare function LoadJson({ url, method, parameters, body, bodyContentType, xpressToken, cookie, options }: { url: string; method?: string; parameters?: any; body?: any; bodyContentType?: string; xpressToken?: string; cookie?: string | null; options?: RequestInit; }): Promise<LoadJsonResult>; export default LoadJson; /** * Given a set of parameters, construct a FormData object that can be used as the body of a request * @param parameters * @return {FormData} */ export declare function createFormData(parameters: { [key: string]: any; }): FormData; //# sourceMappingURL=LoadJson.d.ts.map