Merge pull request #30798 from BamButz/master

Adding types for "hyper-aws4"
This commit is contained in:
Andrew Casey
2018-12-07 11:16:01 -08:00
committed by GitHub
4 changed files with 61 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
import { sign, Request } from "hyper-aws4";
const signOption: Request = {
url: "https://us-west-1.hyper.sh/version",
method: "GET",
credential: {
accessKey: "6DPLADBPWYXDUVXLX34EJXBL",
secretKey: "2ldD1Yz0nzATl9vvagBwYTjglXBjVOWU8gV8aMm5"
}
};
sign(signOption);
+25
View File
@@ -0,0 +1,25 @@
// Type definitions for hyper-aws4 1.1
// Project: https://github.com/Tim-Zhang/hyper-aws4#readme
// Definitions by: BamButz <https://github.com/bambutz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface Credentials {
accessKey: string;
secretKey: string;
}
export interface Header {
[header: string]: string;
}
export type HttpMethods = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
export interface Request {
url: string;
method?: HttpMethods;
body?: string;
headers?: Header;
credential?: Credentials;
}
export function sign(request: Request, credential?: Credentials): Header;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": [
"index.d.ts",
"hyper-aws4-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }