Package com.cognite.client
Class CogniteClient
java.lang.Object
com.cognite.client.CogniteClient
- All Implemented Interfaces:
Serializable
This class represents the main entry point for interacting with this SDK (and Cognite Data Fusion).
All services are exposed via this object.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionassets()ReturnsAssetsrepresenting the Cognite assets api endpoint.protected AuthConfigReturns a auth info for api requestsReturnsContextualizationrepresenting the Cognite contextualization api endpoints.datasets()ReturnsDatasetsrepresenting the Cognite dats sets api endpoint.enableHttp(boolean enable) Enable (or disable) support for http.events()ReturnsEventsrepresenting the Cognite events api endpoint.ReturnsExperimentalrepresenting experimental (non-released) api endpoints.ReturnsExtractionPipelinesrepresenting the Cognite extraction pipelines api endpoint.files()ReturnsFilesrepresenting the Cognite files api endpoints.protected abstract Stringprotected abstract Collection<String>protected abstract CogniteClient.AuthTypeprotected abstract Stringabstract ClientConfigprotected abstract Stringprotected abstract Stringprotected ConnectorServiceV1Returns the services layer mirroring the Cognite Data Fusion API.abstract okhttp3.OkHttpClientprotected abstract Stringprotected abstract URLlabels()ReturnsLabelsrepresenting the Cognite labels api endpoints.static CogniteClientofClientCredentials(String cdfProject, String clientId, String clientSecret, URL tokenUrl) Returns aCogniteClientusing client credentials for authentication.static CogniteClientofClientCredentials(String cdfProject, String clientId, String clientSecret, URL tokenUrl, Collection<String> scopes) Returns aCogniteClientusing client credentials for authentication.static CogniteClientDeprecated.static CogniteClientReturns aCogniteClientusing the provided supplier (function) to provide a bearer token for authorization.raw()ReturnsRawrepresenting the Cognite Raw service.ReturnsRelationshipsrepresenting the Cognite relationships api endpoint.ReturnsSecurityCategoriesrepresenting the Cognite labels api endpoints.ReturnsSequencesrepresenting the Cognite sequences api endpoint.threeD()ReturnsThreeDrepresenting 3D api endpoints.ReturnsTimeseriesrepresenting the Cognite timeseries api endpoint.protected abstract com.cognite.client.CogniteClient.BuilderReturnsTransformationsrepresenting Transformation api endpoints.withBaseUrl(String baseUrl) Returns aCogniteClientusing the specified base URL for issuing API requests.withClientConfig(ClientConfig config) Returns aCogniteClientusing the specified configuration settings.withProject(String project) Returns aCogniteClientusing the specified Cognite Data Fusion project / tenant.withScopes(Collection<String> scopes) Returns aCogniteClientusing the specified list of scopes for issuing API requests.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG
-
-
Constructor Details
-
CogniteClient
public CogniteClient()
-
-
Method Details
-
ofKey
Deprecated.Returns aCogniteClientusing the provided API key for authentication.- Parameters:
cdfProject- The CDF project to connect to.apiKey- The Cognite Data Fusion API key to use for authentication.- Returns:
- the client object with default configuration.
-
ofToken
Returns aCogniteClientusing the provided supplier (function) to provide a bearer token for authorization. If your application handles the authentication flow itself, you can pass aSupplierto this constructor. The supplier will be called for each api request and the provided token will be added as a bearer token to the request header.- Parameters:
cdfProject- The CDF project to connect to.tokenSupplier- A Supplier (functional interface) producing a valid access token when called.- Returns:
- the client object with default configuration.
-
ofClientCredentials
public static CogniteClient ofClientCredentials(String cdfProject, String clientId, String clientSecret, URL tokenUrl, Collection<String> scopes) Returns aCogniteClientusing client credentials for authentication. Client credentials is the preferred authentication pattern for services / machine to machine communication for Openid Connect (and Oauth) compatible identity providers.- Parameters:
cdfProject- The CDF project to connect to.clientId- The client id to use for authentication.clientSecret- The client secret to use for authentication.tokenUrl- The URL to call for obtaining the access token.scopes- The list of scopes to be used for authentication- Returns:
- the client object with default configuration.
-
ofClientCredentials
public static CogniteClient ofClientCredentials(String cdfProject, String clientId, String clientSecret, URL tokenUrl) Returns aCogniteClientusing client credentials for authentication. Client credentials is the preferred authentication pattern for services / machine to machine communication for Openid Connect (and Oauth) compatible identity providers.- Parameters:
cdfProject- The CDF project to connect to.clientId- The client id to use for authentication.clientSecret- The client secret to use for authentication.tokenUrl- The URL to call for obtaining the access token.- Returns:
- the client object with default configuration.
-
toBuilder
protected abstract com.cognite.client.CogniteClient.Builder toBuilder() -
getProject
-
getClientId
-
getClientSecret
-
getTokenUrl
-
getAuthScopes
-
getApiKey
-
getTokenSupplier
-
getAuthType
-
getBaseUrl
-
getClientConfig
-
getHttpClient
public abstract okhttp3.OkHttpClient getHttpClient() -
getExecutorService
-
getTsExecutorService
-
withProject
Returns aCogniteClientusing the specified Cognite Data Fusion project / tenant.- Parameters:
project- The project / tenant to use for interacting with Cognite Data Fusion.- Returns:
- the client object with the project / tenant key set.
-
withBaseUrl
Returns aCogniteClientusing the specified base URL for issuing API requests. The base URL must follow the formathttps://<my-host>.cognitedata.com. The default base URL ishttps://api.cognitedata.com- Parameters:
baseUrl- The CDF api base URL- Returns:
- the client object with the base URL set.
-
withScopes
Returns aCogniteClientusing the specified list of scopes for issuing API requests.- Parameters:
scopes- The collection of scopes to be used for OAuth2.0 authentication- Returns:
- the client object with the authentication handler configured
-
withClientConfig
Returns aCogniteClientusing the specified configuration settings.- Parameters:
config- TheClientConfighosting the client configuration setting.- Returns:
- the client object with the config applied.
-
enableHttp
Enable (or disable) support for http. Set totrueto enable support for http calls. Set tofalseto disable support for http (then only https will be possible). The default setting isdisabled. I.e. only https calls are allowed.- Parameters:
enable- Set totrueto enable support for http calls. Set tofalseto disable support for http.- Returns:
- the client object with the config applied.
-
assets
ReturnsAssetsrepresenting the Cognite assets api endpoint.- Returns:
- The assets api object.
-
timeseries
ReturnsTimeseriesrepresenting the Cognite timeseries api endpoint.- Returns:
- The timeseries api object.
-
events
ReturnsEventsrepresenting the Cognite events api endpoint.- Returns:
- The events api object.
-
files
ReturnsFilesrepresenting the Cognite files api endpoints.- Returns:
- The labels api endpoint.
-
relationships
ReturnsRelationshipsrepresenting the Cognite relationships api endpoint.- Returns:
- The relationships api object.
-
sequences
ReturnsSequencesrepresenting the Cognite sequences api endpoint.- Returns:
- The sequences api object.
-
raw
ReturnsRawrepresenting the Cognite Raw service.- Returns:
- The raw api object.
-
labels
ReturnsLabelsrepresenting the Cognite labels api endpoints.- Returns:
- The labels api endpoint.
-
datasets
ReturnsDatasetsrepresenting the Cognite dats sets api endpoint.- Returns:
- The data sets api object.
-
extractionPipelines
ReturnsExtractionPipelinesrepresenting the Cognite extraction pipelines api endpoint.- Returns:
- The extraction pipelines api object.
-
securityCategories
ReturnsSecurityCategoriesrepresenting the Cognite labels api endpoints.- Returns:
- The security categories api endpoint.
-
contextualization
ReturnsContextualizationrepresenting the Cognite contextualization api endpoints.- Returns:
- The contextualization api endpoint.
-
experimental
ReturnsExperimentalrepresenting experimental (non-released) api endpoints.- Returns:
- The Experimental api endpoints.
-
threeD
ReturnsThreeDrepresenting 3D api endpoints.- Returns:
- The ThreeD api endpoints.
-
transformations
ReturnsTransformationsrepresenting Transformation api endpoints.- Returns:
- The Transformation api endpoints.
-
getConnectorService
Returns the services layer mirroring the Cognite Data Fusion API.- Returns:
-
buildAuthConfig
Returns a auth info for api requests- Returns:
- project config with auth info populated
- Throws:
Exception
-