skipcheck

TM1 client · Docs · The client

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 staticA builder for a client of one TM1 server.
of staticA client over an existing session, such as one from a session pool or a Spring bean.
sessionThe session every service uses.
dimensionsDimensions.
hierarchiesHierarchies.
elementsElements.
edgesEdges.
levelsLevels.
membersMembers.
subsetsSubsets.
attributesAttribute definitions.
localizedAttributesTranslated attribute values.
cubesCubes.
viewsViews.
cellsetsCellsets.
cellsCell writes.
memberSetsMember sets.
sandboxesSandboxes.
changeSetsChange sets.
drillthroughDrillthrough.
processesProcesses.
processDebuggingProcess debugging.
choresChores.
usersUsers.
groupsGroups.
sessionsServer sessions.
threadsServer threads.
serverThe server.
logsThe server's logs.
contentsThe contents tree.
annotationsAnnotations on cube cells.
gitTM1 Git.
encryptionEncryption at rest.
oidcKeysThe cached OpenID Connect keys.
sqlDataSourcesThe ODBC data sources on TM1's host.
batchStarts a JSON $batch on this client's session.
withAsyncA client on an async view of this client's session (Tm1Session.withAsync).
withoutAsyncA client on a synchronous view of this client's session (Tm1Session.withoutAsync).
withSandboxA client whose services all run in sandbox name, sharing this client's session.
withChangeSetA 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.
connectLogs in now rather than on the first request, and completes with this client.
closeCloses the session; see Tm1Session.close.
toString

builder

static
static Tm1Client.Builder builder()

A builder for a client of one TM1 server.

Returns

a new builder

of

static
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

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 Mono emitting this client once logged in

close

Mono<Void> close()

Closes the session; see Tm1Session.close.

Returns

a Mono completing when the session is closed

toString

String toString()

Also in the Javadoc.