Skip to content

Commit

Permalink
Merge pull request #7 from Electroid/master
Browse files Browse the repository at this point in the history
Add a Typescript declaration file
  • Loading branch information
mhart authored May 20, 2020
2 parents eaa2f23 + 3a43655 commit 7d0abd4
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
44 changes: 44 additions & 0 deletions dist/aws4fetch.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
export interface AwsClientInit {
accessKeyId?: string;
secretAccessKey?: string;
sessionToken?: string | null;
service?: string | null;
region?: string | null;
cache?: Map<string,string> | null;
retries?: number | null;
initRetryMs?: number | null;
}

export interface AwsSignerInit extends AwsClientInit {
url?: string | URL;
method?: string ;
headers?: HeadersInit | null;
body?: BodyInit | null;
datetime?: string | null;
signQuery?: boolean | null;
appendSessionToken?: boolean | null;
allHeaders?: boolean | null;
singleEncode?: boolean | null;
}

export interface AwsRequestInfo {
method: string;
url: URL;
headers: Headers;
body: BodyInit;
}

export interface AwsRequestInit extends RequestInit {
aws?: AwsSignerInit | null;
}

export class AwsSigner {
constructor(init: AwsSignerInit);
public sign(): Promise<AwsRequestInfo>;
}

export class AwsClient {
constructor(init: AwsClientInit);
public sign(input: RequestInfo, init?: AwsRequestInit): Promise<Request>;
public fetch(input: RequestInfo, init?: AwsRequestInit): Promise<Response>;
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "dist/aws4fetch.cjs.js",
"module": "dist/aws4fetch.esm.js",
"browser": "dist/aws4fetch.umd.js",
"types": "dist/aws4fetch.d.ts",
"author": "Michael Hart <michael.hart.au@gmail.com>",
"license": "MIT",
"devDependencies": {
Expand Down

0 comments on commit 7d0abd4

Please sign in to comment.