/*! * Copyright (c) 2019 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0 * * SPDX-License-Identifier: EPL-2.0 */ import { HttpThingsHandle } from './handles/things.interfaces'; import { HttpRequester, HttpRequestSenderBuilder } from './request-factory/http-request-sender'; import { DefaultDittoHttpClient, DittoHttpClient } from './ditto-client-http'; import { HttpMessagesHandle } from './handles/messages-http'; import { PoliciesHandle } from './handles/policies'; import { SearchHandle } from './handles/search'; import { FeaturesHandle } from './handles/features.interfaces'; import { AuthProvider } from '../auth/auth-provider'; import { ApiVersion } from '../model/ditto-protocol'; import { AbstractBuilder, AuthenticationStep, BuildStep, CustomBuilderContext, CustomFeaturesHandleStep, CustomMessagesHandleStep, CustomPoliciesHandleStep, CustomSearchHandleStep, CustomThingsHandleStep, EnvironmentStep, ProtocolStep } from './builder-steps'; export interface HttpBuilderInitialStep extends ProtocolStep { } export interface HttpBuildStep extends BuildStep { /** * Sets the request timeout in milliseconds. * * This is important because by default HTTP requests have no timeout * and may hang indefinitely waiting for a response. * * @param timeout - The timeout in milliseconds to use. */ withTimeout(timeout: number): this; /** * Builds a DittoClient for the selected API. * * @returns The DittoClient */ build(): C; } /** * Build step for adding custom handles. * @param - Type of the things handle. * @param - Type of the client. */ export interface HttpCustomHandlesBuildStep extends HttpBuildStep, BuildStep, CustomThingsHandleStep, CustomFeaturesHandleStep, CustomMessagesHandleStep, CustomPoliciesHandleStep, CustomSearchHandleStep { } /** * Interface to build the Context. */ export interface HttpClientBuildStep extends HttpCustomHandlesBuildStep { } /** * Implementation of all the methods to build a Context. */ export declare class HttpClientBuilder extends AbstractBuilder implements HttpBuilderInitialStep, EnvironmentStep, AuthenticationStep, HttpClientBuildStep { private readonly requester; private customHandles; private timeout?; private constructor(); /** * Build a new HttpClientBuilder. * * @param requester - The requester to use. */ static newBuilder(requester: HttpRequester): HttpBuilderInitialStep; finalize(): HttpClientBuildStep; withTimeout(timeout: number): this; build(): DefaultDittoHttpClient; buildClient(tls: boolean, domain: string, apiVersion: ApiVersion, authProviders: AuthProvider[]): DefaultDittoHttpClient; private buildUrl; withCustomThingsHandle(factory: (requestSenderBuilder: HttpRequestSenderBuilder, customBuilderContext?: CustomBuilderContext) => HttpThingsHandle): this; withCustomFeaturesHandle(factory: (requestSenderBuilder: HttpRequestSenderBuilder, thingId: string, customBuilderContext?: CustomBuilderContext) => FeaturesHandle): this; withCustomMessagesHandle(factory: (requestSenderBuilder: HttpRequestSenderBuilder, customBuilderContext?: CustomBuilderContext) => HttpMessagesHandle): this; withCustomPoliciesHandle(factory: (requestSenderBuilder: HttpRequestSenderBuilder, customBuilderContext?: CustomBuilderContext) => PoliciesHandle): this; withCustomSearchHandle(factory: (requestSenderBuilder: HttpRequestSenderBuilder, customBuilderContext?: CustomBuilderContext) => SearchHandle): this; } //# sourceMappingURL=http-client-builder.d.ts.map