diff --git a/types/osmosis/index.d.ts b/types/osmosis/index.d.ts index 4c03388047..8d9f640f8b 100644 --- a/types/osmosis/index.d.ts +++ b/types/osmosis/index.d.ts @@ -56,8 +56,33 @@ interface Osmosis { * result data, osmosis finished */ data(callback: (param: any) => any): Osmosis; - } - declare const osmosis: Osmosis; + /** + * Set configuration options for the **preceeding** command on down the chain. + */ + config(option: string | { [key: string]: any }, value?: any): Osmosis; - export = osmosis; + /** + * Set a cookie. Short for `.config({ cookies: ... })`. Note: Setting a cookie to `null` will delete the cookie. + */ + cookie(name: string, value: string | null): Osmosis; + + /** + * Set an HTTP header. Short for `.config({ headers: ... })` + */ + header(name: string, value: string): Osmosis; + + /** + * Set multiple HTTP headers. Short for `.config({ headers: ... })`. + */ + headers(headers: { [key: string]: string }): Osmosis; + + /** + * Call a callback when the Osmosis instance has completely finished. + */ + done(callback: () => any): Osmosis; +} + +declare const osmosis: Osmosis; + +export = osmosis; diff --git a/types/osmosis/osmosis-tests.ts b/types/osmosis/osmosis-tests.ts index f0c39d4312..94f08db15e 100644 --- a/types/osmosis/osmosis-tests.ts +++ b/types/osmosis/osmosis-tests.ts @@ -12,9 +12,15 @@ const errorFunction = (error: string) => { const myError = error; }; -// example is from https://github.com/rchipka/node-osmosis#example +const doneFunction = () => {}; + +// modified example from https://github.com/rchipka/node-osmosis#example osmosis + .config({ headers: { 'test-header-name': 'test-header-value' } }) + .headers({ 'test-header-name': 'test-header-value' }) + .header('test-header-name', 'test-header-value') + .cookie('test-cookie-name', 'test-cookie-value') .get('www.craigslist.org/about/sites') .find('h1 + div a') .set('location') @@ -39,4 +45,5 @@ osmosis }) .log(logFunction) .error(errorFunction) - .debug(debugFunction); + .debug(debugFunction) + .done(doneFunction);