T - public class Executor<T>
extends java.lang.Object
mutation M {
newTodo: createTodo(text: "This is a mutation example") {
text
done
}
}
using GET
$ curl -g -GET 'http://localhost:8080/graphql?query=mutation+M{newTodo:createTodo(text:"This+is+a+mutation+example"){text+done}}'
using POST + Content-Type: application/graphql
$ curl -XPOST http://localhost:8080/graphql -H 'Content-Type: application/graphql' -d 'mutation M { newTodo: createTodo(text: "This is a mutation example") { text done } }'
using POST + Content-Type: application/json
$ curl -XPOST http://localhost:8080/graphql -H 'Content-Type: application/json' -d '{"query": "mutation M { newTodo: createTodo(text: \"This is a mutation example\") { text done } }"}'
| Constructor and Description |
|---|
Executor(Endpoint endpoint,
java.lang.String operation,
java.lang.String query,
manifold.rt.api.Bindings variables,
java.lang.Class<T> resultType) |
Executor(java.lang.String url,
java.lang.String operation,
java.lang.String query,
manifold.rt.api.Bindings variables,
java.lang.Class<T> resultType) |
Executor(java.util.function.Supplier<Requester<manifold.rt.api.Bindings>> requester,
java.lang.String operation,
java.lang.String query,
manifold.rt.api.Bindings variables,
java.lang.Class<T> resultType) |
| Modifier and Type | Method and Description |
|---|---|
T |
get()
Make an HTTP GET request to
url. |
T |
get(Requester.Format format)
Make an HTTP GET request to
url. |
Endpoint |
getEndpoint()
Access the GraphQL request endpoint.
|
Requester.Format |
getFormat()
Access the GraphQL request format.
|
java.util.Map<java.lang.String,java.lang.String> |
getHeaders()
Access an unmodifiable view of the GraphQL request headers.
|
java.util.function.Function<manifold.rt.api.Bindings,java.lang.Object> |
getRawResponseHandler() |
GqlRequestBody |
getRequestBody()
Access the full GraphQL request body, which includes
query and variables bindings. |
int |
getTimeout()
Access the GraphqL request timeout.
|
T |
post()
Make an HTTP POST request to
url. |
T |
post(Requester.Format format)
Make an HTTP POST request to
url. |
Executor<T> |
withAuthorization(java.lang.String tokenType,
java.lang.String accessToken) |
Executor<T> |
withBasicAuthorization(java.lang.String username,
java.lang.String password)
Set the Basic Authorization header using the provided
username and password |
Executor<T> |
withBearerAuthorization(java.lang.String accessToken)
Set the Bearer Authorization header using the provided
accessToken. |
Executor<T> |
withHeader(java.lang.String name,
java.lang.String value)
Set an HTTP request header
name : value pair
See HTTP header fields |
Executor<T> |
withParam(java.lang.String name,
java.lang.String value)
Add a
name=value parameter to the request URL. |
Executor<T> |
withRawResponseHandler(java.util.function.Function<manifold.rt.api.Bindings,java.lang.Object> handler) |
Executor<T> |
withTimeout(int timeout)
The connection timeout setting in milliseconds.
|
public Executor(java.lang.String url,
java.lang.String operation,
java.lang.String query,
manifold.rt.api.Bindings variables,
java.lang.Class<T> resultType)
public Executor(Endpoint endpoint, java.lang.String operation, java.lang.String query, manifold.rt.api.Bindings variables, java.lang.Class<T> resultType)
public Executor(java.util.function.Supplier<Requester<manifold.rt.api.Bindings>> requester, java.lang.String operation, java.lang.String query, manifold.rt.api.Bindings variables, java.lang.Class<T> resultType)
public GqlRequestBody getRequestBody()
query and variables bindings.public java.util.Map<java.lang.String,java.lang.String> getHeaders()
public Endpoint getEndpoint()
public Requester.Format getFormat()
public int getTimeout()
public Executor<T> withHeader(java.lang.String name, java.lang.String value)
name : value pair
See HTTP header fieldspublic Executor<T> withParam(java.lang.String name, java.lang.String value)
name=value parameter to the request URL.public Executor<T> withBasicAuthorization(java.lang.String username, java.lang.String password)
username and passwordpublic Executor<T> withBearerAuthorization(java.lang.String accessToken)
accessToken.
For instance, if using OAuth, accessToken is the token response from:
curl -d "grant_type=password&client_id=[...]&client_secret=[...]&username=[...]&password=[...]"
https://[domain]/[oauth-service]
public Executor<T> withAuthorization(java.lang.String tokenType, java.lang.String accessToken)
public Executor<T> withTimeout(int timeout)
public Executor<T> withRawResponseHandler(java.util.function.Function<manifold.rt.api.Bindings,java.lang.Object> handler)
handler - An optional handler for processing the raw response as an arbitrary Bindings instance. The handler
may return a custom bindings object which overrides the default, type-safe result instance. In any
case, the handler can process the response in any way. Note, modifications made to the response
persist and, therefore, affect default internal data and error processing.Executor instance.public java.util.function.Function<manifold.rt.api.Bindings,java.lang.Object> getRawResponseHandler()
public T post() throws GqlRequestException
url. The payload, if non-null, is sent as JSON encoded
text in the request's message body.format specified encoded response (primitive/boxed type, String, List of JSON values, or Bindings of String/JSON value)GqlRequestException - If the response contains errors, wraps them in a list of GqlError and throwspublic T post(Requester.Format format) throws GqlRequestException
url. The payload, if non-null, is sent as JSON encoded
text in the request's message body.format - The expected format of the response. One of: Json, Yaml, or Plainformat specified encoded response (primitive/boxed type, String, List of JSON values, or Bindings of String/JSON value)GqlRequestException - If the response contains errors, wraps them in a list of GqlError and throwspublic T get() throws GqlRequestException
url. The payload, if non-null, is sent as JSON encoded
text in the request's message body.format specified encoded response (primitive/boxed type, String, List of JSON values, or Bindings of String/JSON value)GqlRequestException - If the response contains errors, wraps them in a list of GqlError and throwspublic T get(Requester.Format format) throws GqlRequestException
url. The payload, if non-null, is sent as JSON encoded
text in the request's message body.format - The expected format of the response. One of: Json, Yaml, or Plainformat specified encoded response (primitive/boxed type, String, List of JSON values, or Bindings of String/JSON value)GqlRequestException - If the response contains errors, wraps them in a list of GqlError and throwsCopyright © 2024. All rights reserved.