你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

@azure/ms-rest-js package

ApiKeyCredentials

使用 API 密钥向服务进行身份验证。

AzureIdentityCredentialAdapter

此类提供了一个简单的扩展,用于使用 @azure/identity 库中的 <xref:TokenCredential>,以用于接受 ServiceClientCredentials 系列凭据进行身份验证的旧 Azure SDK。

BaseRequestPolicy
BasicAuthenticationCredentials
DefaultHttpClient
DomainCredentials

使用 API 密钥向服务进行身份验证。

HttpHeaders

HTTP 标头键/值对的集合。

RequestPolicyOptions

创建 RequestPolicy 时可以使用的可选属性。

RestError
Serializer
ServiceClient
TokenCredentials

使用令牌字符串和创作方案的凭据对象进行身份验证。

TopicCredentials

使用 API 密钥向服务进行身份验证。

URLBuilder

处理创建、修改和分析 URL 的类。

URLQuery

一个处理 URLBuilder 查询部分的类。

WebResource

创建新的 WebResource 对象。

此类通过与库/实现无关并包装必要的属性来启动请求,从而通过 REST 调用提供抽象。

接口

AbortSignalLike

允许在触发“中止”事件时中止请求。 与浏览器内置 AbortSignal 和常见 polyfills 兼容。

AgentSettings

HTTP 和 HTTPS 代理(仅Node.js)

ApiKeyCredentialOptions
BaseMapper
CompositeMapper
CompositeMapperType
DeserializationContentTypes

指示应以特定方式反序列化作响应的内容类型。

DictionaryMapper
DictionaryMapperType
EnumMapper
EnumMapperType
HttpClient

可以发送 HttpRequests 并接收承诺的 HttpResponses 的接口。

HttpHeader

HttpHeaders 集合中的单个标头。

HttpHeadersLike

HTTP 标头键/值对的集合。

HttpOperationResponse

http 请求和响应的包装器对象。 当响应正文以 JSON 或 XML 接收响应正文时,反序列化对象存储在 parsedBody 属性中。

HttpPipelineLogger

可添加到 HttpPipeline 的记录器。 这使每个 RequestPolicy 能够记录可用于调试的消息。

HttpResponse

HTTP 响应上的属性,该响应将始终存在。

MapperConstraints
OperationArguments

应用于单个作调用的属性集合。

OperationParameter

所有 Operation 参数扩展的通用接口。

OperationQueryParameter

将作为查询参数添加到作的 HTTP 请求的作的参数。

OperationResponse

可从单个状态代码的作请求返回的 OperationResponse。

OperationSpec

定义作的规范。

OperationURLParameter

作的参数,该参数将替换为作的请求 URL。

ParameterValue

RequestPrepareOptions 中为路径或查询参数提供的参数值

PolymorphicDiscriminator
ProxySettings

HTTP 代理设置(仅Node.js)

RedirectOptions

有关如何处理重定向响应的选项。

RequestOptionsBase

描述将在每个作中使用的 options 对象的基结构。

RequestPolicy
RequestPolicyOptionsLike

创建 RequestPolicy 时可以使用的可选属性。

RequestPrepareOptions
RestResponse

对 REST 调用的平展响应。 包含基础 HttpOperationResponse 以及 parsedBody、parsedHeaders 等的合并属性。

SequenceMapper
SequenceMapperType
ServiceCallback
ServiceClientCredentials
ServiceClientOptions

创建客户端时要提供的选项。

SimpleMapperType
TokenResponse

TokenResponse 在 @azure/ms-rest-nodeauth 中定义,此处复制以不添加不必要的依赖项。

UrlParameterValue
WebResourceLike

REST 调用的抽象。

类型别名

Authenticator
CommonRequestInfo
CommonRequestInit
CommonResponse
HttpMethods
HttpRequestBody
Mapper
MapperType
ParameterPath
RawHttpHeaders

表示为简单 JSON 对象的 HttpHeaders 集合。

RequestPolicyFactory

创建一个新的 RequestPolicy per-request,该请求使用提供的 nextPolicy。

TelemetryInfo
TransferProgressEvent

响应上传或下载进度而触发。

枚举

HttpPipelineLogLevel

可用于 HttpPipelineLogger 的不同级别的日志。

