mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 19:43:20 +08:00
feat: add testingbot-api typings
This commit is contained in:
68
types/testingbot-api/index.d.ts
vendored
Normal file
68
types/testingbot-api/index.d.ts
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
// Type definitions for testingbot-api 1.0
|
||||
// Project: https://github.com/testingbot/testingbot-api
|
||||
// Definitions by: Tim Brust <https://github.com/timbru31>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace TestingBot {
|
||||
type BrowserType = 'webdriver' | 'rc';
|
||||
type TestSuccess = true | false | 0 | 1;
|
||||
|
||||
interface TestingBotOptions {
|
||||
api_key?: string;
|
||||
api_secret?: string;
|
||||
}
|
||||
|
||||
interface UserInfo {
|
||||
first_name?: string;
|
||||
last_name?: string;
|
||||
email?: string;
|
||||
}
|
||||
|
||||
interface TestData {
|
||||
'test[success]'?: TestSuccess;
|
||||
'test[status_message]'?: string;
|
||||
'test[name]'?: string;
|
||||
'test[extra]'?: string;
|
||||
build?: string;
|
||||
groups?: string;
|
||||
}
|
||||
|
||||
interface TestLabData {
|
||||
'test[url]'?: string;
|
||||
'test[name]'?: string;
|
||||
'test[cron]'?: string;
|
||||
'test[enabled]'?: boolean;
|
||||
}
|
||||
|
||||
interface TestingBot {
|
||||
getTestDetails(testID: string, callback?: () => any): void;
|
||||
|
||||
getBrowsers(callback?: () => any, type?: BrowserType): void;
|
||||
|
||||
getLabTestDetails(testID: string, callback?: () => any): void;
|
||||
|
||||
getTunnel(callback?: () => any): void;
|
||||
|
||||
getUserInfo(callback?: () => any): void;
|
||||
|
||||
getTests(callback?: () => any, offset?: number, limit?: number): void;
|
||||
|
||||
getLabTests(callback?: () => any, offset?: number, limit?: number): void;
|
||||
|
||||
updateUserInfo(data: UserInfo, callback?: () => any): void;
|
||||
|
||||
updateTest(data: TestData, testID: string, callback?: () => any): void;
|
||||
|
||||
updateLabTest(data: TestLabData, testID: string, callback?: () => any): void;
|
||||
|
||||
deleteTest(testID: string, callback?: () => any): void;
|
||||
|
||||
deleteLabTest(testID: string, callback?: () => any): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare const TestingBot: {
|
||||
new (options?: TestingBot.TestingBotOptions): TestingBot.TestingBot;
|
||||
};
|
||||
|
||||
export = TestingBot;
|
||||
21
types/testingbot-api/testingbot-api-tests.ts
Normal file
21
types/testingbot-api/testingbot-api-tests.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as TestingBot from 'testingbot-api';
|
||||
|
||||
const sessionId = '123';
|
||||
|
||||
const tb = new TestingBot({
|
||||
api_key: 'api-key',
|
||||
api_secret: 'api-secret'
|
||||
});
|
||||
|
||||
function noop() { }
|
||||
|
||||
tb.updateUserInfo({
|
||||
email: 'new-email'
|
||||
}, noop);
|
||||
|
||||
tb.getBrowsers(noop, 'webdriver');
|
||||
|
||||
tb.updateTest({
|
||||
'test[name]': 'test',
|
||||
build: '01'
|
||||
}, sessionId);
|
||||
22
types/testingbot-api/tsconfig.json
Normal file
22
types/testingbot-api/tsconfig.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"testingbot-api-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/testingbot-api/tslint.json
Normal file
1
types/testingbot-api/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user