Adding types for "hyper-aws4"

This commit is contained in:
BamButz 2018-11-25 12:25:56 +01:00
parent 36a32d8a72
commit dcda399637
4 changed files with 61 additions and 0 deletions

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
types/hyper-aws4/index.d.ts vendored Normal file
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;

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"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }