forked from microsoftgraph/msgraph-sdk-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTTPClientFactory.js
More file actions
48 lines (48 loc) · 1.88 KB
/
Copy pathHTTPClientFactory.js
File metadata and controls
48 lines (48 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"use strict";
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @module HTTPClientFactory
*/
var AuthenticationHandler_1 = require("./middleware/AuthenticationHandler");
var HTTPMessageHandler_1 = require("./middleware/HTTPMessageHandler");
var HTTPClient_1 = require("./HTTPClient");
/**
* @class
* Class representing HTTPClientFactory
*/
var HTTPClientFactory = /** @class */ (function () {
function HTTPClientFactory() {
}
/**
* @public
* @static
* Creates HTTPClient with default middleware chain
* @param {AuthenticationProvider} authProvider - The authentication provider instance
* @return A HTTPClient instance
*/
HTTPClientFactory.createWithAuthenticationProvider = function (authProvider) {
var authenticationHandler = new AuthenticationHandler_1.AuthenticationHandler(authProvider);
var httpMessageHandler = new HTTPMessageHandler_1.HTTPMessageHandler();
authenticationHandler.setNext(httpMessageHandler);
return HTTPClientFactory.createWithMiddleware(authenticationHandler);
};
/**
* @public
* @static
* Creates a middleware chain with the given one
* @param {Middleware} middleware - The first middleware of the middleware chain
* @return A HTTPClient instance
*/
HTTPClientFactory.createWithMiddleware = function (middleware) {
return new HTTPClient_1.HTTPClient(middleware);
};
return HTTPClientFactory;
}());
exports.HTTPClientFactory = HTTPClientFactory;
//# sourceMappingURL=HTTPClientFactory.js.map