import type { AxiosRequestConfig } from "axios";
import { Protocol } from "./utils";
import { Paginated, PostRequestOptions } from "./models";
import { AuthResource } from "./resources/auth";
import { IdentitiesResource } from "./resources/identities";
import { AccountsResource } from "./resources/accounts";
import { ConnectionsResource } from "./resources/connections";
import { CategoriesResource } from "./resources/categories";
import { PaymentsResource } from "./resources/payments";
import { TransfersResource } from "./resources/transfers";
import { TransactionsResource } from "./resources/transactions";
import { UsersResource } from "./resources/users";
import { WebhooksResource } from "./resources/webhooks";
import { PartiesResource } from "./resources/parties";
import { AuthorisationsResource } from "./resources/authorisations";
type ApiVersion = "v1";
type RequestOptions = PostRequestOptions;
/**
 * @category API client config
 */
export { Protocol } from "./utils";
/**
 * Authentication and API endpoint configuration for {@link AkahuClient}.
 * @category API client config
 */
export type AkahuClientConfig = {
    /**
     * appToken is required to access the Akahu API.
     */
    appToken: string;
    /**
     * appSecret is only required for completing an OAuth code exchange, or to
     * access app-specific endpoints.
     *
     * For security reasons, this option must not be used client-side in the browser.
     *
     * {@link https://developers.akahu.nz/reference}
     *
     * @defaultValue `undefined`
     */
    appSecret?: string;
    /**
     * The Akahu API version. Currently the only supported value is "v1".
     *
     * @defaultValue `v1`
     */
    apiVersion?: ApiVersion;
    /**
     * The protocol used for Akahu API calls.
     * The Akahu API only supports connections over HTTPS, so this option is only
     * useful for test environments etc.
     *
     * @defaultValue `https`
     */
    protocol?: Protocol;
    /**
     * The Akahu API hostname.
     * It may be useful to override this in staging / testing environments.
     *
     * @defaultValue `api.akahu.io`
     */
    host?: string;
    /**
     * The Akahu API port.
     * It may be useful to override this in staging / testing environments.
     *
     * @defaultValue `undefined`
     */
    port?: number;
    /**
     * Additional headers that will be included in each request.
     */
    headers?: Record<string, string>;
    /**
     * Timeout in ms for each request to the Akahu API.
     *
     * If used in combination with `retries`, the timeout will be applied to
     * each retried request. This means that the total time until an error is
     * thrown due to a timeout will be `timeout * (retries + 1)` milliseconds.
     *
     * @defaultValue `0` (no timeout)
     */
    timeout?: number;
    /**
     * The number of times that API requests will be retried in the case of
     * network errors. Error responses from the Akahu API will not result in
     * a retry.
     *
     * @defaultValue `0`
     */
    retries?: number;
    /**
     * Optional configuration for an HTTP proxy.
     *
     * See the proxy section of the axios {@link https://axios-http.com/docs/req_config request config}
     * for more details.
     */
    proxy?: {
        host: string;
        port: number;
        auth?: {
            username: string;
            password: string;
        };
        protocol?: string;
    };
    /**
     * Optional adapter function which will be passed through to the underlying
     * Axios instance.
     *
     * See {@link https://github.com/axios/axios/tree/v1.8.3/lib/adapters}.
     */
    adapter?: AxiosRequestConfig["adapter"];
};
type AuthMethod = {
    basic: true;
} | {
    token: string;
};
type ApiResponsePayload = Record<string, any> | Record<string, any>[] | Paginated<Record<string, any>> | string | void;
/**
 * The AkahuClient provides a simple interface to the Akahu API and utilities
 * that assist with common usage patterns.
 *
 * AkahuClient uses {@link https://axios-http.com/docs/intro axios} under the hood to make
 * API requests. A subset of axios request options can be passed through to the underlying axios
 * instance using the options available in {@link AkahuClientConfig}.
 *
 * In the case of an error while making an API request, you can expect to handle one of the
 * following two exceptions:
 *
 * - {@link AkahuErrorResponse} When an error response is returned from the API
 * - {@link https://github.com/axios/axios/blob/v0.21.1/index.d.ts#L85 AxiosError} when an error
 *    occurred during the request process, but no response was received (i.e. due to network issues).
 *
 * @category API client
 */
export declare class AkahuClient {
    private readonly axios;
    /** @internal */
    readonly authConfig: {
        appToken: string;
        appSecret?: string;
    };
    /**
     * @category Resource
     * @inheritDoc AuthResource
     * */
    auth: AuthResource;
    /**
     * @category Resource
     * @inheritDoc IdentitiesResource
     * */
    identities: IdentitiesResource;
    /**
     * @category Resource
     * @inheritDoc UsersResource
     * */
    users: UsersResource;
    /**
     * @category Resource
     * @inheritDoc ConnectionsResource
     * */
    connections: ConnectionsResource;
    /**
     * @category Resource
     * @inheritDoc CategoriesResource
     * */
    categories: CategoriesResource;
    /**
     * @category Resource
     * @inheritDoc AccountsResource
     * */
    accounts: AccountsResource;
    /**
     * @category Resource
     * @inheritDoc AuthorisationsResource
     * */
    authorisations: AuthorisationsResource;
    /**
     * @category Resource
     * @inheritDoc PaymentsResource
     * */
    payments: PaymentsResource;
    /**
     * @category Resource
     * @inheritDoc TransfersResource
     * */
    transfers: TransfersResource;
    /**
     * @category Resource
     * @inheritDoc TransactionsResource
     * */
    transactions: TransactionsResource;
    /**
     * @category Resource
     * @inheritDoc WebhooksResource
     * */
    webhooks: WebhooksResource;
    /**
     * @category Resource
     * @inheritDoc PartiesResource
     * */
    parties: PartiesResource;
    constructor(config: AkahuClientConfig);
    private _authorizeRequest;
    private _makeIdempotent;
    private _sanitizeQuery;
    /**
     * Generic API wrapper, exposed for use by client resources.
     * @internal
     */
    _apiCall<T extends ApiResponsePayload>({ path, method, query, data, auth, options, }: {
        path: string;
        method?: "GET" | "POST" | "PUT" | "DELETE";
        query?: Record<string, any>;
        data?: any;
        auth?: AuthMethod;
        options?: RequestOptions;
    }): Promise<T>;
}
