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]>
6.8 KiB
SendApi
All URIs are relative to https://api.hanzo.ai
| Method | HTTP request | Description |
|---|---|---|
| notifyNotifySend | POST /v1/notify/send | Send a notification (generic channel) |
| notifyNotifySendEmail | POST /v1/notify/send/email | Send an email notification |
| notifyNotifySendSms | POST /v1/notify/send/sms | Send an SMS notification |
notifyNotifySend
NotifyNotifySend200Response notifyNotifySend(sync, notifySendRequest)
Send a notification (generic channel)
Synchronously delivers a notification. The channel is read from the request body (`channel: "sms"|"email"`). Only `sms` and `email` are supported by the cloud fold. `sync=true` is REQUIRED. Without it the request fails closed with `503` (async dispatch is not available in the fold). The org scope is taken from the validated principal's tenant, never from a client-supplied header. The provider is chosen from configured KMS credentials unless `provider` pins one explicitly. RESPONSE SHAPE — for a single recipient the body is a bare `SendResponse`. For multiple recipients the body is `{"items": [SendResponse, ...]}`, one entry per recipient. A per-recipient terminal delivery failure is reported as a `200` with `status: "failed"` and an `error` message, NOT as an HTTP error.
Example
// Import classes:
//import ai.hanzo.sdk.infrastructure.*
//import ai.hanzo.sdk.models.*
val apiInstance = SendApi()
val sync : kotlin.String = sync_example // kotlin.String | Must be `true`. Async dispatch is not available in the cloud fold; any other value yields `503`.
val notifySendRequest : NotifySendRequest = {"to":["+15551234567"],"channel":"sms","event":"iam.otp_sent","template_vars":{"otp":"482913","recipient":"+15551234567","app":"Hanzo"}} // NotifySendRequest |
try {
val result : NotifyNotifySend200Response = apiInstance.notifyNotifySend(sync, notifySendRequest)
println(result)
} catch (e: ClientException) {
println("4xx response calling SendApi#notifyNotifySend")
e.printStackTrace()
} catch (e: ServerException) {
println("5xx response calling SendApi#notifyNotifySend")
e.printStackTrace()
}
Parameters
| sync | kotlin.String| Must be `true`. Async dispatch is not available in the cloud fold; any other value yields `503`. | [enum: true] |
| Name | Type | Description | Notes |
|---|---|---|---|
| notifySendRequest | NotifySendRequest |
Return type
Authorization
Configure bearerAuth statically:
ApiClient.accessToken = ""
Configure bearerAuth dynamically:
apiInstance.accessTokenProvider = { "" }
HTTP request headers
- Content-Type: application/json
- Accept: application/json
notifyNotifySendEmail
NotifyNotifySend200Response notifyNotifySendEmail(sync, notifySendRequest)
Send an email notification
Convenience route that pins `channel: email`. Any `channel` in the body is overridden. Otherwise identical to `POST /v1/notify/send` — `sync=true` required, org derived from the validated principal, single vs. list response shape.
Example
// Import classes:
//import ai.hanzo.sdk.infrastructure.*
//import ai.hanzo.sdk.models.*
val apiInstance = SendApi()
val sync : kotlin.String = sync_example // kotlin.String | Must be `true`; otherwise `503`.
val notifySendRequest : NotifySendRequest = {"to":["[email protected]"],"subject":"Welcome","body":"Thanks for signing up."} // NotifySendRequest |
try {
val result : NotifyNotifySend200Response = apiInstance.notifyNotifySendEmail(sync, notifySendRequest)
println(result)
} catch (e: ClientException) {
println("4xx response calling SendApi#notifyNotifySendEmail")
e.printStackTrace()
} catch (e: ServerException) {
println("5xx response calling SendApi#notifyNotifySendEmail")
e.printStackTrace()
}
Parameters
| sync | kotlin.String| Must be `true`; otherwise `503`. | [enum: true] |
| Name | Type | Description | Notes |
|---|---|---|---|
| notifySendRequest | NotifySendRequest |
Return type
Authorization
Configure bearerAuth statically:
ApiClient.accessToken = ""
Configure bearerAuth dynamically:
apiInstance.accessTokenProvider = { "" }
HTTP request headers
- Content-Type: application/json
- Accept: application/json
notifyNotifySendSms
NotifyNotifySend200Response notifyNotifySendSms(sync, notifySendRequest)
Send an SMS notification
Convenience route that pins `channel: sms`. Any `channel` in the body is overridden. Otherwise identical to `POST /v1/notify/send` — `sync=true` required, org derived from the validated principal, single vs. list response shape.
Example
// Import classes:
//import ai.hanzo.sdk.infrastructure.*
//import ai.hanzo.sdk.models.*
val apiInstance = SendApi()
val sync : kotlin.String = sync_example // kotlin.String | Must be `true`; otherwise `503`.
val notifySendRequest : NotifySendRequest = {"to":["+15551234567"],"event":"iam.otp_sent","template_vars":{"otp":"482913","app":"Hanzo"}} // NotifySendRequest |
try {
val result : NotifyNotifySend200Response = apiInstance.notifyNotifySendSms(sync, notifySendRequest)
println(result)
} catch (e: ClientException) {
println("4xx response calling SendApi#notifyNotifySendSms")
e.printStackTrace()
} catch (e: ServerException) {
println("5xx response calling SendApi#notifyNotifySendSms")
e.printStackTrace()
}
Parameters
| sync | kotlin.String| Must be `true`; otherwise `503`. | [enum: true] |
| Name | Type | Description | Notes |
|---|---|---|---|
| notifySendRequest | NotifySendRequest |
Return type
Authorization
Configure bearerAuth statically:
ApiClient.accessToken = ""
Configure bearerAuth dynamically:
apiInstance.accessTokenProvider = { "" }
HTTP request headers
- Content-Type: application/json
- Accept: application/json