@eclipse-ditto/ditto-javascript-client-dom
Version:
DOM implementation of Eclipse Ditto JavaScript API to be used in browsers.
68 lines • 2.56 kB
TypeScript
/*!
* 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 { FetchRequest, RequestSender, RequestSenderFactory } from './request-sender';
import { AuthProvider, DittoURL } from '../../auth/auth-provider';
import { GenericResponse } from '../../model/response';
/**
* Handle to send HTTP requests.
*/
export declare class HttpRequestSender extends RequestSender {
private readonly requester;
private readonly baseUrl;
private readonly authenticationProviders;
constructor(requester: HttpRequester, baseUrl: DittoURL, authenticationProviders: AuthProvider[]);
fetchRequest(options: FetchRequest): Promise<GenericResponse>;
/**
* Builds a URL to make HTTP calls with.
*
* @param id - The id of the basic entity the request is for.
* @param path - The path to the entity the request is about from the basic entity.
* @param options - The options provided in the request.
* @returns The request URL
*/
private buildUrl;
/**
* Builds headers to make HTTP calls with by combining authentication and options headers.
* Options headers will override authentication headers.
*
* @param options - The options to provided in the request.
* @returns The combined headers
*/
private buildHeader;
}
/**
* Requester to execute HTTP requests.
*/
export interface HttpRequester {
/**
* Executes a HTTP request and returns the response.
*
* @param method - The method to use for the request (eg. GET).
* @param url - The request URL.
* @param header - The header to use for the request.
* @param body - The request body.
* @returns The response
*/
doRequest(method: string, url: string, header: Map<string, string>, body: string): Promise<GenericResponse>;
}
/**
* A Factory for a HttpRequestSender.
*/
export declare class HttpRequestSenderBuilder implements RequestSenderFactory {
private readonly requester;
private readonly url;
private readonly authProviders;
constructor(requester: HttpRequester, url: DittoURL, authProviders: AuthProvider[]);
buildInstance(group: string): HttpRequestSender;
}
//# sourceMappingURL=http-request-sender.d.ts.map