<div class="row coredocs-link">

<div class="col-md-6 docs-content">
    <button
        class="btn btn-sm btn-success"
        style="float: right; margin-top: 20px"
        data-toggle="modal"
        data-target="#{{ section_key }}_{{ link_key }}_modal">
        <i class="fa fa-exchange"></i> Interact
    </button>

    <h3 id="{{ section_key }}-{{ link_key }}" class="coredocs-link-title">{{ link.title|default(link_key) }} <a href="#{{ section_key }}-{{ link_key }}"><i class="fa fa-link" aria-hidden="true"></i>
</a></h3>

    <div class="meta">
        <span class="label label-primary">{{ link.action|upper }}</span>
        <code>{{ link.url }}</code>
    </div>

    {% if link.description %}<p class="description">{{ link.description }}</p>{% endif %}

{% if get_fields(link, 'path') %}
    <h4>Path Parameters</h4>
    <p>The following parameters should be included in the URL path.</p>
    <table class="parameters table table-bordered table-striped">
        <thead>
            <tr><th>Parameter</th><th>Description</th></tr>
        </thead>
        <tbody>
            {% for field in get_fields(link, 'path') %}
            <tr><td class="parameter-name"><code>{{ field.name }}</code>{% if field.required %} <span class="label label-warning">required</span>{% endif %}</td><td>{% if field.schema.description %}{{ field.schema.description }}{% endif %}</td></tr>
            {% endfor %}
        </tbody>
    </table>
{% endif %}
{% if get_fields(link, 'query') %}
    <h4>Query Parameters</h4>
    <p>The following parameters should be included as part of a URL query string.</p>
    <table class="parameters table table-bordered table-striped">
        <thead>
            <tr><th>Parameter</th><th>Description</th></tr>
        </thead>
        <tbody>
            {% for field in get_fields(link, 'query') %}
            <tr><td class="parameter-name"><code>{{ field.name }}</code>{% if field.required %} <span class="label label-warning">required</span>{% endif %}</td><td>{% if field.schema.description %}{{ field.schema.description }}{% endif %}</td></tr>
            {% endfor %}
        </tbody>
    </table>
{% endif %}
{% if get_fields(link, 'header') %}
    <h4>Header Parameters</h4>
    <p>The following parameters should be included as HTTP headers.</p>
    <table class="parameters table table-bordered table-striped">
        <thead>
            <tr><th>Parameter</th><th>Description</th></tr>
        </thead>
        <tbody>
            {% for field in get_fields(link, 'header') %}
            <tr><td class="parameter-name"><code>{{ field.name }}</code>{% if field.required %} <span class="label label-warning">required</span>{% endif %}</td><td>{% if field.schema.description %}{{ field.schema.description }}{% endif %}</td></tr>
            {% endfor %}
        </tbody>
    </table>
{% endif %}
{% if get_fields(link, 'body') %}
    <h4>Request Body</h4>
    <p>The request body should be <code>"{{ link.encoding }}"</code> encoded, and should contain a single item.</p>
    <table class="parameters table table-bordered table-striped">
        <thead>
            <tr><th>Parameter</th><th>Description</th></tr>
        </thead>
        <tbody>
            {% for field in get_fields(link, 'body') %}
            <tr><td class="parameter-name"><code>{{ field.name }}</code>{% if field.required %} <span class="label label-warning">required</span>{% endif %}</td><td>{% if field.schema.description %}{{ field.schema.description }}{% endif %}</td></tr>
            {% endfor %}
        </tbody>
    </table>
{% elif get_fields(link, 'form') %}
    <h4>Request Body</h4>
    <p>The request body should be a <code>"{{ link.encoding }}"</code> encoded object, containing the following&nbsp;items.</p>
    <table class="parameters table table-bordered table-striped">
        <thead>
            <tr><th>Parameter</th><th>Description</th></tr>
        </thead>
        <tbody>
            {% for field in get_fields(link, 'form') %}
            <tr><td class="parameter-name"><code>{{ field.name }}</code>{% if field.required %} <span class="label label-warning">required</span>{% endif %}</td><td>{% if field.schema.description %}{{ field.schema.description }}{% endif %}</td></tr>
            {% endfor %}
        </tbody>
    </table>
{% endif %}

</div>

    <div class="col-md-6 code-samples">
        {% if 'shell' in langs %}{% include "apistar/docs/langs/shell.html" %}{% endif %}
        {% if 'python' in langs %}{% include "apistar/docs/langs/python.html" %}{% endif %}
        {% if 'javascript' in langs %}{% include "apistar/docs/langs/javascript.html" %}{% endif %}
    </div>
</div>

{% include "apistar/docs/layout/interact.html" %}
