io.enterpriseai.resources.SessionsClient
Source: sdks/java/enterprise-ai-java/src/main/java/io/enterpriseai/resources/SessionsClient.java. Back to the Java SDK reference index.
This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.
Class SessionsClient
Conversation sessions and messages.
Constructor SessionsClient
SessionsClient(Transport transport)
Creates the client on the shared transport; EnterpriseAIClient builds it and exposes it through the accessor of the same name.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
transport | Transport | yes | Transport shared by the sub-clients of one client. |
SessionsClient.create
JsonNode create(Object body)
Open a session. Opens a conversation session, owned by user_id or by the caller. Opening a session for another user needs tenant_admin or agent (403 forbidden). Needs tenant_admin, developer or agent. 404 agent_not_found for an unknown agent_id. Audited as session.create.
Route: /v1/sessions (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | Object | yes | Agent, owner, channel, title, metadata and lifetime of the session. |
Returns: JsonNode. Decoded JSON answer of the operation "Open a session".
Raises: the typed errors of the transport (Errors).
SessionsClient.create
JsonNode create(Object body, RequestOptions options)
Open a session. Opens a conversation session, owned by user_id or by the caller. Opening a session for another user needs tenant_admin or agent (403 forbidden). Needs tenant_admin, developer or agent. 404 agent_not_found for an unknown agent_id. Audited as session.create.
Route: /v1/sessions (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | Object | yes | Agent, owner, channel, title, metadata and lifetime of the session. | |
options | RequestOptions | yes | Per call options (idempotency key, traceparent, headers, abort signal). |
Returns: JsonNode. Decoded JSON answer of the operation "Open a session".
Raises: the typed errors of the transport (Errors).
SessionsClient.delete
void delete(String id)
Delete a session. Deletes the session and its messages. Needs tenant_admin, developer or agent, and the caller must see the session (its owner, or tenant_admin, auditor, security_officer, agent); otherwise 404 session_not_found. Audited as session.delete.
Route: /v1/sessions/{session_id} (DELETE).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | String | yes | Identifier (UUID) of the session. |
Returns: void.
Raises: the typed errors of the transport (Errors).
SessionsClient.get
JsonNode get(String id)
Get a session. Returns one session. Visible to its owner, to tenant_admin, auditor, security_officer and to the agent role; otherwise 404 session_not_found.
Route: /v1/sessions/{session_id} (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | String | yes | Identifier (UUID) of the session. |
Returns: JsonNode. Decoded JSON answer of the operation "Get a session".
Raises: the typed errors of the transport (Errors).
SessionsClient.list
Page<JsonNode> list()
List the sessions. Sessions, newest first, paginated with cursor. A caller sees its own sessions; tenant_admin, auditor and security_officer see every session of the tenant.
Route: /v1/sessions (GET).
This element takes no parameter.
Returns: Page<JsonNode>. A Page: One page of a cursor paginated collection ({"items": [...], "next_cursor": "..."|null}).
Raises: the typed errors of the transport (Errors).
SessionsClient.list
Page<JsonNode> list(Map<String, ?> query)
List the sessions. Sessions, newest first, paginated with cursor. A caller sees its own sessions; tenant_admin, auditor and security_officer see every session of the tenant.
Route: /v1/sessions (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
query | Map<String, ?> | yes | Query string parameters of the route. |
Returns: Page<JsonNode>. A Page: One page of a cursor paginated collection ({"items": [...], "next_cursor": "..."|null}).
Raises: the typed errors of the transport (Errors).
SessionsClient.messages
Page<JsonNode> messages(String id)
List the messages of a session. Messages in order, paginated with cursor. after (message id or timestamp) lets a runtime poll the new messages only; an unknown message id or a malformed timestamp answers 400 invalid_request.
Route: /v1/sessions/{session_id}/messages (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | String | yes | Identifier (UUID) of the session. |
Returns: Page<JsonNode>. A Page: One page of a cursor paginated collection ({"items": [...], "next_cursor": "..."|null}).
Raises: the typed errors of the transport (Errors).
SessionsClient.messages
Page<JsonNode> messages(String id, Map<String, ?> query)
List the messages of a session. Messages in order, paginated with cursor. after (message id or timestamp) lets a runtime poll the new messages only; an unknown message id or a malformed timestamp answers 400 invalid_request.
Route: /v1/sessions/{session_id}/messages (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | String | yes | Identifier (UUID) of the session. | |
query | Map<String, ?> | yes | Query string parameters of the route. |
Returns: Page<JsonNode>. A Page: One page of a cursor paginated collection ({"items": [...], "next_cursor": "..."|null}).
Raises: the typed errors of the transport (Errors).
SessionsClient.postMessage
JsonNode postMessage(String id, Object body)
Add a message to a session. Appends a message with the next sequence number. The session must be open and not expired (409 session_closed). Needs tenant_admin, developer or agent. The audit event session.message.add keeps the role and the length only, never the content.
Route: /v1/sessions/{session_id}/messages (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | String | yes | Identifier (UUID) of the session. | |
body | Object | yes | Role, content and metadata of the message. |
Returns: JsonNode. Decoded JSON answer of the operation "Add a message to a session".
Raises: the typed errors of the transport (Errors).
SessionsClient.postMessage
JsonNode postMessage(String id, Object body, RequestOptions options)
Add a message to a session. Appends a message with the next sequence number. The session must be open and not expired (409 session_closed). Needs tenant_admin, developer or agent. The audit event session.message.add keeps the role and the length only, never the content.
Route: /v1/sessions/{session_id}/messages (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | String | yes | Identifier (UUID) of the session. | |
body | Object | yes | Role, content and metadata of the message. | |
options | RequestOptions | yes | Per call options (idempotency key, traceparent, headers, abort signal). |
Returns: JsonNode. Decoded JSON answer of the operation "Add a message to a session".
Raises: the typed errors of the transport (Errors).