Class GraphqlClient
- java.lang.Object
-
- org.topbraidlive.client.java.impl.GraphqlClient
-
- All Implemented Interfaces:
ApiFunction
,GetPlatformGraphqlConnectionApiFunction
,GetProjectGraphqlConnectionApiFunction
,GetRawGraphqlConnectionApiFunction
,ListProjectsApiFunction
public final class GraphqlClient extends Object implements GetPlatformGraphqlConnectionApiFunction, GetProjectGraphqlConnectionApiFunction, GetRawGraphqlConnectionApiFunction, ListProjectsApiFunction
-
-
Constructor Summary
Constructors Constructor Description GraphqlClient(ClientConfiguration clientConfiguration, org.apache.http.impl.client.CloseableHttpClient httpClient)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.http.client.methods.CloseableHttpResponse
execute(org.apache.http.client.methods.HttpUriRequest httpUriRequest)
protected org.apache.http.client.methods.CloseableHttpResponse
get(org.apache.http.client.utils.URIBuilder uriBuilder)
protected ClientConfiguration
getClientConfiguration()
protected org.apache.http.impl.client.CloseableHttpClient
getHttpClient()
TypedGraphqlConnection<RootRDFQueryQuery,RootRDFQuery>
getPlatformGraphqlConnection()
Get a GraphQL connection for the platform APIO.<RootQueryT extends AbstractQuery<RootQueryT>,RootResponseT extends AbstractResponse<RootResponseT>>
TypedGraphqlConnection<RootQueryT,RootResponseT>getProjectGraphqlConnection(GetProjectGraphqlConnectionParameters<RootQueryT,RootResponseT> parameters)
Get a GraphQL connection for a specific project.RawGraphqlConnection
getRawGraphqlConnection(String endpointUrlPath)
Get a raw GraphQL connection.RawGraphqlConnection
getRawGraphqlConnection(ProjectGraphUri projectGraphUri, Optional<ProjectGraphqlSchemaType> projectGraphqlSchemaType)
com.google.common.collect.ImmutableList<ProjectGraphUri>
listProjects()
List project graphs known to the server.protected ClientException
newClientException(org.apache.http.HttpResponse httpResponse)
protected org.apache.http.client.utils.URIBuilder
newUriBuilder(String relativeUriPath)
protected org.apache.http.client.methods.CloseableHttpResponse
postForm(List<org.apache.http.NameValuePair> nameValuePairs, org.apache.http.client.utils.URIBuilder uriBuilder)
protected String
toString(org.apache.http.HttpResponse httpResponse)
Convert an HttpResponse to a string, usually for logging.protected String
toString(org.apache.http.HttpResponse httpResponse, String httpResponseEntity)
Convert an HttpResponse to a string, usually for logging.protected static RuntimeException
wrap(IOException e)
-
-
-
Constructor Detail
-
GraphqlClient
public GraphqlClient(ClientConfiguration clientConfiguration, org.apache.http.impl.client.CloseableHttpClient httpClient)
-
-
Method Detail
-
getPlatformGraphqlConnection
public final TypedGraphqlConnection<RootRDFQueryQuery,RootRDFQuery> getPlatformGraphqlConnection()
Description copied from interface:GetPlatformGraphqlConnectionApiFunction
Get a GraphQL connection for the platform APIO.- Specified by:
getPlatformGraphqlConnection
in interfaceGetPlatformGraphqlConnectionApiFunction
-
getProjectGraphqlConnection
public final <RootQueryT extends AbstractQuery<RootQueryT>,RootResponseT extends AbstractResponse<RootResponseT>> TypedGraphqlConnection<RootQueryT,RootResponseT> getProjectGraphqlConnection(GetProjectGraphqlConnectionParameters<RootQueryT,RootResponseT> parameters)
Description copied from interface:GetProjectGraphqlConnectionApiFunction
Get a GraphQL connection for a specific project.- Specified by:
getProjectGraphqlConnection
in interfaceGetProjectGraphqlConnectionApiFunction
-
getRawGraphqlConnection
public final RawGraphqlConnection getRawGraphqlConnection(ProjectGraphUri projectGraphUri, Optional<ProjectGraphqlSchemaType> projectGraphqlSchemaType)
-
getRawGraphqlConnection
public final RawGraphqlConnection getRawGraphqlConnection(String endpointUrlPath)
Description copied from interface:GetRawGraphqlConnectionApiFunction
Get a raw GraphQL connection.- Specified by:
getRawGraphqlConnection
in interfaceGetRawGraphqlConnectionApiFunction
- Parameters:
endpointUrlPath
- relative endpoint URL path as /tbl/graphql/_
-
listProjects
public final com.google.common.collect.ImmutableList<ProjectGraphUri> listProjects()
Description copied from interface:ListProjectsApiFunction
List project graphs known to the server.- Specified by:
listProjects
in interfaceListProjectsApiFunction
-
wrap
protected static final RuntimeException wrap(IOException e)
-
getClientConfiguration
protected final ClientConfiguration getClientConfiguration()
-
execute
protected final org.apache.http.client.methods.CloseableHttpResponse execute(org.apache.http.client.methods.HttpUriRequest httpUriRequest)
-
get
protected final org.apache.http.client.methods.CloseableHttpResponse get(org.apache.http.client.utils.URIBuilder uriBuilder)
-
getHttpClient
protected final org.apache.http.impl.client.CloseableHttpClient getHttpClient()
-
newClientException
protected final ClientException newClientException(org.apache.http.HttpResponse httpResponse) throws IOException
- Throws:
IOException
-
newUriBuilder
protected final org.apache.http.client.utils.URIBuilder newUriBuilder(String relativeUriPath)
-
postForm
protected final org.apache.http.client.methods.CloseableHttpResponse postForm(List<org.apache.http.NameValuePair> nameValuePairs, org.apache.http.client.utils.URIBuilder uriBuilder)
-
toString
protected final String toString(org.apache.http.HttpResponse httpResponse) throws IOException
Convert an HttpResponse to a string, usually for logging.Consumes the entity (body) in order to convert it to a string.
- Throws:
IOException
-
toString
protected final String toString(org.apache.http.HttpResponse httpResponse, String httpResponseEntity) throws IOException
Convert an HttpResponse to a string, usually for logging.Uses an entity (body) that has been previously converted to a string.
- Throws:
IOException
-
-