import type { Logger } from '@znet/shared';
import { type OAuth1Credentials } from './oauth1.js';
import { type QueryParams, type SearchCriteria } from './search-criteria.js';
import type { SearchResult } from './types.js';
export interface MagentoClientOptions {
    baseUrl: string;
    accessToken: string;
    /** All four OAuth1 values present → signed requests; otherwise the token is sent as a Bearer token. */
    oauth1?: Partial<OAuth1Credentials>;
    timeoutMs?: number;
    maxRetries?: number;
    logger?: Logger;
    /** Injected for tests. */
    fetch?: typeof fetch;
}
export interface RequestOptions {
    /** Store view code. `all` = admin/default scope. */
    store?: string;
    query?: QueryParams;
    /** Magento `fields=` projection to trim payloads, e.g. `items[sku,id],total_count`. */
    fields?: string;
}
export declare class MagentoApiError extends Error {
    readonly status: number;
    readonly path: string;
    readonly body: string;
    constructor(status: number, path: string, body: string);
    get isNotFound(): boolean;
}
/** Read-only Magento REST + storefront GraphQL client. */
export declare class MagentoClient {
    private readonly opts;
    private readonly fetchImpl;
    private readonly oauth1;
    constructor(opts: MagentoClientOptions);
    get<T>(path: string, options?: RequestOptions): Promise<T>;
    /** One page of a `searchCriteria` list endpoint. */
    search<T>(path: string, criteria: SearchCriteria, options?: Omit<RequestOptions, 'query'>): Promise<SearchResult<T>>;
    /**
     * Iterate every page of a list endpoint. Stops on `total_count`, not on an empty page: Magento
     * returns the *last* page again when `currentPage` overshoots.
     */
    paginate<T>(path: string, criteria: SearchCriteria, options?: Omit<RequestOptions, 'query'>): AsyncGenerator<T[]>;
    /**
     * Anonymous POST, used only for Magento's admin-token endpoints when checking a staff login.
     * Never sends the integration credentials and never retries (failed logins must not be replayed).
     */
    postAnonymous<T>(path: string, body: unknown): Promise<T>;
    /** Storefront GraphQL (public data; `Store` header selects the store view). */
    graphql<T>(query: string, variables: Record<string, unknown>, store: string): Promise<T>;
    private authHeader;
    /** Sends with timeout + exponential backoff on transient failures. `build` re-signs each attempt. */
    private send;
}
//# sourceMappingURL=client.d.ts.map