QueryCollectionFormat

将用于将值数组联接在一起的查询参数值的格式。

函数

agentPolicy(AgentSettings)
applyMixins(any, any[])

将 sourceCtors 原型上的属性应用于 targetCtor 的原型

delay<T>(number, T)

setTimeout 的包装器,用于解析 t 毫秒后的承诺。

deserializationPolicy(DeserializationContentTypes)

创建一个新的序列化 RequestPolicyCreator,它将在 HTTP 管道传递时序列化 HTTP 请求正文。

deserializeResponseBody(string[], string[], HttpOperationResponse)
encodeUri(string)

对 URI 进行编码。

executePromisesSequentially(any[], any)

按顺序执行承诺数组。 此方法的灵感如下:https://pouchdb.com/2015/05/18/we-have-a-problem-with-promises.html。 关于承诺的真棒博客!

exponentialRetryPolicy(number, number, number, number)
flattenResponse(HttpOperationResponse, undefined | OperationResponse)
generateClientRequestIdPolicy(string)
generateUuid()

生成的 UUID

getDefaultProxySettings(string)
getDefaultUserAgentValue()
isDuration(string)

指示给定字符串是否采用 ISO 8601 格式。

isValidUuid(string)

将给定的 uuid 验证为字符串

logPolicy(any)
promiseToCallback(Promise<any>)

将 Promise 转换为回调。

promiseToServiceCallback<T>(Promise<HttpOperationResponse>)

将 Promise 转换为服务回调。

proxyPolicy(ProxySettings)
redirectPolicy(number)
serializeObject(any)
signingPolicy(ServiceClientCredentials)
stripRequest(WebResourceLike)

返回不包含授权标头的 Http 请求的剥离版本。

stripResponse(HttpOperationResponse)

返回仅包含正文、标头和状态的 Http 响应的剥离版本。

systemErrorRetryPolicy(number, number, number, number)
throttlingRetryPolicy(number)
userAgentPolicy(TelemetryInfo)

函数详细信息

agentPolicy(AgentSettings)

function agentPolicy(agentSettings?: AgentSettings): RequestPolicyFactory

参数

agentSettings
AgentSettings

返回

applyMixins(any, any[])

将 sourceCtors 原型上的属性应用于 targetCtor 的原型

function applyMixins(targetCtor: any, sourceCtors: any[])

参数

targetCtor

any

需要对其应用属性的目标对象。

sourceCtors

any[]

需要从中获取属性的源对象的数组。

delay<T>(number, T)

setTimeout 的包装器,用于解析 t 毫秒后的承诺。

function delay<T>(t: number, value?: T): Promise<T>

参数

t

number

要延迟的毫秒数。

value

T

要在超时时间为 t 毫秒后解析的值。

返回

Promise<T>

已解决的承诺

deserializationPolicy(DeserializationContentTypes)

创建一个新的序列化 RequestPolicyCreator,它将在 HTTP 管道传递时序列化 HTTP 请求正文。

function deserializationPolicy(deserializationContentTypes?: DeserializationContentTypes): RequestPolicyFactory

参数

deserializationContentTypes
DeserializationContentTypes

返回

deserializeResponseBody(string[], string[], HttpOperationResponse)

function deserializeResponseBody(jsonContentTypes: string[], xmlContentTypes: string[], response: HttpOperationResponse): Promise<HttpOperationResponse>

参数

jsonContentTypes

string[]

xmlContentTypes

string[]

返回

encodeUri(string)

对 URI 进行编码。

function encodeUri(uri: string): string

参数

uri

string

要编码的 URI。

返回

string

编码的 URI。

executePromisesSequentially(any[], any)

按顺序执行承诺数组。 此方法的灵感如下:https://pouchdb.com/2015/05/18/we-have-a-problem-with-promises.html。 关于承诺的真棒博客!

function executePromisesSequentially(promiseFactories: any[], kickstart?: any): Promise<any>

参数

promiseFactories

any[]

承诺工厂数组(返回 promise 的函数)

kickstart

any

输入用于启动承诺链的第一个承诺。 如果未提供,则承诺链以未定义开头。

返回

Promise<any>

已解决或拒绝的承诺链

exponentialRetryPolicy(number, number, number, number)

