BaseRequest<T> Class
- java.
lang. Object - com.
microsoft. graph. http. BaseRequest<T>
- com.
Type Parameters
- T
the response class
Implements
public abstract class BaseRequest<T>
implements IHttpRequest
An HTTP request.
Field Summary
| Modifier and Type | Field and Description |
|---|---|
| static final java.lang.String |
REQUEST_STATS_HEADER_VALUE_FORMAT_STRING
The request stats header value format string |
|
protected final
java.util.List<Function |
functionOptions
The function options for this request |
|
protected final
java.util.List<Query |
queryOptions
The query options for this request |
Constructor Summary
| Constructor | Description |
|---|---|
| BaseRequest(String requestUrl, IBaseClient<?> client, List<? extends Option> options, Class<? extends T> responseClass) |
Creates the request |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
| protected T |
send(HttpMethod method, T1 serializedObject)
Sends this request |
| protected java.util.concurrent.CompletableFuture<T> |
sendAsync(HttpMethod method, T1 serializedObject)
Sends this request |
| nativeRequestType |
<requestBodyType,responseType,nativeRequestType>getHttpRequest(requestBodyType serializedObject)
Returns the Request object to be executed |
| protected void |
addCountOption(boolean value)
Adds the count query string value for the request |
| protected void |
addExpandOption(String value)
Sets the expand clause for the request |
| protected void |
addFilterOption(String value)
Sets the filter clause for the request |
| void |
addFunctionOption(FunctionOption option)
Adds a function option |
| void |
addHeader(String header, String value)
Adds a header to this request |
| protected void |
addOrderByOption(String value)
Sets the order by clause for the request |
| void |
addQueryOption(QueryOption option)
Adds a query option |
| protected void |
addSelectOption(String value)
Sets the select clause for the request |
| protected void |
addSkipOption(int value)
Sets the skip value for the request |
| protected void |
addSkipTokenOption(String skipToken)
Add Skip token for pagination |
| protected void |
addTopOption(int value)
Sets the top value for the request |
|
IBase |
getClient()
Gets the client |
| long |
getDelay()
Gets delay between retries |
|
java.util.List<Function |
getFunctionOptions()
Gets the function options for this request |
|
java.util.List<Header |
getHeaders()
Gets the headers |
|
Http |
getHttpMethod()
Gets the HTTP method |
| int |
getMaxRedirects()
Gets the max redirects |
| int |
getMaxRetries()
Gets max retries |
| java.util.List<Option> |
getOptions()
Gets the full list of options for this request |
|
java.util.List<Query |
getQueryOptions()
Gets the query options for this request |
| java.net.URL |
getRequestUrl()
Gets the request URL |
| java.lang.Class<> |
getResponseType()
Gets the response type |
|
IShould |
getShouldRedirect()
Gets the should redirect callback |
|
IShould |
getShouldRetry()
Gets the should retry callback |
| boolean |
getUseCaches()
Gets use |
| void |
setDelay(long delay)
Sets the delay in seconds between retires |
| void |
setHttpMethod(HttpMethod httpMethod)
Sets the HTTP method |
| void |
setMaxRedirects(int maxRedirects)
Sets the max redirects |
| void |
setMaxRetries(int maxRetries)
Sets the max retries |
| void |
setShouldRedirect(IShouldRedirect shouldRedirect)
Sets the should redirect callback |
| void |
setShouldRetry(IShouldRetry shouldretry)
Sets the should retry callback |
| void |
setUseCaches(boolean useCaches)
Sets use |
|
IHttp |
withHttpMethod(HttpMethod httpMethod)
Sets the HTTP method and returns the current request |
Methods inherited from java.lang.Object
Field Details
REQUEST_STATS_HEADER_VALUE_FORMAT_STRING
public static final String REQUEST_STATS_HEADER_VALUE_FORMAT_STRING
The request stats header value format string
functionOptions
protected final List
The function options for this request
queryOptions
protected final List
The query options for this request
Constructor Details
BaseRequest
public BaseRequest(String requestUrl, IBaseClient client, List options, Class responseClass)
Creates the request
Parameters:
Method Details
send
protected T
Sends this request
Parameters:
Returns:
Throws:
sendAsync
protected CompletableFuture
Sends this request
Parameters:
Returns:
<requestBodyType,responseType,nativeRequestType>getHttpRequest
public nativeRequestType
Returns the Request object to be executed
Parameters:
Returns:
Throws:
addCountOption
protected void addCountOption(boolean value)
Adds the count query string value for the request
Parameters:
- Wheter to return the count or not
addExpandOption
protected void addExpandOption(String value)
Sets the expand clause for the request
Parameters:
addFilterOption
protected void addFilterOption(String value)
Sets the filter clause for the request
Parameters:
addFunctionOption
public void addFunctionOption(FunctionOption option)
Adds a function option
Parameters:
addHeader
public void addHeader(String header, String value)
Adds a header to this request
Parameters:
addOrderByOption
protected void addOrderByOption(String value)
Sets the order by clause for the request
Parameters:
addQueryOption
public void addQueryOption(QueryOption option)
Adds a query option
Parameters:
addSelectOption
protected void addSelectOption(String value)
Sets the select clause for the request
Parameters:
addSkipOption
protected void addSkipOption(int value)
Sets the skip value for the request
Parameters:
addSkipTokenOption
protected void addSkipTokenOption(String skipToken)
Add Skip token for pagination
Parameters:
- Token for pagination
addTopOption
protected void addTopOption(int value)
Sets the top value for the request
Parameters:
getClient
public IBaseClient getClient()
Gets the client
Returns:
getDelay
public long getDelay()
Gets delay between retries
Returns:
getFunctionOptions
public List
Gets the function options for this request
Returns:
getHeaders
public List
Gets the headers
Returns:
getHttpMethod
public HttpMethod getHttpMethod()
Gets the HTTP method
Returns:
getMaxRedirects
public int getMaxRedirects()
Gets the max redirects
Returns:
getMaxRetries
public int getMaxRetries()
Gets max retries
Returns:
getOptions
public List
Gets the full list of options for this request
Returns:
getQueryOptions
public List
Gets the query options for this request
Returns:
getRequestUrl
public URL getRequestUrl()
Gets the request URL
Returns:
getResponseType
public Class getResponseType()
Gets the response type
Returns:
getShouldRedirect
public IShouldRedirect getShouldRedirect()
Gets the should redirect callback
Returns:
getShouldRetry
public IShouldRetry getShouldRetry()
Gets the should retry callback
Returns:
getUseCaches
public boolean getUseCaches()
Gets useCaches parameter
Returns:
setDelay
public void setDelay(long delay)
Sets the delay in seconds between retires
Parameters:
setHttpMethod
public void setHttpMethod(HttpMethod httpMethod)
Sets the HTTP method
Parameters:
setMaxRedirects
public void setMaxRedirects(int maxRedirects)
Sets the max redirects
Parameters:
setMaxRetries
public void setMaxRetries(int maxRetries)
Sets the max retries
Parameters:
setShouldRedirect
public void setShouldRedirect(IShouldRedirect shouldRedirect)
Sets the should redirect callback
Parameters:
setShouldRetry
public void setShouldRetry(IShouldRetry shouldretry)
Sets the should retry callback
Parameters:
setUseCaches
public void setUseCaches(boolean useCaches)
Sets useCaches parameter to cache the response
Parameters:
withHttpMethod
public IHttpRequest withHttpMethod(HttpMethod httpMethod)
Sets the HTTP method and returns the current request
Parameters:
Returns: