@akamai-consulting/edgegrid-js-fetch
Version:
Signing and fetch library the Akamai OPEN EdgeGrid Authentication scheme in a JS environment that supports the fetch spec
36 lines (35 loc) • 1.49 kB
TypeScript
import EdgeGridCredentials from './credentials';
/** Class representing an EdgeGrid request signer and fetcher. */
export default class EdgeGrid {
#private;
/**
* Get the configuration object used for signing requests.
* @returns {EdgeGridCredentials} The edgerc configuration object.
*/
get config(): EdgeGridCredentials;
/**
* Create an EdgeGridCredentials object.
* @param {EdgeGridCredentials} credentials - The credentials used for signing requests
*/
constructor(credentials: EdgeGridCredentials);
/**
* Builds the request using the properties of the local config Object.
* Follows the same signature as the WHATWG fetch spec
*
* @param {RequestInfo|URL} input - The Request Object or URL.
* @param {RequestInit} init - An init object to include options such as heders and body.
*
* @returns Promise which resolves to a signed Request object
*/
signRequest(input: RequestInfo | URL, init?: RequestInit): Promise<Request>;
/**
* Signs and fetches the request using the properties of the local config Object.
* Follows the same signature as the WHATWG fetch spec
*
* @param {RequestInfo|URL} input - The Request Object or URL.
* @param {RequestInit} init - An init object to include options such as heders and body.
*
* @returns Response object fetched from the EdgeGrid API
*/
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
}