Class CustomRequest<T>

java.lang.Object
com.microsoft.graph.http.BaseRequest<T>
com.microsoft.graph.http.CustomRequest<T>
Type Parameters:
T - the entity or complex type
All Implemented Interfaces:
IHttpRequest

public class CustomRequest<T> extends BaseRequest<T>
Respresents a custom request to be executed against the service
  • Constructor Details

    • CustomRequest

      public CustomRequest(@Nonnull String requestUrl, @Nonnull IBaseClient<?> client, @Nullable List<? extends Option> requestOptions, @Nonnull Class<T> responseClass)
      Instanciates a custom requests to be executed against the service
      Parameters:
      requestUrl - the URL to send the request to
      client - the client to use to send the request
      requestOptions - the options to apply to the request
      responseClass - the class for response deserialization
  • Method Details

    • create

      @Nonnull public static CustomRequest<com.google.gson.JsonObject> create(@Nonnull String requestUrl, @Nonnull IBaseClient<?> client, @Nullable List<? extends Option> requestOptions)
      Creates a custom requests to be executed against the service
      Parameters:
      requestUrl - the URL to send the request to
      client - the client to use to send the request
      requestOptions - the options to apply to the request
      Returns:
      the request to execute against the service
    • get

      @Nullable public T get() throws ClientException
      Gets the resource and returns the deserialized resource
      Returns:
      the deserialized resource
      Throws:
      ClientException
    • getAsync

      @Nonnull public CompletableFuture<T> getAsync()
      Gets the resource and calls the callback with the deserialized resource
      Returns:
      a future with the result
    • deleteAsync

      @Nonnull public CompletableFuture<T> deleteAsync()
      Delete this item from the service
      Returns:
      a future with the result
    • delete

      public void delete() throws ClientException
      Delete this item from the service
      Throws:
      ClientException - if there was an exception during the delete operation
    • patchAsync

      @Nonnull public CompletableFuture<T> patchAsync()
      Patches this item with a source
      Returns:
      a future with the result
    • patch

      @Nullable public T patch(@Nonnull T sourceObject) throws ClientException
      Patches this item with a source
      Parameters:
      sourceObject - the source object with updates
      Returns:
      the updated item
      Throws:
      ClientException - this exception occurs if the request was unable to complete for any reason
    • postAsync

      @Nonnull public CompletableFuture<T> postAsync(@Nonnull T newObject)
      Creates a new object
      Parameters:
      newObject - the new object to create
      Returns:
      a future with the result
    • post

      @Nullable public T post(@Nonnull T newObject) throws ClientException
      Creates a new object
      Parameters:
      newObject - the new object to create
      Returns:
      the created object
      Throws:
      ClientException - this exception occurs if the request was unable to complete for any reason
    • putAsync

      @Nonnull public CompletableFuture<T> putAsync(@Nonnull T putObject)
      Creates a new object
      Parameters:
      putObject - the new object to create
      Returns:
      a future with the result
    • put

      @Nullable public T put(@Nonnull T putObject) throws ClientException
      Creates a new object
      Parameters:
      putObject - the new object to create
      Returns:
      the created object
      Throws:
      ClientException - this exception occurs if the request was unable to complete for any reason
    • select

      @Nonnull public CustomRequest<T> select(@Nonnull String value)
      Sets the select clause for the request
      Parameters:
      value - the select clause
      Returns:
      the updated request
    • expand

      @Nonnull public CustomRequest<T> expand(@Nonnull String value)
      Sets the expand clause for the request
      Parameters:
      value - the expand clause
      Returns:
      the updated request