Coroutine-native client covering the full Hanzo /v1 cloud surface, for JVM and Android. Generated with openapi-generator kotlin (library=jvm-okhttp4, useCoroutines=true). Coordinate: ai.hanzo:sdk. Base URL: https://api.hanzo.ai. Co-authored-by: Hanzo Dev <[email protected]>
3.7 KiB
SubscribeApi
All URIs are relative to https://api.hanzo.ai
| Method | HTTP request | Description |
|---|---|---|
| mqSubscribe | GET /v1/mq/subscribe/{subject} | Subscribe to subject via SSE |
| pubsubSubscribe | GET /v1/pubsub/subscribe | Subscribe to a subject (SSE) |
mqSubscribe
MqMessage mqSubscribe(subject, queue)
Subscribe to subject via SSE
Opens a Server-Sent Events stream for messages on the given subject. Supports NATS wildcard tokens: `*` matches a single token, `>` matches one or more tokens. The connection stays open until the client disconnects.
Example
// Import classes:
//import ai.hanzo.sdk.infrastructure.*
//import ai.hanzo.sdk.models.*
val apiInstance = SubscribeApi()
val subject : kotlin.String = subject_example // kotlin.String | Subject to subscribe to. Supports wildcards (`events.*`, `logs.>`).
val queue : kotlin.String = queue_example // kotlin.String | Queue group name for load-balanced delivery.
try {
val result : MqMessage = apiInstance.mqSubscribe(subject, queue)
println(result)
} catch (e: ClientException) {
println("4xx response calling SubscribeApi#mqSubscribe")
e.printStackTrace()
} catch (e: ServerException) {
println("5xx response calling SubscribeApi#mqSubscribe")
e.printStackTrace()
}
Parameters
| subject | kotlin.String| Subject to subscribe to. Supports wildcards (`events.*`, `logs.>`). | |
| Name | Type | Description | Notes |
|---|---|---|---|
| queue | kotlin.String | Queue group name for load-balanced delivery. | [optional] |
Return type
Authorization
Configure bearerAuth statically:
ApiClient.accessToken = ""
Configure bearerAuth dynamically:
apiInstance.accessTokenProvider = { "" }
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
pubsubSubscribe
PubsubMessage pubsubSubscribe(subject, queue)
Subscribe to a subject (SSE)
Subscribe to messages on a subject using Server-Sent Events. Supports wildcard subscriptions (`>` for multi-level, `*` for single-level).
Example
// Import classes:
//import ai.hanzo.sdk.infrastructure.*
//import ai.hanzo.sdk.models.*
val apiInstance = SubscribeApi()
val subject : kotlin.String = orders.> // kotlin.String | Subject to subscribe to (supports wildcards)
val queue : kotlin.String = queue_example // kotlin.String | Queue group name for load-balanced delivery
try {
val result : PubsubMessage = apiInstance.pubsubSubscribe(subject, queue)
println(result)
} catch (e: ClientException) {
println("4xx response calling SubscribeApi#pubsubSubscribe")
e.printStackTrace()
} catch (e: ServerException) {
println("5xx response calling SubscribeApi#pubsubSubscribe")
e.printStackTrace()
}
Parameters
| subject | kotlin.String| Subject to subscribe to (supports wildcards) | |
| Name | Type | Description | Notes |
|---|---|---|---|
| queue | kotlin.String | Queue group name for load-balanced delivery | [optional] |
Return type
Authorization
Configure bearerAuth statically:
ApiClient.accessToken = ""
Configure bearerAuth dynamically:
apiInstance.accessTokenProvider = { "" }
HTTP request headers
- Content-Type: Not defined
- Accept: Not defined