@types/got
Advanced tools
Comparing version 9.2.2 to 9.3.0
@@ -1,2 +0,2 @@ | ||
// Type definitions for got 9.2 | ||
// Type definitions for got 9.3 | ||
// Project: https://github.com/sindresorhus/got#readme | ||
@@ -105,8 +105,46 @@ // Definitions by: BendingBender <https://github.com/BendingBender> | ||
type Hook<T> = (options: T) => any; | ||
type Hooks<T> = Record<'beforeRequest', Array<Hook<T>>>; | ||
/** | ||
* Hooks allow modifications during the request lifecycle. Hook functions may be async and are | ||
* run serially. | ||
* | ||
* @see https://github.com/sindresorhus/got#hooks | ||
* @template Options Request options. | ||
* @template Body Response body type. | ||
*/ | ||
interface Hooks<Options, Body extends Buffer | string | object> { | ||
beforeRequest?: Array<BeforeRequestHook<Options>>; | ||
beforeRedirect?: Array<BeforeRedirectHook<Options>>; | ||
beforeRetry?: Array<BeforeRetryHook<Options>>; | ||
afterResponse?: Array<AfterResponseHook<Options, Body>>; | ||
} | ||
/** | ||
* @param options Normalized request options. | ||
*/ | ||
type BeforeRequestHook<Options> = (options: Options) => any; | ||
/** | ||
* @param options Normalized request options. | ||
*/ | ||
type BeforeRedirectHook<Options> = (options: Options) => any; | ||
/** | ||
* @param options Normalized request options. | ||
* @param error Request error. | ||
* @param retryCount Number of retry. | ||
*/ | ||
type BeforeRetryHook<Options> = (options: Options, error: GotError, retryCount: number) => any; | ||
/** | ||
* @param response Response object. | ||
* @param retryWithMergedOptions Retries request with the updated options. | ||
*/ | ||
type AfterResponseHook<Options, Body extends Buffer | string | object> = ( | ||
response: Response<Body>, | ||
retryWithMergedOptions: (updateOptions: Options) => GotPromise<Body> | ||
) => Response<Body> | Promise<Response<Body>>; | ||
interface GotBodyOptions<E extends string | null> extends GotOptions<E> { | ||
body?: string | Buffer | nodeStream.Readable; | ||
hooks?: Hooks<GotBodyOptions<E>>; | ||
hooks?: Hooks<GotBodyOptions<E>, string | Buffer | nodeStream.Readable>; | ||
} | ||
@@ -119,10 +157,10 @@ | ||
json: true; | ||
hooks?: Hooks<GotJSONOptions>; | ||
hooks?: Hooks<GotJSONOptions, object>; | ||
} | ||
interface GotFormOptions<E extends string | null> extends GotOptions<E> { | ||
body?: {[key: string]: any}; | ||
body?: Record<string, any>; | ||
form: true; | ||
json?: boolean; | ||
hooks?: Hooks<GotFormOptions<E>>; | ||
hooks?: Hooks<GotFormOptions<E>, Record<string, any>>; | ||
} | ||
@@ -129,0 +167,0 @@ |
{ | ||
"name": "@types/got", | ||
"version": "9.2.2", | ||
"version": "9.3.0", | ||
"description": "TypeScript definitions for got", | ||
@@ -39,4 +39,4 @@ "license": "MIT", | ||
}, | ||
"typesPublisherContentHash": "fd320f37e388a74af1bb96016ee7d9593c422ad9dc4d18eaef59298a81039a4f", | ||
"typesPublisherContentHash": "df4a012b25eac238c78af9a1df6a26cf7a095e2670f3a02eb1f983180bd2a889", | ||
"typeScriptVersion": "2.3" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Tue, 18 Dec 2018 21:06:51 GMT | ||
* Last updated: Wed, 02 Jan 2019 22:29:07 GMT | ||
* Dependencies: @types/tough-cookie, @types/node | ||
@@ -14,0 +14,0 @@ * Global values: none |
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
15321
262