mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 21:10:23 +00:00
Added declaration files for gramps rest-helpers
Why did you do this? The package doesn't have it's own so I'm adding them. I don't use all of the methods in the GraphQLConnector class, so I haven't validated that all of these methods work, but based on the comments in the source code it appears to be the correct types.
This commit is contained in:
@@ -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
@@ -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({});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user