Package com.symphony.bdk.http.api
Interface ApiClient
@API(status=STABLE)
public interface ApiClient
Interface used to perform HTTP requests performed by the generated Swagger code.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Enforce an authentication scheme using the authentication name.escapeString
(String str) Escape the given string to be used as URL query value.Get authentications (key: authentication name, value: authentication).Returns the API base path<T> ApiResponse<T>
invokeAPI
(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, TypeReference<T> returnType) Invoke API by sending HTTP request with the given options.parameterToPairs
(String collectionFormat, String name, Object value) Format toPair
objects.parameterToString
(Object param) Format the given parameter object into string.default void
rotate()
Change target server according to the load balancing configuration, applies only for calls to the agent.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)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.
-
Method Details
-
invokeAPI
<T> ApiResponse<T> invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, throws ApiExceptionString> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, TypeReference<T> returnType) Invoke API by sending HTTP request with the given options.- Type Parameters:
T
- Type- Parameters:
path
- The sub-path of the HTTP URLmethod
- The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE"queryParams
- The query parametersbody
- The request body objectheaderParams
- The header parameterscookieParams
- The cookie parametersformParams
- The form parametersaccept
- The request's Accept headercontentType
- The request's Content-Type headerauthNames
- The authentications to applyreturnType
- The return type into which to deserialize the response- Returns:
- The response body in type of string
- Throws:
ApiException
- API exception
-
getBasePath
String getBasePath()Returns the API base path- Returns:
- API base path
-
parameterToString
Format the given parameter object into string.- Parameters:
param
- Object- Returns:
- Object in string format
-
parameterToPairs
Format toPair
objects.- Parameters:
collectionFormat
- Collection formatname
- Namevalue
- Value- Returns:
- List of pairs
-
selectHeaderAccept
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)- Parameters:
accepts
- The accepts array to select from- Returns:
- The Accept header to use. If the given array is empty, null will be returned (not to set the Accept header explicitly).
-
selectHeaderContentType
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.- Parameters:
contentTypes
- The Content-Type array to select from- Returns:
- The Content-Type header to use. If the given array is empty, JSON will be used.
-
escapeString
Escape the given string to be used as URL query value.- Parameters:
str
- String- Returns:
- Escaped string
-
getAuthentications
Map<String,Authentication> getAuthentications()Get authentications (key: authentication name, value: authentication).- Returns:
- Map of
Authentication
object
-
addEnforcedAuthenticationScheme
Enforce an authentication scheme using the authentication name.- Parameters:
name
- of the authentication
-
rotate
default void rotate()Change target server according to the load balancing configuration, applies only for calls to the agent. Default implementation does nothing.
-