alef 0.67.4

Opinionated polyglot binding generator for Rust libraries
Documentation
import {{ package_name }}.*
{% if needs_mapper %}import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
{% endif %}

fun main() {% if is_async %}= kotlinx.coroutines.runBlocking {% endif %}{
{% if needs_mapper %}    val mapper = jacksonObjectMapper()
{% endif %}
{% if expects_error %}    try {
{% endif %}
{% for line in setup_lines %}    {{ line }}
{% endfor %}
{% if client_factory %}    val apiKey = requireNotNull(System.getenv("{{ api_key_var }}")) { "{{ api_key_var }} must be set" }
{% if returns_void %}    {{ class_name }}.{{ client_factory }}(apiKey = apiKey{% if base_url %}, baseUrl = "{{ base_url }}"{% endif %}).use { client -> client.{{ function_name }}({{ args }}) }
{% else %}    val {{ result_var }} = {{ class_name }}.{{ client_factory }}(apiKey = apiKey{% if base_url %}, baseUrl = "{{ base_url }}"{% endif %}).use { client -> client.{{ function_name }}({{ args }}) }
{% endif %}
{% elif returns_void %}    {{ class_name }}.{{ function_name }}({{ args }})
{% else %}    val {{ result_var }} = {{ class_name }}.{{ function_name }}({{ args }})
{% endif %}
{% if not expects_error and not returns_void %}
{% if presentation %}
{% for operation in presentation %}
{% if operation.kind == "show" %}
    println({{ operation.expression }})
{% else %}
    for ({{ operation.item }} in {{ operation.expression }}{% if operation.optional %}.orEmpty(){% endif %}) {
{% for field in operation.fields %}
        println({{ field }})
{% endfor %}
    }
{% endif %}
{% endfor %}
{% else %}
    println({{ result_var }})
{% endif %}
{% endif %}
{% if expects_error %}    } catch (error: Exception) {
        System.err.println("${error::class.simpleName}: ${error.message}")
    }
{% endif %}
}