diff --git a/types/gravatar/gravatar-tests.ts b/types/gravatar/gravatar-tests.ts index 9fa79a2d40..90c470b344 100644 --- a/types/gravatar/gravatar-tests.ts +++ b/types/gravatar/gravatar-tests.ts @@ -1,16 +1,21 @@ - - import gravatar = require('gravatar'); -gravatar.url("email@example.com"); -gravatar.url("email@example.com", { s: "200", r: "pg", d: "404" }); -gravatar.url("email@example.com", { size: "200", r: "pg", d: "404" }); -gravatar.url("email@example.com", { s: "200" }); -gravatar.url("email@example.com", { default: "404" }); -gravatar.url("email@example.com", { s: "200", rating: "pg", d: "404" }, true); -gravatar.url("email@example.com", { s: "200", r: "pg", default: "404" }, false); -gravatar.url("email@example.com", { d: "404" }, false); -gravatar.url("email@example.com", { forcedefault: "y" }, false); -gravatar.url("email@example.com", { f: "y" }); -gravatar.url("email@example.com", { protocol: "https" }); -gravatar.url("email@example.com", { format: "xml" }); +gravatar.url('email@example.com'); +gravatar.url('email@example.com', { s: '200', r: 'pg', d: '404' }); +gravatar.url('email@example.com', { size: '200', r: 'pg', d: '404' }); +gravatar.url('email@example.com', { s: '200' }); +gravatar.url('email@example.com', { default: '404' }); +gravatar.url('email@example.com', { s: '200', rating: 'pg', d: '404' }, true); +gravatar.url('email@example.com', { s: '200', r: 'pg', default: '404' }, false); +gravatar.url('email@example.com', { d: '404' }, false); +gravatar.url('email@example.com', { forcedefault: 'y' }, false); +gravatar.url('email@example.com', { f: 'y' }); +gravatar.url('email@example.com', { protocol: 'https' }); +gravatar.url('email@example.com', { format: 'xml' }); +gravatar.profile_url('email@example.com'); +gravatar.profile_url('email@example.com', {}); +gravatar.profile_url('email@example.com', {}, true); +gravatar.profile_url('emerleite@gmail.com', { protocol: 'https' }); +gravatar.profile_url('emerleite@gmail.com', { protocol: 'http', format: 'qr' }); +gravatar.url('email@example.com', { cdn: 'http://cdn-gravatar.wuweixing.com' }); +gravatar.profile_url('email@example.com', { cdn: 'http://cdn-gravatar.wuweixing.com' }); diff --git a/types/gravatar/index.d.ts b/types/gravatar/index.d.ts index 161ba459af..534cdc48e3 100644 --- a/types/gravatar/index.d.ts +++ b/types/gravatar/index.d.ts @@ -1,23 +1,35 @@ -// Type definitions for gravatar v1.8.0 +// Type definitions for gravatar 1.8 // Project: https://github.com/emerleite/node-gravatar // Definitions by: Denis Sokolov +// Piotr Błażejewicz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace GravatarModule { - type Options = { - d?: string - default?: string - f?: string - forcedefault?: string - format?: string - protocol?: string - r?: string - rating?: string - s?: string - size?: string - } - - function url(email: string, options?: Options, forceProtocol?: boolean): string; +export interface Options { + cdn?: string; + d?: string; + default?: string; + f?: string; + forcedefault?: string; + format?: string; + protocol?: string; + r?: string; + rating?: string; + s?: string; + size?: string; } - -export = GravatarModule; +/** + * @param email - The gravatar email + * @param [options] - Query string options + * @param [protocol] - Define if will use no protocol, http or https gravatar URL. + * Default is 'undefined', which generates URLs without protocol. + * True to force https and false to force http + */ +export function url(email: string, options?: Options, protocol?: boolean): string; +/** + * @param email - The gravatar email + * @param [options] - Query string options + * @param [protocol] - Define if will use no protocol, http or https gravatar URL. + * Default is 'undefined', which generates URLs without protocol. + * True to force https and false to force http + */ +export function profile_url(email: string, options?: Options, protocol?: boolean): string; diff --git a/types/gravatar/tslint.json b/types/gravatar/tslint.json index eff86ecb12..f93cf8562a 100644 --- a/types/gravatar/tslint.json +++ b/types/gravatar/tslint.json @@ -1,14 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "callable-types": false, - "dt-header": false, - "export-just-namespace": false, - "interface-over-type-literal": false, - "no-consecutive-blank-lines": false, - "no-redundant-jsdoc": false, - "prefer-method-signature": false, - "semicolon": false, - "trim-file": false - } -} \ No newline at end of file + "extends": "dtslint/dt.json" +}