Comparing version 0.14.0-beta.4 to 0.14.0-beta.5
@@ -18,11 +18,7 @@ declare enum ResponseStatusGroup { | ||
urlencoded = "urlencoded", | ||
plain = "plain" | ||
plain = "plain", | ||
formData = "formData" | ||
} | ||
declare const contentTypeMap: { | ||
readonly json: "application/json; charset=utf-8"; | ||
readonly text: "application/x-www-form-urlencoded"; | ||
readonly binary: null; | ||
readonly stream: null; | ||
}; | ||
export { ResponseStatusGroup, ExpectedResponseBodyType, RequestBodyType, contentTypeMap }; | ||
declare const requestContentTypeMap: Record<RequestBodyType, string | null>; | ||
export { ResponseStatusGroup, ExpectedResponseBodyType, RequestBodyType, requestContentTypeMap }; | ||
//# sourceMappingURL=const.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.contentTypeMap = exports.RequestBodyType = exports.ExpectedResponseBodyType = exports.ResponseStatusGroup = void 0; | ||
exports.requestContentTypeMap = exports.RequestBodyType = exports.ExpectedResponseBodyType = exports.ResponseStatusGroup = void 0; | ||
var ResponseStatusGroup; | ||
@@ -25,10 +25,11 @@ (function (ResponseStatusGroup) { | ||
RequestBodyType["plain"] = "plain"; | ||
RequestBodyType["formData"] = "formData"; | ||
})(RequestBodyType || (exports.RequestBodyType = RequestBodyType = {})); | ||
const contentTypeMap = { | ||
const requestContentTypeMap = { | ||
json: "application/json; charset=utf-8", | ||
text: "application/x-www-form-urlencoded", | ||
binary: null, | ||
stream: null, | ||
urlencoded: "application/x-www-form-urlencoded", | ||
plain: null, | ||
formData: null, | ||
}; | ||
exports.contentTypeMap = contentTypeMap; | ||
exports.requestContentTypeMap = requestContentTypeMap; | ||
//# sourceMappingURL=const.js.map |
import type { ApiResponse } from "./response/response.js"; | ||
import type { AbortablePromise, ApiEndpoints, Dependencies, GenericHeaders, Options, RequestData, RequestOptions, BodyType, BodyTypeType, HeadersType, ParamsType, QueryType, ValidateApiEndpoints } from "./types"; | ||
import type { AbortablePromise, ApiEndpoints, BodyType, BodyTypeType, Dependencies, GenericHeaders, HeadersType, Options, ParamsType, QueryType, RequestData, RequestOptions, ValidateApiEndpoints } from "./types"; | ||
import { ExpectedResponseBodyType } from "./const.js"; | ||
import { ResponseDataTypeMismatchError } from "./errors.js"; | ||
declare class ApiClient<T extends ExpectedResponseBodyType, RL extends ApiEndpoints> { | ||
declare class ApiClient<T extends ExpectedResponseBodyType, Endp extends ApiEndpoints> { | ||
private readonly _options; | ||
@@ -11,3 +11,3 @@ private readonly _dependencies; | ||
private _getRequestType; | ||
private _getContentType; | ||
private _getRequestContentType; | ||
private _buildRequestBody; | ||
@@ -19,5 +19,5 @@ private _buildFetchOptions; | ||
private _buildUrl; | ||
get<U extends keyof RL["get"] & string, P extends ParamsType<RL["get"][U]>, B extends BodyType<RL["get"][U]>, BT extends BodyTypeType<RL["get"][U]>, Q extends QueryType<RL["get"][U]>, H extends HeadersType<RL["get"][U]>, D extends RequestData<P, B, BT, Q, H>, RB extends RL["get"][U]["response"], RT extends ExpectedResponseBodyType = T>(url: U, data: D, options?: RequestOptions<RT, H>): AbortablePromise<RT extends ExpectedResponseBodyType.json ? ApiResponse<"get", U, P, B, BT, Q, H, RB, RT> : RT extends ExpectedResponseBodyType.stream ? ApiResponse<"get", U, P, B, BT, Q, H, ReadableStream, RT> : ApiResponse<"get", U, P, B, BT, Q, H, string, RT>>; | ||
post<U extends keyof RL["post"] & string, P extends ParamsType<RL["post"][U]>, B extends BodyType<RL["post"][U]>, BT extends BodyTypeType<RL["post"][U]>, Q extends QueryType<RL["post"][U]>, H extends HeadersType<RL["post"][U]>, D extends RequestData<P, B, BT, Q, H>, RB extends RL["post"][U]["response"], RT extends ExpectedResponseBodyType = T>(url: U, data: D, options?: RequestOptions<RT, H>): AbortablePromise<RT extends ExpectedResponseBodyType.json ? ApiResponse<"post", U, P, B, BT, Q, H, RB, RT> : RT extends ExpectedResponseBodyType.stream ? ApiResponse<"post", U, P, B, BT, Q, H, ReadableStream, RT> : ApiResponse<"post", U, P, B, BT, Q, H, string, RT>>; | ||
request<Mthd extends string, U extends keyof RL[Lowercase<Mthd>] & string, P extends ParamsType<RL[Lowercase<Mthd>][U]>, B extends BodyType<RL[Lowercase<Mthd>][U]>, BT extends BodyTypeType<RL[Lowercase<Mthd>][U]>, Q extends QueryType<RL[Lowercase<Mthd>][U]>, H extends HeadersType<RL[Lowercase<Mthd>][U]>, D extends RequestData<P, B, BT, Q, H>, RB extends RL[Lowercase<Mthd>][U]["response"], RT extends ExpectedResponseBodyType = T>(method: Mthd, url: U, data: D, options?: RequestOptions<RT, H>): AbortablePromise<RT extends ExpectedResponseBodyType.json ? ApiResponse<Mthd, U, P, B, BT, Q, H, RB, RT> : RT extends ExpectedResponseBodyType.stream ? ApiResponse<Mthd, U, P, B, BT, Q, H, ReadableStream, RT> : ApiResponse<Mthd, U, P, B, BT, Q, H, string, RT>>; | ||
get<U extends keyof Endp["get"] & string, P extends ParamsType<Endp["get"][U]>, B extends BodyType<Endp["get"][U]>, BT extends BodyTypeType<Endp["get"][U]>, Q extends QueryType<Endp["get"][U]>, H extends HeadersType<Endp["get"][U]>, D extends RequestData<P, B, BT, Q, H>, RB extends Endp["get"][U]["response"], RT extends ExpectedResponseBodyType = T>(url: U, data: D, options?: RequestOptions<RT, H>): AbortablePromise<RT extends ExpectedResponseBodyType.json ? ApiResponse<"get", U, P, B, BT, Q, H, RB, RT> : RT extends ExpectedResponseBodyType.stream ? ApiResponse<"get", U, P, B, BT, Q, H, ReadableStream, RT> : ApiResponse<"get", U, P, B, BT, Q, H, string, RT>>; | ||
post<U extends keyof Endp["post"] & string, P extends ParamsType<Endp["post"][U]>, B extends BodyType<Endp["post"][U]>, BT extends BodyTypeType<Endp["post"][U]>, Q extends QueryType<Endp["post"][U]>, H extends HeadersType<Endp["post"][U]>, D extends RequestData<P, B, BT, Q, H>, RB extends Endp["post"][U]["response"], RT extends ExpectedResponseBodyType = T>(url: U, data: D, options?: RequestOptions<RT, H>): AbortablePromise<RT extends ExpectedResponseBodyType.json ? ApiResponse<"post", U, P, B, BT, Q, H, RB, RT> : RT extends ExpectedResponseBodyType.stream ? ApiResponse<"post", U, P, B, BT, Q, H, ReadableStream, RT> : ApiResponse<"post", U, P, B, BT, Q, H, string, RT>>; | ||
request<Mthd extends string, U extends keyof Endp[Lowercase<Mthd>] & string, P extends ParamsType<Endp[Lowercase<Mthd>][U]>, B extends BodyType<Endp[Lowercase<Mthd>][U]>, BT extends BodyTypeType<Endp[Lowercase<Mthd>][U]>, Q extends QueryType<Endp[Lowercase<Mthd>][U]>, H extends HeadersType<Endp[Lowercase<Mthd>][U]>, D extends RequestData<P, B, BT, Q, H>, RB extends Endp[Lowercase<Mthd>][U]["response"], RT extends ExpectedResponseBodyType = T>(method: Mthd, url: U, data: D, options?: RequestOptions<RT, H>): AbortablePromise<RT extends ExpectedResponseBodyType.json ? ApiResponse<Mthd, U, P, B, BT, Q, H, RB, RT> : RT extends ExpectedResponseBodyType.stream ? ApiResponse<Mthd, U, P, B, BT, Q, H, ReadableStream, RT> : ApiResponse<Mthd, U, P, B, BT, Q, H, string, RT>>; | ||
private _prepareAndSendRequest; | ||
@@ -24,0 +24,0 @@ private _sendRequest; |
@@ -18,3 +18,2 @@ "use strict"; | ||
responseType: const_js_1.ExpectedResponseBodyType.json, | ||
requestType: const_js_1.RequestBodyType.json, | ||
timeout: 30000, | ||
@@ -47,3 +46,3 @@ retry: 0, | ||
this._options = options !== null && options !== void 0 ? options : {}; | ||
this._dependencies = Object.assign({ fetch: fetch, URL: URL, qsStringify: qs_1.default.stringify, AbortController: AbortController }, dependencies); | ||
this._dependencies = Object.assign({ fetch: fetch, URL: URL, FormData: FormData, qsStringify: qs_1.default.stringify, AbortController: AbortController }, dependencies); | ||
} | ||
@@ -54,38 +53,42 @@ _getResponseType(options) { | ||
} | ||
_getRequestType(options) { | ||
var _a, _b; | ||
return (_b = (_a = options.requestType) !== null && _a !== void 0 ? _a : this._options.requestType) !== null && _b !== void 0 ? _b : const_js_1.RequestBodyType.json; | ||
_getRequestType(data) { | ||
var _a; | ||
return (_a = data.bodyType) !== null && _a !== void 0 ? _a : const_js_1.RequestBodyType.json; | ||
} | ||
_getContentType(options) { | ||
const type = this._getResponseType(options); | ||
return const_js_1.contentTypeMap[type]; | ||
_getRequestContentType(data) { | ||
const type = this._getRequestType(data); | ||
return const_js_1.requestContentTypeMap[type]; | ||
} | ||
_buildRequestBody(options, body) { | ||
const requestType = this._getRequestType(options); | ||
if (requestType === const_js_1.RequestBodyType.plain && typeof body !== "string") { | ||
_buildRequestBody(data) { | ||
const requestType = this._getRequestType(data); | ||
if (requestType === const_js_1.RequestBodyType.plain && typeof data.body !== "string") { | ||
throw new Error("Body must be a string when request type is set to plain text"); | ||
} | ||
if (typeof body === "string") { | ||
return body; | ||
const isFormData = data.body instanceof this._dependencies.FormData; | ||
if (requestType === const_js_1.RequestBodyType.formData && !isFormData) { | ||
throw new Error("Body must be a FormData object when request type is set to form data"); | ||
} | ||
if (isFormData || typeof data.body === "string") { | ||
return data.body; | ||
} | ||
if (requestType === const_js_1.RequestBodyType.json) { | ||
return JSON.stringify(body); | ||
return JSON.stringify(data.body); | ||
} | ||
if (requestType === const_js_1.RequestBodyType.urlencoded) { | ||
return this._dependencies.qsStringify(body); | ||
return this._dependencies.qsStringify(data.body); | ||
} | ||
return null; | ||
} | ||
_buildFetchOptions(options, method, body, headers) { | ||
var _a, _b, _c, _d; | ||
_buildFetchOptions(options, method, data) { | ||
var _a, _b, _c, _d, _e; | ||
const instanceHeaders = (_b = (_a = this._options.fetchOptions) === null || _a === void 0 ? void 0 : _a.headers) !== null && _b !== void 0 ? _b : {}; | ||
const requestHeaders = headers !== null && headers !== void 0 ? headers : {}; | ||
const requestHeaders = (_c = data === null || data === void 0 ? void 0 : data.headers) !== null && _c !== void 0 ? _c : {}; | ||
const contentType = {}; | ||
const bodyOptions = {}; | ||
if (body != null) { | ||
const ct = this._getContentType(options); | ||
if ((data === null || data === void 0 ? void 0 : data.body) != null) { | ||
const ct = this._getRequestContentType(data); | ||
if (ct != null) { | ||
contentType["Content-Type"] = ct; | ||
} | ||
const bd = this._buildRequestBody(options, body); | ||
const bd = this._buildRequestBody(data); | ||
if (bd != null) { | ||
@@ -95,3 +98,3 @@ bodyOptions.body = bd; | ||
} | ||
const retry = (_d = (_c = options.retry) !== null && _c !== void 0 ? _c : this._options.retry) !== null && _d !== void 0 ? _d : defaultOptions.retry; | ||
const retry = (_e = (_d = options.retry) !== null && _d !== void 0 ? _d : this._options.retry) !== null && _e !== void 0 ? _e : defaultOptions.retry; | ||
const cache = this._buildCacheOptions(options); | ||
@@ -174,3 +177,3 @@ const opts = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, utils_1.omit)(defaultOptions, ["cache"])), (0, utils_1.omit)(this._options, ["cache"])), (0, utils_1.omit)(options, ["cache"])), { retry: { | ||
const _data = data; | ||
const finalOptions = this._buildFetchOptions(options !== null && options !== void 0 ? options : {}, method.toUpperCase(), _data === null || _data === void 0 ? void 0 : _data.body, _data === null || _data === void 0 ? void 0 : _data.headers); | ||
const finalOptions = this._buildFetchOptions(options !== null && options !== void 0 ? options : {}, method.toUpperCase(), _data); | ||
const finalUrl = this._buildUrl(url, _data === null || _data === void 0 ? void 0 : _data.params, _data === null || _data === void 0 ? void 0 : _data.query, finalOptions); | ||
@@ -177,0 +180,0 @@ const request = new request_js_1.ApiRequest(method.toUpperCase(), { url: url, fullUrl: finalUrl }, _data, finalOptions); |
import type { RequestRedirect as NodeFetchRequestRedirect } from "node-fetch"; | ||
import type { ExpectedResponseBodyType, RequestBodyType } from "../const"; | ||
import type { ExpectedResponseBodyType } from "../const"; | ||
import type { GenericHeaders } from "./common"; | ||
@@ -32,3 +32,2 @@ import type { CacheGetKey, CacheGetTTL, CacheInterface, CacheShouldCacheResponse, CacheSaveStrategy, CacheLoadStrategy } from "./cache"; | ||
responseType?: RT; | ||
requestType?: RequestBodyType; | ||
retry?: RetryOptions; | ||
@@ -58,3 +57,3 @@ timeout?: number | TimeoutOptions; | ||
method: string; | ||
body?: string; | ||
body?: any; | ||
headers: H; | ||
@@ -67,2 +66,3 @@ redirect?: NodeFetchRequestRedirect; | ||
URL: typeof URL; | ||
FormData: typeof FormData; | ||
AbortController: typeof AbortController; | ||
@@ -69,0 +69,0 @@ qsStringify: (data: unknown) => string; |
@@ -1,1 +0,1 @@ | ||
window.searchData = JSON.parse("{\"kinds\":{\"8\":\"Enumeration\",\"16\":\"Enumeration Member\",\"64\":\"Function\",\"128\":\"Class\",\"512\":\"Constructor\",\"1024\":\"Property\",\"2048\":\"Method\",\"4194304\":\"Type alias\",\"33554432\":\"@knodes/typedoc-plugin-pages: page\"},\"rows\":[{\"kind\":64,\"name\":\"createApiClient\",\"url\":\"functions/createApiClient.html\",\"classes\":\"tsd-kind-function\"},{\"kind\":128,\"name\":\"ApiClient\",\"url\":\"classes/ApiClient.html\",\"classes\":\"tsd-kind-class\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/ApiClient.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class\",\"parent\":\"ApiClient\"},{\"kind\":1024,\"name\":\"_options\",\"url\":\"classes/ApiClient.html#_options\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":1024,\"name\":\"_dependencies\",\"url\":\"classes/ApiClient.html#_dependencies\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_getResponseType\",\"url\":\"classes/ApiClient.html#_getResponseType\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_getRequestType\",\"url\":\"classes/ApiClient.html#_getRequestType\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_getContentType\",\"url\":\"classes/ApiClient.html#_getContentType\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_buildRequestBody\",\"url\":\"classes/ApiClient.html#_buildRequestBody\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_buildFetchOptions\",\"url\":\"classes/ApiClient.html#_buildFetchOptions\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_buildCacheOptions\",\"url\":\"classes/ApiClient.html#_buildCacheOptions\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_safeUrlParse\",\"url\":\"classes/ApiClient.html#_safeUrlParse\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_buildUrlBase\",\"url\":\"classes/ApiClient.html#_buildUrlBase\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_buildUrl\",\"url\":\"classes/ApiClient.html#_buildUrl\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"get\",\"url\":\"classes/ApiClient.html#get\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"post\",\"url\":\"classes/ApiClient.html#post\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"request\",\"url\":\"classes/ApiClient.html#request\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_prepareAndSendRequest\",\"url\":\"classes/ApiClient.html#_prepareAndSendRequest\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_sendRequest\",\"url\":\"classes/ApiClient.html#_sendRequest\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_buildResponse\",\"url\":\"classes/ApiClient.html#_buildResponse\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":64,\"name\":\"ResponseDataTypeMismatchError\",\"url\":\"functions/ResponseDataTypeMismatchError-1.html\",\"classes\":\"tsd-kind-function\"},{\"kind\":4194304,\"name\":\"ResponseDataTypeMismatchError\",\"url\":\"types/ResponseDataTypeMismatchError.html\",\"classes\":\"tsd-kind-type-alias\"},{\"kind\":128,\"name\":\"AbortedResponse\",\"url\":\"classes/AbortedResponse.html\",\"classes\":\"tsd-kind-class\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/AbortedResponse.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"AbortedResponse\"},{\"kind\":1024,\"name\":\"status\",\"url\":\"classes/AbortedResponse.html#status\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"AbortedResponse\"},{\"kind\":1024,\"name\":\"statusText\",\"url\":\"classes/AbortedResponse.html#statusText\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"AbortedResponse\"},{\"kind\":1024,\"name\":\"headers\",\"url\":\"classes/AbortedResponse.html#headers\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"AbortedResponse\"},{\"kind\":1024,\"name\":\"request\",\"url\":\"classes/AbortedResponse.html#request\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"AbortedResponse\"},{\"kind\":1024,\"name\":\"body\",\"url\":\"classes/AbortedResponse.html#body\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"AbortedResponse\"},{\"kind\":1024,\"name\":\"cached\",\"url\":\"classes/AbortedResponse.html#cached\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"AbortedResponse\"},{\"kind\":128,\"name\":\"InformationalResponse\",\"url\":\"classes/InformationalResponse.html\",\"classes\":\"tsd-kind-class\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/InformationalResponse.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"InformationalResponse\"},{\"kind\":1024,\"name\":\"status\",\"url\":\"classes/InformationalResponse.html#status\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"InformationalResponse\"},{\"kind\":1024,\"name\":\"statusText\",\"url\":\"classes/InformationalResponse.html#statusText\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"InformationalResponse\"},{\"kind\":1024,\"name\":\"headers\",\"url\":\"classes/InformationalResponse.html#headers\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"InformationalResponse\"},{\"kind\":1024,\"name\":\"request\",\"url\":\"classes/InformationalResponse.html#request\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"InformationalResponse\"},{\"kind\":1024,\"name\":\"body\",\"url\":\"classes/InformationalResponse.html#body\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"InformationalResponse\"},{\"kind\":1024,\"name\":\"cached\",\"url\":\"classes/InformationalResponse.html#cached\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"InformationalResponse\"},{\"kind\":128,\"name\":\"SuccessResponse\",\"url\":\"classes/SuccessResponse.html\",\"classes\":\"tsd-kind-class\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/SuccessResponse.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"SuccessResponse\"},{\"kind\":1024,\"name\":\"status\",\"url\":\"classes/SuccessResponse.html#status\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"SuccessResponse\"},{\"kind\":1024,\"name\":\"statusText\",\"url\":\"classes/SuccessResponse.html#statusText\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"SuccessResponse\"},{\"kind\":1024,\"name\":\"headers\",\"url\":\"classes/SuccessResponse.html#headers\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"SuccessResponse\"},{\"kind\":1024,\"name\":\"request\",\"url\":\"classes/SuccessResponse.html#request\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"SuccessResponse\"},{\"kind\":1024,\"name\":\"body\",\"url\":\"classes/SuccessResponse.html#body\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"SuccessResponse\"},{\"kind\":1024,\"name\":\"cached\",\"url\":\"classes/SuccessResponse.html#cached\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"SuccessResponse\"},{\"kind\":128,\"name\":\"RedirectResponse\",\"url\":\"classes/RedirectResponse.html\",\"classes\":\"tsd-kind-class\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/RedirectResponse.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"RedirectResponse\"},{\"kind\":1024,\"name\":\"status\",\"url\":\"classes/RedirectResponse.html#status\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"RedirectResponse\"},{\"kind\":1024,\"name\":\"statusText\",\"url\":\"classes/RedirectResponse.html#statusText\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"RedirectResponse\"},{\"kind\":1024,\"name\":\"headers\",\"url\":\"classes/RedirectResponse.html#headers\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"RedirectResponse\"},{\"kind\":1024,\"name\":\"request\",\"url\":\"classes/RedirectResponse.html#request\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"RedirectResponse\"},{\"kind\":1024,\"name\":\"body\",\"url\":\"classes/RedirectResponse.html#body\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"RedirectResponse\"},{\"kind\":1024,\"name\":\"cached\",\"url\":\"classes/RedirectResponse.html#cached\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"RedirectResponse\"},{\"kind\":128,\"name\":\"ClientErrorResponse\",\"url\":\"classes/ClientErrorResponse.html\",\"classes\":\"tsd-kind-class\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/ClientErrorResponse.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ClientErrorResponse\"},{\"kind\":1024,\"name\":\"status\",\"url\":\"classes/ClientErrorResponse.html#status\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ClientErrorResponse\"},{\"kind\":1024,\"name\":\"statusText\",\"url\":\"classes/ClientErrorResponse.html#statusText\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ClientErrorResponse\"},{\"kind\":1024,\"name\":\"headers\",\"url\":\"classes/ClientErrorResponse.html#headers\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ClientErrorResponse\"},{\"kind\":1024,\"name\":\"request\",\"url\":\"classes/ClientErrorResponse.html#request\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ClientErrorResponse\"},{\"kind\":1024,\"name\":\"body\",\"url\":\"classes/ClientErrorResponse.html#body\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ClientErrorResponse\"},{\"kind\":1024,\"name\":\"cached\",\"url\":\"classes/ClientErrorResponse.html#cached\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ClientErrorResponse\"},{\"kind\":128,\"name\":\"ServerErrorResponse\",\"url\":\"classes/ServerErrorResponse.html\",\"classes\":\"tsd-kind-class\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/ServerErrorResponse.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ServerErrorResponse\"},{\"kind\":1024,\"name\":\"status\",\"url\":\"classes/ServerErrorResponse.html#status\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ServerErrorResponse\"},{\"kind\":1024,\"name\":\"statusText\",\"url\":\"classes/ServerErrorResponse.html#statusText\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ServerErrorResponse\"},{\"kind\":1024,\"name\":\"headers\",\"url\":\"classes/ServerErrorResponse.html#headers\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ServerErrorResponse\"},{\"kind\":1024,\"name\":\"request\",\"url\":\"classes/ServerErrorResponse.html#request\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ServerErrorResponse\"},{\"kind\":1024,\"name\":\"body\",\"url\":\"classes/ServerErrorResponse.html#body\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ServerErrorResponse\"},{\"kind\":1024,\"name\":\"cached\",\"url\":\"classes/ServerErrorResponse.html#cached\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ServerErrorResponse\"},{\"kind\":8,\"name\":\"ExpectedResponseBodyType\",\"url\":\"enums/ExpectedResponseBodyType.html\",\"classes\":\"tsd-kind-enum\"},{\"kind\":16,\"name\":\"json\",\"url\":\"enums/ExpectedResponseBodyType.html#json\",\"classes\":\"tsd-kind-enum-member tsd-parent-kind-enum\",\"parent\":\"ExpectedResponseBodyType\"},{\"kind\":16,\"name\":\"text\",\"url\":\"enums/ExpectedResponseBodyType.html#text\",\"classes\":\"tsd-kind-enum-member tsd-parent-kind-enum\",\"parent\":\"ExpectedResponseBodyType\"},{\"kind\":16,\"name\":\"binary\",\"url\":\"enums/ExpectedResponseBodyType.html#binary\",\"classes\":\"tsd-kind-enum-member tsd-parent-kind-enum\",\"parent\":\"ExpectedResponseBodyType\"},{\"kind\":16,\"name\":\"stream\",\"url\":\"enums/ExpectedResponseBodyType.html#stream\",\"classes\":\"tsd-kind-enum-member tsd-parent-kind-enum\",\"parent\":\"ExpectedResponseBodyType\"},{\"kind\":4194304,\"name\":\"ApiEndpoints\",\"url\":\"types/ApiEndpoints.html\",\"classes\":\"tsd-kind-type-alias\"},{\"kind\":4194304,\"name\":\"ValidateApiEndpoints\",\"url\":\"types/ValidateApiEndpoints.html\",\"classes\":\"tsd-kind-type-alias\"},{\"kind\":33554432,\"name\":\"Basic usage\",\"url\":\"pages/tutorials/Basic usage.html\",\"classes\":\"pages-entry pages-entry-page\"},{\"kind\":33554432,\"name\":\"Usage with React Native\",\"url\":\"pages/tutorials/Usage with React Native.html\",\"classes\":\"pages-entry pages-entry-page\"}],\"index\":{\"version\":\"2.3.9\",\"fields\":[\"name\",\"comment\"],\"fieldVectors\":[[\"name/0\",[0,40.565]],[\"comment/0\",[]],[\"name/1\",[1,40.565]],[\"comment/1\",[]],[\"name/2\",[2,24.147]],[\"comment/2\",[]],[\"name/3\",[3,40.565]],[\"comment/3\",[]],[\"name/4\",[4,40.565]],[\"comment/4\",[]],[\"name/5\",[5,40.565]],[\"comment/5\",[]],[\"name/6\",[6,40.565]],[\"comment/6\",[]],[\"name/7\",[7,40.565]],[\"comment/7\",[]],[\"name/8\",[8,40.565]],[\"comment/8\",[]],[\"name/9\",[9,40.565]],[\"comment/9\",[]],[\"name/10\",[10,40.565]],[\"comment/10\",[]],[\"name/11\",[11,40.565]],[\"comment/11\",[]],[\"name/12\",[12,40.565]],[\"comment/12\",[]],[\"name/13\",[13,40.565]],[\"comment/13\",[]],[\"name/14\",[14,40.565]],[\"comment/14\",[]],[\"name/15\",[15,40.565]],[\"comment/15\",[]],[\"name/16\",[16,24.147]],[\"comment/16\",[]],[\"name/17\",[17,40.565]],[\"comment/17\",[]],[\"name/18\",[18,40.565]],[\"comment/18\",[]],[\"name/19\",[19,40.565]],[\"comment/19\",[]],[\"name/20\",[20,35.354]],[\"comment/20\",[]],[\"name/21\",[20,35.354]],[\"comment/21\",[]],[\"name/22\",[21,40.565]],[\"comment/22\",[]],[\"name/23\",[2,24.147]],[\"comment/23\",[]],[\"name/24\",[22,25.607]],[\"comment/24\",[]],[\"name/25\",[23,25.607]],[\"comment/25\",[]],[\"name/26\",[24,25.607]],[\"comment/26\",[]],[\"name/27\",[16,24.147]],[\"comment/27\",[]],[\"name/28\",[25,25.607]],[\"comment/28\",[]],[\"name/29\",[26,25.607]],[\"comment/29\",[]],[\"name/30\",[27,40.565]],[\"comment/30\",[]],[\"name/31\",[2,24.147]],[\"comment/31\",[]],[\"name/32\",[22,25.607]],[\"comment/32\",[]],[\"name/33\",[23,25.607]],[\"comment/33\",[]],[\"name/34\",[24,25.607]],[\"comment/34\",[]],[\"name/35\",[16,24.147]],[\"comment/35\",[]],[\"name/36\",[25,25.607]],[\"comment/36\",[]],[\"name/37\",[26,25.607]],[\"comment/37\",[]],[\"name/38\",[28,40.565]],[\"comment/38\",[]],[\"name/39\",[2,24.147]],[\"comment/39\",[]],[\"name/40\",[22,25.607]],[\"comment/40\",[]],[\"name/41\",[23,25.607]],[\"comment/41\",[]],[\"name/42\",[24,25.607]],[\"comment/42\",[]],[\"name/43\",[16,24.147]],[\"comment/43\",[]],[\"name/44\",[25,25.607]],[\"comment/44\",[]],[\"name/45\",[26,25.607]],[\"comment/45\",[]],[\"name/46\",[29,40.565]],[\"comment/46\",[]],[\"name/47\",[2,24.147]],[\"comment/47\",[]],[\"name/48\",[22,25.607]],[\"comment/48\",[]],[\"name/49\",[23,25.607]],[\"comment/49\",[]],[\"name/50\",[24,25.607]],[\"comment/50\",[]],[\"name/51\",[16,24.147]],[\"comment/51\",[]],[\"name/52\",[25,25.607]],[\"comment/52\",[]],[\"name/53\",[26,25.607]],[\"comment/53\",[]],[\"name/54\",[30,40.565]],[\"comment/54\",[]],[\"name/55\",[2,24.147]],[\"comment/55\",[]],[\"name/56\",[22,25.607]],[\"comment/56\",[]],[\"name/57\",[23,25.607]],[\"comment/57\",[]],[\"name/58\",[24,25.607]],[\"comment/58\",[]],[\"name/59\",[16,24.147]],[\"comment/59\",[]],[\"name/60\",[25,25.607]],[\"comment/60\",[]],[\"name/61\",[26,25.607]],[\"comment/61\",[]],[\"name/62\",[31,40.565]],[\"comment/62\",[]],[\"name/63\",[2,24.147]],[\"comment/63\",[]],[\"name/64\",[22,25.607]],[\"comment/64\",[]],[\"name/65\",[23,25.607]],[\"comment/65\",[]],[\"name/66\",[24,25.607]],[\"comment/66\",[]],[\"name/67\",[16,24.147]],[\"comment/67\",[]],[\"name/68\",[25,25.607]],[\"comment/68\",[]],[\"name/69\",[26,25.607]],[\"comment/69\",[]],[\"name/70\",[32,40.565]],[\"comment/70\",[]],[\"name/71\",[33,40.565]],[\"comment/71\",[]],[\"name/72\",[34,40.565]],[\"comment/72\",[]],[\"name/73\",[35,40.565]],[\"comment/73\",[]],[\"name/74\",[36,40.565]],[\"comment/74\",[]],[\"name/75\",[37,40.565]],[\"comment/75\",[]],[\"name/76\",[38,40.565]],[\"comment/76\",[]],[\"name/77\",[39,29.033,40,25.304]],[\"comment/77\",[]],[\"name/78\",[40,16.132,41,18.509,42,18.509,43,18.509]],[\"comment/78\",[]]],\"invertedIndex\":[[\"_buildcacheoptions\",{\"_index\":10,\"name\":{\"10\":{}},\"comment\":{}}],[\"_buildfetchoptions\",{\"_index\":9,\"name\":{\"9\":{}},\"comment\":{}}],[\"_buildrequestbody\",{\"_index\":8,\"name\":{\"8\":{}},\"comment\":{}}],[\"_buildresponse\",{\"_index\":19,\"name\":{\"19\":{}},\"comment\":{}}],[\"_buildurl\",{\"_index\":13,\"name\":{\"13\":{}},\"comment\":{}}],[\"_buildurlbase\",{\"_index\":12,\"name\":{\"12\":{}},\"comment\":{}}],[\"_dependencies\",{\"_index\":4,\"name\":{\"4\":{}},\"comment\":{}}],[\"_getcontenttype\",{\"_index\":7,\"name\":{\"7\":{}},\"comment\":{}}],[\"_getrequesttype\",{\"_index\":6,\"name\":{\"6\":{}},\"comment\":{}}],[\"_getresponsetype\",{\"_index\":5,\"name\":{\"5\":{}},\"comment\":{}}],[\"_options\",{\"_index\":3,\"name\":{\"3\":{}},\"comment\":{}}],[\"_prepareandsendrequest\",{\"_index\":17,\"name\":{\"17\":{}},\"comment\":{}}],[\"_safeurlparse\",{\"_index\":11,\"name\":{\"11\":{}},\"comment\":{}}],[\"_sendrequest\",{\"_index\":18,\"name\":{\"18\":{}},\"comment\":{}}],[\"abortedresponse\",{\"_index\":21,\"name\":{\"22\":{}},\"comment\":{}}],[\"apiclient\",{\"_index\":1,\"name\":{\"1\":{}},\"comment\":{}}],[\"apiendpoints\",{\"_index\":37,\"name\":{\"75\":{}},\"comment\":{}}],[\"basic\",{\"_index\":39,\"name\":{\"77\":{}},\"comment\":{}}],[\"binary\",{\"_index\":35,\"name\":{\"73\":{}},\"comment\":{}}],[\"body\",{\"_index\":25,\"name\":{\"28\":{},\"36\":{},\"44\":{},\"52\":{},\"60\":{},\"68\":{}},\"comment\":{}}],[\"cached\",{\"_index\":26,\"name\":{\"29\":{},\"37\":{},\"45\":{},\"53\":{},\"61\":{},\"69\":{}},\"comment\":{}}],[\"clienterrorresponse\",{\"_index\":30,\"name\":{\"54\":{}},\"comment\":{}}],[\"constructor\",{\"_index\":2,\"name\":{\"2\":{},\"23\":{},\"31\":{},\"39\":{},\"47\":{},\"55\":{},\"63\":{}},\"comment\":{}}],[\"createapiclient\",{\"_index\":0,\"name\":{\"0\":{}},\"comment\":{}}],[\"expectedresponsebodytype\",{\"_index\":32,\"name\":{\"70\":{}},\"comment\":{}}],[\"get\",{\"_index\":14,\"name\":{\"14\":{}},\"comment\":{}}],[\"headers\",{\"_index\":24,\"name\":{\"26\":{},\"34\":{},\"42\":{},\"50\":{},\"58\":{},\"66\":{}},\"comment\":{}}],[\"informationalresponse\",{\"_index\":27,\"name\":{\"30\":{}},\"comment\":{}}],[\"json\",{\"_index\":33,\"name\":{\"71\":{}},\"comment\":{}}],[\"native\",{\"_index\":43,\"name\":{\"78\":{}},\"comment\":{}}],[\"post\",{\"_index\":15,\"name\":{\"15\":{}},\"comment\":{}}],[\"react\",{\"_index\":42,\"name\":{\"78\":{}},\"comment\":{}}],[\"redirectresponse\",{\"_index\":29,\"name\":{\"46\":{}},\"comment\":{}}],[\"request\",{\"_index\":16,\"name\":{\"16\":{},\"27\":{},\"35\":{},\"43\":{},\"51\":{},\"59\":{},\"67\":{}},\"comment\":{}}],[\"responsedatatypemismatcherror\",{\"_index\":20,\"name\":{\"20\":{},\"21\":{}},\"comment\":{}}],[\"servererrorresponse\",{\"_index\":31,\"name\":{\"62\":{}},\"comment\":{}}],[\"status\",{\"_index\":22,\"name\":{\"24\":{},\"32\":{},\"40\":{},\"48\":{},\"56\":{},\"64\":{}},\"comment\":{}}],[\"statustext\",{\"_index\":23,\"name\":{\"25\":{},\"33\":{},\"41\":{},\"49\":{},\"57\":{},\"65\":{}},\"comment\":{}}],[\"stream\",{\"_index\":36,\"name\":{\"74\":{}},\"comment\":{}}],[\"successresponse\",{\"_index\":28,\"name\":{\"38\":{}},\"comment\":{}}],[\"text\",{\"_index\":34,\"name\":{\"72\":{}},\"comment\":{}}],[\"usage\",{\"_index\":40,\"name\":{\"77\":{},\"78\":{}},\"comment\":{}}],[\"validateapiendpoints\",{\"_index\":38,\"name\":{\"76\":{}},\"comment\":{}}],[\"with\",{\"_index\":41,\"name\":{\"78\":{}},\"comment\":{}}]],\"pipeline\":[]}}"); | ||
window.searchData = JSON.parse("{\"kinds\":{\"8\":\"Enumeration\",\"16\":\"Enumeration Member\",\"64\":\"Function\",\"128\":\"Class\",\"512\":\"Constructor\",\"1024\":\"Property\",\"2048\":\"Method\",\"4194304\":\"Type alias\",\"33554432\":\"@knodes/typedoc-plugin-pages: page\"},\"rows\":[{\"kind\":64,\"name\":\"createApiClient\",\"url\":\"functions/createApiClient.html\",\"classes\":\"tsd-kind-function\"},{\"kind\":128,\"name\":\"ApiClient\",\"url\":\"classes/ApiClient.html\",\"classes\":\"tsd-kind-class\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/ApiClient.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class\",\"parent\":\"ApiClient\"},{\"kind\":1024,\"name\":\"_options\",\"url\":\"classes/ApiClient.html#_options\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":1024,\"name\":\"_dependencies\",\"url\":\"classes/ApiClient.html#_dependencies\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_getResponseType\",\"url\":\"classes/ApiClient.html#_getResponseType\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_getRequestType\",\"url\":\"classes/ApiClient.html#_getRequestType\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_getRequestContentType\",\"url\":\"classes/ApiClient.html#_getRequestContentType\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_buildRequestBody\",\"url\":\"classes/ApiClient.html#_buildRequestBody\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_buildFetchOptions\",\"url\":\"classes/ApiClient.html#_buildFetchOptions\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_buildCacheOptions\",\"url\":\"classes/ApiClient.html#_buildCacheOptions\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_safeUrlParse\",\"url\":\"classes/ApiClient.html#_safeUrlParse\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_buildUrlBase\",\"url\":\"classes/ApiClient.html#_buildUrlBase\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_buildUrl\",\"url\":\"classes/ApiClient.html#_buildUrl\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"get\",\"url\":\"classes/ApiClient.html#get\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"post\",\"url\":\"classes/ApiClient.html#post\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"request\",\"url\":\"classes/ApiClient.html#request\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_prepareAndSendRequest\",\"url\":\"classes/ApiClient.html#_prepareAndSendRequest\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_sendRequest\",\"url\":\"classes/ApiClient.html#_sendRequest\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":2048,\"name\":\"_buildResponse\",\"url\":\"classes/ApiClient.html#_buildResponse\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"ApiClient\"},{\"kind\":64,\"name\":\"ResponseDataTypeMismatchError\",\"url\":\"functions/ResponseDataTypeMismatchError-1.html\",\"classes\":\"tsd-kind-function\"},{\"kind\":4194304,\"name\":\"ResponseDataTypeMismatchError\",\"url\":\"types/ResponseDataTypeMismatchError.html\",\"classes\":\"tsd-kind-type-alias\"},{\"kind\":128,\"name\":\"AbortedResponse\",\"url\":\"classes/AbortedResponse.html\",\"classes\":\"tsd-kind-class\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/AbortedResponse.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"AbortedResponse\"},{\"kind\":1024,\"name\":\"status\",\"url\":\"classes/AbortedResponse.html#status\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"AbortedResponse\"},{\"kind\":1024,\"name\":\"statusText\",\"url\":\"classes/AbortedResponse.html#statusText\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"AbortedResponse\"},{\"kind\":1024,\"name\":\"headers\",\"url\":\"classes/AbortedResponse.html#headers\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"AbortedResponse\"},{\"kind\":1024,\"name\":\"request\",\"url\":\"classes/AbortedResponse.html#request\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"AbortedResponse\"},{\"kind\":1024,\"name\":\"body\",\"url\":\"classes/AbortedResponse.html#body\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"AbortedResponse\"},{\"kind\":1024,\"name\":\"cached\",\"url\":\"classes/AbortedResponse.html#cached\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"AbortedResponse\"},{\"kind\":128,\"name\":\"InformationalResponse\",\"url\":\"classes/InformationalResponse.html\",\"classes\":\"tsd-kind-class\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/InformationalResponse.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"InformationalResponse\"},{\"kind\":1024,\"name\":\"status\",\"url\":\"classes/InformationalResponse.html#status\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"InformationalResponse\"},{\"kind\":1024,\"name\":\"statusText\",\"url\":\"classes/InformationalResponse.html#statusText\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"InformationalResponse\"},{\"kind\":1024,\"name\":\"headers\",\"url\":\"classes/InformationalResponse.html#headers\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"InformationalResponse\"},{\"kind\":1024,\"name\":\"request\",\"url\":\"classes/InformationalResponse.html#request\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"InformationalResponse\"},{\"kind\":1024,\"name\":\"body\",\"url\":\"classes/InformationalResponse.html#body\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"InformationalResponse\"},{\"kind\":1024,\"name\":\"cached\",\"url\":\"classes/InformationalResponse.html#cached\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"InformationalResponse\"},{\"kind\":128,\"name\":\"SuccessResponse\",\"url\":\"classes/SuccessResponse.html\",\"classes\":\"tsd-kind-class\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/SuccessResponse.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"SuccessResponse\"},{\"kind\":1024,\"name\":\"status\",\"url\":\"classes/SuccessResponse.html#status\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"SuccessResponse\"},{\"kind\":1024,\"name\":\"statusText\",\"url\":\"classes/SuccessResponse.html#statusText\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"SuccessResponse\"},{\"kind\":1024,\"name\":\"headers\",\"url\":\"classes/SuccessResponse.html#headers\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"SuccessResponse\"},{\"kind\":1024,\"name\":\"request\",\"url\":\"classes/SuccessResponse.html#request\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"SuccessResponse\"},{\"kind\":1024,\"name\":\"body\",\"url\":\"classes/SuccessResponse.html#body\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"SuccessResponse\"},{\"kind\":1024,\"name\":\"cached\",\"url\":\"classes/SuccessResponse.html#cached\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"SuccessResponse\"},{\"kind\":128,\"name\":\"RedirectResponse\",\"url\":\"classes/RedirectResponse.html\",\"classes\":\"tsd-kind-class\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/RedirectResponse.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"RedirectResponse\"},{\"kind\":1024,\"name\":\"status\",\"url\":\"classes/RedirectResponse.html#status\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"RedirectResponse\"},{\"kind\":1024,\"name\":\"statusText\",\"url\":\"classes/RedirectResponse.html#statusText\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"RedirectResponse\"},{\"kind\":1024,\"name\":\"headers\",\"url\":\"classes/RedirectResponse.html#headers\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"RedirectResponse\"},{\"kind\":1024,\"name\":\"request\",\"url\":\"classes/RedirectResponse.html#request\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"RedirectResponse\"},{\"kind\":1024,\"name\":\"body\",\"url\":\"classes/RedirectResponse.html#body\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"RedirectResponse\"},{\"kind\":1024,\"name\":\"cached\",\"url\":\"classes/RedirectResponse.html#cached\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"RedirectResponse\"},{\"kind\":128,\"name\":\"ClientErrorResponse\",\"url\":\"classes/ClientErrorResponse.html\",\"classes\":\"tsd-kind-class\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/ClientErrorResponse.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ClientErrorResponse\"},{\"kind\":1024,\"name\":\"status\",\"url\":\"classes/ClientErrorResponse.html#status\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ClientErrorResponse\"},{\"kind\":1024,\"name\":\"statusText\",\"url\":\"classes/ClientErrorResponse.html#statusText\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ClientErrorResponse\"},{\"kind\":1024,\"name\":\"headers\",\"url\":\"classes/ClientErrorResponse.html#headers\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ClientErrorResponse\"},{\"kind\":1024,\"name\":\"request\",\"url\":\"classes/ClientErrorResponse.html#request\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ClientErrorResponse\"},{\"kind\":1024,\"name\":\"body\",\"url\":\"classes/ClientErrorResponse.html#body\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ClientErrorResponse\"},{\"kind\":1024,\"name\":\"cached\",\"url\":\"classes/ClientErrorResponse.html#cached\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ClientErrorResponse\"},{\"kind\":128,\"name\":\"ServerErrorResponse\",\"url\":\"classes/ServerErrorResponse.html\",\"classes\":\"tsd-kind-class\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/ServerErrorResponse.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ServerErrorResponse\"},{\"kind\":1024,\"name\":\"status\",\"url\":\"classes/ServerErrorResponse.html#status\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ServerErrorResponse\"},{\"kind\":1024,\"name\":\"statusText\",\"url\":\"classes/ServerErrorResponse.html#statusText\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ServerErrorResponse\"},{\"kind\":1024,\"name\":\"headers\",\"url\":\"classes/ServerErrorResponse.html#headers\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ServerErrorResponse\"},{\"kind\":1024,\"name\":\"request\",\"url\":\"classes/ServerErrorResponse.html#request\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ServerErrorResponse\"},{\"kind\":1024,\"name\":\"body\",\"url\":\"classes/ServerErrorResponse.html#body\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ServerErrorResponse\"},{\"kind\":1024,\"name\":\"cached\",\"url\":\"classes/ServerErrorResponse.html#cached\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-inherited\",\"parent\":\"ServerErrorResponse\"},{\"kind\":8,\"name\":\"ExpectedResponseBodyType\",\"url\":\"enums/ExpectedResponseBodyType.html\",\"classes\":\"tsd-kind-enum\"},{\"kind\":16,\"name\":\"json\",\"url\":\"enums/ExpectedResponseBodyType.html#json\",\"classes\":\"tsd-kind-enum-member tsd-parent-kind-enum\",\"parent\":\"ExpectedResponseBodyType\"},{\"kind\":16,\"name\":\"text\",\"url\":\"enums/ExpectedResponseBodyType.html#text\",\"classes\":\"tsd-kind-enum-member tsd-parent-kind-enum\",\"parent\":\"ExpectedResponseBodyType\"},{\"kind\":16,\"name\":\"binary\",\"url\":\"enums/ExpectedResponseBodyType.html#binary\",\"classes\":\"tsd-kind-enum-member tsd-parent-kind-enum\",\"parent\":\"ExpectedResponseBodyType\"},{\"kind\":16,\"name\":\"stream\",\"url\":\"enums/ExpectedResponseBodyType.html#stream\",\"classes\":\"tsd-kind-enum-member tsd-parent-kind-enum\",\"parent\":\"ExpectedResponseBodyType\"},{\"kind\":4194304,\"name\":\"ApiEndpoints\",\"url\":\"types/ApiEndpoints.html\",\"classes\":\"tsd-kind-type-alias\"},{\"kind\":4194304,\"name\":\"ValidateApiEndpoints\",\"url\":\"types/ValidateApiEndpoints.html\",\"classes\":\"tsd-kind-type-alias\"},{\"kind\":33554432,\"name\":\"Basic usage\",\"url\":\"pages/tutorials/Basic usage.html\",\"classes\":\"pages-entry pages-entry-page\"},{\"kind\":33554432,\"name\":\"Usage with React Native\",\"url\":\"pages/tutorials/Usage with React Native.html\",\"classes\":\"pages-entry pages-entry-page\"}],\"index\":{\"version\":\"2.3.9\",\"fields\":[\"name\",\"comment\"],\"fieldVectors\":[[\"name/0\",[0,40.565]],[\"comment/0\",[]],[\"name/1\",[1,40.565]],[\"comment/1\",[]],[\"name/2\",[2,24.147]],[\"comment/2\",[]],[\"name/3\",[3,40.565]],[\"comment/3\",[]],[\"name/4\",[4,40.565]],[\"comment/4\",[]],[\"name/5\",[5,40.565]],[\"comment/5\",[]],[\"name/6\",[6,40.565]],[\"comment/6\",[]],[\"name/7\",[7,40.565]],[\"comment/7\",[]],[\"name/8\",[8,40.565]],[\"comment/8\",[]],[\"name/9\",[9,40.565]],[\"comment/9\",[]],[\"name/10\",[10,40.565]],[\"comment/10\",[]],[\"name/11\",[11,40.565]],[\"comment/11\",[]],[\"name/12\",[12,40.565]],[\"comment/12\",[]],[\"name/13\",[13,40.565]],[\"comment/13\",[]],[\"name/14\",[14,40.565]],[\"comment/14\",[]],[\"name/15\",[15,40.565]],[\"comment/15\",[]],[\"name/16\",[16,24.147]],[\"comment/16\",[]],[\"name/17\",[17,40.565]],[\"comment/17\",[]],[\"name/18\",[18,40.565]],[\"comment/18\",[]],[\"name/19\",[19,40.565]],[\"comment/19\",[]],[\"name/20\",[20,35.354]],[\"comment/20\",[]],[\"name/21\",[20,35.354]],[\"comment/21\",[]],[\"name/22\",[21,40.565]],[\"comment/22\",[]],[\"name/23\",[2,24.147]],[\"comment/23\",[]],[\"name/24\",[22,25.607]],[\"comment/24\",[]],[\"name/25\",[23,25.607]],[\"comment/25\",[]],[\"name/26\",[24,25.607]],[\"comment/26\",[]],[\"name/27\",[16,24.147]],[\"comment/27\",[]],[\"name/28\",[25,25.607]],[\"comment/28\",[]],[\"name/29\",[26,25.607]],[\"comment/29\",[]],[\"name/30\",[27,40.565]],[\"comment/30\",[]],[\"name/31\",[2,24.147]],[\"comment/31\",[]],[\"name/32\",[22,25.607]],[\"comment/32\",[]],[\"name/33\",[23,25.607]],[\"comment/33\",[]],[\"name/34\",[24,25.607]],[\"comment/34\",[]],[\"name/35\",[16,24.147]],[\"comment/35\",[]],[\"name/36\",[25,25.607]],[\"comment/36\",[]],[\"name/37\",[26,25.607]],[\"comment/37\",[]],[\"name/38\",[28,40.565]],[\"comment/38\",[]],[\"name/39\",[2,24.147]],[\"comment/39\",[]],[\"name/40\",[22,25.607]],[\"comment/40\",[]],[\"name/41\",[23,25.607]],[\"comment/41\",[]],[\"name/42\",[24,25.607]],[\"comment/42\",[]],[\"name/43\",[16,24.147]],[\"comment/43\",[]],[\"name/44\",[25,25.607]],[\"comment/44\",[]],[\"name/45\",[26,25.607]],[\"comment/45\",[]],[\"name/46\",[29,40.565]],[\"comment/46\",[]],[\"name/47\",[2,24.147]],[\"comment/47\",[]],[\"name/48\",[22,25.607]],[\"comment/48\",[]],[\"name/49\",[23,25.607]],[\"comment/49\",[]],[\"name/50\",[24,25.607]],[\"comment/50\",[]],[\"name/51\",[16,24.147]],[\"comment/51\",[]],[\"name/52\",[25,25.607]],[\"comment/52\",[]],[\"name/53\",[26,25.607]],[\"comment/53\",[]],[\"name/54\",[30,40.565]],[\"comment/54\",[]],[\"name/55\",[2,24.147]],[\"comment/55\",[]],[\"name/56\",[22,25.607]],[\"comment/56\",[]],[\"name/57\",[23,25.607]],[\"comment/57\",[]],[\"name/58\",[24,25.607]],[\"comment/58\",[]],[\"name/59\",[16,24.147]],[\"comment/59\",[]],[\"name/60\",[25,25.607]],[\"comment/60\",[]],[\"name/61\",[26,25.607]],[\"comment/61\",[]],[\"name/62\",[31,40.565]],[\"comment/62\",[]],[\"name/63\",[2,24.147]],[\"comment/63\",[]],[\"name/64\",[22,25.607]],[\"comment/64\",[]],[\"name/65\",[23,25.607]],[\"comment/65\",[]],[\"name/66\",[24,25.607]],[\"comment/66\",[]],[\"name/67\",[16,24.147]],[\"comment/67\",[]],[\"name/68\",[25,25.607]],[\"comment/68\",[]],[\"name/69\",[26,25.607]],[\"comment/69\",[]],[\"name/70\",[32,40.565]],[\"comment/70\",[]],[\"name/71\",[33,40.565]],[\"comment/71\",[]],[\"name/72\",[34,40.565]],[\"comment/72\",[]],[\"name/73\",[35,40.565]],[\"comment/73\",[]],[\"name/74\",[36,40.565]],[\"comment/74\",[]],[\"name/75\",[37,40.565]],[\"comment/75\",[]],[\"name/76\",[38,40.565]],[\"comment/76\",[]],[\"name/77\",[39,29.033,40,25.304]],[\"comment/77\",[]],[\"name/78\",[40,16.132,41,18.509,42,18.509,43,18.509]],[\"comment/78\",[]]],\"invertedIndex\":[[\"_buildcacheoptions\",{\"_index\":10,\"name\":{\"10\":{}},\"comment\":{}}],[\"_buildfetchoptions\",{\"_index\":9,\"name\":{\"9\":{}},\"comment\":{}}],[\"_buildrequestbody\",{\"_index\":8,\"name\":{\"8\":{}},\"comment\":{}}],[\"_buildresponse\",{\"_index\":19,\"name\":{\"19\":{}},\"comment\":{}}],[\"_buildurl\",{\"_index\":13,\"name\":{\"13\":{}},\"comment\":{}}],[\"_buildurlbase\",{\"_index\":12,\"name\":{\"12\":{}},\"comment\":{}}],[\"_dependencies\",{\"_index\":4,\"name\":{\"4\":{}},\"comment\":{}}],[\"_getrequestcontenttype\",{\"_index\":7,\"name\":{\"7\":{}},\"comment\":{}}],[\"_getrequesttype\",{\"_index\":6,\"name\":{\"6\":{}},\"comment\":{}}],[\"_getresponsetype\",{\"_index\":5,\"name\":{\"5\":{}},\"comment\":{}}],[\"_options\",{\"_index\":3,\"name\":{\"3\":{}},\"comment\":{}}],[\"_prepareandsendrequest\",{\"_index\":17,\"name\":{\"17\":{}},\"comment\":{}}],[\"_safeurlparse\",{\"_index\":11,\"name\":{\"11\":{}},\"comment\":{}}],[\"_sendrequest\",{\"_index\":18,\"name\":{\"18\":{}},\"comment\":{}}],[\"abortedresponse\",{\"_index\":21,\"name\":{\"22\":{}},\"comment\":{}}],[\"apiclient\",{\"_index\":1,\"name\":{\"1\":{}},\"comment\":{}}],[\"apiendpoints\",{\"_index\":37,\"name\":{\"75\":{}},\"comment\":{}}],[\"basic\",{\"_index\":39,\"name\":{\"77\":{}},\"comment\":{}}],[\"binary\",{\"_index\":35,\"name\":{\"73\":{}},\"comment\":{}}],[\"body\",{\"_index\":25,\"name\":{\"28\":{},\"36\":{},\"44\":{},\"52\":{},\"60\":{},\"68\":{}},\"comment\":{}}],[\"cached\",{\"_index\":26,\"name\":{\"29\":{},\"37\":{},\"45\":{},\"53\":{},\"61\":{},\"69\":{}},\"comment\":{}}],[\"clienterrorresponse\",{\"_index\":30,\"name\":{\"54\":{}},\"comment\":{}}],[\"constructor\",{\"_index\":2,\"name\":{\"2\":{},\"23\":{},\"31\":{},\"39\":{},\"47\":{},\"55\":{},\"63\":{}},\"comment\":{}}],[\"createapiclient\",{\"_index\":0,\"name\":{\"0\":{}},\"comment\":{}}],[\"expectedresponsebodytype\",{\"_index\":32,\"name\":{\"70\":{}},\"comment\":{}}],[\"get\",{\"_index\":14,\"name\":{\"14\":{}},\"comment\":{}}],[\"headers\",{\"_index\":24,\"name\":{\"26\":{},\"34\":{},\"42\":{},\"50\":{},\"58\":{},\"66\":{}},\"comment\":{}}],[\"informationalresponse\",{\"_index\":27,\"name\":{\"30\":{}},\"comment\":{}}],[\"json\",{\"_index\":33,\"name\":{\"71\":{}},\"comment\":{}}],[\"native\",{\"_index\":43,\"name\":{\"78\":{}},\"comment\":{}}],[\"post\",{\"_index\":15,\"name\":{\"15\":{}},\"comment\":{}}],[\"react\",{\"_index\":42,\"name\":{\"78\":{}},\"comment\":{}}],[\"redirectresponse\",{\"_index\":29,\"name\":{\"46\":{}},\"comment\":{}}],[\"request\",{\"_index\":16,\"name\":{\"16\":{},\"27\":{},\"35\":{},\"43\":{},\"51\":{},\"59\":{},\"67\":{}},\"comment\":{}}],[\"responsedatatypemismatcherror\",{\"_index\":20,\"name\":{\"20\":{},\"21\":{}},\"comment\":{}}],[\"servererrorresponse\",{\"_index\":31,\"name\":{\"62\":{}},\"comment\":{}}],[\"status\",{\"_index\":22,\"name\":{\"24\":{},\"32\":{},\"40\":{},\"48\":{},\"56\":{},\"64\":{}},\"comment\":{}}],[\"statustext\",{\"_index\":23,\"name\":{\"25\":{},\"33\":{},\"41\":{},\"49\":{},\"57\":{},\"65\":{}},\"comment\":{}}],[\"stream\",{\"_index\":36,\"name\":{\"74\":{}},\"comment\":{}}],[\"successresponse\",{\"_index\":28,\"name\":{\"38\":{}},\"comment\":{}}],[\"text\",{\"_index\":34,\"name\":{\"72\":{}},\"comment\":{}}],[\"usage\",{\"_index\":40,\"name\":{\"77\":{},\"78\":{}},\"comment\":{}}],[\"validateapiendpoints\",{\"_index\":38,\"name\":{\"76\":{}},\"comment\":{}}],[\"with\",{\"_index\":41,\"name\":{\"78\":{}},\"comment\":{}}]],\"pipeline\":[]}}"); |
@@ -18,11 +18,7 @@ declare enum ResponseStatusGroup { | ||
urlencoded = "urlencoded", | ||
plain = "plain" | ||
plain = "plain", | ||
formData = "formData" | ||
} | ||
declare const contentTypeMap: { | ||
readonly json: "application/json; charset=utf-8"; | ||
readonly text: "application/x-www-form-urlencoded"; | ||
readonly binary: null; | ||
readonly stream: null; | ||
}; | ||
export { ResponseStatusGroup, ExpectedResponseBodyType, RequestBodyType, contentTypeMap }; | ||
declare const requestContentTypeMap: Record<RequestBodyType, string | null>; | ||
export { ResponseStatusGroup, ExpectedResponseBodyType, RequestBodyType, requestContentTypeMap }; | ||
//# sourceMappingURL=const.d.ts.map |
@@ -22,10 +22,11 @@ var ResponseStatusGroup; | ||
RequestBodyType["plain"] = "plain"; | ||
RequestBodyType["formData"] = "formData"; | ||
})(RequestBodyType || (RequestBodyType = {})); | ||
const contentTypeMap = { | ||
const requestContentTypeMap = { | ||
json: "application/json; charset=utf-8", | ||
text: "application/x-www-form-urlencoded", | ||
binary: null, | ||
stream: null, | ||
urlencoded: "application/x-www-form-urlencoded", | ||
plain: null, | ||
formData: null, | ||
}; | ||
export { ResponseStatusGroup, ExpectedResponseBodyType, RequestBodyType, contentTypeMap }; | ||
export { ResponseStatusGroup, ExpectedResponseBodyType, RequestBodyType, requestContentTypeMap }; | ||
//# sourceMappingURL=const.js.map |
import type { ApiResponse } from "./response/response.js"; | ||
import type { AbortablePromise, ApiEndpoints, Dependencies, GenericHeaders, Options, RequestData, RequestOptions, BodyType, BodyTypeType, HeadersType, ParamsType, QueryType, ValidateApiEndpoints } from "./types"; | ||
import type { AbortablePromise, ApiEndpoints, BodyType, BodyTypeType, Dependencies, GenericHeaders, HeadersType, Options, ParamsType, QueryType, RequestData, RequestOptions, ValidateApiEndpoints } from "./types"; | ||
import { ExpectedResponseBodyType } from "./const.js"; | ||
import { ResponseDataTypeMismatchError } from "./errors.js"; | ||
declare class ApiClient<T extends ExpectedResponseBodyType, RL extends ApiEndpoints> { | ||
declare class ApiClient<T extends ExpectedResponseBodyType, Endp extends ApiEndpoints> { | ||
private readonly _options; | ||
@@ -11,3 +11,3 @@ private readonly _dependencies; | ||
private _getRequestType; | ||
private _getContentType; | ||
private _getRequestContentType; | ||
private _buildRequestBody; | ||
@@ -19,5 +19,5 @@ private _buildFetchOptions; | ||
private _buildUrl; | ||
get<U extends keyof RL["get"] & string, P extends ParamsType<RL["get"][U]>, B extends BodyType<RL["get"][U]>, BT extends BodyTypeType<RL["get"][U]>, Q extends QueryType<RL["get"][U]>, H extends HeadersType<RL["get"][U]>, D extends RequestData<P, B, BT, Q, H>, RB extends RL["get"][U]["response"], RT extends ExpectedResponseBodyType = T>(url: U, data: D, options?: RequestOptions<RT, H>): AbortablePromise<RT extends ExpectedResponseBodyType.json ? ApiResponse<"get", U, P, B, BT, Q, H, RB, RT> : RT extends ExpectedResponseBodyType.stream ? ApiResponse<"get", U, P, B, BT, Q, H, ReadableStream, RT> : ApiResponse<"get", U, P, B, BT, Q, H, string, RT>>; | ||
post<U extends keyof RL["post"] & string, P extends ParamsType<RL["post"][U]>, B extends BodyType<RL["post"][U]>, BT extends BodyTypeType<RL["post"][U]>, Q extends QueryType<RL["post"][U]>, H extends HeadersType<RL["post"][U]>, D extends RequestData<P, B, BT, Q, H>, RB extends RL["post"][U]["response"], RT extends ExpectedResponseBodyType = T>(url: U, data: D, options?: RequestOptions<RT, H>): AbortablePromise<RT extends ExpectedResponseBodyType.json ? ApiResponse<"post", U, P, B, BT, Q, H, RB, RT> : RT extends ExpectedResponseBodyType.stream ? ApiResponse<"post", U, P, B, BT, Q, H, ReadableStream, RT> : ApiResponse<"post", U, P, B, BT, Q, H, string, RT>>; | ||
request<Mthd extends string, U extends keyof RL[Lowercase<Mthd>] & string, P extends ParamsType<RL[Lowercase<Mthd>][U]>, B extends BodyType<RL[Lowercase<Mthd>][U]>, BT extends BodyTypeType<RL[Lowercase<Mthd>][U]>, Q extends QueryType<RL[Lowercase<Mthd>][U]>, H extends HeadersType<RL[Lowercase<Mthd>][U]>, D extends RequestData<P, B, BT, Q, H>, RB extends RL[Lowercase<Mthd>][U]["response"], RT extends ExpectedResponseBodyType = T>(method: Mthd, url: U, data: D, options?: RequestOptions<RT, H>): AbortablePromise<RT extends ExpectedResponseBodyType.json ? ApiResponse<Mthd, U, P, B, BT, Q, H, RB, RT> : RT extends ExpectedResponseBodyType.stream ? ApiResponse<Mthd, U, P, B, BT, Q, H, ReadableStream, RT> : ApiResponse<Mthd, U, P, B, BT, Q, H, string, RT>>; | ||
get<U extends keyof Endp["get"] & string, P extends ParamsType<Endp["get"][U]>, B extends BodyType<Endp["get"][U]>, BT extends BodyTypeType<Endp["get"][U]>, Q extends QueryType<Endp["get"][U]>, H extends HeadersType<Endp["get"][U]>, D extends RequestData<P, B, BT, Q, H>, RB extends Endp["get"][U]["response"], RT extends ExpectedResponseBodyType = T>(url: U, data: D, options?: RequestOptions<RT, H>): AbortablePromise<RT extends ExpectedResponseBodyType.json ? ApiResponse<"get", U, P, B, BT, Q, H, RB, RT> : RT extends ExpectedResponseBodyType.stream ? ApiResponse<"get", U, P, B, BT, Q, H, ReadableStream, RT> : ApiResponse<"get", U, P, B, BT, Q, H, string, RT>>; | ||
post<U extends keyof Endp["post"] & string, P extends ParamsType<Endp["post"][U]>, B extends BodyType<Endp["post"][U]>, BT extends BodyTypeType<Endp["post"][U]>, Q extends QueryType<Endp["post"][U]>, H extends HeadersType<Endp["post"][U]>, D extends RequestData<P, B, BT, Q, H>, RB extends Endp["post"][U]["response"], RT extends ExpectedResponseBodyType = T>(url: U, data: D, options?: RequestOptions<RT, H>): AbortablePromise<RT extends ExpectedResponseBodyType.json ? ApiResponse<"post", U, P, B, BT, Q, H, RB, RT> : RT extends ExpectedResponseBodyType.stream ? ApiResponse<"post", U, P, B, BT, Q, H, ReadableStream, RT> : ApiResponse<"post", U, P, B, BT, Q, H, string, RT>>; | ||
request<Mthd extends string, U extends keyof Endp[Lowercase<Mthd>] & string, P extends ParamsType<Endp[Lowercase<Mthd>][U]>, B extends BodyType<Endp[Lowercase<Mthd>][U]>, BT extends BodyTypeType<Endp[Lowercase<Mthd>][U]>, Q extends QueryType<Endp[Lowercase<Mthd>][U]>, H extends HeadersType<Endp[Lowercase<Mthd>][U]>, D extends RequestData<P, B, BT, Q, H>, RB extends Endp[Lowercase<Mthd>][U]["response"], RT extends ExpectedResponseBodyType = T>(method: Mthd, url: U, data: D, options?: RequestOptions<RT, H>): AbortablePromise<RT extends ExpectedResponseBodyType.json ? ApiResponse<Mthd, U, P, B, BT, Q, H, RB, RT> : RT extends ExpectedResponseBodyType.stream ? ApiResponse<Mthd, U, P, B, BT, Q, H, ReadableStream, RT> : ApiResponse<Mthd, U, P, B, BT, Q, H, string, RT>>; | ||
private _prepareAndSendRequest; | ||
@@ -24,0 +24,0 @@ private _sendRequest; |
@@ -6,8 +6,7 @@ import urlJoin from "url-join"; | ||
import { ClientErrorResponse, createResponse, ServerErrorResponse } from "./response/response.js"; | ||
import { contentTypeMap, ExpectedResponseBodyType, RequestBodyType } from "./const.js"; | ||
import { AbortError, HttpClientError, HttpError, HttpServerError, ResponseDataTypeMismatchError, TimeoutError, UnknownError, CacheMissError, ApiReachError, } from "./errors.js"; | ||
import { ExpectedResponseBodyType, RequestBodyType, requestContentTypeMap } from "./const.js"; | ||
import { AbortError, ApiReachError, CacheMissError, HttpClientError, HttpError, HttpServerError, ResponseDataTypeMismatchError, TimeoutError, UnknownError, } from "./errors.js"; | ||
import { ApiRequest } from "./request/request.js"; | ||
const defaultOptions = { | ||
responseType: ExpectedResponseBodyType.json, | ||
requestType: RequestBodyType.json, | ||
timeout: 30000, | ||
@@ -47,2 +46,3 @@ retry: 0, | ||
URL: URL, | ||
FormData: FormData, | ||
qsStringify: qs.stringify, | ||
@@ -57,38 +57,42 @@ AbortController: AbortController, | ||
} | ||
_getRequestType(options) { | ||
var _a, _b; | ||
return (_b = (_a = options.requestType) !== null && _a !== void 0 ? _a : this._options.requestType) !== null && _b !== void 0 ? _b : RequestBodyType.json; | ||
_getRequestType(data) { | ||
var _a; | ||
return (_a = data.bodyType) !== null && _a !== void 0 ? _a : RequestBodyType.json; | ||
} | ||
_getContentType(options) { | ||
const type = this._getResponseType(options); | ||
return contentTypeMap[type]; | ||
_getRequestContentType(data) { | ||
const type = this._getRequestType(data); | ||
return requestContentTypeMap[type]; | ||
} | ||
_buildRequestBody(options, body) { | ||
const requestType = this._getRequestType(options); | ||
if (requestType === RequestBodyType.plain && typeof body !== "string") { | ||
_buildRequestBody(data) { | ||
const requestType = this._getRequestType(data); | ||
if (requestType === RequestBodyType.plain && typeof data.body !== "string") { | ||
throw new Error("Body must be a string when request type is set to plain text"); | ||
} | ||
if (typeof body === "string") { | ||
return body; | ||
const isFormData = data.body instanceof this._dependencies.FormData; | ||
if (requestType === RequestBodyType.formData && !isFormData) { | ||
throw new Error("Body must be a FormData object when request type is set to form data"); | ||
} | ||
if (isFormData || typeof data.body === "string") { | ||
return data.body; | ||
} | ||
if (requestType === RequestBodyType.json) { | ||
return JSON.stringify(body); | ||
return JSON.stringify(data.body); | ||
} | ||
if (requestType === RequestBodyType.urlencoded) { | ||
return this._dependencies.qsStringify(body); | ||
return this._dependencies.qsStringify(data.body); | ||
} | ||
return null; | ||
} | ||
_buildFetchOptions(options, method, body, headers) { | ||
var _a, _b, _c, _d; | ||
_buildFetchOptions(options, method, data) { | ||
var _a, _b, _c, _d, _e; | ||
const instanceHeaders = (_b = (_a = this._options.fetchOptions) === null || _a === void 0 ? void 0 : _a.headers) !== null && _b !== void 0 ? _b : {}; | ||
const requestHeaders = headers !== null && headers !== void 0 ? headers : {}; | ||
const requestHeaders = (_c = data === null || data === void 0 ? void 0 : data.headers) !== null && _c !== void 0 ? _c : {}; | ||
const contentType = {}; | ||
const bodyOptions = {}; | ||
if (body != null) { | ||
const ct = this._getContentType(options); | ||
if ((data === null || data === void 0 ? void 0 : data.body) != null) { | ||
const ct = this._getRequestContentType(data); | ||
if (ct != null) { | ||
contentType["Content-Type"] = ct; | ||
} | ||
const bd = this._buildRequestBody(options, body); | ||
const bd = this._buildRequestBody(data); | ||
if (bd != null) { | ||
@@ -98,3 +102,3 @@ bodyOptions.body = bd; | ||
} | ||
const retry = (_d = (_c = options.retry) !== null && _c !== void 0 ? _c : this._options.retry) !== null && _d !== void 0 ? _d : defaultOptions.retry; | ||
const retry = (_e = (_d = options.retry) !== null && _d !== void 0 ? _d : this._options.retry) !== null && _e !== void 0 ? _e : defaultOptions.retry; | ||
const cache = this._buildCacheOptions(options); | ||
@@ -194,3 +198,3 @@ const opts = { | ||
const _data = data; | ||
const finalOptions = this._buildFetchOptions(options !== null && options !== void 0 ? options : {}, method.toUpperCase(), _data === null || _data === void 0 ? void 0 : _data.body, _data === null || _data === void 0 ? void 0 : _data.headers); | ||
const finalOptions = this._buildFetchOptions(options !== null && options !== void 0 ? options : {}, method.toUpperCase(), _data); | ||
const finalUrl = this._buildUrl(url, _data === null || _data === void 0 ? void 0 : _data.params, _data === null || _data === void 0 ? void 0 : _data.query, finalOptions); | ||
@@ -197,0 +201,0 @@ const request = new ApiRequest(method.toUpperCase(), { url: url, fullUrl: finalUrl }, _data, finalOptions); |
import type { RequestRedirect as NodeFetchRequestRedirect } from "node-fetch"; | ||
import type { ExpectedResponseBodyType, RequestBodyType } from "../const"; | ||
import type { ExpectedResponseBodyType } from "../const"; | ||
import type { GenericHeaders } from "./common"; | ||
@@ -32,3 +32,2 @@ import type { CacheGetKey, CacheGetTTL, CacheInterface, CacheShouldCacheResponse, CacheSaveStrategy, CacheLoadStrategy } from "./cache"; | ||
responseType?: RT; | ||
requestType?: RequestBodyType; | ||
retry?: RetryOptions; | ||
@@ -58,3 +57,3 @@ timeout?: number | TimeoutOptions; | ||
method: string; | ||
body?: string; | ||
body?: any; | ||
headers: H; | ||
@@ -67,2 +66,3 @@ redirect?: NodeFetchRequestRedirect; | ||
URL: typeof URL; | ||
FormData: typeof FormData; | ||
AbortController: typeof AbortController; | ||
@@ -69,0 +69,0 @@ qsStringify: (data: unknown) => string; |
{ | ||
"name": "api-reach", | ||
"version": "0.14.0-beta.4", | ||
"version": "0.14.0-beta.5", | ||
"repository": "git@github.com:dzek69/api-reach.git", | ||
@@ -5,0 +5,0 @@ "author": "Jacek Nowacki @dzek69 <git-public@dzek.eu>", |
@@ -93,3 +93,3 @@ import fastify from "fastify"; | ||
const mock = mockHandlers[mockIndex](req, res); | ||
const mock = mockHandlers[mockIndex]!(req, res); | ||
mockHandlers.splice(mockIndex, 1); | ||
@@ -142,2 +142,5 @@ | ||
}); | ||
const httpBinApi = createApiClient<ResponsesList>({ | ||
base: "https://httpbin.org", | ||
}); | ||
@@ -1128,7 +1131,7 @@ it("TS", async () => { | ||
...cacheOpts, | ||
loadStrategy: "prefer-cache", | ||
loadStrategy: "cache-only", | ||
}, | ||
}); | ||
request4.then(() => { | ||
await request4.then((r) => { | ||
throw new Error("Expected request to fail"); | ||
@@ -1152,2 +1155,22 @@ }, (e: unknown) => { | ||
// TODO throw if hash given for base url | ||
describe("supports FormData", () => { | ||
it('should not crash sending form data', async () => { | ||
const formData = new FormData(); | ||
formData.append("name", "John"); | ||
formData.append("a", new Blob(["hello"]), "hello.txt"); | ||
const response = await httpBinApi.post("/post", { | ||
body: formData, | ||
bodyType: "formData", | ||
}); | ||
must(response.status).equal(200); | ||
must(response.body.form).eql({ | ||
name: "John", | ||
}); | ||
must(response.body.files).eql({ | ||
a: "hello", | ||
}); | ||
}); | ||
}) | ||
}); |
@@ -25,19 +25,35 @@ enum ResponseStatusGroup { | ||
enum RequestBodyType { | ||
/** | ||
* Body should be a plain object or stringified JSON (this won't be validated) | ||
* Appropriately sets Content-Type header | ||
*/ | ||
json = "json", | ||
/** | ||
* Body should be a plain object or stringified URL-encoded data (this won't be validated) | ||
* Appropriately sets Content-Type header | ||
*/ | ||
urlencoded = "urlencoded", | ||
/** | ||
* Body should be a string | ||
* No Content-Type header will be set | ||
*/ | ||
plain = "plain", // @TODO should accept only stringified body | ||
// @TODO binary = "binary", // or file? | ||
// @TODO stream = "stream", | ||
/** | ||
* Body should be a FormData object | ||
* Appropriately sets Content-Type header | ||
*/ | ||
formData = "formData", | ||
// @TODO stream = "stream", ? | ||
} | ||
/** | ||
* Maps body type to sent content type | ||
* Maps body type to Content-Type header we need to add | ||
*/ | ||
const contentTypeMap = { | ||
const requestContentTypeMap: Record<RequestBodyType, string | null> = { | ||
json: "application/json; charset=utf-8", | ||
text: "application/x-www-form-urlencoded", | ||
binary: null, | ||
stream: null, | ||
urlencoded: "application/x-www-form-urlencoded", | ||
plain: null, | ||
formData: null, // fetch will set it automatically | ||
} as const; | ||
export { ResponseStatusGroup, ExpectedResponseBodyType, RequestBodyType, contentTypeMap }; | ||
export { ResponseStatusGroup, ExpectedResponseBodyType, RequestBodyType, requestContentTypeMap }; |
183
src/index.ts
@@ -12,2 +12,4 @@ /* eslint-disable max-lines */ | ||
ApiEndpoints, | ||
BodyType, | ||
BodyTypeType, | ||
CachedData, | ||
@@ -21,10 +23,8 @@ CacheOptions, | ||
GenericQuery, | ||
HeadersType, | ||
Options, | ||
ParamsType, | ||
QueryType, | ||
RequestData, | ||
RequestOptions, | ||
BodyType, | ||
BodyTypeType, | ||
HeadersType, | ||
ParamsType, | ||
QueryType, | ||
ValidateApiEndpoints, | ||
@@ -34,5 +34,7 @@ } from "./types"; | ||
import { ClientErrorResponse, createResponse, ServerErrorResponse } from "./response/response.js"; | ||
import { contentTypeMap, ExpectedResponseBodyType, RequestBodyType } from "./const.js"; | ||
import { ExpectedResponseBodyType, RequestBodyType, requestContentTypeMap } from "./const.js"; | ||
import { | ||
AbortError, | ||
ApiReachError, | ||
CacheMissError, | ||
HttpClientError, | ||
@@ -44,4 +46,2 @@ HttpError, | ||
UnknownError, | ||
CacheMissError, | ||
ApiReachError, | ||
} from "./errors.js"; | ||
@@ -52,6 +52,5 @@ import { ApiRequest } from "./request/request.js"; | ||
Required<Options<ExpectedResponseBodyType, any>>, // eslint-disable-line @typescript-eslint/no-explicit-any | ||
"requestType" | "responseType" | "timeout" | "retry" | "throw" | ||
"responseType" | "timeout" | "retry" | "throw" | ||
> & { cache: Partial<Options<ExpectedResponseBodyType, any>["cache"]> } = { // eslint-disable-line @typescript-eslint/no-explicit-any,max-len | ||
responseType: ExpectedResponseBodyType.json, | ||
requestType: RequestBodyType.json, | ||
timeout: 30000, | ||
@@ -69,3 +68,3 @@ retry: 0, | ||
class ApiClient<T extends ExpectedResponseBodyType, RL extends ApiEndpoints> { | ||
class ApiClient<T extends ExpectedResponseBodyType, Endp extends ApiEndpoints> { | ||
private readonly _options: Options<T, GenericHeaders>; | ||
@@ -81,2 +80,3 @@ | ||
URL: URL, | ||
FormData: FormData, | ||
qsStringify: qs.stringify, | ||
@@ -101,4 +101,13 @@ AbortController: AbortController, | ||
*/ | ||
private _getRequestType(options: Pick<Options<any, any>, "requestType">): RequestBodyType { // eslint-disable-line @typescript-eslint/no-explicit-any,max-len | ||
return options.requestType ?? this._options.requestType ?? RequestBodyType.json; | ||
private _getRequestType< | ||
H extends GenericHeaders, | ||
M extends string, | ||
B extends GenericBody, | ||
P extends GenericParams, | ||
Q extends GenericQuery, | ||
BT extends BodyTypeType<Endp[M]>, | ||
D extends RequestData<P, B, BT, Q, H>, | ||
>(data: D): RequestBodyType { | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
return data.bodyType ?? RequestBodyType.json; | ||
} | ||
@@ -108,8 +117,14 @@ | ||
* Get request content type | ||
* @param options | ||
* @private | ||
*/ | ||
private _getContentType(options: Pick<Options<any, any>, "responseType">) { // eslint-disable-line @typescript-eslint/no-explicit-any,max-len | ||
const type = this._getResponseType(options); | ||
return contentTypeMap[type]; | ||
private _getRequestContentType< | ||
H extends GenericHeaders, | ||
M extends string, | ||
B extends GenericBody, | ||
P extends GenericParams, | ||
Q extends GenericQuery, | ||
BT extends BodyTypeType<Endp[M]>, | ||
D extends RequestData<P, B, BT, Q, H>, | ||
>(data: D) { | ||
const type = this._getRequestType(data); | ||
return requestContentTypeMap[type]; | ||
} | ||
@@ -119,24 +134,34 @@ | ||
* Prepares request body to send | ||
* @param options | ||
* @param body | ||
* @private | ||
* @param data | ||
*/ | ||
private _buildRequestBody< | ||
H extends GenericHeaders, | ||
M extends string, | ||
B extends GenericBody, | ||
>(options: Pick<Options<any, any>, "requestType">, body?: B) { // eslint-disable-line @typescript-eslint/no-explicit-any,max-len | ||
const requestType = this._getRequestType(options); | ||
P extends GenericParams, | ||
Q extends GenericQuery, | ||
BT extends BodyTypeType<Endp[M]>, | ||
D extends RequestData<P, B, BT, Q, H>, | ||
>(data: D) { | ||
const requestType = this._getRequestType(data); | ||
if (requestType === RequestBodyType.plain && typeof body !== "string") { | ||
if (requestType === RequestBodyType.plain && typeof data.body !== "string") { | ||
throw new Error("Body must be a string when request type is set to plain text"); | ||
} | ||
if (typeof body === "string") { | ||
return body; | ||
const isFormData = data.body instanceof this._dependencies.FormData; | ||
if (requestType === RequestBodyType.formData && !isFormData) { | ||
throw new Error("Body must be a FormData object when request type is set to form data"); | ||
} | ||
if (isFormData || typeof data.body === "string") { | ||
return data.body; | ||
} | ||
if (requestType === RequestBodyType.json) { | ||
return JSON.stringify(body); | ||
return JSON.stringify(data.body); | ||
} | ||
if (requestType === RequestBodyType.urlencoded) { | ||
return this._dependencies.qsStringify(body); | ||
return this._dependencies.qsStringify(data.body); | ||
} | ||
@@ -153,14 +178,18 @@ | ||
B extends GenericBody, | ||
>(options: RequestOptions<RT, H>, method: M, body?: B, headers?: H) { | ||
P extends GenericParams, | ||
Q extends GenericQuery, | ||
BT extends BodyTypeType<Endp[M]>, | ||
D extends RequestData<P, B, BT, Q, H>, | ||
>(options: RequestOptions<RT, H>, method: M, data: D | undefined) { | ||
const instanceHeaders = this._options.fetchOptions?.headers ?? {}; | ||
const requestHeaders = headers ?? {}; | ||
const requestHeaders = data?.headers ?? {}; | ||
const contentType: { "Content-Type"?: string } = {}; | ||
const bodyOptions: { body?: string } = {}; | ||
if (body != null) { | ||
const ct = this._getContentType(options); | ||
const bodyOptions: { body?: unknown } = {}; // TODO better type? | ||
if (data?.body != null) { | ||
const ct = this._getRequestContentType(data); | ||
if (ct != null) { | ||
contentType["Content-Type"] = ct; | ||
} | ||
const bd = this._buildRequestBody(options, body); | ||
const bd = this._buildRequestBody(data); | ||
if (bd != null) { | ||
@@ -321,10 +350,10 @@ bodyOptions.body = bd; | ||
public get< | ||
U extends keyof RL["get"] & string, | ||
P extends ParamsType<RL["get"][U]>, | ||
B extends BodyType<RL["get"][U]>, | ||
BT extends BodyTypeType<RL["get"][U]>, | ||
Q extends QueryType<RL["get"][U]>, | ||
H extends HeadersType<RL["get"][U]>, | ||
U extends keyof Endp["get"] & string, | ||
P extends ParamsType<Endp["get"][U]>, | ||
B extends BodyType<Endp["get"][U]>, | ||
BT extends BodyTypeType<Endp["get"][U]>, | ||
Q extends QueryType<Endp["get"][U]>, | ||
H extends HeadersType<Endp["get"][U]>, | ||
D extends RequestData<P, B, BT, Q, H>, | ||
RB extends RL["get"][U]["response"], | ||
RB extends Endp["get"][U]["response"], | ||
RT extends ExpectedResponseBodyType = T, | ||
@@ -345,10 +374,10 @@ >( | ||
public post< | ||
U extends keyof RL["post"] & string, | ||
P extends ParamsType<RL["post"][U]>, | ||
B extends BodyType<RL["post"][U]>, | ||
BT extends BodyTypeType<RL["post"][U]>, | ||
Q extends QueryType<RL["post"][U]>, | ||
H extends HeadersType<RL["post"][U]>, | ||
U extends keyof Endp["post"] & string, | ||
P extends ParamsType<Endp["post"][U]>, | ||
B extends BodyType<Endp["post"][U]>, | ||
BT extends BodyTypeType<Endp["post"][U]>, | ||
Q extends QueryType<Endp["post"][U]>, | ||
H extends HeadersType<Endp["post"][U]>, | ||
D extends RequestData<P, B, BT, Q, H>, | ||
RB extends RL["post"][U]["response"], | ||
RB extends Endp["post"][U]["response"], | ||
RT extends ExpectedResponseBodyType = T, | ||
@@ -368,10 +397,10 @@ >( | ||
Mthd extends string, | ||
U extends keyof RL[Lowercase<Mthd>] & string, | ||
P extends ParamsType<RL[Lowercase<Mthd>][U]>, | ||
B extends BodyType<RL[Lowercase<Mthd>][U]>, | ||
BT extends BodyTypeType<RL[Lowercase<Mthd>][U]>, | ||
Q extends QueryType<RL[Lowercase<Mthd>][U]>, | ||
H extends HeadersType<RL[Lowercase<Mthd>][U]>, | ||
U extends keyof Endp[Lowercase<Mthd>] & string, | ||
P extends ParamsType<Endp[Lowercase<Mthd>][U]>, | ||
B extends BodyType<Endp[Lowercase<Mthd>][U]>, | ||
BT extends BodyTypeType<Endp[Lowercase<Mthd>][U]>, | ||
Q extends QueryType<Endp[Lowercase<Mthd>][U]>, | ||
H extends HeadersType<Endp[Lowercase<Mthd>][U]>, | ||
D extends RequestData<P, B, BT, Q, H>, | ||
RB extends RL[Lowercase<Mthd>][U]["response"], | ||
RB extends Endp[Lowercase<Mthd>][U]["response"], | ||
RT extends ExpectedResponseBodyType = T, | ||
@@ -392,10 +421,10 @@ >( | ||
Mthd extends string, | ||
U extends keyof RL[Lowercase<Mthd>] & string, | ||
P extends ParamsType<RL[Lowercase<Mthd>][U]>, | ||
B extends BodyType<RL[Lowercase<Mthd>][U]>, | ||
BT extends BodyTypeType<RL[Lowercase<Mthd>][U]>, | ||
Q extends QueryType<RL[Lowercase<Mthd>][U]>, | ||
H extends HeadersType<RL[Lowercase<Mthd>][U]>, | ||
U extends keyof Endp[Lowercase<Mthd>] & string, | ||
P extends ParamsType<Endp[Lowercase<Mthd>][U]>, | ||
B extends BodyType<Endp[Lowercase<Mthd>][U]>, | ||
BT extends BodyTypeType<Endp[Lowercase<Mthd>][U]>, | ||
Q extends QueryType<Endp[Lowercase<Mthd>][U]>, | ||
H extends HeadersType<Endp[Lowercase<Mthd>][U]>, | ||
D extends RequestData<P, B, BT, Q, H>, | ||
RB extends RL[Lowercase<Mthd>][U]["response"], | ||
RB extends Endp[Lowercase<Mthd>][U]["response"], | ||
RT extends ExpectedResponseBodyType = T, | ||
@@ -415,3 +444,3 @@ >( | ||
const finalOptions = this._buildFetchOptions(options ?? {}, method.toUpperCase(), _data?.body, _data?.headers); | ||
const finalOptions = this._buildFetchOptions(options ?? {}, method.toUpperCase(), _data); | ||
const finalUrl = this._buildUrl(url, _data?.params, _data?.query, finalOptions); | ||
@@ -637,9 +666,9 @@ const request = new ApiRequest(method.toUpperCase(), { url: url, fullUrl: finalUrl }, _data, finalOptions); | ||
Mthd extends string, | ||
U extends keyof RL[Uppercase<Mthd>] & string, | ||
P extends RL[Uppercase<Mthd>][U]["params"], | ||
B extends RL[Uppercase<Mthd>][U]["body"], | ||
BT extends RL[Uppercase<Mthd>][U]["bodyType"], | ||
Q extends RL[Uppercase<Mthd>][U]["query"], | ||
H extends RL[Uppercase<Mthd>][U]["headers"], | ||
RB extends RL[Uppercase<Mthd>][U]["response"], | ||
U extends keyof Endp[Uppercase<Mthd>] & string, | ||
P extends Endp[Uppercase<Mthd>][U]["params"], | ||
B extends Endp[Uppercase<Mthd>][U]["body"], | ||
BT extends Endp[Uppercase<Mthd>][U]["bodyType"], | ||
Q extends Endp[Uppercase<Mthd>][U]["query"], | ||
H extends Endp[Uppercase<Mthd>][U]["headers"], | ||
RB extends Endp[Uppercase<Mthd>][U]["response"], | ||
// eslint-disable-next-line @typescript-eslint/no-use-before-define | ||
@@ -673,9 +702,9 @@ AReq extends ApiRequest<Mthd, U, P, B, BT, Q, H, RT>, | ||
Mthd extends string, | ||
U extends keyof RL[Uppercase<Mthd>] & string, | ||
P extends RL[Uppercase<Mthd>][U]["params"], | ||
B extends RL[Uppercase<Mthd>][U]["body"], | ||
BT extends RL[Uppercase<Mthd>][U]["bodyType"], | ||
Q extends RL[Uppercase<Mthd>][U]["query"], | ||
H extends RL[Uppercase<Mthd>][U]["headers"], | ||
RB extends RL[Uppercase<Mthd>][U]["response"], | ||
U extends keyof Endp[Uppercase<Mthd>] & string, | ||
P extends Endp[Uppercase<Mthd>][U]["params"], | ||
B extends Endp[Uppercase<Mthd>][U]["body"], | ||
BT extends Endp[Uppercase<Mthd>][U]["bodyType"], | ||
Q extends Endp[Uppercase<Mthd>][U]["query"], | ||
H extends Endp[Uppercase<Mthd>][U]["headers"], | ||
RB extends Endp[Uppercase<Mthd>][U]["response"], | ||
// eslint-disable-next-line @typescript-eslint/no-use-before-define | ||
@@ -682,0 +711,0 @@ AReq extends ApiRequest<Mthd, U, P, B, BT, Q, H, RT>, |
import type { RequestRedirect as NodeFetchRequestRedirect } from "node-fetch"; | ||
import type { ExpectedResponseBodyType, RequestBodyType } from "../const"; | ||
import type { ExpectedResponseBodyType } from "../const"; | ||
import type { GenericHeaders } from "./common"; | ||
@@ -56,3 +56,2 @@ import type { | ||
responseType?: RT; | ||
requestType?: RequestBodyType; | ||
retry?: RetryOptions; | ||
@@ -92,3 +91,4 @@ timeout?: number | TimeoutOptions; | ||
method: string; | ||
body?: string; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
body?: any; // @TODO better type | ||
headers: H; | ||
@@ -102,2 +102,3 @@ redirect?: NodeFetchRequestRedirect; | ||
URL: typeof URL; | ||
FormData: typeof FormData; | ||
AbortController: typeof AbortController; | ||
@@ -104,0 +105,0 @@ qsStringify: (data: unknown) => string; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1136358
5974