1 |
|
2 | import { TokenCredential } from "@azure/core-auth";
|
3 | import { ServiceClientCredentials } from "./credentials/serviceClientCredentials";
|
4 | import { HttpClient } from "./httpClient";
|
5 | import { HttpOperationResponse, RestResponse } from "./httpOperationResponse";
|
6 | import { HttpPipelineLogger } from "./httpPipelineLogger";
|
7 | import { OperationArguments } from "./operationArguments";
|
8 | import { ParameterPath } from "./operationParameter";
|
9 | import { OperationSpec } from "./operationSpec";
|
10 | import { DeserializationContentTypes } from "./policies/deserializationPolicy";
|
11 | import { RedirectOptions } from "./policies/redirectPolicy";
|
12 | import { RequestPolicyFactory } from "./policies/requestPolicy";
|
13 | import { Mapper, Serializer } from "./serializer";
|
14 | import { RequestPrepareOptions, WebResourceLike } from "./webResource";
|
15 | import { OperationResponse } from "./operationResponse";
|
16 | import { ServiceCallback } from "./util/utils";
|
17 | import { Agent } from "http";
|
18 |
|
19 |
|
20 |
|
21 | export interface ProxySettings {
|
22 | host: string;
|
23 | port: number;
|
24 | username?: string;
|
25 | password?: string;
|
26 | }
|
27 |
|
28 |
|
29 |
|
30 | export interface AgentSettings {
|
31 | http: Agent;
|
32 | https: Agent;
|
33 | }
|
34 |
|
35 |
|
36 |
|
37 | export interface ServiceClientOptions {
|
38 | |
39 |
|
40 |
|
41 |
|
42 |
|
43 | requestPolicyFactories?: RequestPolicyFactory[] | ((defaultRequestPolicyFactories: RequestPolicyFactory[]) => void | RequestPolicyFactory[]);
|
44 | /**
|
45 | * The HttpClient that will be used to send HTTP requests.
|
46 | */
|
47 | httpClient?: HttpClient;
|
48 | /**
|
49 | * The HttpPipelineLogger that can be used to debug RequestPolicies within the HTTP pipeline.
|
50 | */
|
51 | httpPipelineLogger?: HttpPipelineLogger;
|
52 | /**
|
53 | * If set to true, turn off the default retry policy.
|
54 | */
|
55 | noRetryPolicy?: boolean;
|
56 | /**
|
57 | * Gets or sets the retry timeout in seconds for AutomaticRPRegistration. Default value is 30.
|
58 | */
|
59 | rpRegistrationRetryTimeout?: number;
|
60 | /**
|
61 | * Whether or not to generate a client request ID header for each HTTP request.
|
62 | */
|
63 | generateClientRequestIdHeader?: boolean;
|
64 | /**
|
65 | * Whether to include credentials in CORS requests in the browser.
|
66 | * See https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials for more information.
|
67 | */
|
68 | withCredentials?: boolean;
|
69 | /**
|
70 | * If specified, a GenerateRequestIdPolicy will be added to the HTTP pipeline that will add a
|
71 | * header to all outgoing requests with this header name and a random UUID as the request ID.
|
72 | */
|
73 | clientRequestIdHeaderName?: string;
|
74 | /**
|
75 | * The content-types that will be associated with JSON or XML serialization.
|
76 | */
|
77 | deserializationContentTypes?: DeserializationContentTypes;
|
78 | /**
|
79 | * The header name to use for the telemetry header while sending the request. If this is not
|
80 | * specified, then "User-Agent" will be used when running on Node.js and "x-ms-command-name" will
|
81 | * be used when running in a browser.
|
82 | */
|
83 | userAgentHeaderName?: string | ((defaultUserAgentHeaderName: string) => string);
|
84 | /**
|
85 | * The string to be set to the telemetry header while sending the request, or a function that
|
86 | * takes in the default user-agent string and returns the user-agent string that will be used.
|
87 | */
|
88 | userAgent?: string | ((defaultUserAgent: string) => string);
|
89 | /**
|
90 | * Proxy settings which will be used for every HTTP request (Node.js only).
|
91 | */
|
92 | proxySettings?: ProxySettings;
|
93 | /**
|
94 | * Options for how redirect responses are handled.
|
95 | */
|
96 | redirectOptions?: RedirectOptions;
|
97 | /**
|
98 | * HTTP and HTTPS agents which will be used for every HTTP request (Node.js only).
|
99 | */
|
100 | agentSettings?: AgentSettings;
|
101 | }
|
102 | /**
|
103 | * @class
|
104 | * Initializes a new instance of the ServiceClient.
|
105 | */
|
106 | export declare class ServiceClient {
|
107 | /**
|
108 | * If specified, this is the base URI that requests will be made against for this ServiceClient.
|
109 | * If it is not specified, then all OperationSpecs must contain a baseUrl property.
|
110 | */
|
111 | protected baseUri?: string;
|
112 | /**
|
113 | * The default request content type for the service.
|
114 | * Used if no requestContentType is present on an OperationSpec.
|
115 | */
|
116 | protected requestContentType?: string;
|
117 | /**
|
118 | * The HTTP client that will be used to send requests.
|
119 | */
|
120 | private readonly _httpClient;
|
121 | private readonly _requestPolicyOptions;
|
122 | private readonly _requestPolicyFactories;
|
123 | private readonly _withCredentials;
|
124 | /**
|
125 | * The ServiceClient constructor
|
126 | * @constructor
|
127 | * @param {ServiceClientCredentials} [credentials] The credentials object used for authentication.
|
128 | * @param {ServiceClientOptions} [options] The service client options that govern the behavior of the client.
|
129 | */
|
130 | constructor(credentials?: ServiceClientCredentials | TokenCredential, options?: ServiceClientOptions);
|
131 | /**
|
132 | * Send the provided httpRequest.
|
133 | */
|
134 | sendRequest(options: RequestPrepareOptions | WebResourceLike): Promise<HttpOperationResponse>;
|
135 | /**
|
136 | * Send an HTTP request that is populated using the provided OperationSpec.
|
137 | * @param {OperationArguments} operationArguments The arguments that the HTTP request's templated values will be populated from.
|
138 | * @param {OperationSpec} operationSpec The OperationSpec to use to populate the httpRequest.
|
139 | * @param {ServiceCallback} callback The callback to call when the response is received.
|
140 | */
|
141 | sendOperationRequest(operationArguments: OperationArguments, operationSpec: OperationSpec, callback?: ServiceCallback<any>): Promise<RestResponse>;
|
142 | }
|
143 | export declare function serializeRequestBody(serviceClient: ServiceClient, httpRequest: WebResourceLike, operationArguments: OperationArguments, operationSpec: OperationSpec): void;
|
144 | export declare type PropertyParent = {
|
145 | [propertyName: string]: any;
|
146 | };
|
147 | /**
|
148 | * Get the property parent for the property at the provided path when starting with the provided
|
149 | * parent object.
|
150 | */
|
151 | export declare function getPropertyParent(parent: PropertyParent, propertyPath: string[]): PropertyParent;
|
152 | export declare function getOperationArgumentValueFromParameterPath(serviceClient: ServiceClient, operationArguments: OperationArguments, parameterPath: ParameterPath, parameterMapper: Mapper, serializer: Serializer): any;
|
153 | export declare function flattenResponse(_response: HttpOperationResponse, responseSpec: OperationResponse | undefined): RestResponse;
|
154 | //# sourceMappingURL=serviceClient.d.ts.map |
\ | No newline at end of file |