From fa9ee2aa43fe6e214c666de58b882fbd1328d83e Mon Sep 17 00:00:00 2001 From: Gleb Popov Date: Mon, 11 Mar 2024 22:36:29 +0700 Subject: [PATCH] docs: initMethod --- src/createHttpClient/initMethod.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/createHttpClient/initMethod.ts b/src/createHttpClient/initMethod.ts index 3d94e70..962151d 100644 --- a/src/createHttpClient/initMethod.ts +++ b/src/createHttpClient/initMethod.ts @@ -9,6 +9,23 @@ import { is } from '../utils'; import { createMethod } from './createMethod'; +/** + * @namespace httpClient + * @module initMethod + * @description Wrapper that return REST method. + * @param {string} method + * @param {Object} options + * @param {string} options.query + * @param {number} options.timeout + * @param {string} options.url + * @param {Function[]} options.middleware + * @param {Object} options.params + * @param {string} options.method + * @param {string} options.format + * @throws {Response & { formattedResponse: string | object }} + * @returns {Response} resolved or rejected promise + */ + export function initMethod(method: `${Lowercase}`, options?: CreateHttpClientOptions) { return (methodOptions?: unknown) => {