Class RequestOptions
- java.lang.Object
-
- com.adobe.cq.commerce.graphql.client.RequestOptions
-
public class RequestOptions extends java.lang.ObjectThis class is used to set various options when executing a GraphQL request.
-
-
Constructor Summary
Constructors Constructor Description RequestOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)CachingStrategygetCachingStrategy()com.google.gson.GsongetGson()java.util.List<org.apache.http.Header>getHeaders()HttpMethodgetHttpMethod()inthashCode()RequestOptionswithCachingStrategy(CachingStrategy cachingStrategy)RequestOptionswithGson(com.google.gson.Gson gson)Sets theGsoninstance that will be used to deserialise the JSON response.RequestOptionswithHeaders(java.util.List<org.apache.http.Header> headers)Permits to define HTTP headers that will be sent with the GraphQL request.RequestOptionswithHttpMethod(HttpMethod httpMethod)Sets the HTTP method used to send the request, only GET or POST are supported.
-
-
-
Method Detail
-
withGson
public RequestOptions withGson(com.google.gson.Gson gson)
Sets theGsoninstance 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 customGsoninstance.- 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. SeeBasicHeaderfor 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.
-
withCachingStrategy
public RequestOptions withCachingStrategy(CachingStrategy cachingStrategy)
-
getGson
public com.google.gson.Gson getGson()
-
getHeaders
public java.util.List<org.apache.http.Header> getHeaders()
-
getHttpMethod
public HttpMethod getHttpMethod()
-
getCachingStrategy
public CachingStrategy getCachingStrategy()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-