1 | import { HttpOperationResponse } from "../httpOperationResponse";
|
2 | import { HttpPipelineLogger } from "../httpPipelineLogger";
|
3 | import { HttpPipelineLogLevel } from "../httpPipelineLogLevel";
|
4 | import { WebResourceLike } from "../webResource";
|
5 |
|
6 |
|
7 |
|
8 | export declare type RequestPolicyFactory = {
|
9 | create(nextPolicy: RequestPolicy, options: RequestPolicyOptionsLike): RequestPolicy;
|
10 | };
|
11 | export interface RequestPolicy {
|
12 | sendRequest(httpRequest: WebResourceLike): Promise<HttpOperationResponse>;
|
13 | }
|
14 | export declare abstract class BaseRequestPolicy implements RequestPolicy {
|
15 | readonly _nextPolicy: RequestPolicy;
|
16 | readonly _options: RequestPolicyOptionsLike;
|
17 | protected constructor(_nextPolicy: RequestPolicy, _options: RequestPolicyOptionsLike);
|
18 | abstract sendRequest(webResource: WebResourceLike): Promise<HttpOperationResponse>;
|
19 | /**
|
20 | * Get whether or not a log with the provided log level should be logged.
|
21 | * @param logLevel The log level of the log that will be logged.
|
22 | * @returns Whether or not a log with the provided log level should be logged.
|
23 | */
|
24 | shouldLog(logLevel: HttpPipelineLogLevel): boolean;
|
25 | /**
|
26 | * Attempt to log the provided message to the provided logger. If no logger was provided or if
|
27 | * the log level does not meat the logger's threshold, then nothing will be logged.
|
28 | * @param logLevel The log level of this log.
|
29 | * @param message The message of this log.
|
30 | */
|
31 | log(logLevel: HttpPipelineLogLevel, message: string): void;
|
32 | }
|
33 | /**
|
34 | * Optional properties that can be used when creating a RequestPolicy.
|
35 | */
|
36 | export interface RequestPolicyOptionsLike {
|
37 | |
38 |
|
39 |
|
40 |
|
41 |
|
42 | shouldLog(logLevel: HttpPipelineLogLevel): boolean;
|
43 | |
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | log(logLevel: HttpPipelineLogLevel, message: string): void;
|
50 | }
|
51 |
|
52 |
|
53 |
|
54 | export declare class RequestPolicyOptions implements RequestPolicyOptionsLike {
|
55 | private _logger?;
|
56 | constructor(_logger?: HttpPipelineLogger | undefined);
|
57 | /**
|
58 | * Get whether or not a log with the provided log level should be logged.
|
59 | * @param logLevel The log level of the log that will be logged.
|
60 | * @returns Whether or not a log with the provided log level should be logged.
|
61 | */
|
62 | shouldLog(logLevel: HttpPipelineLogLevel): boolean;
|
63 | /**
|
64 | * Attempt to log the provided message to the provided logger. If no logger was provided or if
|
65 | * the log level does not meat the logger's threshold, then nothing will be logged.
|
66 | * @param logLevel The log level of this log.
|
67 | * @param message The message of this log.
|
68 | */
|
69 | log(logLevel: HttpPipelineLogLevel, message: string): void;
|
70 | }
|
71 | //# sourceMappingURL=requestPolicy.d.ts.map |
\ | No newline at end of file |