/**
 * Copyright (c) Microsoft Corporation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { ChannelOwner } from './channelOwner';
import { Tracing } from './tracing';
import { TimeoutSettings } from './timeoutSettings';
import type { Playwright } from './playwright';
import type { ClientCertificate, FilePayload, Headers, SetStorageState, StorageState, TimeoutOptions } from './types';
import type { Serializable } from '../../types/structs';
import type * as api from '../../types/types';
import type { HeadersArray } from '@isomorphic/types';
import type * as channels from '@protocol/channels';
import type * as fs from 'fs';
export type FetchOptions = {
    params?: {
        [key: string]: string | number | boolean;
    } | URLSearchParams | string;
    method?: string;
    headers?: Headers;
    data?: string | Buffer | Serializable;
    form?: {
        [key: string]: string | number | boolean;
    } | FormData;
    multipart?: {
        [key: string]: string | number | boolean | fs.ReadStream | FilePayload;
    } | FormData;
    timeout?: number;
    failOnStatusCode?: boolean;
    ignoreHTTPSErrors?: boolean;
    maxRedirects?: number;
    maxRetries?: number;
};
export type NewContextOptions = Omit<channels.PlaywrightNewRequestOptions, 'extraHTTPHeaders' | 'clientCertificates' | 'storageState' | 'tracesDir'> & {
    extraHTTPHeaders?: Headers;
    storageState?: string | SetStorageState;
    clientCertificates?: ClientCertificate[];
};
type RequestWithBodyOptions = Omit<FetchOptions, 'method'>;
export declare class APIRequest implements api.APIRequest {
    private _playwright;
    readonly _contexts: Set<APIRequestContext>;
    constructor(playwright: Playwright);
    newContext(options?: NewContextOptions & TimeoutOptions): Promise<APIRequestContext>;
}
export declare class APIRequestContext extends ChannelOwner<channels.APIRequestContextChannel> implements api.APIRequestContext {
    _request?: APIRequest;
    readonly tracing: Tracing;
    private _closeReason;
    _timeoutSettings: TimeoutSettings;
    static from(channel: channels.APIRequestContextChannel): APIRequestContext;
    constructor(parent: ChannelOwner, type: string, guid: string, initializer: channels.APIRequestContextInitializer);
    [Symbol.asyncDispose](): Promise<void>;
    dispose(options?: {
        reason?: string;
    }): Promise<void>;
    delete(url: string, options?: RequestWithBodyOptions): Promise<APIResponse>;
    head(url: string, options?: RequestWithBodyOptions): Promise<APIResponse>;
    get(url: string, options?: RequestWithBodyOptions): Promise<APIResponse>;
    patch(url: string, options?: RequestWithBodyOptions): Promise<APIResponse>;
    post(url: string, options?: RequestWithBodyOptions): Promise<APIResponse>;
    put(url: string, options?: RequestWithBodyOptions): Promise<APIResponse>;
    fetch(urlOrRequest: string | api.Request, options?: FetchOptions): Promise<APIResponse>;
    _innerFetch(options?: FetchOptions & {
        url?: string;
        request?: api.Request;
    }): Promise<APIResponse>;
    storageState(options?: {
        path?: string;
        indexedDB?: boolean;
    }): Promise<StorageState>;
}
export declare class APIResponse implements api.APIResponse {
    private readonly _initializer;
    private readonly _headers;
    readonly _request: APIRequestContext;
    _apiName: string;
    constructor(context: APIRequestContext, initializer: channels.APIResponse);
    ok(): boolean;
    url(): string;
    status(): number;
    statusText(): string;
    headers(): Headers;
    headersArray(): HeadersArray;
    body(): Promise<Buffer>;
    text(): Promise<string>;
    json(): Promise<object>;
    [Symbol.asyncDispose](): Promise<void>;
    dispose(): Promise<void>;
    private _inspect;
    _fetchUid(): string;
    _fetchLog(): Promise<string[]>;
}
export {};
//# sourceMappingURL=fetch.d.ts.map