DefinitelyTyped/types/hosted-git-info/index.d.ts
Michael Mitchell a6c082f346
[hosted-git-info] Update types for 3.0 (#42499)
Not exactly sure where the original author got `host` from but from what I can
see it's always been `type`.

Also remove `fromUrl` from the class as it's not actually a part of the class
2020-02-25 11:02:14 -08:00

76 lines
2.3 KiB
TypeScript

// Type definitions for hosted-git-info 3.0
// Project: https://github.com/npm/hosted-git-info
// Definitions by: Jason <https://github.com/OiyouYeahYou>, Michael <https://github.com/Ovyerus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class GitHost {
constructor(type: GitHost.Hosts, user: string, auth: string | undefined, project: string, committish: string | undefined, defaultRepresentation: string, opts?: GitHost.FillOptions);
type: GitHost.Hosts;
user: string;
auth?: string;
project: string;
committish?: string;
default: string;
opts: GitHost.Options;
protocols: string[];
domain: string;
treepath?: string;
// Templates
sshtemplate: string;
sshurltemplate: string;
browsetemplate: string;
browsefiletemplate: string;
docstemplate: string;
httpstemplate: string;
filetemplate: string;
shortcuttemplate: string;
pathtemplate: string;
bugstemplate: string;
gittemplate?: string;
tarballtemplate: string;
pathmatch: RegExp;
protocols_re: RegExp;
hashformat(fragment: string): string;
hash(): string;
ssh(opts?: GitHost.FillOptions): string;
sshurl(opts?: GitHost.FillOptions): string;
browse(opts?: GitHost.FillOptions): string;
browse(path: string, opts?: GitHost.FillOptions): string;
browse(path: string, fragment: string, opts?: GitHost.FillOptions): string;
docs(opts?: GitHost.FillOptions): string;
bugs(opts?: GitHost.FillOptions): string;
https(opts?: GitHost.FillOptions): string;
git(opts?: GitHost.FillOptions): string;
shortcut(opts?: GitHost.FillOptions): string;
path(opts?: GitHost.FillOptions): string;
tarball(opts?: GitHost.FillOptions): string;
file(path: string, opts?: GitHost.FillOptions): string;
getDefaultRepresentation(): string;
toString(opts?: GitHost.FillOptions): string;
}
declare namespace GitHost {
function fromUrl(gitUrl: string, opts?: Options): GitHost;
interface Options {
noCommittish?: boolean;
noGitPlus?: boolean;
}
interface FillOptions extends Options {
path?: string;
auth?: string;
fragment?: string;
committish?: string;
treepath?: string;
}
type Hosts = 'github' | 'bitbucket' | 'gitlab' | 'gist';
}
export = GitHost;