Changeset View
Changeset View
Standalone View
Standalone View
swh/web/templates/api/apidoc.html
Show All 29 Lines | |||||
{% endblock %} | {% endblock %} | ||||
{% block content %} | {% block content %} | ||||
<div class='swh-apidoc'> | <div class='swh-apidoc'> | ||||
{% if description %} | {% if description %} | ||||
<div> | <div> | ||||
<h4> Description </h4> | <h4> Description </h4> | ||||
{{ description | safe_docstring_display | safe }} | {{ description | docstring_display | safe }} | ||||
</div> | </div> | ||||
{% endif %} | {% endif %} | ||||
{% if response_data is not None %} | {% if response_data is not None %} | ||||
<div> | <div> | ||||
<h4>Request</h4> | <h4>Request</h4> | ||||
<pre><strong>{{ request.method }}</strong> {{ request.build_absolute_uri }}</pre> | <pre><strong>{{ request.method }}</strong> {{ request.build_absolute_uri }}</pre> | ||||
<hr/> | <hr/> | ||||
<h4>Response</h4> | <h4>Response</h4> | ||||
Show All 19 Lines | <table class="m-x-auto table"> | ||||
<tr> | <tr> | ||||
<th>URL</th> | <th>URL</th> | ||||
<th>Allowed Methods</th> | <th>Allowed Methods</th> | ||||
</tr> | </tr> | ||||
</thead> | </thead> | ||||
<tbody> | <tbody> | ||||
{% for url in urls %} | {% for url in urls %} | ||||
<tr> | <tr> | ||||
<td>{{ url.rule | safe_docstring_display | safe }}</td> | <td>{{ url.rule | docstring_display | safe }}</td> | ||||
<td>{{ url.methods | dictsort:0 | join:', ' }}</td> | <td>{{ url.methods | dictsort:0 | join:', ' }}</td> | ||||
</tr> | </tr> | ||||
{% endfor %} | {% endfor %} | ||||
</tbody> | </tbody> | ||||
</table> | </table> | ||||
</div> | </div> | ||||
<hr/> | <hr/> | ||||
{% endif %} | {% endif %} | ||||
{% if args and args|length > 0 %} | {% if args and args|length > 0 %} | ||||
<div> | <div> | ||||
<h4> Arguments </h4> | <h4> Arguments </h4> | ||||
{% for arg in args %} | {% for arg in args %} | ||||
<dl class="row"> | <dl class="row"> | ||||
<dt class="col col-md-2 text-right"> {{ arg.name }} ({{ arg.type }}) </dt> | <dt class="col col-md-2 text-right"> {{ arg.name }} ({{ arg.type }}) </dt> | ||||
<dd class="col col-md-9"> {{ arg.doc | safe_docstring_display | safe }} </dd> | <dd class="col col-md-9"> {{ arg.doc | docstring_display | safe }} </dd> | ||||
</dl> | </dl> | ||||
{% endfor %} | {% endfor %} | ||||
</div> | </div> | ||||
<hr/> | <hr/> | ||||
{% endif %} | {% endif %} | ||||
{% if params and params|length > 0 %} | {% if params and params|length > 0 %} | ||||
<div> | <div> | ||||
<h4> Query parameters </h4> | <h4> Query parameters </h4> | ||||
{% for param in params %} | {% for param in params %} | ||||
<dl class="row"> | <dl class="row"> | ||||
<dt class="col col-md-2 text-right"> {{ param.name }} ({{ param.type }}) </dt> | <dt class="col col-md-2 text-right"> {{ param.name }} ({{ param.type }}) </dt> | ||||
<dd class="col col-md-9"> {{ param.doc | safe_docstring_display | safe }} </dd> | <dd class="col col-md-9"> {{ param.doc | docstring_display | safe }} </dd> | ||||
</dl> | </dl> | ||||
{% endfor %} | {% endfor %} | ||||
</div> | </div> | ||||
<hr/> | <hr/> | ||||
{% endif %} | {% endif %} | ||||
{% if reqheaders and reqheaders|length > 0 %} | {% if reqheaders and reqheaders|length > 0 %} | ||||
<div> | <div> | ||||
<h4> Request headers </h4> | <h4> Request headers </h4> | ||||
{% for header in reqheaders %} | {% for header in reqheaders %} | ||||
<dl class="row"> | <dl class="row"> | ||||
<dt class="col col-md-2 text-right"> {{ header.name }} </dt> | <dt class="col col-md-2 text-right"> {{ header.name }} </dt> | ||||
<dd class="col col-md-9"> {{ header.doc | safe_docstring_display | safe }} </dd> | <dd class="col col-md-9"> {{ header.doc | docstring_display | safe }} </dd> | ||||
</dl> | </dl> | ||||
{% endfor %} | {% endfor %} | ||||
</div> | </div> | ||||
<hr/> | <hr/> | ||||
{% endif %} | {% endif %} | ||||
{% if input_type %} | {% if input_type %} | ||||
<div> | <div> | ||||
<h4> Request data </h4> | <h4> Request data </h4> | ||||
<dl class="row"> | <dl class="row"> | ||||
<dt class="col col-md-2 text-right"> {{ input_type }} </dt> | <dt class="col col-md-2 text-right"> {{ input_type }} </dt> | ||||
<dd class="col col-md-9"> | <dd class="col col-md-9"> | ||||
<p> | <p> | ||||
{% if input_type == 'array' and inputs_list == '' %} | {% if input_type == 'array' and inputs_list == '' %} | ||||
{{ inputs.0.doc | safe }} | {{ inputs.0.doc | safe }} | ||||
{% elif input_type == 'array' and inputs_list != '' %} | {% elif input_type == 'array' and inputs_list != '' %} | ||||
an array of objects containing the following keys: | an array of objects containing the following keys: | ||||
{% elif input_type == 'octet stream' %} | {% elif input_type == 'octet stream' %} | ||||
raw data as an octet stream | raw data as an octet stream | ||||
{% elif input_type == 'object' %} | {% elif input_type == 'object' %} | ||||
an object containing the following keys: | an object containing the following keys: | ||||
{% endif %} | {% endif %} | ||||
{% if inputs_list != '' %} | {% if inputs_list != '' %} | ||||
{{ inputs_list | safe_docstring_display | safe }} | {{ inputs_list | docstring_display | safe }} | ||||
{% endif %} | {% endif %} | ||||
</p> | </p> | ||||
</dd> | </dd> | ||||
</dl> | </dl> | ||||
</div> | </div> | ||||
<hr/> | <hr/> | ||||
{% endif %} | {% endif %} | ||||
{% if resheaders and resheaders|length > 0 %} | {% if resheaders and resheaders|length > 0 %} | ||||
<div> | <div> | ||||
<h4> Response headers </h4> | <h4> Response headers </h4> | ||||
{% for header in resheaders %} | {% for header in resheaders %} | ||||
<dl class="row"> | <dl class="row"> | ||||
<dt class="col col-md-2 text-right"> {{ header.name }} </dt> | <dt class="col col-md-2 text-right"> {{ header.name }} </dt> | ||||
<dd class="col col-md-9"> {{ header.doc | safe_docstring_display | safe }} </dd> | <dd class="col col-md-9"> {{ header.doc | docstring_display | safe }} </dd> | ||||
</dl> | </dl> | ||||
{% endfor %} | {% endfor %} | ||||
</div> | </div> | ||||
<hr/> | <hr/> | ||||
{% endif %} | {% endif %} | ||||
{% if return_type %} | {% if return_type %} | ||||
<div> | <div> | ||||
<h4> Returns </h4> | <h4> Returns </h4> | ||||
<dl class="row"> | <dl class="row"> | ||||
<dt class="col col-md-2 text-right"> {{ return_type }} </dt> | <dt class="col col-md-2 text-right"> {{ return_type }} </dt> | ||||
<dd class="col col-md-9"> | <dd class="col col-md-9"> | ||||
<p> | <p> | ||||
{% if return_type == 'array' and returns_list == '' %} | {% if return_type == 'array' and returns_list == '' %} | ||||
{{ returns.0.doc | safe }} | {{ returns.0.doc | safe }} | ||||
{% elif return_type == 'array' and returns_list != '' %} | {% elif return_type == 'array' and returns_list != '' %} | ||||
an array of objects containing the following keys: | an array of objects containing the following keys: | ||||
{% elif return_type == 'octet stream' %} | {% elif return_type == 'octet stream' %} | ||||
raw data as an octet stream | raw data as an octet stream | ||||
{% elif return_type == 'object' %} | {% elif return_type == 'object' %} | ||||
an object containing the following keys: | an object containing the following keys: | ||||
{% endif %} | {% endif %} | ||||
{% if returns_list != '' %} | {% if returns_list != '' %} | ||||
{{ returns_list | safe_docstring_display | safe }} | {{ returns_list | docstring_display | safe }} | ||||
{% endif %} | {% endif %} | ||||
</p> | </p> | ||||
</dd> | </dd> | ||||
</dl> | </dl> | ||||
</div> | </div> | ||||
<hr/> | <hr/> | ||||
{% endif %} | {% endif %} | ||||
{% if status_codes and status_codes|length > 0 %} | {% if status_codes and status_codes|length > 0 %} | ||||
<div> | <div> | ||||
<h4> HTTP status codes </h4> | <h4> HTTP status codes </h4> | ||||
{% for status in status_codes %} | {% for status in status_codes %} | ||||
<dl class="row"> | <dl class="row"> | ||||
<dt class="col col-md-2 text-right"> {{ status.code }} </dt> | <dt class="col col-md-2 text-right"> {{ status.code }} </dt> | ||||
<dd class="col col-md-9"> {{ status.doc | safe_docstring_display | safe }} </dd> | <dd class="col col-md-9"> {{ status.doc | docstring_display | safe }} </dd> | ||||
</dl> | </dl> | ||||
{% endfor %} | {% endfor %} | ||||
</div> | </div> | ||||
<hr/> | <hr/> | ||||
{% endif %} | {% endif %} | ||||
{% if examples and examples|length > 0 %} | {% if examples and examples|length > 0 %} | ||||
<div> | <div> | ||||
<h4> Examples </h4> | <h4> Examples </h4> | ||||
Show All 17 Lines |