Skip to content

Commit

Permalink
Merge pull request #94 from akamai/release/v3.2.0
Browse files Browse the repository at this point in the history
Release/v3.2.0
  • Loading branch information
Piyush Kaushik authored Apr 26, 2022
2 parents c81fe35 + dba3d8c commit 21ef7a6
Show file tree
Hide file tree
Showing 6 changed files with 2,031 additions and 197 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# RELEASE NOTES

## 3.2.0 (Apr 26, 2022)

#### IMPROVEMENTS:
* Add Typescript declaration file ([#71](https://github.com/akamai/AkamaiOPEN-edgegrid-node/issues/71))

## 3.1.4 (Mar 24, 2022)

#### IMPROVEMENTS:
Expand Down
33 changes: 33 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { AxiosError, AxiosResponse } from "axios";

declare class EdgeGrid {
constructor(clientTokenOrOptions: string | object,
clientSecret?: string,
accessToken?: string,
host?: string,
debug?: boolean);

request: object;
config: object;

/**
* Sends the request and invokes the callback function.
*
* @param {Function} callback The callback function.
* @return EdgeGrid object (self)
*/
send(callback: (error: AxiosError, response?: AxiosResponse, body?: string) => void): EdgeGrid;

/**
* Builds the request using the properties of the local config Object.
*
* @param {Object} req The request Object. Can optionally contain a
* 'headersToSign' property: An ordered list header names
* that will be included in the signature. This will be
* provided by specific APIs.
* @return EdgeGrid object (self)
*/
auth(req: object): EdgeGrid;
}

export = EdgeGrid;
19 changes: 19 additions & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { expectType } from 'tsd';
import EdgeGrid = require('.')

const eg = new EdgeGrid({
path: '/path/to/.edgerc',
section: 'section-name'
});

expectType<EdgeGrid>(eg)

var req = {
path: '/diagnostic-tools/v1/locations',
method: 'GET',
headers: {},
body: 'bodyData'
}
expectType<EdgeGrid>(eg.auth(req))

expectType<EdgeGrid>(eg.send((error, resp, body) => console.log(body)))
Loading

0 comments on commit 21ef7a6

Please sign in to comment.