function exponentialRetryPolicy(retryCount?: number, retryInterval?: number, minRetryInterval?: number, maxRetryInterval?: number): RequestPolicyFactory

参数

retryCount

number

retryInterval

number

minRetryInterval

number

maxRetryInterval

number

返回

flattenResponse(HttpOperationResponse, undefined | OperationResponse)

function flattenResponse(_response: HttpOperationResponse, responseSpec: undefined | OperationResponse): RestResponse

参数

responseSpec

undefined | OperationResponse

返回

generateClientRequestIdPolicy(string)

function generateClientRequestIdPolicy(requestIdHeaderName?: string): RequestPolicyFactory

参数

requestIdHeaderName

string

返回

generateUuid()

生成的 UUID

function generateUuid(): string

返回

string

RFC4122 v4 UUID。

getDefaultProxySettings(string)

function getDefaultProxySettings(proxyUrl?: string): ProxySettings | undefined

参数

proxyUrl

string

返回

ProxySettings | undefined

getDefaultUserAgentValue()

function getDefaultUserAgentValue(): string

返回

string

isDuration(string)

指示给定字符串是否采用 ISO 8601 格式。

function isDuration(value: string): boolean

参数

value

string

要验证的 ISO 8601 持续时间格式的值。

返回

boolean

如果有效,则 true 否则 false

isValidUuid(string)

将给定的 uuid 验证为字符串

function isValidUuid(uuid: string): boolean

参数

uuid

string

作为需要验证的字符串的 uuid

返回

boolean

如果 uuid 有效,则为 True;否则为 false。

logPolicy(any)

function logPolicy(logger?: any): RequestPolicyFactory

参数

logger

any

返回

promiseToCallback(Promise<any>)

警告

现已弃用此 API。

generated code should instead depend on responseToBody

将 Promise 转换为回调。

function promiseToCallback(promise: Promise<any>): Function

参数

promise

Promise<any>

要转换为回调的 Promise

返回

Function

采用回调的函数(cb: Function): void

promiseToServiceCallback<T>(Promise<HttpOperationResponse>)

将 Promise 转换为服务回调。

function promiseToServiceCallback<T>(promise: Promise<HttpOperationResponse>): Function

参数

promise

Promise<HttpOperationResponse>

要转换为服务回调的 HttpOperationResponse 的承诺

返回

Function

获取服务回调的函数 (cb: ServiceCallback): void

proxyPolicy(ProxySettings)

function proxyPolicy(proxySettings?: ProxySettings): RequestPolicyFactory

参数

proxySettings
ProxySettings

返回

redirectPolicy(number)

function redirectPolicy(maximumRetries?: number): RequestPolicyFactory

参数

maximumRetries

number

返回

serializeObject(any)

function serializeObject(toSerialize: any): any

参数

toSerialize

any

返回

any

signingPolicy(ServiceClientCredentials)

function signingPolicy(authenticationProvider: ServiceClientCredentials): RequestPolicyFactory

参数

authenticationProvider
ServiceClientCredentials

返回

stripRequest(WebResourceLike)

返回不包含授权标头的 Http 请求的剥离版本。

function stripRequest(request: WebResourceLike): WebResourceLike

参数

request
WebResourceLike

Http 请求对象

返回

Http 请求的剥离版本。

stripResponse(HttpOperationResponse)

返回仅包含正文、标头和状态的 Http 响应的剥离版本。

function stripResponse(response: HttpOperationResponse): any

参数

response
HttpOperationResponse

Http 响应

返回

any

Http 响应的剥离版本。

systemErrorRetryPolicy(number, number, number, number)

function systemErrorRetryPolicy(retryCount?: number, retryInterval?: number, minRetryInterval?: number, maxRetryInterval?: number): RequestPolicyFactory

参数

retryCount

number

retryInterval

number

minRetryInterval

number

maxRetryInterval

number

返回

throttlingRetryPolicy(number)

function throttlingRetryPolicy(maxRetries?: number): RequestPolicyFactory

参数

maxRetries

number

返回

userAgentPolicy(TelemetryInfo)

function userAgentPolicy(userAgentData?: TelemetryInfo): RequestPolicyFactory

参数

userAgentData
TelemetryInfo

返回