Package com.microsoft.graph.http
Class BaseCollectionRequest<T,T2 extends ICollectionResponse<T>,T3 extends BaseCollectionPage<T,? extends BaseRequestBuilder<T>>>
java.lang.Object
com.microsoft.graph.http.BaseCollectionRequest<T,T2,T3>
- Type Parameters:
T- the type of the object in the collectionT2- the response collection typeT3- the collection page type
- All Implemented Interfaces:
IHttpRequest
- Direct Known Subclasses:
BaseActionCollectionRequest,BaseEntityCollectionRequest,BaseFunctionCollectionRequest,BaseVoidActionCollectionRequest
public abstract class BaseCollectionRequest<T,T2 extends ICollectionResponse<T>,T3 extends BaseCollectionPage<T,? extends BaseRequestBuilder<T>>>
extends Object
implements IHttpRequest
A request against a collection
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe class for the response collection -
Constructor Summary
ConstructorsConstructorDescriptionBaseCollectionRequest(String requestUrl, IBaseClient<?> client, List<? extends Option> options, Class<T2> responseCollectionClass, Class<T3> collectionPageClass, Class<? extends BaseCollectionRequestBuilder<T,? extends BaseRequestBuilder<T>,T2,T3,? extends BaseCollectionRequest<T,T2,T3>>> collectionRequestBuilderClass)Create the collection request -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCountOption(boolean value)Adds the count query string value for the requestprotected voidaddExpandOption(String value)Sets the expand clause for the requestprotected voidaddFilterOption(String value)Sets the filter clause for the requestvoidaddFunctionOption(FunctionOption option)Adds a query optionvoidAdds a header to this requestprotected voidaddOrderByOption(String value)Sets the order by clause for the requestvoidaddQueryOption(QueryOption option)Adds a query optionprotected voidaddSelectOption(String value)Sets the select clause for the requestprotected voidaddSkipOption(int value)Sets the skip value for the requestprotected voidaddSkipTokenOption(String skipToken)Add Skip token for paginationprotected voidaddTopOption(int value)Sets the top value for the requestbuildFromResponse(T2 response)Deserializes the collection from the response objectGets the base request for this collection requestGets the class for the collection pagelonggetDelay()Gets delay between retriesGets the headersGets the HTTP method<requestBodyType, responseType, nativeRequestType>
nativeRequestTypegetHttpRequest(requestBodyType serializedObject)Returns the Request object to be executedintGets the max redirectsintGets max retriesGets the full list of options for this requestGets the request URLGets the should redirect callbackGets the should retry callbackbooleanGets useCaches parameterprotected T2send()Send this requestprotected CompletableFuture<T2>Send this requestvoidsetDelay(long delay)Sets the delay in seconds between retiresvoidsetMaxRedirects(int maxRedirects)Sets the max redirectsvoidsetMaxRetries(int maxRetries)Sets the max retriesvoidsetShouldRedirect(IShouldRedirect shouldRedirect)Sets the should redirect callbackvoidsetShouldRetry(IShouldRetry shouldretry)Sets the should retry callbackvoidsetUseCaches(boolean useCaches)Sets useCaches parameter to cache the responsewithHttpMethod(HttpMethod httpMethod)Sets the HTTP method and returns the current requestMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.microsoft.graph.http.IHttpRequest
getHttpRequest
-
Field Details
-
responseCollectionClass
The class for the response collection
-
-
Constructor Details
-
BaseCollectionRequest
public BaseCollectionRequest(@Nonnull String requestUrl, @Nonnull IBaseClient<?> client, @Nullable List<? extends Option> options, @Nonnull Class<T2> responseCollectionClass, @Nonnull Class<T3> collectionPageClass, @Nonnull Class<? extends BaseCollectionRequestBuilder<T,? extends BaseRequestBuilder<T>,T2,T3,? extends BaseCollectionRequest<T,T2,T3>>> collectionRequestBuilderClass)Create the collection request- Parameters:
requestUrl- the URL to make the request againstclient- the client which can issue the requestoptions- the options for this requestresponseCollectionClass- the class for the response collectioncollectionPageClass- the class for the collection pagecollectionRequestBuilderClass- the class for the collection request builder
-
-
Method Details
-
send
Send this request- Returns:
- the response object
- Throws:
ClientException- an exception occurs if there was an error while the request was sent
-
sendAsync
Send this request- Returns:
- the response object
- Throws:
ClientException- an exception occurs if there was an error while the request was sent
-
buildFromResponse
Deserializes the collection from the response object- Parameters:
response- the collection response- Returns:
- the collection page
-
getRequestUrl
Gets the request URL- Specified by:
getRequestUrlin interfaceIHttpRequest- Returns:
- the request URL
-
getHttpMethod
Gets the HTTP method- Specified by:
getHttpMethodin interfaceIHttpRequest- Returns:
- the HTTP method
-
getHeaders
Gets the headers- Specified by:
getHeadersin interfaceIHttpRequest- Returns:
- the headers
-
addHeader
Adds a header to this request- Specified by:
addHeaderin interfaceIHttpRequest- Parameters:
header- the name of the headervalue- the value of the header
-
setUseCaches
public void setUseCaches(boolean useCaches)Sets useCaches parameter to cache the response- Specified by:
setUseCachesin interfaceIHttpRequest- Parameters:
useCaches- the value of useCaches
-
getUseCaches
public boolean getUseCaches()Gets useCaches parameter- Specified by:
getUseCachesin interfaceIHttpRequest- Returns:
- the value of useCaches
-
getOptions
Gets the full list of options for this request- Specified by:
getOptionsin interfaceIHttpRequest- Returns:
- the full list of options for this request
-
addQueryOption
Adds a query option- Parameters:
option- the query option to add
-
addExpandOption
Sets the expand clause for the request- Parameters:
value- the expand clause
-
addFilterOption
Sets the filter clause for the request- Parameters:
value- the filter clause
-
addOrderByOption
Sets the order by clause for the request- Parameters:
value- the order by clause
-
addSelectOption
Sets the select clause for the request- Parameters:
value- the select clause
-
addTopOption
protected void addTopOption(int value)Sets the top value for the request- Parameters:
value- the max number of items to return
-
addSkipOption
protected void addSkipOption(int value)Sets the skip value for the request- Parameters:
value- of the number of items to skip
-
addSkipTokenOption
Add Skip token for pagination- Parameters:
skipToken- - Token for pagination
-
addCountOption
protected void addCountOption(boolean value)Adds the count query string value for the request- Parameters:
value- - Wheter to return the count or not
-
addFunctionOption
Adds a query option- Parameters:
option- the query option to add
-
getBaseRequest
Gets the base request for this collection request- Returns:
- the base request for this collection request
-
getCollectionPageClass
Gets the class for the collection page- Returns:
- the class for the collection page
-
setMaxRedirects
public void setMaxRedirects(int maxRedirects)Sets the max redirects- Specified by:
setMaxRedirectsin interfaceIHttpRequest- Parameters:
maxRedirects- Max redirects that a request can take
-
getMaxRedirects
public int getMaxRedirects()Gets the max redirects- Specified by:
getMaxRedirectsin interfaceIHttpRequest- Returns:
- Max redirects that a request can take
-
setShouldRedirect
Sets the should redirect callback- Specified by:
setShouldRedirectin interfaceIHttpRequest- Parameters:
shouldRedirect- Callback called before doing a redirect
-
getShouldRedirect
Gets the should redirect callback- Specified by:
getShouldRedirectin interfaceIHttpRequest- Returns:
- Callback which is called before redirect
-
setShouldRetry
Sets the should retry callback- Specified by:
setShouldRetryin interfaceIHttpRequest- Parameters:
shouldretry- The callback called before retry
-
getShouldRetry
Gets the should retry callback- Specified by:
getShouldRetryin interfaceIHttpRequest- Returns:
- Callback called before retry
-
setMaxRetries
public void setMaxRetries(int maxRetries)Sets the max retries- Specified by:
setMaxRetriesin interfaceIHttpRequest- Parameters:
maxRetries- Max retries for a request
-
getMaxRetries
public int getMaxRetries()Gets max retries- Specified by:
getMaxRetriesin interfaceIHttpRequest- Returns:
- Max retries for a request
-
setDelay
public void setDelay(long delay)Sets the delay in seconds between retires- Specified by:
setDelayin interfaceIHttpRequest- Parameters:
delay- Delay in seconds between retries
-
getDelay
public long getDelay()Gets delay between retries- Specified by:
getDelayin interfaceIHttpRequest- Returns:
- Delay between retries in seconds
-
withHttpMethod
Sets the HTTP method and returns the current request- Specified by:
withHttpMethodin interfaceIHttpRequest- Parameters:
httpMethod- the HTTP method- Returns:
- the current request
-
getHttpRequest
@Nullable public <requestBodyType, responseType, nativeRequestType> nativeRequestType getHttpRequest(@Nullable requestBodyType serializedObject) throws ClientExceptionReturns the Request object to be executed- Specified by:
getHttpRequestin interfaceIHttpRequest- Type Parameters:
requestBodyType- the type of the serialized objectresponseType- the type of the responsenativeRequestType- type of a request for the native http client- Parameters:
serializedObject- the object to serialize at the body of the request- Returns:
- the Request object to be executed
- Throws:
ClientException
-