alef 0.80.0

Opinionated polyglot binding generator for Rust libraries
Documentation
require "{{ require_path }}"
{% if expects_error %}begin
{% endif %}
{% for line in setup_lines %}
{% if expects_error %}  {% endif %}{{ line }}
{% endfor %}
{% if client_factory %}
{% if expects_error %}  {% endif %}api_key = ENV.fetch("{{ api_key_var }}")
{% if expects_error %}  {% endif %}client = {{ receiver }}.{{ client_factory }}(api_key)
{% endif %}
{% if returns_void %}
{% if expects_error %}  {% endif %}{{ call_receiver }}.{{ function }}({{ args }})
{% elif is_streaming %}
{% if expects_error %}  {% endif %}{{ result_var }} = {{ call_receiver }}.{{ function }}({{ args }}).to_a
{% else %}
{% if expects_error %}  {% endif %}{{ result_var }} = {{ call_receiver }}.{{ function }}({{ args }})
{% endif %}
{% if not expects_error and not returns_void %}
{% if presentation %}
{% for operation in presentation %}
{% if operation.kind == "show" %}
puts {{ operation.expression }}{{ "" if operation.display else ".inspect" }}
{% else %}
{% if operation.optional %}({{ operation.expression }} || []){% else %}{{ operation.expression }}{% endif %}.each do |{{ operation.item }}|
{% for field in operation.fields %}
  puts {{ field }}{{ "" if operation.display else ".inspect" }}
{% endfor %}
end
{% endif %}
{% endfor %}
{% else %}
puts {{ result_var }}.inspect
{% endif %}
{% endif %}
{% if expects_error %}rescue StandardError => error
  warn "#{error.class}: #{error.message}"
end
{% endif %}