{% for method_name in spec.supports %}
{% if spec.supports[method_name] and spec.supports[method_name] != spec.supports|attr(method_name) %}
{% set method = spec.supports[method_name] %}
{% else %}
{% set method = {} %}
{% endif %}
{% if not spec.entity %}
{% if method_name == 'get_all' %}
GET |
{{ path }}/ |
|
{% if 'response_doc' in method %}
{{ method.response_doc|join|safe }}
{% else %}
A collection of {{ avro_link(entity) }}
{% endif %}
|
{% if 'doc' in method %}
{{ method.doc|join|safe }}
{% else %}
Gets all the {{ avro_link(entity) }}s in the {{ code(spec.name) }} collection.
{% endif %}
|
{% elif method_name == 'count' %}
GET |
{{ path }}/count/ |
|
{% if 'response_doc' in method %}
{{ method.response_doc|join|safe }}
{% else %}
{{ code('int') }}
{% endif %}
|
{% if 'doc' in method %}
{{ method.doc|join|safe }}
{% else %}
The count of {{ code(spec.name) }}.
{% endif %}
|
{% elif method_name == 'get' %}
GET |
{{ path }}/[{{ spec.identifier.name }}]/ |
|
{% if 'response_doc' in method %}
{{ method.response_doc|join|safe }}
{% else %}
{{ avro_link(entity) }} identified by {{ code(spec.identifier.name) }}
{% endif %}
|
{{ method.doc|join|safe }}
|
{% elif method_name == 'create' %}
POST |
{{ path }}/ |
{% if 'body_doc' in method %}
{{ method.body_doc|join|safe }}
{% elif entity %}
{{ avro_link(entity) }} to create
{% endif %}
|
{% if 'response_doc' in method %}
{{ method.response_doc|join|safe }}
{% elif entity %}
URI to pointing to new {{ avro_link(entity) }}
{% endif %}
|
{% if 'doc' in method %}
{{ method.doc|join|safe }}
{% else %}
Creates a new {{ avro_link(entity) }}.
{% endif %}
|
{% elif method_name == 'update' %}
PUT |
{{ path }}/[{{ spec.identifier.name }}]/ |
{% if 'body_doc' in method %}
{{ method.body_doc|join|safe }}
{% elif entity %}
A sparse {{ avro_link(entity) }} (only set fields will be updated)
{% endif %}
|
{{ method.response_doc|join|safe }}
|
{% if 'doc' in method %}
{{ method.doc|join|safe }}
{% else %}
Applies a partial update to the {{ avro_link(entity) }}.
TODO: This kind of breaks the semantics of standard PUT, which should replace the object
{% endif %}
|
{% elif method_name == 'delete' %}
DELETE |
{{ path }}/[{{ spec.identifier.name }}]/ |
|
{{ method.response_doc|join|safe }}
|
{% if 'doc' in method %}
{{ method.doc|join|safe }}
{% else %}
Deletes the {{ avro_link(entity) }} identified by {{ code(spec.identifier.name) }}.
{% endif %}
|
{% elif method_name == 'batch_get' %}
GET |
{{ path }}?{{ spec.identifier.name }}=[{{ spec.identifier.name }}1]&{{ spec.identifier.name }}=[{{ spec.identifier.name }}2]&... |
|
{% if 'response_doc' in method %}
{{ method.response_doc|join|safe }}
{% else %}
An array of {{ avro_link(entity) }} matching the given {{ code(spec.identifier.name + 's') }}
{% endif %}
|
{{ method.doc|join|safe }}
|
{% elif method_name == 'batch_create' %}
POST |
{{ path }}?multi= |
{% if 'body_doc' in method %}
{{ method.body_doc|join|safe }}
{% elif entity %}
An array of {{ avro_link(entity) }} to create
{% endif %}
|
{% if 'response_doc' in method %}
{{ method.response_doc|join|safe }}
{% elif entity %}
An array of URIs pointing to the new {{ avro_link(entity) }}
{% endif %}
|
{% if 'doc' in method %}
{{ method.doc|join|safe }}
{% else %}
Batch creation of {{ avro_link(entity) }}.
{% endif %}
|
{% elif method_name == 'batch_update' %}
PUT |
{{ path }}?multi= |
{% if 'body_doc' in method %}
{{ method.body_doc|join|safe }}
{% elif entity %}
An array of sparse {{ avro_link(entity) }} (only set fields will be updated). The
{{ code(spec.identifier.name + 's') }} MUST be set on each {{ avro_link(entity) }} passed in.
{% endif %}
|
{% if 'response_doc' in method %}
{{ method.response_doc|join|safe }}
{% endif %}
|
{% if 'doc' in method %}
{{ method.doc|join|safe }}
{% else %}
Batch partial updates to {{ avro_link(entity) }} identified by {{ code(spec.identifier.name + 's') }} in
the request body.
TODO: This kind of breaks the semantics of standard PUT, which should replace the collection
{% endif %}
|
{% elif method_name == 'batch_delete' %}
DELETE |
{{ path }}?{{ spec.identifier.name }}=[{{ spec.identifier.name }}1]&{{ spec.identifier.name }}=[{{ spec.identifier.name }}2]&... |
|
{% if 'response_doc' in method %}
{{ method.response_doc|join|safe }}
{% endif %}
|
{% if 'doc' in method %}
{{ method.doc|join|safe }}
{% else %}
Batch delete of the {{ avro_link(entity) }} identified by the given {{ code(spec.identifier.name + 's') }}
{% endif %}
|
{% endif %}
{% else %}
{% if method_name == 'get' %}
GET |
{{ path }}/ |
|
{% if 'response_doc' in method %}
{{ method.response|join|safe }}
{% else %}
{{ avro_link(entity) }}
{% endif %}
|
{% if 'doc' in method %}
{{ method.doc|join|safe }}
{% else %}
Gets the {{ code(spec.name) }} {{ avro_link(entity) }}
{% endif %}
|
{% elif method_name == 'create' %}
POST |
{{ path }}/ |
{% if 'body_doc' in method %}
{{ method.body_doc|join|safe }}
{% else %}
{{ avro_link(entity) }} to create
{% endif %}
|
{% if 'response_doc' in method %}
{{ method.response|join|safe }}
{% else %}
URI to pointing to the new {{ avro_link(entity) }}
{% endif %}
|
{% if 'doc' in method %}
{{ method.doc|join|safe }}
{% else %}
Creates a new {{ code(spec.name) }} {{ avro_link(entity) }}.
TODO: Is it an error if you try to create one when one already exists? Does
this even get added to the parent collection?
{% endif %}
|
{% elif method_name == 'update' %}
PUT |
{{ path }}/ |
{% if 'body_doc' in method %}
{{ method.body_doc|join|safe }}
{% else %}
A sparse {{ avro_link(entity) }} (only set fields will be updated)
{% endif %}
|
{{ method.response|join|safe }}
|
{% if 'doc' in method %}
{{ method.doc|join|safe }}
{% else %}
Applies a partial update to the {{ code(spec.name) }} {{ avro_link(entity) }}.
TODO: This kind of breaks the semantics of standard PUT, which should replace the object
{% endif %}
|
{% elif method_name == 'delete' %}
DELETE |
{{ path }}/ |
|
{{ method.response|join|safe }}
|
{% if 'doc' in method %}
{{ method.doc|join|safe }}
{% else %}
Deletes the {{ code(spec.name) }} {{ avro_link(entity) }}.
{% endif %}
|
{% endif %}
{% endif %}
{% endfor %}