import { Credentials, RestServiceConfig } from '../interfaces/services-config'; import { RestClient } from './rest-client'; import { CredentialsType } from '../enums'; import { RetryOptions } from '../lib/retriable-executor'; /** * Class RestClientBuilder * Its jobs is to build RestClientInstances and provide the entire configurations * of a request */ export declare class RestClientBuilder { private restClientConfig; private credentialsManager; private retryExecutor; private restClient; constructor(); /** * Sets request headers * @param headers * @return RestClientBuilder instance */ setHeaders(headers?: Object): RestClientBuilder; /** * Sets request data * @param data Object * @return RestClientBuilder instance */ setData(data?: Object): RestClientBuilder; /** * Sets request url * @param url string * @return RestClientBuilder instance */ setUrl(url: string): RestClientBuilder; /** * Sets the entire config of a RestServiceConfig. Be aware that this method * replace prior configurations * @param restClientConfig RestServiceConfig * @return RestClientBuilder instance */ setConfig(restClientConfig: RestServiceConfig): RestClientBuilder; /** * Sets the credentials based on type credentials and configuration * @param credentialsConfig any * @param type CredentialsTYpe * @return RestClientBuilder instance */ setCredentials(type: CredentialsType, credentialsConfig: Credentials): RestClientBuilder; /** * Sets request Auth data * @param auth { username: string; password: string; } * @return RestClientBuilder instance */ setAuth(auth: { username: string; password: string; }): RestClientBuilder; /** * Sets the request params * @param params Object * @return RestClientBuilder instance */ setParams(params: Object): RestClientBuilder; /** * Sets the retry options of a request. * Note: The retry options helps to retry a request when this fails for some reason * @param retryOptions RetryOptions * @return RestClientBuilder instance */ setRetryOptions(retryOptions: RetryOptions): RestClientBuilder; /** * Sets the request timeout * @param timeout string | number * @return RestClientBuilder instance */ setTimeout(timeout: number): RestClientBuilder; /** * Start building a rest client * @return RestClientBuilder instance */ build(): RestClient; /** * Check if restClientConfig credentials attribute is object, if so, sets proper credentials * based on type attribute. * @param restClientConfig * @private */ private setProperCredentialsConfig; }