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
ConstructorsConstructorDescriptionBimWorksClientFactory(String address) BimWorksClientFactory(String address, nl.sascom.backplane.client.ClientSettings settings) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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.Leaves the Java version and the operating system out of what the clients created afterwards send.setApplication(String name, String version) Names your application, sent with every request of the clients created afterwards (theappof the X-BIMworks-Client header and the end of the User-Agent).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
-
setApplication
Names your application, sent with every request of the clients created afterwards (theappof the X-BIMworks-Client header and the end of the User-Agent). It tells BIM.works support which of your integrations made a call. Letters, digits and. _ + -; anything else becomes_.- Parameters:
name- your application, e.g.acme-syncversion- its version, or null- Returns:
- this factory
-
excludePlatformInfo
Leaves the Java version and the operating system out of what the clients created afterwards send. The SDK's own name, version and build are always sent: support needs them.- Returns:
- this factory
-
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:
closein 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:
ExceptionBimWorksException
-