Class BimWorksClientFactory

java.lang.Object
nl.bimbase.bimworks.client.BimWorksClientFactory
All Implemented Interfaces:
AutoCloseable

public class BimWorksClientFactory extends Object implements 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 Details

    • BimWorksClientFactory

      public BimWorksClientFactory(String address)
      Parameters:
      address - The address of your BIM.works environment. In the form of https://host[:port][/context_path]
    • BimWorksClientFactory

      public BimWorksClientFactory(String address, nl.sascom.backplane.client.ClientSettings settings)
  • Method Details

    • createAnonymousClient

      public BimWorksClient createAnonymousClient() throws BimWorksException
      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

      public BimWorksClient createClientWithApiToken(String apiToken) throws BimWorksException
      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 @see AuthApi. 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

      public String getAddress()
      Returns:
      The address with which this factory was initialized
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      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