mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-17 03:24:15 +08:00
Merge pull request #26650 from AutoGravity/add_gramps_rest_helper_types
Added declaration files for @gramps/rest-helpers
This commit is contained in:
16
types/gramps__rest-helpers/gramps__rest-helpers-tests.ts
Normal file
16
types/gramps__rest-helpers/gramps__rest-helpers-tests.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { GraphQLConnector, GraphQLModel } from '@gramps/rest-helpers';
|
||||
|
||||
const myConnector = new GraphQLConnector();
|
||||
|
||||
myConnector.apiBaseUri = "some uri";
|
||||
myConnector.headers = {};
|
||||
myConnector.cacheExpiry = 300;
|
||||
myConnector.enableCache = true;
|
||||
myConnector.redis = false;
|
||||
|
||||
myConnector.get("someurl");
|
||||
myConnector.post("someendpoint", {}, {}).then(() => {});
|
||||
myConnector.put("someendpoint", {}, {}).then(() => {});
|
||||
myConnector.delete("someendpoint", {}).then(() => {});
|
||||
|
||||
const myModel = new GraphQLModel(myConnector);
|
||||
26
types/gramps__rest-helpers/index.d.ts
vendored
Normal file
26
types/gramps__rest-helpers/index.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// Type definitions for @gramps/rest-helpers 1.1
|
||||
// Project: https://github.com/gramps-graphql/rest-helpers
|
||||
// Definitions by: Claude Ciocan <https://github.com/claude>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
export class GraphQLConnector {
|
||||
constructor();
|
||||
|
||||
apiBaseUri: string;
|
||||
headers: object;
|
||||
request: any;
|
||||
cacheExpiry: number;
|
||||
enableCache: boolean;
|
||||
redis: boolean;
|
||||
get(endpoint: string): Promise<any>;
|
||||
post(endpoint: string, body: object, options: object): Promise<any>;
|
||||
put(endpoint: string, body: object, options: object): Promise<any>;
|
||||
delete(endpoint: string, options: object): Promise<any>;
|
||||
}
|
||||
|
||||
export class GraphQLModel {
|
||||
connector: GraphQLConnector;
|
||||
|
||||
constructor({});
|
||||
}
|
||||
28
types/gramps__rest-helpers/tsconfig.json
Normal file
28
types/gramps__rest-helpers/tsconfig.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"@gramps/rest-helpers": [
|
||||
"gramps__rest-helpers"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gramps__rest-helpers-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/gramps__rest-helpers/tslint.json
Normal file
3
types/gramps__rest-helpers/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user