Class RequestOptions


  • public class RequestOptions
    extends java.lang.Object
    This class is used to set various options when executing a GraphQL request.
    • Constructor Detail

      • RequestOptions

        public RequestOptions()
    • Method Detail

      • withGson

        public RequestOptions withGson​(com.google.gson.Gson gson)
        Sets the Gson instance that will be used to deserialise the JSON response. This should only be used when the JSON response cannot be deserialised by a standard Gson instance, or when some custom deserialisation is needed.
        Parameters:
        gson - A custom Gson instance.
        Returns:
        This RequestOptions object.
      • withHeaders

        public RequestOptions withHeaders​(java.util.List<org.apache.http.Header> headers)
        Permits to define HTTP headers that will be sent with the GraphQL request. See BasicHeader for an implementation of the Header interface.
        Parameters:
        headers - The HTTP headers.
        Returns:
        This RequestOptions object.
      • withHttpMethod

        public RequestOptions withHttpMethod​(HttpMethod httpMethod)
        Sets the HTTP method used to send the request, only GET or POST are supported. By default, the client sends a POST request. If GET is used, the underlying HTTP client will automatically URL-Encode the GraphQL query, operation name, and variables.
        Parameters:
        httpMethod - The HTTP method.
        Returns:
        This RequestOptions object.
      • getGson

        public com.google.gson.Gson getGson()
      • getHeaders

        public java.util.List<org.apache.http.Header> getHeaders()
      • getHttpMethod

        public HttpMethod getHttpMethod()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object