Class Tm1Client

java.lang.Object
io.skipcheck.tm1.client.Tm1Client

public final class Tm1Client extends Object
The client for one TM1 server: one Tm1Session, and every service built on it, such as dimensions(). Services arrive with the endpoint phases; session() sends any request, for what has no service yet.
Tm1Client tm1 = Tm1Client.builder()
	.baseUrl("http://localhost:8010/api/v1/")
	.basicAuth("admin", "apple")
	.build();

tm1.cubes()
	.modelCubes(ODataQuery.none().select(Cube.NAME))
	.map(Cube::name)
	.doOnNext(System.out::println)
	.then(tm1.close()) // close after the list completes, not alongside it
	.block(); // block only in a standalone main(), never in reactive code

Run a long process asynchronously, so no request stays open for its whole run:

// TM1 runs it in the background and the client polls for the result, so no
// request stays open. Cancelling the subscription stops the process on TM1.
return tm1.withAsync(Duration.ofSeconds(2))
	.processes()
	.executeWithReturn("Rebuild Forecast", Map.of(), ODataQuery.none());
  • Method Details

    • builder

      public static Tm1Client.Builder builder()
      A builder for a client of one TM1 server.
      Returns:
      a new builder
    • of

      public static Tm1Client of(Tm1Session session)
      A client over an existing session, such as one from a session pool or a Spring bean.
      Parameters:
      session - the session to send requests on
      Returns:
      a client over session
    • session

      public Tm1Session session()
      The session every service uses.
      Returns:
      the session
    • dimensions

      public DimensionService dimensions()
      Dimensions.
      Returns:
      the dimension service, on this client's session
    • hierarchies

      public HierarchyService hierarchies()
      Hierarchies.
      Returns:
      the hierarchie service, on this client's session
    • elements

      public ElementService elements()
      Elements.
      Returns:
      the element service, on this client's session
    • edges

      public EdgeService edges()
      Edges.
      Returns:
      the edge service, on this client's session
    • levels

      public LevelService levels()
      Levels.
      Returns:
      the level service, on this client's session
    • members

      public MemberService members()
      Members.
      Returns:
      the member service, on this client's session
    • subsets

      public SubsetService subsets()
      Subsets.
      Returns:
      the subset service, on this client's session
    • attributes

      public AttributeService attributes()
      Attribute definitions.
      Returns:
      the attribute service, on this client's session
    • localizedAttributes

      public LocalizedAttributeService localizedAttributes()
      Translated attribute values.
      Returns:
      the localized attribute service, on this client's session
    • cubes

      public CubeService cubes()
      Cubes.
      Returns:
      the cube service, on this client's session
    • views

      public ViewService views()
      Views.
      Returns:
      the view service, on this client's session
    • cellsets

      public CellsetService cellsets()
      Cellsets.
      Returns:
      the cellset service, on this client's session
    • cells

      public CellService cells()
      Cell writes.
      Returns:
      the cell service, on this client's session
    • memberSets

      public MemberSetService memberSets()
      Member sets.
      Returns:
      the member set service, on this client's session
    • sandboxes

      public SandboxService sandboxes()
      Sandboxes.
      Returns:
      the sandboxe service, on this client's session
    • changeSets

      public ChangeSetService changeSets()
      Change sets.
      Returns:
      the change set service, on this client's session
    • drillthrough

      public DrillthroughService drillthrough()
      Drillthrough.
      Returns:
      the drillthrough service, on this client's session
    • processes

      public ProcessService processes()
      Processes.
      Returns:
      the processe service, on this client's session
    • processDebugging

      public ProcessDebugService processDebugging()
      Process debugging.
      Returns:
      the process debug service, on this client's session
    • chores

      public ChoreService chores()
      Chores.
      Returns:
      the chore service, on this client's session
    • users

      public UserService users()
      Users.
      Returns:
      the user service, on this client's session
    • groups

      public GroupService groups()
      Groups.
      Returns:
      the group service, on this client's session
    • sessions

      public SessionService sessions()
      Server sessions.
      Returns:
      the session service, on this client's session
    • threads

      public ThreadService threads()
      Server threads.
      Returns:
      the thread service, on this client's session
    • server

      public ServerService server()
      The server.
      Returns:
      the server service, on this client's session
    • logs

      public LogService logs()
      The server's logs.
      Returns:
      the the server's log service, on this client's session
    • contents

      public ContentService contents()
      The contents tree.
      Returns:
      the the contents tree service, on this client's session
    • annotations

      public AnnotationService annotations()
      Annotations on cube cells.
      Returns:
      the annotations on cube cell service, on this client's session
    • git

      public GitService git()
      TM1 Git.
      Returns:
      the tm1 git service, on this client's session
    • encryption

      public EncryptionService encryption()
      Encryption at rest.
      Returns:
      the encryption at rest service, on this client's session
    • oidcKeys

      public OidcKeyService oidcKeys()
      The cached OpenID Connect keys.
      Returns:
      the the cached openid connect key service, on this client's session
    • sqlDataSources

      public SqlDataSourceService sqlDataSources()
      The ODBC data sources on TM1's host.
      Returns:
      the the odbc data sources on tm1's host service, on this client's session
    • batch

      public Tm1Batch batch()
      Starts a JSON $batch on this client's session: calls made through Tm1Batch.client() are queued, and Tm1Batch.run() sends them together.
      Returns:
      the batch
    • withAsync

      public Tm1Client withAsync(Duration every)
      A client on an async view of this client's session (Tm1Session.withAsync(Duration)): every service's methods work as usual, but TM1 runs each request asynchronously and the client polls for the result, so a long process or chore holds no request open. Cancelling a subscription before its result stops the work on TM1.
      Parameters:
      every - how long to wait between polls
      Returns:
      the client
    • withoutAsync

      public Tm1Client withoutAsync()
      A client on a synchronous view of this client's session (Tm1Session.withoutAsync()).
      Returns:
      the client
    • withSandbox

      public Tm1Client withSandbox(String name)
      A client whose services all run in sandbox name, sharing this client's session.
      Parameters:
      name - the sandbox's name
      Returns:
      a new client; this one is unchanged
    • withChangeSet

      public Tm1Client withChangeSet(String id)
      A client on a view of this client's session whose writes are recorded in change set id (Tm1Session.withChangeSet(String)); ChangeSetService.within makes one for the length of some work.
      Parameters:
      id - the change set's ID
      Returns:
      the client
    • connect

      public reactor.core.publisher.Mono<Tm1Client> connect()
      Logs in now rather than on the first request, and completes with this client.
      Returns:
      a Mono emitting this client once logged in
    • close

      public reactor.core.publisher.Mono<Void> close()
      Closes the session; see Tm1Session.close().
      Returns:
      a Mono completing when the session is closed
    • toString

      public String toString()
      Overrides:
      toString in class Object