Package nl.bimbase.bimworks.client
Class BimWorksClientFactory
java.lang.Object
nl.bimbase.bimworks.client.BimWorksClientFactory
- All Implemented Interfaces:
AutoCloseable
Factory for BimWorksClient objects. An instance of this class is supposed to be a long-lived object.
One BimWorksClientFactory is required per endpoint (in case you are connecting to multiple BIM.works environments from the same client).
-
Constructor Summary
ConstructorDescriptionBimWorksClientFactory
(String address) BimWorksClientFactory
(String address, nl.sascom.backplane.client.ClientSettings settings) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Create a new BimWorksClient with anonymous access, only a very small set of API calls is allowedcreateClient
(nl.bimbase.bimworks.Credentials credentials) Alternative way of creating BimWorksClient objects, generally @see BimWorksClientFactory.createClientWithApiToken and @see BimWorksClientFactory.createClientWithAuth are preferred.createClientWithApiToken
(String apiToken) Create a new BimWorksClient based on an API Token.createClientWithAuth
(com.fasterxml.jackson.databind.node.ObjectNode auth) Create a new BimWorksClient based on an Auth Token.createClientWithUsernamePassword
(String username, String password) Login to the API with a username / password.toString()
-
Constructor Details
-
BimWorksClientFactory
- Parameters:
address
- The address of your BIM.works environment. In the form of https://host[:port][/context_path]
-
BimWorksClientFactory
-
-
Method Details
-
createAnonymousClient
Create a new BimWorksClient with anonymous access, only a very small set of API calls is allowed- Returns:
- A new BimWorksClient instance
- Throws:
BimWorksException
-
createClientWithUsernamePassword
public BimWorksClient createClientWithUsernamePassword(String username, String password) throws BimWorksException Login to the API with a username / password. This is generally not the recommended way of connecting, the preferrable option is to use an API Token.- Parameters:
username
- Your username, always a valid email address format (it does not always have to exist)password
- You password- Returns:
- A new BimWorksClient instance on successful authentication
- Throws:
BimWorksException
- See Also:
-
createClientWithApiToken
Create a new BimWorksClient based on an API Token. API Tokens in BIM.works are long-lived tokens that can be revoked. See general documentation for more information.- Parameters:
apiToken
- Your API Token. API Tokens can be created with API calls in @seeAuthApi
. API Token are generally created using the BIM.works UI, as you generally do it once for each application.- Returns:
- A new BimWorksClient instance on successful authentication
- Throws:
BimWorksException
-
createClientWithAuth
public BimWorksClient createClientWithAuth(com.fasterxml.jackson.databind.node.ObjectNode auth) throws BimWorksException Create a new BimWorksClient based on an Auth Token. Auth Tokens are short-lived tokens. See general documentation for more information.- Parameters:
auth
- The AuthToken as a Jackson ObjectNode- Returns:
- A new BimWorksClient instance on successful authentication
- Throws:
BimWorksException
-
getAddress
- Returns:
- The address with which this factory was initialized
-
toString
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
createClient
public BimWorksClient createClient(nl.bimbase.bimworks.Credentials credentials) throws BimWorksException Alternative way of creating BimWorksClient objects, generally @see BimWorksClientFactory.createClientWithApiToken and @see BimWorksClientFactory.createClientWithAuth are preferred.- Parameters:
credentials
- The credentials- Returns:
- A new BimWorksClient instance on successful authentication
- Throws:
Exception
BimWorksException
-