diff --git a/src/index.ts b/src/index.ts index ee3f9d5..d495b21 100644 --- a/src/index.ts +++ b/src/index.ts @@ -77,12 +77,20 @@ export { default as Serializer } from './structures/Serializer'; export { default as HttpError } from './errors/HttpError'; export { default as Response } from './structures/Response'; -export * as middleware from './middleware'; export { RequestOptions, HttpClient, UrlLike, Request }; +export * as middleware from './middleware'; export * from './serializers'; export interface SingleRequestOptions extends HttpClientOptions, Omit {} +export declare function get(url: UrlLike | SingleRequestOptions, options?: Omit): Request; +export declare function put(url: UrlLike | SingleRequestOptions, options?: Omit): Request; +export declare function post(url: UrlLike | SingleRequestOptions, options?: Omit): Request; +export declare function patch(url: UrlLike | SingleRequestOptions, options?: Omit): Request; +export declare function trace(url: UrlLike | SingleRequestOptions, options?: Omit): Request; +export declare function options(url: UrlLike | SingleRequestOptions, options?: Omit): Request; +export declare function connect(url: UrlLike | SingleRequestOptions, options?: Omit): Request; + for (const method of HttpMethods.filter(r => r.toLowerCase() === r)) { exports[method] = function onMethod(url: UrlLike | SingleRequestOptions, options?: Omit) { const client = new HttpClient({ diff --git a/src/methods.d.ts b/src/methods.d.ts deleted file mode 100644 index 8417d83..0000000 --- a/src/methods.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2020-2021 August - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -import type { UrlLike, SingleRequestOptions, Request } from '.'; - -export declare function get(url: UrlLike | SingleRequestOptions, options?: Omit): Request; -export declare function put(url: UrlLike | SingleRequestOptions, options?: Omit): Request; -export declare function post(url: UrlLike | SingleRequestOptions, options?: Omit): Request; -export declare function patch(url: UrlLike | SingleRequestOptions, options?: Omit): Request; -export declare function trace(url: UrlLike | SingleRequestOptions, options?: Omit): Request; -export declare function options(url: UrlLike | SingleRequestOptions, options?: Omit): Request; -export declare function connect(url: UrlLike | SingleRequestOptions, options?: Omit): Request;