程序包 com.volcengine
类 ApiClient
- java.lang.Object
-
- com.volcengine.BaseClient
-
- com.volcengine.ApiClient
-
public class ApiClient extends BaseClient
-
-
构造器概要
构造器 构造器 说明 ApiClient()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 ApiClientaddDefaultHeader(String key, String value)Add a default header.ServiceInfoaddPairAndGetServiceInfo(String path, List<Pair> queryParams, Map<String,String> headerParams)ApiClientaddRetryErrorCode(String retryErrorCode)ApiClientaddRetryErrorCodes(Set<String> retryErrorCodes)InterceptorContextbuildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String,String> headerParams, Map<String,Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener, boolean... isCommon)Build HTTP call with the given options.voidbuildQueryParams(String path, StringBuilder url, List<Pair> queryParams)com.squareup.okhttp.RequestbuildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String,String> headerParams, Map<String,Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener, boolean... isCommon)Build an HTTP request with the given options.com.squareup.okhttp.RequestBodybuildRequestBodyFormEncoding(Map<String,Object> formParams)Build a form-encoding request body with the given form parameters.com.squareup.okhttp.RequestBodybuildRequestBodyMultipart(Map<String,Object> formParams)Build a multipart (file uploading) request body with the given form parameters, which could contain text fields and file fields.voidbuildSimpleRequest(Object body, List<Pair> queryParams, Map<String,String> headerParams, StringBuilder builder, com.squareup.okhttp.FormEncodingBuilder formBuilder, String chain, boolean... isCommon)StringbuildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams)Build full URL by concatenating base path, the given sub path and query parameters.<T> Tdeserialize(com.squareup.okhttp.Response response, Type returnType, boolean... isCommon)Deserialize response body to Java object, according to the return type and the Content-Type response header.FiledownloadFileFromResponse(com.squareup.okhttp.Response response)Download file from the given response.StringescapeString(String str)Escape the given string to be used as URL query value.<T> ApiResponse<T>execute(com.squareup.okhttp.Call call)<T> ApiResponse<T>execute(com.squareup.okhttp.Call call, Type returnType, boolean... isCommon)Execute HTTP call and deserialize the HTTP response body into the given return type.<T> voidexecuteAsync(com.squareup.okhttp.Call call, ApiCallback<T> callback)<T> voidexecuteAsync(com.squareup.okhttp.Call call, Type returnType, ApiCallback<T> callback)Execute HTTP call asynchronously.AuthenticationgetAuthentication(String authName)Get authentication for the given name.Map<String,Authentication>getAuthentications()Get authentications (key: authentication name, value: authentication).BackoffStrategygetBackoffStrategy()intgetConnectTimeout()Get connection timeout (in milliseconds).CredentialProvidergetCredentialProvider()CredentialsgetCredentials()Get credentialsSet<String>getCustomBootstrapRegion()Get the custom bootstrapping regions.DateFormatgetDateFormat()voidgetDefaultContentType(Map<String,String> headerParams)booleangetDisableSSL()Get disableSSLStringgetEndpoint()Get base pathEndpointResolvergetEndpointResolver()com.squareup.okhttp.OkHttpClientgetHttpClient()Get HTTP clientStringgetHttpProxy()Get the http proxy.StringgetHttpsProxy()Get the https proxy.JSONgetJSON()Get JSONIntegergetKeepAliveDurationMs()KeyManager[]getKeyManagers()IntegergetMaxIdleConns()longgetMaxRetryDelayMs()longgetMinRetryDelayMs()intgetNumMaxRetries()com.squareup.okhttp.OkHttpClientgetOkHttpClient()intgetReadTimeout()Get read timeout (in milliseconds).StringgetRegion()Get regionRetryConditiongetRetryCondition()Set<String>getRetryErrorCodes()InputStreamgetSslCaCert()Get SSL CA cert.StringgetTempFolderPath()The path of temporary folder used to store downloaded files from endpoints with file response.StringgetTruePath(String path, Map<String,String> headerParams)BooleangetUseDualStack()Get the use dual stack flag.intgetWriteTimeout()Get write timeout (in milliseconds).StringguessContentTypeFromFile(File file)Guess Content-Type header from the given file (defaults to "application/octet-stream").<T> ThandleResponse(com.squareup.okhttp.Response response, Type returnType, boolean... isCommon)Handle the given response, return the deserialized object when the response is successful.booleanisApplicationJsonBody(Map<String,String> headerParams)booleanisAutoRetry()booleanisDebugging()Check that whether debugging is enabled for this API client.booleanisJsonMime(String mime)Check if the given MIME is a JSON MIME.booleanisPostBody(Map<String,String> headerParams)booleanisVerifyingSsl()True if isVerifyingSsl flag is onList<Pair>parameterToPair(String name, Object value)Formats the specified query parameter to a list containing a singlePairobject.List<Pair>parameterToPairs(String collectionFormat, String name, Collection value)Formats the specified collection query parameters to a list ofPairobjects.StringparameterToString(Object param)Format the given parameter object into string.FileprepareDownloadFile(com.squareup.okhttp.Response response)Prepare file for downloadvoidprocessDefaultHeader(Map<String,String> headerParams)voidprocessHeaderParams(Map<String,String> headerParams, com.squareup.okhttp.Request.Builder reqBuilder)Set header parameters to the request builder, including default headers.StringsanitizeFilename(String filename)Sanitize filename by removing path.StringselectHeaderAccept(String[] accepts)Select the Accept header's value from the given accepts array: if JSON exists in the given array, use it; otherwise use all of them (joining into a string)StringselectHeaderContentType(String[] contentTypes)Select the Content-Type header's value from the given array: if JSON exists in the given array, use it; otherwise use the first one of the array.com.squareup.okhttp.RequestBodyserialize(Object obj, String contentType)Serialize the given Java object into request body according to the object's class and the request Content-Type.ApiClientsetAutoRetry(boolean autoRetry)ApiClientsetBackoffStrategy(BackoffStrategy backoffStrategy)ApiClientsetConnectTimeout(int connectionTimeout)Sets the connect timeout (in milliseconds).ApiClientsetCredentialProvider(CredentialProvider credentialProvider)ApiClientsetCredentials(Credentials credentials)Set credentialsApiClientsetCustomBootstrapRegion(Set<String> customBootstrapRegion)Set the custom bootstrapping regions.ApiClientsetDateFormat(DateFormat dateFormat)ApiClientsetDebugging(boolean debugging)Enable/disable debugging for this API client.ApiClientsetDisableSSL(boolean disableSSL)Set disableSSLApiClientsetEndpoint(String endpoint)Set base pathApiClientsetEndpointResolver(EndpointResolver endpointResolver)ApiClientsetHttpClient(com.squareup.okhttp.OkHttpClient httpClient)Set HTTP clientApiClientsetHttpProxy(String httpProxy)Set the http proxy.ApiClientsetHttpsProxy(String httpsProxy)Set the https proxy.ApiClientsetJSON(JSON json)Set JSONApiClientsetKeepAliveDurationMs(Integer keepAliveDurationMs)ApiClientsetKeyManagers(KeyManager[] managers)Configure client keys to use for authorization in an SSL session.ApiClientsetLenientOnJson(boolean lenientOnJson)ApiClientsetLocalDateFormat(org.threeten.bp.format.DateTimeFormatter dateFormat)ApiClientsetMaxIdleConns(Integer maxIdleConns)ApiClientsetMaxRetryDelayMs(long maxRetryDelayMs)ApiClientsetMinRetryDelayMs(long minRetryDelayMs)ApiClientsetNumMaxRetries(int numMaxRetries)ApiClientsetOffsetDateTimeFormat(org.threeten.bp.format.DateTimeFormatter dateFormat)ApiClientsetReadTimeout(int readTimeout)Sets the read timeout (in milliseconds).ApiClientsetRegion(String region)Set regionApiClientsetRetryCondition(RetryCondition retryCondition)ApiClientsetSqlDateFormat(DateFormat dateFormat)ApiClientsetSslCaCert(InputStream sslCaCert)Configure the CA certificate to be trusted when making https requests.ApiClientsetTempFolderPath(String tempFolderPath)Set the temporary folder path (for downloading files)ApiClientsetUseDualStack(boolean useDualStack)Set the use dual stack flag.ApiClientsetUserAgent(String userAgent)Set the User-Agent header's value (by adding to the default header map).ApiClientsetVerifyingSsl(boolean verifyingSsl)Configure whether to verify certificate and hostname when making https requests.ApiClientsetWriteTimeout(int writeTimeout)Sets the write timeout (in milliseconds).voidupdateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String,String> headerParams)Update query and header parameters based on authentication settings.voidupdateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String,String> headerParams, ServiceInfo serviceInfo, String payload)voidupdateQueryParams(List<Pair> queryParams, String[] param)
-
-
-
方法详细资料
-
setUserAgent
public ApiClient setUserAgent(String userAgent)
Set the User-Agent header's value (by adding to the default header map).- 参数:
userAgent- HTTP request's user agent- 返回:
- ApiClient
-
getEndpoint
public String getEndpoint()
Get base path- 返回:
- Baes path
-
setEndpoint
public ApiClient setEndpoint(String endpoint)
Set base path- 参数:
endpoint- endpoint of the URL- 返回:
- An instance of OkHttpClient
-
getDisableSSL
public boolean getDisableSSL()
Get disableSSL- 返回:
- Baes path
-
setDisableSSL
public ApiClient setDisableSSL(boolean disableSSL)
Set disableSSL- 参数:
disableSSL-- 返回:
- An instance of OkHttpClient
-
getRegion
public String getRegion()
Get region- 返回:
- Baes path
-
setRegion
public ApiClient setRegion(String region)
Set region- 参数:
region-- 返回:
- An instance of OkHttpClient
-
getCredentials
public Credentials getCredentials()
Get credentials- 返回:
- Baes path
-
setCredentials
public ApiClient setCredentials(Credentials credentials)
Set credentials- 参数:
credentials-- 返回:
- An instance of OkHttpClient
-
getHttpClient
public com.squareup.okhttp.OkHttpClient getHttpClient()
Get HTTP client- 返回:
- An instance of OkHttpClient
-
setHttpClient
public ApiClient setHttpClient(com.squareup.okhttp.OkHttpClient httpClient)
Set HTTP client- 参数:
httpClient- An instance of OkHttpClient- 返回:
- Api Client
-
getJSON
public JSON getJSON()
Get JSON- 返回:
- JSON object
-
isVerifyingSsl
public boolean isVerifyingSsl()
True if isVerifyingSsl flag is on- 返回:
- True if isVerifySsl flag is on
-
setVerifyingSsl
public ApiClient setVerifyingSsl(boolean verifyingSsl)
Configure whether to verify certificate and hostname when making https requests. Default to true. NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks.- 参数:
verifyingSsl- True to verify TLS/SSL connection- 返回:
- ApiClient
-
getSslCaCert
public InputStream getSslCaCert()
Get SSL CA cert.- 返回:
- Input stream to the SSL CA cert
-
setSslCaCert
public ApiClient setSslCaCert(InputStream sslCaCert)
Configure the CA certificate to be trusted when making https requests. Use null to reset to default.- 参数:
sslCaCert- input stream for SSL CA cert- 返回:
- ApiClient
-
getKeyManagers
public KeyManager[] getKeyManagers()
-
setKeyManagers
public ApiClient setKeyManagers(KeyManager[] managers)
Configure client keys to use for authorization in an SSL session. Use null to reset to default.- 参数:
managers- The KeyManagers to use- 返回:
- ApiClient
-
getDateFormat
public DateFormat getDateFormat()
-
setDateFormat
public ApiClient setDateFormat(DateFormat dateFormat)
-
setSqlDateFormat
public ApiClient setSqlDateFormat(DateFormat dateFormat)
-
setOffsetDateTimeFormat
public ApiClient setOffsetDateTimeFormat(org.threeten.bp.format.DateTimeFormatter dateFormat)
-
setLocalDateFormat
public ApiClient setLocalDateFormat(org.threeten.bp.format.DateTimeFormatter dateFormat)
-
setLenientOnJson
public ApiClient setLenientOnJson(boolean lenientOnJson)
-
getAuthentications
public Map<String,Authentication> getAuthentications()
Get authentications (key: authentication name, value: authentication).- 返回:
- Map of authentication objects
-
getAuthentication
public Authentication getAuthentication(String authName)
Get authentication for the given name.- 参数:
authName- The authentication name- 返回:
- The authentication, null if not found
-
addDefaultHeader
public ApiClient addDefaultHeader(String key, String value)
Add a default header.- 参数:
key- The header's keyvalue- The header's value- 返回:
- ApiClient
-
isDebugging
public boolean isDebugging()
Check that whether debugging is enabled for this API client.- 返回:
- True if debugging is enabled, false otherwise.
-
setDebugging
public ApiClient setDebugging(boolean debugging)
Enable/disable debugging for this API client.- 参数:
debugging- To enable (true) or disable (false) debugging- 返回:
- ApiClient
-
getTempFolderPath
public String getTempFolderPath()
The path of temporary folder used to store downloaded files from endpoints with file response. The default value isnull, i.e. using the system's default tempopary folder.- 返回:
- Temporary folder path
- 另请参阅:
- createTempFile
-
setTempFolderPath
public ApiClient setTempFolderPath(String tempFolderPath)
Set the temporary folder path (for downloading files)- 参数:
tempFolderPath- Temporary folder path- 返回:
- ApiClient
-
getConnectTimeout
public int getConnectTimeout()
Get connection timeout (in milliseconds).- 返回:
- Timeout in milliseconds
-
setConnectTimeout
public ApiClient setConnectTimeout(int connectionTimeout)
Sets the connect timeout (in milliseconds). A value of 0 means no timeout, otherwise values must be between 1 and- 参数:
connectionTimeout- connection timeout in milliseconds- 返回:
- Api client
-
getReadTimeout
public int getReadTimeout()
Get read timeout (in milliseconds).- 返回:
- Timeout in milliseconds
-
setReadTimeout
public ApiClient setReadTimeout(int readTimeout)
Sets the read timeout (in milliseconds). A value of 0 means no timeout, otherwise values must be between 1 andInteger.MAX_VALUE.- 参数:
readTimeout- read timeout in milliseconds- 返回:
- Api client
-
getWriteTimeout
public int getWriteTimeout()
Get write timeout (in milliseconds).- 返回:
- Timeout in milliseconds
-
setWriteTimeout
public ApiClient setWriteTimeout(int writeTimeout)
Sets the write timeout (in milliseconds). A value of 0 means no timeout, otherwise values must be between 1 andInteger.MAX_VALUE.- 参数:
writeTimeout- connection timeout in milliseconds- 返回:
- Api client
-
getCustomBootstrapRegion
public Set<String> getCustomBootstrapRegion()
Get the custom bootstrapping regions.- 返回:
- Set of custom bootstrapping regions
-
setCustomBootstrapRegion
public ApiClient setCustomBootstrapRegion(Set<String> customBootstrapRegion)
Set the custom bootstrapping regions.- 参数:
customBootstrapRegion- Set of custom bootstrapping regions- 返回:
- Api client
-
getUseDualStack
public Boolean getUseDualStack()
Get the use dual stack flag.- 返回:
- use dual stack flag
-
setUseDualStack
public ApiClient setUseDualStack(boolean useDualStack)
Set the use dual stack flag.- 参数:
useDualStack- boolean- 返回:
- Api client
-
getHttpProxy
public String getHttpProxy()
Get the http proxy.- 返回:
- http proxy
-
getHttpsProxy
public String getHttpsProxy()
Get the https proxy.- 返回:
- https proxy
-
setHttpsProxy
public ApiClient setHttpsProxy(String httpsProxy)
Set the https proxy.- 返回:
- Api client
-
parameterToString
public String parameterToString(Object param)
Format the given parameter object into string.- 参数:
param- Parameter- 返回:
- String representation of the parameter
-
parameterToPair
public List<Pair> parameterToPair(String name, Object value)
Formats the specified query parameter to a list containing a singlePairobject.Note that
valuemust not be a collection.- 参数:
name- The name of the parameter.value- The value of the parameter.- 返回:
- A list containing a single
Pairobject.
-
parameterToPairs
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection value)
Formats the specified collection query parameters to a list ofPairobjects.Note that the values of each of the returned Pair objects are percent-encoded.
- 参数:
collectionFormat- The collection format of the parameter.name- The name of the parameter.value- The value of the parameter.- 返回:
- A list of
Pairobjects.
-
sanitizeFilename
public String sanitizeFilename(String filename)
Sanitize filename by removing path. e.g. ../../sun.gif becomes sun.gif- 参数:
filename- The filename to be sanitized- 返回:
- The sanitized filename
-
isJsonMime
public boolean isJsonMime(String mime)
Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; charset=UTF8 APPLICATION/JSON application/vnd.company+json "* / *" is also default to JSON- 参数:
mime- MIME (Multipurpose Internet Mail Extensions)- 返回:
- True if the given MIME is JSON, false otherwise.
-
selectHeaderAccept
public String selectHeaderAccept(String[] accepts)
Select the Accept header's value from the given accepts array: if JSON exists in the given array, use it; otherwise use all of them (joining into a string)- 参数:
accepts- The accepts array to select from- 返回:
- The Accept header to use. If the given array is empty, null will be returned (not to set the Accept header explicitly).
-
selectHeaderContentType
public String selectHeaderContentType(String[] contentTypes)
Select the Content-Type header's value from the given array: if JSON exists in the given array, use it; otherwise use the first one of the array.- 参数:
contentTypes- The Content-Type array to select from- 返回:
- The Content-Type header to use. If the given array is empty, or matches "any", JSON will be used.
-
escapeString
public String escapeString(String str)
Escape the given string to be used as URL query value.- 参数:
str- String to be escaped- 返回:
- Escaped string
-
deserialize
public <T> T deserialize(com.squareup.okhttp.Response response, Type returnType, boolean... isCommon) throws ApiExceptionDeserialize response body to Java object, according to the return type and the Content-Type response header.- 类型参数:
T- Type- 参数:
response- HTTP responsereturnType- The type of the Java objectisCommon- The flag for Universal- 返回:
- The deserialized Java object
- 抛出:
ApiException- If fail to deserialize response body, i.e. cannot read response body or the Content-Type of the response is not supported.
-
serialize
public com.squareup.okhttp.RequestBody serialize(Object obj, String contentType) throws ApiException
Serialize the given Java object into request body according to the object's class and the request Content-Type.- 参数:
obj- The Java objectcontentType- The request Content-Type- 返回:
- The serialized request body
- 抛出:
ApiException- If fail to serialize the given object
-
downloadFileFromResponse
public File downloadFileFromResponse(com.squareup.okhttp.Response response) throws ApiException
Download file from the given response.- 参数:
response- An instance of the Response object- 返回:
- Downloaded file
- 抛出:
ApiException- If fail to read file content from response and write to disk
-
prepareDownloadFile
public File prepareDownloadFile(com.squareup.okhttp.Response response) throws IOException
Prepare file for download- 参数:
response- An instance of the Response object- 返回:
- Prepared file for the download
- 抛出:
IOException- If fail to prepare file for download
-
execute
public <T> ApiResponse<T> execute(com.squareup.okhttp.Call call) throws ApiException
- 类型参数:
T- Type- 参数:
call- An instance of the Call object- 返回:
- ApiResponse<T>
- 抛出:
ApiException- If fail to execute the call
-
execute
public <T> ApiResponse<T> execute(com.squareup.okhttp.Call call, Type returnType, boolean... isCommon) throws ApiException
Execute HTTP call and deserialize the HTTP response body into the given return type.- 类型参数:
T- The return type corresponding to (same with) returnType- 参数:
returnType- The return type used to deserialize HTTP response bodycall- CallisCommon- The flag for Universal- 返回:
- ApiResponse object containing response status, headers and data, which is a Java object deserialized from response body and would be null when returnType is null.
- 抛出:
ApiException- If fail to execute the call
-
executeAsync
public <T> void executeAsync(com.squareup.okhttp.Call call, ApiCallback<T> callback)- 类型参数:
T- Type- 参数:
call- An instance of the Call objectcallback- ApiCallback<T>
-
executeAsync
public <T> void executeAsync(com.squareup.okhttp.Call call, Type returnType, ApiCallback<T> callback)Execute HTTP call asynchronously.- 类型参数:
T- Type- 参数:
call- The callback to be executed when the API call finishesreturnType- Return typecallback- ApiCallback- 另请参阅:
execute(Call, Type, boolean...)
-
handleResponse
public <T> T handleResponse(com.squareup.okhttp.Response response, Type returnType, boolean... isCommon) throws ApiExceptionHandle the given response, return the deserialized object when the response is successful.- 类型参数:
T- Type- 参数:
response- ResponsereturnType- Return typeisCommon- The flag for Universal- 返回:
- Type
- 抛出:
ApiException- If the response has a unsuccessful status code or fail to deserialize the response body
-
buildCall
public InterceptorContext buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String,String> headerParams, Map<String,Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener, boolean... isCommon) throws ApiException
Build HTTP call with the given options.- 覆盖:
buildCall在类中BaseClient- 参数:
path- The sub-path of the HTTP URLmethod- The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE"queryParams- The query parameterscollectionQueryParams- The collection query parametersbody- The request body objectheaderParams- The header parametersformParams- The form parametersauthNames- The authentications to applyprogressRequestListener- Progress request listenerisCommon- The flag for Universal- 返回:
- The HTTP call
- 抛出:
ApiException- If fail to serialize the request body object
-
addPairAndGetServiceInfo
public ServiceInfo addPairAndGetServiceInfo(String path, List<Pair> queryParams, Map<String,String> headerParams)
-
buildSimpleRequest
public void buildSimpleRequest(Object body, List<Pair> queryParams, Map<String,String> headerParams, StringBuilder builder, com.squareup.okhttp.FormEncodingBuilder formBuilder, String chain, boolean... isCommon) throws Exception
- 抛出:
Exception
-
buildRequest
public com.squareup.okhttp.Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String,String> headerParams, Map<String,Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener, boolean... isCommon) throws ApiException
Build an HTTP request with the given options.- 参数:
path- The sub-path of the HTTP URLmethod- The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE"queryParams- The query parameterscollectionQueryParams- The collection query parametersbody- The request body objectheaderParams- The header parametersformParams- The form parametersauthNames- The authentications to applyprogressRequestListener- Progress request listenerisCommon- The flag for Universal- 返回:
- The HTTP request
- 抛出:
ApiException- If fail to serialize the request body object
-
buildUrl
public String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams)
Build full URL by concatenating base path, the given sub path and query parameters.- 参数:
path- The sub pathqueryParams- The query parameterscollectionQueryParams- The collection query parameters- 返回:
- The full URL
-
buildQueryParams
public void buildQueryParams(String path, StringBuilder url, List<Pair> queryParams)
-
processHeaderParams
public void processHeaderParams(Map<String,String> headerParams, com.squareup.okhttp.Request.Builder reqBuilder)
Set header parameters to the request builder, including default headers.- 参数:
headerParams- Header parameters in the ofrm of MapreqBuilder- Reqeust.Builder
-
updateParamsForAuth
public void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String,String> headerParams)
Update query and header parameters based on authentication settings.- 参数:
authNames- The authentications to applyqueryParams- List of query parametersheaderParams- Map of header parameters
-
updateParamsForAuth
public void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String,String> headerParams, ServiceInfo serviceInfo, String payload)
-
buildRequestBodyFormEncoding
public com.squareup.okhttp.RequestBody buildRequestBodyFormEncoding(Map<String,Object> formParams)
Build a form-encoding request body with the given form parameters.- 参数:
formParams- Form parameters in the form of Map- 返回:
- RequestBody
-
buildRequestBodyMultipart
public com.squareup.okhttp.RequestBody buildRequestBodyMultipart(Map<String,Object> formParams)
Build a multipart (file uploading) request body with the given form parameters, which could contain text fields and file fields.- 参数:
formParams- Form parameters in the form of Map- 返回:
- RequestBody
-
guessContentTypeFromFile
public String guessContentTypeFromFile(File file)
Guess Content-Type header from the given file (defaults to "application/octet-stream").- 参数:
file- The given file- 返回:
- The guessed Content-Type
-
getCredentialProvider
public CredentialProvider getCredentialProvider()
-
setCredentialProvider
public ApiClient setCredentialProvider(CredentialProvider credentialProvider)
-
getEndpointResolver
public EndpointResolver getEndpointResolver()
-
setEndpointResolver
public ApiClient setEndpointResolver(EndpointResolver endpointResolver)
-
getMaxIdleConns
public Integer getMaxIdleConns()
-
getKeepAliveDurationMs
public Integer getKeepAliveDurationMs()
-
isAutoRetry
public boolean isAutoRetry()
-
setAutoRetry
public ApiClient setAutoRetry(boolean autoRetry)
-
getNumMaxRetries
public int getNumMaxRetries()
-
setNumMaxRetries
public ApiClient setNumMaxRetries(int numMaxRetries)
-
getMinRetryDelayMs
public long getMinRetryDelayMs()
-
setMinRetryDelayMs
public ApiClient setMinRetryDelayMs(long minRetryDelayMs)
-
getMaxRetryDelayMs
public long getMaxRetryDelayMs()
-
setMaxRetryDelayMs
public ApiClient setMaxRetryDelayMs(long maxRetryDelayMs)
-
getRetryCondition
public RetryCondition getRetryCondition()
-
setRetryCondition
public ApiClient setRetryCondition(RetryCondition retryCondition) throws ApiException
- 抛出:
ApiException
-
getBackoffStrategy
public BackoffStrategy getBackoffStrategy()
-
setBackoffStrategy
public ApiClient setBackoffStrategy(BackoffStrategy backoffStrategy) throws ApiException
- 抛出:
ApiException
-
getOkHttpClient
public com.squareup.okhttp.OkHttpClient getOkHttpClient()
- 指定者:
getOkHttpClient在类中BaseClient
-
-