Skip to main content

io.enterpriseai.Transport

Source: sdks/java/enterprise-ai-java/src/main/java/io/enterpriseai/Transport.java. Back to the Java SDK reference index.

note

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 Transport​

HTTP layer shared by every resource client: authentication and tenancy headers, Accept-Language, W3C traceparent, Idempotency-Key, retries with exponential backoff honoring Retry-After, error envelope mapping and pagination.

Transport.baseUrl​

URI baseUrl()

Control Plane base URL, validated, without trailing slash.

This element takes no parameter.

Returns: URI. The base URI.

Transport.bytes​

byte[] bytes(String method, String template, Object body, RequestOptions o, String... params)

Binary call (audio, exports).

NameTypeDefaultRequiredDescription
methodStringyesHTTP method, such as GET or POST; a POST gets an Idempotency-Key.
templateStringyesPath template such as /v1/runs/{run_id}; the {name} placeholders are filled in order from params.
bodyObjectyesRequest body, serialized as JSON.
oRequestOptionsyesPer call options (idempotency key, traceparent, headers).
paramsString...yesExtra fields merged into the request.

Returns: byte[]. The full response body as bytes.

Transport.environment​

String environment()

Environment set on the builder.

This element takes no parameter.

Returns: String. The environment, or null.

Transport.exchange​

Response<JsonNode> exchange(String method, String template, Object body, Map<String, ?> query, RequestOptions o, String... params)

JSON call returning the response with headers.

NameTypeDefaultRequiredDescription
methodStringyesHTTP method, such as GET or POST; a POST gets an Idempotency-Key.
templateStringyesPath template such as /v1/runs/{run_id}; the {name} placeholders are filled in order from params.
bodyObjectyesRequest body, serialized as JSON.
queryMap<String, ?>yesQuery string parameters of the route.
oRequestOptionsyesPer call options (idempotency key, traceparent, headers).
paramsString...yesExtra fields merged into the request.

Returns: Response<JsonNode>. A Response: Raw response: status, headers and body.

Transport.json​

JsonNode json(String method, String template, Object body, Map<String, ?> query, RequestOptions o, String... params)

JSON call returning the parsed body (NullNode for empty bodies such as 204).

NameTypeDefaultRequiredDescription
methodStringyesHTTP method, such as GET or POST; a POST gets an Idempotency-Key.
templateStringyesPath template such as /v1/runs/{run_id}; the {name} placeholders are filled in order from params.
bodyObjectyesRequest body, serialized as JSON.
queryMap<String, ?>yesQuery string parameters of the route.
oRequestOptionsyesPer call options (idempotency key, traceparent, headers).
paramsString...yesExtra fields merged into the request.

Returns: JsonNode. The parsed body, NullNode when empty.

Transport.locale​

Locale locale()

Message language of the client.

This element takes no parameter.

Returns: Locale. The Locale of the client.

Transport.page​

Page<JsonNode> page(String template, Map<String, ?> query, String... params)

Cursor paginated GET.

NameTypeDefaultRequiredDescription
templateStringyesPath template such as /v1/runs/{run_id}; the {name} placeholders are filled in order from params.
queryMap<String, ?>yesQuery string parameters of the route.
paramsString...yesExtra fields merged into the request.

Returns: Page<JsonNode>. A Page: One page of a cursor paginated collection ({"items": [...], "next_cursor": "..."|null}).

Transport.project​

String project()

Project slug set on the builder.

This element takes no parameter.

Returns: String. The project slug, or null.

Transport.send​

Response<InputStream> send(String method, String path, Map<String, ?> query, Object body, RequestOptions o, String accept)

Sends one request with retries.

NameTypeDefaultRequiredDescription
methodStringyesHTTP method, such as GET or POST; a POST gets an Idempotency-Key.
pathStringyesPath already expanded, relative to the base URL.
queryMap<String, ?>yesQuery string parameters of the route.
bodyObjectyesRequest body, serialized as JSON.
oRequestOptionsyesPer call options (idempotency key, traceparent, headers).
acceptStringyesAccept header value

Returns: Response<InputStream>. the successful response; the caller owns and must close the body stream

Raises: EaiException.

Transport.sse​

SseStream sse(String method, String template, Object body, RequestOptions o, String... params)

SSE call: the returned stream must be closed.

NameTypeDefaultRequiredDescription
methodStringyesHTTP method, such as GET or POST; a POST gets an Idempotency-Key.
templateStringyesPath template such as /v1/runs/{run_id}; the {name} placeholders are filled in order from params.
bodyObjectyesRequest body, serialized as JSON.
oRequestOptionsyesPer call options (idempotency key, traceparent, headers).
paramsString...yesExtra fields merged into the request.

Returns: SseStream. A SseStream: Blocking Server-Sent Events reader. Use it with try-with-resources, as an Iterator, a Stream or a reactive Flow.Publisher. A data: [DONE] event ends the stream.

Transport.tenant​

String tenant()

Tenant slug set on the builder.

This element takes no parameter.

Returns: String. The tenant slug, or null.

Transport.toString​

String toString()

Never prints the API key or the token.

This element takes no parameter.

Returns: String. The base URL with the API key and the token masked.

Transport.websocket​

CompletableFuture<WebSocket> websocket(String template, WebSocket.Listener listener, String... params)

Opens a WebSocket on template (http(s) base URL mapped to ws(s)) with the auth headers.

NameTypeDefaultRequiredDescription
templateStringyesPath template such as /v1/runs/{run_id}; the {name} placeholders are filled in order from params.
listenerWebSocket.ListeneryesWebSocket.Listener that receives the frames.
paramsString...yesExtra fields merged into the request.

Returns: CompletableFuture<WebSocket>. A CompletableFuture completed with the open WebSocket.

Model Transport.Response​

Raw response: status, headers and body.

Fields:

NameTypeRequiredDescription
statusintyesHTTP status of the response.
headersHttpHeadersyesHeaders of the event, string values. The trace context is added.
bodyTyesBody of the response: byte stream, parsed JsonNode or other depending on the call.

Response.header​

String header(String name)

Reads a header of the response.

NameTypeDefaultRequiredDescription
nameStringyesName of the header, case insensitive.

Returns: String. The first value of the header, or null when absent.