Tm1Client
import io.skipcheck.tm1.client.Tm1Client;Used in the walkthroughs Connect and list your cubes, Test your code against a real TM1, Add TM1 to a Spring Boot application.
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());
Members
builder static | A builder for a client of one TM1 server. |
of static | A client over an existing session, such as one from a session pool or a Spring bean. |
session | The session every service uses. |
dimensions | Dimensions. |
hierarchies | Hierarchies. |
elements | Elements. |
edges | Edges. |
levels | Levels. |
members | Members. |
subsets | Subsets. |
attributes | Attribute definitions. |
localizedAttributes | Translated attribute values. |
cubes | Cubes. |
views | Views. |
cellsets | Cellsets. |
cells | Cell writes. |
memberSets | Member sets. |
sandboxes | Sandboxes. |
changeSets | Change sets. |
drillthrough | Drillthrough. |
processes | Processes. |
processDebugging | Process debugging. |
chores | Chores. |
users | Users. |
groups | Groups. |
sessions | Server sessions. |
threads | Server threads. |
server | The server. |
logs | The server's logs. |
contents | The contents tree. |
annotations | Annotations on cube cells. |
git | TM1 Git. |
encryption | Encryption at rest. |
oidcKeys | The cached OpenID Connect keys. |
sqlDataSources | The ODBC data sources on TM1's host. |
batch | Starts a JSON $batch on this client's session. |
withAsync | A client on an async view of this client's session (Tm1Session.withAsync). |
withoutAsync | A client on a synchronous view of this client's session (Tm1Session.withoutAsync). |
withSandbox | A client whose services all run in sandbox name, sharing this client's session. |
withChangeSet | A client on a view of this client's session whose writes are recorded in change set id (Tm1Session.withChangeSet); ChangeSetService.within makes one for the length of some work. |
connect | Logs in now rather than on the first request, and completes with this client. |
close | Closes the session; see Tm1Session.close. |
toString |
builder
staticstatic Tm1Client.Builder builder()A builder for a client of one TM1 server.
Returns
- a new builder
of
staticstatic 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
Tm1Session session()The session every service uses.
Returns
- the session
dimensions
DimensionService dimensions()Dimensions.
Returns
- the dimension service, on this client's session
hierarchies
HierarchyService hierarchies()Hierarchies.
Returns
- the hierarchie service, on this client's session
elements
ElementService elements()Elements.
Returns
- the element service, on this client's session
edges
EdgeService edges()Edges.
Returns
- the edge service, on this client's session
levels
LevelService levels()Levels.
Returns
- the level service, on this client's session
members
MemberService members()Members.
Returns
- the member service, on this client's session
subsets
SubsetService subsets()Subsets.
Returns
- the subset service, on this client's session
attributes
AttributeService attributes()Attribute definitions.
Returns
- the attribute service, on this client's session
localizedAttributes
LocalizedAttributeService localizedAttributes()Translated attribute values.
Returns
- the localized attribute service, on this client's session
cubes
CubeService cubes()Cubes.
Returns
- the cube service, on this client's session
views
ViewService views()Views.
Returns
- the view service, on this client's session
cellsets
CellsetService cellsets()Cellsets.
Returns
- the cellset service, on this client's session
cells
CellService cells()Cell writes.
Returns
- the cell service, on this client's session
memberSets
MemberSetService memberSets()Member sets.
Returns
- the member set service, on this client's session
sandboxes
SandboxService sandboxes()Sandboxes.
Returns
- the sandboxe service, on this client's session
changeSets
ChangeSetService changeSets()Change sets.
Returns
- the change set service, on this client's session
drillthrough
DrillthroughService drillthrough()Drillthrough.
Returns
- the drillthrough service, on this client's session
processes
ProcessService processes()Processes.
Returns
- the processe service, on this client's session
processDebugging
ProcessDebugService processDebugging()Process debugging.
Returns
- the process debug service, on this client's session
chores
ChoreService chores()Chores.
Returns
- the chore service, on this client's session
users
UserService users()Users.
Returns
- the user service, on this client's session
groups
GroupService groups()Groups.
Returns
- the group service, on this client's session
sessions
SessionService sessions()Server sessions.
Returns
- the session service, on this client's session
threads
ThreadService threads()Server threads.
Returns
- the thread service, on this client's session
server
ServerService server()The server.
Returns
- the server service, on this client's session
logs
LogService logs()The server's logs.
Returns
- the the server's log service, on this client's session
contents
ContentService contents()The contents tree.
Returns
- the the contents tree service, on this client's session
annotations
AnnotationService annotations()Annotations on cube cells.
Returns
- the annotations on cube cell service, on this client's session
git
GitService git()TM1 Git.
Returns
- the tm1 git service, on this client's session
encryption
EncryptionService encryption()Encryption at rest.
Returns
- the encryption at rest service, on this client's session
oidcKeys
OidcKeyService oidcKeys()The cached OpenID Connect keys.
Returns
- the the cached openid connect key service, on this client's session
sqlDataSources
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
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
Tm1Client withAsync(Duration every) A client on an async view of this client's session (Tm1Session.withAsync):
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
Tm1Client withoutAsync() A client on a synchronous view of this client's session
(Tm1Session.withoutAsync).
Returns
- the client
withSandbox
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
Tm1Client withChangeSet(String id) A client on a view of this client's session whose writes are recorded in change set
id (Tm1Session.withChangeSet); ChangeSetService.within
makes one for the length of some work.
Parameters
id- the change set's ID
Returns
- the client
connect
Mono<Tm1Client> connect()Logs in now rather than on the first request, and completes with this client.
Returns
- a
Monoemitting this client once logged in
close
Mono<Void> close() Closes the session; see Tm1Session.close.
Returns
- a
Monocompleting when the session is closed
toString
String toString()Also in the Javadoc.