/** Represents return result for {@link TwinfinityApiClient.get}. */
export interface TypedResponse<T> extends Response {
    /**
     * Returns result for responses considered Ok. Otherwise an error is thrown.
     */
    readonly value: Promise<T>;
}
/**
 * HTTP Status codes (only a subset is used in the current model)
 */
export declare enum HttpStatusCode {
    Ok = 200,
    Created = 201,
    Accepted = 202,
    NoContent = 204,
    Aborted = 299,// Made up status code for aborted requests
    Unauthorized = 401,
    Forbidden = 403,
    Conflict = 409,
    NotFound = 404,
    InternalServerError = 500
}
/** Creates a mocked TypedResponse for testing */
export declare function createMockTypedResponse<T>(o: {
    value: T;
} & Partial<Response>): TypedResponse<T>;
/**
 * HTTP methods
 */
export declare enum HttpMethod {
    Post = "POST",
    Put = "PUT",
    Delete = "DELETE",
    Get = "GET",
    Patch = "PATCH"
}
/**
 * Same as {@link RequestInit} but without the method. Used with methods on {@link Http}
 */
export type HttpRequestInit = Omit<RequestInit, 'method'>;
export interface AuthorizationHeaderProvider {
    getAuthorizationHeader(): Promise<string | undefined>;
}
/**
 * Utility class for making HTTP requests. If requests are made to the Twinfinity
 * backend then correct headers are automatically set.
 */
export declare class Http {
    private static _authorizationHeaderProvider?;
    /**
     * Issues a GET HTTP request
     * @param absoluteUrl Absolute url
     * @param responseconverter How response should be converted. Use functions on {@link HttpResponseType}
     * @param init Optional {@link HttpRequestInit} values.
     */
    static get<R>(absoluteUrl: string | URL, responseconverter: (r: Response) => TypedResponse<R>, init?: HttpRequestInit): Promise<TypedResponse<R>>;
    /**
     * Issues a POST HTTP request
     * @param absoluteUrl Absolute url
     * @param responseconverter How response should be converted. Use functions on {@link HttpResponseType}
     * @param init Optional {@link HttpRequestInit} values.
     */
    static post<R>(absoluteUrl: string | URL, responseconverter: (r: Response) => TypedResponse<R>, init?: HttpRequestInit): Promise<TypedResponse<R>>;
    /**
     * Issues a DELETE HTTP request
     * @param absoluteUrl Absolute url
     * @param responseconverter How response should be converted. Use functions on {@link HttpResponseType}
     * @param init Optional {@link HttpRequestInit} values.
     */
    static delete<R>(absoluteUrl: string | URL, responseconverter: (r: Response) => TypedResponse<R>, init?: HttpRequestInit): Promise<TypedResponse<R>>;
    /**
     * Issues a PUT HTTP request
     * @param absoluteUrl Absolute url
     * @param responseconverter How response should be converted. Use functions on {@link HttpResponseType}
     * @param init Optional {@link HttpRequestInit} values.
     */
    static put<R>(absoluteUrl: string | URL, responseconverter: (r: Response) => TypedResponse<R>, init?: HttpRequestInit): Promise<TypedResponse<R>>;
    /**
     * Issues a PATCH HTTP request
     * @param absoluteUrl Absolute url
     * @param responseconverter How response should be converted. Use functions on {@link HttpResponseType}
     * @param init Optional {@link HttpRequestInit} values.
     */
    static patch<R>(absoluteUrl: string | URL, responseconverter: (r: Response) => TypedResponse<R>, init?: HttpRequestInit): Promise<TypedResponse<R>>;
    /**
     * Issues a HTTP request
     * @param method Method of http request.
     * @param absoluteUrl Absolute url
     * @param responseconverter How response should be converted. Use functions on {@link HttpResponseType}
     * @param init Optional {@link HttpRequestInit} values.
     */
    static fetch<R>(method: HttpMethod, absoluteUrl: string | URL, responseconverter: (r: Response) => TypedResponse<R>, init?: HttpRequestInit): Promise<TypedResponse<R>>;
    static setAuthorizationHeaderProvider(authorizationHeaderProvider: AuthorizationHeaderProvider): void;
    private static toURL;
    private static isTwinfinityUrl;
    private static requiresAuthorizationHeader;
}
/** Used with  {@link TwinfinityApiClient.get} to convert responses to correct data. See {@link TwinfinityApiClient.get} for an example. */
export declare class HttpResponseType {
    private readonly _statuses;
    /**
     * By default, {@link TypedResponse.value} conversion methods only assign {@link TypedResponse.value} when {@link Response.status} === `200`
     */
    static readonly default: HttpResponseType;
    /**
     * Converts an array buffer {@link Response} to {@link TypedResponse<ArrayBuffer>}.
     */
    readonly arrayBuffer: (r: Response) => TypedResponse<ArrayBuffer>;
    /**
     * Converts a JSON {@link Response} to {@link TypedResponse}.
     */
    readonly json: <T>(r: Response) => TypedResponse<T>;
    /**
     * Converts a text {@link Response} to {@link TypedResponse<string>}.
     */
    readonly text: (r: Response) => TypedResponse<string>;
    /**
     * Converts a blob {@link Response} to {@link TypedResponse<Blob>}.
     */
    readonly blob: (r: Response) => TypedResponse<Blob>;
    /**
     * Converts an empty {@link Response} to {@link TypedResponse<undefined>}.
     */
    readonly empty: (r: Response) => TypedResponse<undefined>;
    private constructor();
    /**
     * Default is that {@link TypedResponse.value} is only valid if {@link Response.status} === `200` for
     * responses sent into {@link arrayBuffer}, {@link json}, {@link text} and {@link blob}. Call this method
     * to create a custom {@link HttpResponseType} where {@link TypedResponse.value} can be assigned for other status values
     * as well.
     * Example: A conflict response may still contain data which should be assigned to {@link TypedResponse.value}.
     * @param statuses
     */
    static status(statuses: number[]): HttpResponseType;
    /**
     * Converts an array buffer {@link Response} to {@link TypedResponse<ArrayBuffer>}.
     */
    static arrayBuffer(r: Response): TypedResponse<ArrayBuffer>;
    /**
     * Converts a JSON {@link Response} to {@link TypedResponse}.
     */
    static json<T>(r: Response): TypedResponse<T>;
    /**
     * Converts a text {@link Response} to {@link TypedResponse<string>}.
     */
    static text(r: Response): TypedResponse<string>;
    /**
     * Converts a blob {@link Response} to {@link TypedResponse<Blob>}.
     */
    static blob(r: Response): TypedResponse<Blob>;
    private setValue;
}
//# sourceMappingURL=http.d.ts.map