declare class EdgeGrid { /** * Creates a client configured from an .edgerc credentials file. */ constructor(options: EdgeGrid.EdgeGridOptions); /** * Creates a client configured from explicit credential strings. */ constructor(clientToken: string, clientSecret: string, accessToken: string, host: string); /** * @deprecated The `max_body` parameter is deprecated. Please use the 4-argument constructor. */ constructor(clientToken: string, clientSecret: string, accessToken: string, host: string, max_body: number); config: EdgeGrid.EdgeGridConfig; _dispatcher: EdgeGrid.HttpDispatcher | null | undefined; /** * Authenticates and executes a request, returning a Promise. * * Resolves with { statusCode, headers, body, url } on a 2xx response. * Rejects with an EdgeGridError on HTTP errors (4xx/5xx) or network failures. */ send(request: EdgeGrid.EdgeGridRequest): Promise; /** * @deprecated Use `send(request)` (Promise API) instead. * Callback support will be removed in a future major version. * * Compatibility mode: the callback is invoked with (err, response, body) and `this` is returned * for chaining, matching the pre-v5 behavior. */ send(request: EdgeGrid.EdgeGridRequest, callback: ( error: EdgeGrid.EdgeGridError | null, response?: EdgeGrid.SendResult | null, body?: string | Buffer | null ) => void): this; enableLogging(option: boolean | object): this; } declare namespace EdgeGrid { /** * Options accepted by the `new EdgeGrid({ ... })` form, which reads * credentials from an .edgerc file. */ export interface EdgeGridOptions { /** * Path to the .edgerc credentials file. Defaults to '~/.edgerc' when omitted. * Not required if the corresponding AKAMAI_* (or AKAMAI_
_*) environment * variables are set instead — those take precedence over the file when present. */ path?: string; /** Section header within the .edgerc file to read. Defaults to 'default' when omitted. */ section?: string; } /** Resolved client configuration, whichever constructor form was used. */ export interface EdgeGridConfig { client_token: string; client_secret: string; access_token: string; host: string; /** @deprecated retained for backwards compatibility; no longer configurable. */ max_body: number; } /** * Minimal structural interface for an HTTP dispatcher (e.g. undici's Dispatcher, * ProxyAgent, or MockAgent). Typed structurally so callers are not forced to * take a direct dependency on undici. */ export interface HttpDispatcher { dispatch(options: object, handler: object): boolean; } /** Request options passed to send(). */ export interface EdgeGridRequest { /** API path, e.g. '/identity-management/v3/user-profile'. */ path: string; /** HTTP method. Defaults to 'GET'. */ method?: string; /** Request headers. */ headers?: Record; /** Request body. Objects are JSON-serialised automatically. */ body?: string | Buffer | Uint8Array | object; /** Query string parameters as a key-value map. */ qs?: Record; /** Ordered list of header names to include in the EdgeGrid signature. */ headersToSign?: Record; } /** Resolved value of the Promise returned by send(). */ export interface SendResult { /** HTTP status code. */ statusCode: number; /** Response headers. */ headers: Record; /** * Response body. * - string for text responses: text/*, application/json, application/xml, * application/javascript, and any *+json or *+xml type * - Buffer for all other content types (binary/unknown), or when * responseType: 'arraybuffer' is explicitly set */ body: string | Buffer; /** Final URL of the request, after any redirects. */ url: string; } /** Error thrown (Promise rejection) for HTTP errors (4xx, 5xx) or network failures. */ export interface EdgeGridError extends Error { /** HTTP status code. Absent for network-level errors (e.g. connection refused). */ statusCode?: number; /** Response headers. Absent for network-level errors. */ headers?: Record; /** Response body. Absent for network-level errors. */ body?: string | Buffer; /** URL that was requested when the error occurred. */ url?: string; /** Underlying transport-layer error, present for network-level failures. */ cause?: Error; } } export = EdgeGrid;