From 53a14e969e2489a736b455ccb8da00bdce27b8b9 Mon Sep 17 00:00:00 2001 From: Yukine Date: Fri, 18 May 2018 22:33:05 +0200 Subject: [PATCH] update snekfetch typings to 4.0.0 release --- types/snekfetch/index.d.ts | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/types/snekfetch/index.d.ts b/types/snekfetch/index.d.ts index ac77f8a572..643c376c5a 100644 --- a/types/snekfetch/index.d.ts +++ b/types/snekfetch/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for snekfetch 3.6 +// Type definitions for snekfetch 4.0 // Project: https://github.com/GusCaplan/snekfetch // Definitions by: Iker Pérez Brunelli // Shayne Hartford @@ -8,19 +8,23 @@ /// -import { ClientRequest } from 'http'; +import { ClientRequest, Agent } from 'http'; import { Readable } from 'stream'; declare namespace Snekfetch { interface SnekfetchOptions { headers?: { [key: string]: any }; - data?: any; + data?: object | string | Buffer; + agent?: Agent | boolean; + qs?: object; + query?: object | string; + redirect?: boolean; } - interface Result { + interface SnekfetchResponse { request: ClientRequest; - body: Buffer; - text: string; + body: string | object | Buffer; + raw: Buffer; ok: boolean; headers: { [key: string]: any }; status: number; @@ -37,7 +41,6 @@ declare namespace Snekfetch { | 'HEAD' | 'LINK' | 'LOCK' - | 'M-SEARCH' | 'MERGE' | 'MKACTIVITY' | 'MKCALENDAR' @@ -54,13 +57,13 @@ declare namespace Snekfetch { | 'REBIND' | 'REPORT' | 'SEARCH' + | 'SOURCE' | 'SUBSCRIBE' | 'TRACE' | 'UNBIND' | 'UNLINK' | 'UNLOCK' - | 'UNSUBSCRIBE' - | 'BREW'; + | 'UNSUBSCRIBE'; } declare class Snekfetch extends Readable { @@ -69,7 +72,7 @@ declare class Snekfetch extends Readable { data: any; request: ClientRequest; - readonly response: Snekfetch.Result | null; + readonly response: Snekfetch.SnekfetchResponse | null; constructor(method: Snekfetch.methods, url: string, opts?: Snekfetch.SnekfetchOptions); @@ -83,7 +86,6 @@ declare class Snekfetch extends Readable { static head(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static link(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static lock(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; - static msearch(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static merge(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static mkactivity(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static mkcalendar(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; @@ -100,13 +102,13 @@ declare class Snekfetch extends Readable { static rebind(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static report(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static search(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; + static source(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static subscribe(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static trace(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static unbind(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static unlink(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static unlock(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static unsubscribe(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; - static brew(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; query(name: string | { [key: string]: string | string[] }, value?: string): Snekfetch; @@ -116,13 +118,13 @@ declare class Snekfetch extends Readable { send(data?: string|Buffer|object): Snekfetch; - then(): Promise; - then(resolver: (res: Snekfetch.Result) => T, rejector?: (err: Error) => any): Promise; + then(): Promise; + then(resolver: (res: Snekfetch.SnekfetchResponse) => T, rejector?: (err: Error) => any): Promise; - catch(rejector: (err: Error) => any): Promise; + catch(rejector: (err: Error) => any): Promise; - end(): Promise; - end(cb: (err: Error | null, res: Snekfetch.Result | Error | null) => T): Promise; + end(): Promise; + end(cb: (err: Error | null, res: Snekfetch.SnekfetchResponse | Error | null) => T): Promise; } export = Snekfetch;