import { Injector } from '@angular/core';
import { HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { AuthorizedLocationType, EntityReferenceType, LinkType, ResourceType, SessionType, TaskType } from '@vcd/bindings/vcloud/api/rest/schema_v1_5';
import { AccessibleLocation, Session } from '../openapi';
import { Query } from '../query/index';
import { VcdHttpClient } from './vcd.http.client';
import { VcdTransferClient } from './vcd.transfer.client';
import { VcdSdkConfig } from "../../core/plugin.module";
import * as i0 from "@angular/core";
export declare const TRANSFER_LINK_REL = "upload:default";
export type Navigable = ResourceType | {
    link?: LinkType[];
};
export declare const HATEOAS_HEADER = "Link";
/**
 * Parse out Link headers using a very lazily implemented pull parser
 * @param header '<url1>;name1="value1",name2="value2",<url2>;name3="value3,value4"'
 * @returns parsed link headers
 */
export declare function parseHeaderHateoasLinks(header: string): LinkType[];
export declare enum LinkRelType {
    add = "add",
    remove = "remove",
    edit = "edit"
}
/**
 * A basic client for interacting with the VMware Cloud Director APIs.
 *
 * A VMware Cloud Director plugin can get a reference to this client by using angular injection.
 * ```
 *     constructor(private vcdApi: VcdApiClient) {}
 * ```
 *
 * VcdApiClient reuses the authentication from the VCD platform so in general there is
 * no need of an explicit authentication/login.
 *
 * When dealing with the session management there are two APIs:
 * 1. Deprecated legacy API that is using the `api/session` endpoint and the corresponding models
 * 2. Newly added API that is using the `cloudapi` endpoint and the corresponding models
 *
 * Note that if a plugin performs an explicit cloud api authentication call through
 * {@link VcdApiClient#setCloudApiAuthentication} or {@link VcdApiClient#cloudApiLogin}
 * from that moment on the VcdApiClient uses only cloud api session management.
 * This means calls to {@link VcdApiClient#setAuthentication} or {@link VcdApiClient#login} have no effect.
 */
export declare class VcdApiClient {
    private http;
    private injector;
    private config?;
    set baseUrl(_baseUrl: string);
    get version(): string;
    private _negotiateVersion;
    private _baseUrl;
    /**
     * @deprecated Use {@link VcdApiClient#_cloudApiSession}
     */
    private _session;
    private _sessionObservable;
    private _getSession;
    /**
     * CloudApi Session
     */
    private _cloudApiSession;
    private _cloudApiSessionObservable;
    /**
     * This observable has a special purpose when doing automatic login during the constructor initialization.
     * It allows backend call only after an API version is set.
     * It also ensures that a backend call to get the current session is done once prior to any other calls.
     *
     * In case of an explicit cloud api auth request there is no need of this observable
     * since this auth request will retrieve the session itself
     */
    private _getCloudApiSession;
    private _cloudApiSessionLinks;
    /**
     * Cached, lazy loaded observable of the AccessibleLocation array
     */
    private _cloudApiAccessibleLocations;
    /**
     * This property determines if it is an explicit cloud api login.
     * In this case the old API (/api/session) should not be used at all.
     */
    private _isCloudApiLogin;
    constructor(http: VcdHttpClient, injector: Injector, config?: VcdSdkConfig);
    private negotiateVersion;
    /**
     * The purpose of this function is to ensure that prior to sending any call to the backend
     * the version has been set and the current session has been retrieved.
     * Note that this is important during the automatic authentication that is done during the
     * constructor initialization, when the plugin is not required to perform its own explicit authentication
     * but rather the ones from the underlying framework is used.
     */
    private validateRequestContext;
    /**
     *
     * For use cases wich solely depends on cloudapi without any backward compatibility
     * there should be no dependence on the old /api endpoint at all
     */
    private validateRequestContextCloudApiOnly;
    setVersion(_version: string): VcdApiClient;
    /**
     * Global configuration for the service, that allows a provider user to execute API requests
     * in the scope of a specific tenant.
     *
     * If you want to execute single API request in scope of specific tenant you can do it
     * by passing "X-VMWARE-VCLOUD-TENANT-CONTEXT" header to the specific API Request.
     *
     * This scoping is available to query-based API calls and to bulk GET calls in the
     * /cloudapi space.
     *
     * @param actAs an entityRef of the tenant (organization) to scope subsequent calls to in
     *  the VcdApiClient, or null/no parameter to remove tenant-specific scoping
     * @returns the current VcdApiClient instance (for chaining)
     */
    actAs(actAs?: EntityReferenceType): VcdApiClient;
    /**
     * @deprecated Use {@link VcdApiClient#setCloudApiAuthentication}
     *
     * Sets the authentication token to use for the VcdApiClient.
     *
     * After setting the token, the client will get the current session
     * information associated with the authenticated token.
     *
     * @param authentication the authentication string (to be used in either the 'Authorization'
     *  or 'x-vcloud-authorization' header)
     * @returns the session associated with the authentication token
     */
    setAuthentication(authentication: string): Observable<SessionType>;
    /**
     * Sets the authentication token to use for the VcdApiClient.
     *
     * After setting the token, the client will get the current session
     * information associated with the authenticated token.
     *
     * @param authentication the authentication string (to be used in either the 'Authorization'
     *  or 'x-vcloud-authorization' header)
     *
     * @returns session observable associated with the authentication token
     */
    setCloudApiAuthentication(authentication: string): Observable<Session>;
    enableLogging(): VcdApiClient;
    /**
     * @deprecated Use {@link VcdApiClient#cloudApiLogin}
     *
     * Creates an authenticated session for the specified credential data.
     *
     * @param username the name of the user to authenticate
     * @param tenant the organization the user belongs to
     * @param password the password for the user
     * @returns an authenticated session for the given credentials
     */
    login(username: string, tenant: string, password: string): Observable<SessionType>;
    /**
     * Creates an authenticated session for the specified credential data using cloud api endpoint.
     *
     * @param username the name of the user to authenticate
     * @param tenant the organization the user belongs to
     * @param password the password for the user
     * @returns an authenticated session for the given credentials
     */
    cloudApiLogin(username: string, tenant: string, password: string): Observable<Session>;
    /**
     * It is necessary to know if an explicit cloud api auth request was done.
     * This function handles this by setting the corresponding flags, properties etc.
     */
    private onBeforeCloudApiAuthentication;
    /**
     * Handle authentication.
     * This includes getting HATEOAS links, setting the session, handling errors etc.
     */
    private onCloudApiAuthentication;
    private onCloudApiAuthenticationError;
    private setCloudApiSessionLinks;
    get<T>(endpoint: string, options?: {
        headers?: HttpHeaders;
    }): Observable<T>;
    list<T>(endpoint: string, queryBuilder?: Query.Builder, multisite?: boolean | AuthorizedLocationType[], options?: {
        headers?: HttpHeaders;
    }): Observable<T>;
    createSync<T>(endpoint: string, item: T, options?: {
        headers?: HttpHeaders;
    }): Observable<T>;
    createAsync<T>(endpoint: string, item: T, options?: {
        headers?: HttpHeaders;
    }): Observable<TaskType>;
    getTransferLink<T>(endpoint: string, item: T, transferRel?: string): Observable<string>;
    startTransfer<T>(endpoint: string, item: T, transferRel?: string): Observable<VcdTransferClient>;
    updateSync<T>(endpoint: string, item: T, options?: {
        headers?: HttpHeaders;
    }): Observable<T>;
    updateAsync<T>(endpoint: string, item: T, options?: {
        headers?: HttpHeaders;
    }): Observable<TaskType>;
    deleteSync(endpoint: string, options?: {
        headers?: HttpHeaders;
    }): Observable<void>;
    deleteAsync(endpoint: string, options?: {
        headers?: HttpHeaders;
    }): Observable<TaskType>;
    private mapResponseToTask;
    getEntity<T extends EntityReferenceType>(entityRef: EntityReferenceType): Observable<T>;
    getEntity<T extends EntityReferenceType>(urn: string): Observable<T>;
    updateTask(task: TaskType, options?: {
        headers?: HttpHeaders;
    }): Observable<TaskType>;
    isTaskComplete(task: TaskType): boolean;
    removeItem(item: Navigable, options?: {
        headers?: HttpHeaders;
    }): Observable<TaskType>;
    /**
     * Queries the VMware Cloud Director API based on the specified Query.Builder instance.
     *
     * @param builder An definition of the query to construct (type, filter, page size, etc.)
     * @param multisite a flag indicating whether or not to fan the query out to all available sites
     * @returns a query result for the specified query
     */
    query<T>(builder: Query.Builder, multisite?: boolean, options?: {
        headers?: HttpHeaders;
    }): Observable<T>;
    /**
     * Queries the VMware Cloud Director API based on the specified Query.Builder instance.
     *
     * @param builder An definition of the query to construct (type, filter, page size, etc.)
     * @param multisite the set of site locations to include in the query fanout
     * @returns a query result for the specified query
     */
    query<T>(builder: Query.Builder, multisite?: AuthorizedLocationType[], options?: {
        headers?: HttpHeaders;
    }): Observable<T>;
    /**
     * Queries the VMware Cloud Director API for the first page of the provided result set.
     *
     * @param result the result set to retrieve the first page of records for
     * @param multisite a flag indicating whether or not to fan the query out to all available sites
     * @returns the records for the first page of the query
     */
    firstPage<T>(result: T, multisite?: boolean, options?: {
        headers?: HttpHeaders;
    }): Observable<T>;
    /**
     * Queries the VMware Cloud Director API for the first page of the provided result set.
     *
     * @param result the result set to retrieve the first page of records for
     * @param multisite the set of site locations to include in the query fanout
     * @returns the records for the first page of the query
     */
    firstPage<T>(result: T, multisite?: AuthorizedLocationType[], options?: {
        headers?: HttpHeaders;
    }): Observable<T>;
    hasFirstPage<T>(result: T): boolean;
    /**
     * Queries the VMware Cloud Director API for the previous page of the provided result set.
     *
     * @param result the result set to retrieve the previous page of records for
     * @param multisite a flag indicating whether or not to fan the query out to all available sites
     * @returns the records for the previous page of the query
     */
    previousPage<T>(result: T, multisite?: boolean, options?: {
        headers?: HttpHeaders;
    }): Observable<T>;
    /**
     * Queries the VMware Cloud Director API for the previous page of the provided result set.
     *
     * @param result the result set to retrieve the previous page of records for
     * @param multisite the set of site locations to include in the query fanout
     * @returns the records for the previous page of the query
     */
    previousPage<T>(result: T, multisite?: AuthorizedLocationType[], options?: {
        headers?: HttpHeaders;
    }): Observable<T>;
    hasPreviousPage<T>(result: T): boolean;
    /**
     * Queries the VMware Cloud Director API for the next page of the provided result set.
     *
     * @param result the result set to retrieve the next page of records for
     * @param multisite a flag indicating whether or not to fan the query out to all available sites
     * @returns the records for the next page of the query
     */
    nextPage<T>(result: T, multisite?: boolean, options?: {
        headers?: HttpHeaders;
    }): Observable<T>;
    /**
     * Queries the VMware Cloud Director API for the next page of the provided result set.
     *
     * @param result the result set to retrieve the next page of records for
     * @param multisite the set of site locations to include in the query fanout
     * @returns the records for the next page of the query
     */
    nextPage<T>(result: T, multisite?: AuthorizedLocationType[], options?: {
        headers?: HttpHeaders;
    }): Observable<T>;
    hasNextPage<T>(result: T): boolean;
    /**
     * Queries the VMware Cloud Director API for the last page of the provided result set.
     *
     * @param result the result set to retrieve the last page of records for
     * @param multisite a flag indicating whether or not to fan the query out to all available sites
     * @returns the records for the last page of the query
     */
    lastPage<T>(result: T, multisite?: boolean, options?: {
        headers?: HttpHeaders;
    }): Observable<T>;
    /**
     * Queries the VMware Cloud Director API for the last page of the provided result set.
     *
     * @param result the result set to retrieve the last page of records for
     * @param multisite the set of site locations to include in the query fanout
     * @returns the records for the last page of the query
     */
    lastPage<T>(result: T, multisite?: AuthorizedLocationType[], options?: {
        headers?: HttpHeaders;
    }): Observable<T>;
    hasLastPage<T>(result: T): boolean;
    private getQueryPage;
    /**
     * Use to perform action availability check before calling the API
     * @param item - the navigable item (containing link collection)
     * @param linkRelType - the link rel type, pass either LinkRelType or string
     * @param entityRefType - the entity reference type
     */
    canPerformAction(item: Navigable, linkRelType: LinkRelType | string, entityRefType?: string): boolean;
    private findLink;
    private parseMultisiteValue;
    /**
     * @deprecated Use cloudApiSession
     */
    get session(): Observable<SessionType>;
    /**
     * Get Session observable
     */
    get cloudApiSession(): Observable<Session>;
    get username(): Observable<string>;
    get organization(): Observable<string>;
    /**
     * @deprecated Use cloudApiLocation
     */
    get location(): Observable<AuthorizedLocationType>;
    /**
     * Gets the location corresponding to the current session
     */
    get cloudApiLocation(): Observable<AccessibleLocation>;
    getLocation(session: SessionType): AuthorizedLocationType;
    /**
     * Build the endpoint url. If the provided endpoint is already an absolute URL, then return it as it is without
     * any modifications, otherwise consider it as a relative one and prepend the baseUrl as defined by the host application.
     */
    private buildEndpointUrl;
    static ɵfac: i0.ɵɵFactoryDeclaration<VcdApiClient, [null, null, { optional: true; }]>;
    static ɵprov: i0.ɵɵInjectableDeclaration<VcdApiClient>;
}
