mirror of
https://github.com/hanzo-kt/sdk.git
synced 2026-10-30 20:43:57 +00:00
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]>
4.3 KiB
4.3 KiB
PubSubApi
All URIs are relative to https://api.hanzo.ai
| Method | HTTP request | Description |
|---|---|---|
| kvListChannels | GET /v1/kv/pubsub/channels | List active channels |
| kvPublish | POST /v1/kv/pubsub/publish | Publish message to channel |
| kvSubscribe | GET /v1/kv/pubsub/subscribe | Subscribe to channels (SSE) |
kvListChannels
KvListChannels200Response kvListChannels(pattern)
List active channels
Example
// Import classes:
//import ai.hanzo.sdk.infrastructure.*
//import ai.hanzo.sdk.models.*
val apiInstance = PubSubApi()
val pattern : kotlin.String = pattern_example // kotlin.String |
try {
val result : KvListChannels200Response = apiInstance.kvListChannels(pattern)
println(result)
} catch (e: ClientException) {
println("4xx response calling PubSubApi#kvListChannels")
e.printStackTrace()
} catch (e: ServerException) {
println("5xx response calling PubSubApi#kvListChannels")
e.printStackTrace()
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| pattern | kotlin.String | [optional] [default to "*"] |
Return type
Authorization
Configure bearerAuth statically:
ApiClient.accessToken = ""
Configure bearerAuth dynamically:
apiInstance.accessTokenProvider = { "" }
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
kvPublish
KvPublish200Response kvPublish(kvPublishRequest)
Publish message to channel
Example
// Import classes:
//import ai.hanzo.sdk.infrastructure.*
//import ai.hanzo.sdk.models.*
val apiInstance = PubSubApi()
val kvPublishRequest : KvPublishRequest = // KvPublishRequest |
try {
val result : KvPublish200Response = apiInstance.kvPublish(kvPublishRequest)
println(result)
} catch (e: ClientException) {
println("4xx response calling PubSubApi#kvPublish")
e.printStackTrace()
} catch (e: ServerException) {
println("5xx response calling PubSubApi#kvPublish")
e.printStackTrace()
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| kvPublishRequest | KvPublishRequest |
Return type
Authorization
Configure bearerAuth statically:
ApiClient.accessToken = ""
Configure bearerAuth dynamically:
apiInstance.accessTokenProvider = { "" }
HTTP request headers
- Content-Type: application/json
- Accept: application/json
kvSubscribe
kotlin.String kvSubscribe(channels, pattern)
Subscribe to channels (SSE)
Example
// Import classes:
//import ai.hanzo.sdk.infrastructure.*
//import ai.hanzo.sdk.models.*
val apiInstance = PubSubApi()
val channels : kotlin.collections.List<kotlin.String> = // kotlin.collections.List<kotlin.String> | Channels to subscribe to
val pattern : kotlin.String = pattern_example // kotlin.String | Pattern to subscribe to (e.g. user:*)
try {
val result : kotlin.String = apiInstance.kvSubscribe(channels, pattern)
println(result)
} catch (e: ClientException) {
println("4xx response calling PubSubApi#kvSubscribe")
e.printStackTrace()
} catch (e: ServerException) {
println("5xx response calling PubSubApi#kvSubscribe")
e.printStackTrace()
}
Parameters
| channels | kotlin.collections.List<kotlin.String>| Channels to subscribe to | |
| Name | Type | Description | Notes |
|---|---|---|---|
| pattern | kotlin.String | Pattern to subscribe to (e.g. user:*) | [optional] |
Return type
kotlin.String
Authorization
Configure bearerAuth statically:
ApiClient.accessToken = ""
Configure bearerAuth dynamically:
apiInstance.accessTokenProvider = { "" }
HTTP request headers
- Content-Type: Not defined
- Accept: Not defined