@azure/ms-rest-js package
Classes
ApiKeyCredentials |
Authenticates to a service using an API key. |
AzureIdentityCredentialAdapter |
This class provides a simple extension to use <xref:TokenCredential> from |
BaseRequestPolicy | |
BasicAuthenticationCredentials | |
DefaultHttpClient | |
DomainCredentials |
Authenticates to a service using an API key. |
HttpHeaders |
A collection of HTTP header key/value pairs. |
RequestPolicyOptions |
Optional properties that can be used when creating a RequestPolicy. |
RestError | |
Serializer | |
ServiceClient | |
TokenCredentials |
A credentials object that uses a token string and a authorzation scheme to authenticate. |
TopicCredentials |
Authenticates to a service using an API key. |
URLBuilder |
A class that handles creating, modifying, and parsing URLs. |
URLQuery |
A class that handles the query portion of a URLBuilder. |
WebResource |
Creates a new WebResource object. This class provides an abstraction over a REST call by being library / implementation agnostic and wrapping the necessary properties to initiate a request. |
Interfaces
AbortSignalLike |
Allows the request to be aborted upon firing of the "abort" event. Compatible with the browser built-in AbortSignal and common polyfills. |
AgentSettings |
HTTP and HTTPS agents (Node.js only) |
ApiKeyCredentialOptions | |
BaseMapper | |
CompositeMapper | |
CompositeMapperType | |
DeserializationContentTypes |
The content-types that will indicate that an operation response should be deserialized in a particular way. |
DictionaryMapper | |
DictionaryMapperType | |
EnumMapper | |
EnumMapperType | |
HttpClient |
An interface that can send HttpRequests and receive promised HttpResponses. |
HttpHeader |
An individual header within a HttpHeaders collection. |
HttpHeadersLike |
A collection of HTTP header key/value pairs. |
HttpOperationResponse |
Wrapper object for http request and response. Deserialized object is stored in
the |
HttpPipelineLogger |
A Logger that can be added to a HttpPipeline. This enables each RequestPolicy to log messages that can be used for debugging purposes. |
HttpResponse |
The properties on an HTTP response which will always be present. |
MapperConstraints | |
OperationArguments |
A collection of properties that apply to a single invocation of an operation. |
OperationParameter |
A common interface that all Operation parameter's extend. |
OperationQueryParameter |
A parameter for an operation that will be added as a query parameter to the operation's HTTP request. |
OperationResponse |
An OperationResponse that can be returned from an operation request for a single status code. |
OperationSpec |
A specification that defines an operation. |
OperationURLParameter |
A parameter for an operation that will be substituted into the operation's request URL. |
ParameterValue |
The Parameter value provided for path or query parameters in RequestPrepareOptions |
PolymorphicDiscriminator | |
ProxySettings |
HTTP proxy settings (Node.js only) |
RedirectOptions |
Options for how redirect responses are handled. |
RequestOptionsBase |
Describes the base structure of the options object that will be used in every operation. |
RequestPolicy | |
RequestPolicyOptionsLike |
Optional properties that can be used when creating a RequestPolicy. |
RequestPrepareOptions | |
RestResponse |
The flattened response to a REST call. Contains the underlying HttpOperationResponse as well as the merged properties of the parsedBody, parsedHeaders, etc. |
SequenceMapper | |
SequenceMapperType | |
ServiceCallback | |
ServiceClientCredentials | |
ServiceClientOptions |
Options to be provided while creating the client. |
SimpleMapperType | |
TokenResponse |
TokenResponse is defined in |
UrlParameterValue | |
WebResourceLike |
An abstraction over a REST call. |
Type Aliases
Authenticator | |
CommonRequestInfo | |
CommonRequestInit | |
CommonResponse | |
HttpMethods | |
HttpRequestBody | |
Mapper | |
MapperType | |
ParameterPath | |
RawHttpHeaders |
A HttpHeaders collection represented as a simple JSON object. |
RequestPolicyFactory |
Creates a new RequestPolicy per-request that uses the provided nextPolicy. |
TelemetryInfo | |
TransferProgressEvent |
Fired in response to upload or download progress. |
Enums
HttpPipelineLogLevel |
The different levels of logs that can be used with the HttpPipelineLogger. |
QueryCollectionFormat |
The format that will be used to join an array of values together for a query parameter value. |
Functions
Function Details
agentPolicy(AgentSettings)
function agentPolicy(agentSettings?: AgentSettings): RequestPolicyFactory
Parameters
- agentSettings
- AgentSettings
Returns
applyMixins(any, any[])
Applies the properties on the prototype of sourceCtors to the prototype of targetCtor
function applyMixins(targetCtor: any, sourceCtors: any[])
Parameters
- targetCtor
-
any
The target object on which the properties need to be applied.
- sourceCtors
-
any[]
An array of source objects from which the properties need to be taken.
delay<T>(number, T)
A wrapper for setTimeout that resolves a promise after t milliseconds.
function delay<T>(t: number, value?: T): Promise<T>
Parameters
- t
-
number
The number of milliseconds to be delayed.
- value
-
T
The value to be resolved with after a timeout of t milliseconds.
Returns
Promise<T>
Resolved promise
deserializationPolicy(DeserializationContentTypes)
Create a new serialization RequestPolicyCreator that will serialized HTTP request bodies as they pass through the HTTP pipeline.
function deserializationPolicy(deserializationContentTypes?: DeserializationContentTypes): RequestPolicyFactory
Parameters
- deserializationContentTypes
- DeserializationContentTypes
Returns
deserializeResponseBody(string[], string[], HttpOperationResponse)
function deserializeResponseBody(jsonContentTypes: string[], xmlContentTypes: string[], response: HttpOperationResponse): Promise<HttpOperationResponse>
Parameters
- jsonContentTypes
-
string[]
- xmlContentTypes
-
string[]
- response
- HttpOperationResponse
Returns
Promise<HttpOperationResponse>
encodeUri(string)
Encodes an URI.
function encodeUri(uri: string): string
Parameters
- uri
-
string
The URI to be encoded.
Returns
string
The encoded URI.
executePromisesSequentially(any[], any)
Executes an array of promises sequentially. Inspiration of this method is here: https://pouchdb.com/2015/05/18/we-have-a-problem-with-promises.html. An awesome blog on promises!
function executePromisesSequentially(promiseFactories: any[], kickstart?: any): Promise<any>
Parameters
- promiseFactories
-
any[]
An array of promise factories(A function that return a promise)
- kickstart
-
any
Input to the first promise that is used to kickstart the promise chain. If not provided then the promise chain starts with undefined.
Returns
Promise<any>
A chain of resolved or rejected promises
exponentialRetryPolicy(number, number, number, number)
function exponentialRetryPolicy(retryCount?: number, retryInterval?: number, minRetryInterval?: number, maxRetryInterval?: number): RequestPolicyFactory
Parameters
- retryCount
-
number
- retryInterval
-
number
- minRetryInterval
-
number
- maxRetryInterval
-
number
Returns
flattenResponse(HttpOperationResponse, undefined | OperationResponse)
function flattenResponse(_response: HttpOperationResponse, responseSpec: undefined | OperationResponse): RestResponse
Parameters
- _response
- HttpOperationResponse
- responseSpec
-
undefined | OperationResponse
Returns
generateClientRequestIdPolicy(string)
function generateClientRequestIdPolicy(requestIdHeaderName?: string): RequestPolicyFactory
Parameters
- requestIdHeaderName
-
string
Returns
generateUuid()
Generated UUID
function generateUuid(): string
Returns
string
RFC4122 v4 UUID.
getDefaultProxySettings(string)
function getDefaultProxySettings(proxyUrl?: string): ProxySettings | undefined
Parameters
- proxyUrl
-
string
Returns
ProxySettings | undefined
getDefaultUserAgentValue()
function getDefaultUserAgentValue(): string
Returns
string
isDuration(string)
Indicates whether the given string is in ISO 8601 format.
function isDuration(value: string): boolean
Parameters
- value
-
string
The value to be validated for ISO 8601 duration format.
Returns
boolean
true
if valid, false
otherwise.
isValidUuid(string)
Validates the given uuid as a string
function isValidUuid(uuid: string): boolean
Parameters
- uuid
-
string
The uuid as a string that needs to be validated
Returns
boolean
True if the uuid is valid; false otherwise.
logPolicy(any)
function logPolicy(logger?: any): RequestPolicyFactory
Parameters
- logger
-
any
Returns
promiseToCallback(Promise<any>)
Warning
This API is now deprecated.
generated code should instead depend on responseToBody
Converts a Promise to a callback.
function promiseToCallback(promise: Promise<any>): Function
Parameters
- promise
-
Promise<any>
The Promise to be converted to a callback
Returns
Function
A function that takes the callback (cb: Function): void
promiseToServiceCallback<T>(Promise<HttpOperationResponse>)
Converts a Promise to a service callback.
function promiseToServiceCallback<T>(promise: Promise<HttpOperationResponse>): Function
Parameters
- promise
-
Promise<HttpOperationResponse>
The Promise of HttpOperationResponse to be converted to a service callback
Returns
Function
A function that takes the service callback (cb: ServiceCallback): void
proxyPolicy(ProxySettings)
function proxyPolicy(proxySettings?: ProxySettings): RequestPolicyFactory
Parameters
- proxySettings
- ProxySettings
Returns
redirectPolicy(number)
function redirectPolicy(maximumRetries?: number): RequestPolicyFactory
Parameters
- maximumRetries
-
number
Returns
serializeObject(any)
function serializeObject(toSerialize: any): any
Parameters
- toSerialize
-
any
Returns
any
signingPolicy(ServiceClientCredentials)
function signingPolicy(authenticationProvider: ServiceClientCredentials): RequestPolicyFactory
Parameters
- authenticationProvider
- ServiceClientCredentials
Returns
stripRequest(WebResourceLike)
Returns a stripped version of the Http Request that does not contain the Authorization header.
function stripRequest(request: WebResourceLike): WebResourceLike
Parameters
- request
- WebResourceLike
The Http Request object
Returns
The stripped version of Http Request.
stripResponse(HttpOperationResponse)
Returns a stripped version of the Http Response which only contains body, headers and the status.
function stripResponse(response: HttpOperationResponse): any
Parameters
- response
- HttpOperationResponse
The Http Response
Returns
any
The stripped version of Http Response.
systemErrorRetryPolicy(number, number, number, number)
function systemErrorRetryPolicy(retryCount?: number, retryInterval?: number, minRetryInterval?: number, maxRetryInterval?: number): RequestPolicyFactory
Parameters
- retryCount
-
number
- retryInterval
-
number
- minRetryInterval
-
number
- maxRetryInterval
-
number
Returns
throttlingRetryPolicy(number)
function throttlingRetryPolicy(maxRetries?: number): RequestPolicyFactory
Parameters
- maxRetries
-
number
Returns
userAgentPolicy(TelemetryInfo)
function userAgentPolicy(userAgentData?: TelemetryInfo): RequestPolicyFactory
Parameters
- userAgentData
- TelemetryInfo