1 | /**
|
2 | * -------------------------------------------------------------------------------------------
|
3 | * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
|
4 | * See License in the project root for license information.
|
5 | * -------------------------------------------------------------------------------------------
|
6 | */
|
7 | /**
|
8 | * @module HTTPClient
|
9 | */
|
10 | import { Context } from "./IContext";
|
11 | import { Middleware } from "./middleware/IMiddleware";
|
12 | /**
|
13 | * @class
|
14 | * Class representing HTTPClient
|
15 | */
|
16 | export declare class HTTPClient {
|
17 | /**
|
18 | * @private
|
19 | * A member holding first middleware of the middleware chain
|
20 | */
|
21 | private middleware;
|
22 | /**
|
23 | * @public
|
24 | * @constructor
|
25 | * Creates an instance of a HTTPClient
|
26 | * @param {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers
|
27 | */
|
28 | constructor(...middleware: Middleware[]);
|
29 | /**
|
30 | * @private
|
31 | * Processes the middleware parameter passed to set this.middleware property
|
32 | * The calling function should validate if middleware is not undefined or not empty.
|
33 | * @param {...Middleware} middleware - The middleware passed
|
34 | * Nothing
|
35 | */
|
36 | private setMiddleware;
|
37 | /**
|
38 | * @private
|
39 | * Processes the middleware array to construct the chain
|
40 | * and sets this.middleware property to the first middleware handler of the array
|
41 | * The calling function should validate if middleware is not undefined or not empty
|
42 | * @param {Middleware[]} middlewareArray - The array of middleware handlers
|
43 | * @returns Nothing
|
44 | */
|
45 | private parseMiddleWareArray;
|
46 | /**
|
47 | * @public
|
48 | * @async
|
49 | * To send the request through the middleware chain
|
50 | * @param {Context} context - The context of a request
|
51 | * @returns A promise that resolves to the Context
|
52 | */
|
53 | sendRequest(context: Context): Promise<Context>;
|
54 | }
|