Files
asterisk/rest-api-templates/api.wiki.mustache
George Joseph 3868f7cb47 docs: Enable since/version handling for XML, CLI and ARI documentation
* Added the "since" element to the XML configObject and configOption elements
  in appdocsxml.dtd.

* Added the "Since" section to the following CLI output:
  ```
  config show help <module> <object>
  config show help <module> <object> <option>
  core show application <app>
  core show function <func>
  manager show command <command>
  manager show event <event>
  agi show commands topic <topic>
  ```

* Refactored the commands above to output their sections in the same order:
  Synopsis, Since, Description, Syntax, Arguments, SeeAlso

* Refactored the commands above so they all use the same pattern for writing
  the output to the CLI.

* Fixed several memory leaks caused by failure to free temporary output
  buffers.

* Added a "since" array to the mustache template for the top-level resources
  (Channel, Endpoint, etc.) and to the paths/methods underneath them. These
  will be added to the generated markdown if present.
  Example:
  ```
    "resourcePath": "/api-docs/channels.{format}",
    "requiresModules": [
        "res_stasis_answer",
        "res_stasis_playback",
        "res_stasis_recording",
        "res_stasis_snoop"
    ],
    "since": [
        "18.0.0",
        "21.0.0"
    ],
    "apis": [
        {
            "path": "/channels",
            "description": "Active channels",
            "operations": [
                {
                    "httpMethod": "GET",
                    "since": [
                        "18.6.0",
                        "21.8.0"
                    ],
                    "summary": "List all active channels in Asterisk.",
                    "nickname": "list",
                    "responseClass": "List[Channel]"
                },

  ```

NOTE:  No versioning information is actually added in this commit.
Those will be added separately and instructions for adding and maintaining
them will be published on the documentation site at a later date.
2025-01-16 08:13:21 -07:00

86 lines
2.4 KiB
Plaintext

{{#api_declaration}}
# {{name_title}}
{{#since}}
## Since: {{since}}
{{/since}}
| Method | Path (Parameters are case-sensitive) | Return Model | Summary | Since |
|:------ |:------------------------------------ |:------------ |:------- |:----- |
{{#apis}}
{{#operations}}
| {{http_method}} | [{{wiki_path}}](#{{nickname_lc}}) | {{#response_class}}{{#is_primitive}}{{name}}{{/is_primitive}}{{^is_primitive}}[{{wiki_name}}]({{wiki_prefix}}Asterisk_REST_Data_Models#{{lc_singular_name}}){{/is_primitive}}{{/response_class}} | {{{summary}}} | {{since}} |
{{/operations}}
{{/apis}}
{{#apis}}
{{#operations}}
---
[//]: # (anchor:{{nickname_lc}})
## {{nickname}}
{{#since}}
### Since: {{since}}
{{/since}}
### {{http_method}} {{wiki_path}}
{{{wiki_summary}}}{{#wiki_notes}} {{{wiki_notes}}}{{/wiki_notes}}
{{#has_path_parameters}}
### Path parameters
Parameters are case-sensitive.
{{#path_parameters}}
* {{name}}: _{{data_type}}_ - {{{wiki_description}}}
{{#default_value}}
* Default: {{default_value}}
{{/default_value}}
{{#wiki_allowable_values}}
* {{wiki_allowable_values}}
{{/wiki_allowable_values}}
{{/path_parameters}}
{{/has_path_parameters}}
{{#has_query_parameters}}
### Query parameters
{{#query_parameters}}
* {{name}}: _{{data_type}}_ -{{#required}} *(required)*{{/required}} {{{wiki_description}}}
{{#default_value}}
* Default: {{default_value}}
{{/default_value}}
{{#wiki_allowable_values}}
* {{wiki_allowable_values}}
{{/wiki_allowable_values}}
{{#allow_multiple}}
* Allows comma separated values.
{{/allow_multiple}}
{{/query_parameters}}
{{/has_query_parameters}}
{{#has_body_parameter}}
### Body parameter
{{#body_parameter}}
* {{name}}: {{data_type}}{{#default_value}} = {{default_value}}{{/default_value}} -{{#required}} *(required)*{{/required}} {{{wiki_description}}}
{{#allow_multiple}}
* Allows comma separated values.
{{/allow_multiple}}
{{/body_parameter}}
{{/has_body_parameter}}
{{#has_header_parameters}}
### Header parameters
{{#header_parameters}}
* {{name}}: {{data_type}}{{#default_value}} = {{default_value}}{{/default_value}} -{{#required}} *(required)*{{/required}} {{{wiki_description}}}
{{#allow_multiple}}
* Allows comma separated values.
{{/allow_multiple}}
{{/header_parameters}}
{{/has_header_parameters}}
{{#has_error_responses}}
### Error Responses
{{#error_responses}}
* {{code}} - {{{wiki_reason}}}
{{/error_responses}}
{{/has_error_responses}}
{{/operations}}
{{/apis}}
{{/api_declaration}}