mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Merge pull request #31115 from Leko/add-ghauth
Add type definitions for ghauth 3.2
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/// <reference types="node" />
|
||||
import ghauth = require("ghauth");
|
||||
import { AuthOptions, TokenData } from "ghauth";
|
||||
|
||||
// Full
|
||||
const authOptions1: AuthOptions = {
|
||||
configName: "awesome",
|
||||
noSave: true,
|
||||
authUrl: "https://api.github.com/authorizations",
|
||||
promptName: "GitHub",
|
||||
scopes: ["user"],
|
||||
note: "This token is for my awesome app",
|
||||
userAgent: "My Awesome App",
|
||||
};
|
||||
|
||||
ghauth(authOptions1, (err: Error, authData: TokenData) => {
|
||||
authData.user;
|
||||
authData.token;
|
||||
});
|
||||
|
||||
// Required
|
||||
const authOptions2: AuthOptions = {
|
||||
configName: "awesome",
|
||||
};
|
||||
|
||||
ghauth(authOptions2, (err: Error, authData: TokenData) => {
|
||||
authData.user;
|
||||
authData.token;
|
||||
});
|
||||
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
// Type definitions for ghauth 3.2
|
||||
// Project: https://github.com/rvagg/ghauth
|
||||
// Definitions by: Leko <https://github.com/Leko>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function ghauth(authOptions: ghauth.AuthOptions, callback: (err: Error, tokenData: ghauth.TokenData) => void): void;
|
||||
|
||||
declare namespace ghauth {
|
||||
interface AuthOptions {
|
||||
configName: string;
|
||||
|
||||
/**
|
||||
* @default false
|
||||
*/
|
||||
noSave?: boolean;
|
||||
|
||||
/**
|
||||
* @default "https://api.github.com/authorizations"
|
||||
*/
|
||||
authUrl?: string;
|
||||
|
||||
/**
|
||||
* @default "GitHub"
|
||||
*/
|
||||
promptName?: string;
|
||||
|
||||
/**
|
||||
* @default []
|
||||
*/
|
||||
scopes?: ReadonlyArray<string>;
|
||||
|
||||
/**
|
||||
* @default "Node.js command-line app with ghauth"
|
||||
*/
|
||||
note?: string;
|
||||
|
||||
/**
|
||||
* @default "Magic Node.js application that does magic things with ghauth"
|
||||
*/
|
||||
userAgent?: string;
|
||||
}
|
||||
|
||||
interface TokenData {
|
||||
user: string;
|
||||
token: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = ghauth;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ghauth-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user