1
0
mirror of synced 2025-12-21 10:57:10 -05:00
Files
docs/includes/rest_operation.html
Robert Sese a9571cb7b1 Make child param IDs unique (#20630)
* Make child param IDs unique

* Use span instead of h4

* Add bottom margin
2021-08-04 17:00:11 +00:00

152 lines
6.1 KiB
HTML

<div>
<div>
<h3 id="{{operation.slug}}" class="pt-3">
<a href="#{{operation.slug}}">{{operation.summary}}</a>
</h3>
{{operation.descriptionHTML}}
</div>
<pre><code><span class="color-bg-info-inverse color-text-inverse rounded-1 px-2 py-1" style="text-transform: uppercase">{{operation.verb}}</span> {{operation.requestPath}}</code></pre>
<div>
{%- if operation.parameters.size > 0 or operation.bodyParameters.size > 0 -%}
<h4 id="{{operation.slug}}--parameters">
<a href="#{{operation.slug}}--parameters">{%- data ui.products.rest.reference.parameters -%}</a>
</h4>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>In</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<!--
Previews require an `accept` header. These used to be documented
as `operation.parameters` but have moved to `operation.x-github.previews`
-->
<tr>
<td><code>accept</code></td>
<td class="opacity-70">string</td>
<td class="opacity-70">header</td>
<td class="opacity-70">
<p>
{%- if operation.hasRequiredPreviews -%}
This API is under preview and subject to change.
{%- else -%}
Setting to <code>application/vnd.github.v3+json</code> is recommended.
{%- endif -%}
{%- if operation.x-github.previews.size > 0 -%}
<a href="#{{operation.slug}}-preview-notices">
{%- if operation.x-github.previews.size > 1 -%}
{%- data ui.products.rest.reference.see_preview_notices -%}
{%- else -%}
{%- data ui.products.rest.reference.see_preview_notice -%}
{%- endif -%}
</a>
{%- endif -%}
</p>
</td>
</tr>
{%- for param in operation.parameters -%}
<tr>
<td><code>{{ param.name }}</code></td>
<td class="opacity-70">{{ param.schema.type }}</td>
<td class="opacity-70">{{ param.in }}</td>
<td class="opacity-70">
{{ param.descriptionHTML }}
{%- if param.schema.default != nil -%}
Default: <code>{{ param.schema.default }}</code>
{%- endif -%}
</td>
</tr>
{%- endfor -%}
{%- for bodyParam in operation.bodyParameters -%}
<tr>
<td><code>{{ bodyParam.name }}</code></td>
<td class="opacity-70">{{ bodyParam.type }}</td>
<td class="opacity-70">{{ bodyParam.in }}</td>
<td class="opacity-70">
{{ bodyParam.description }}
{%- if bodyParam.default != nil -%}
Default: <code>{{ bodyParam.default }}</code>
{%- endif -%}
</td>
</tr>
{%- if bodyParam.childParamsGroups.size > 0 -%}
<tr style="border: none;">
<td colspan="4" class="has-nested-table">
{%- for childParamsGroup in bodyParam.childParamsGroups -%}
<details>
<summary class="color-text-secondary"><span class="d-inline-block mb-3" id="{{ operation.slug }}-{{ childParamsGroup.id }}">Properties of the <code>{{ childParamsGroup.parentName }}</code> {{ childParamsGroup.parentType }}</span></summary>
<table>
<tbody>
{%- for childParam in childParamsGroup.params -%}
<tr>
<td class="opacity-60"><code>{{ childParam.name }}</code> ({{ childParam.type }})</td>
<td class="opacity-60">{{ childParam.description }}</td>
</tr>
{%- endfor -%}
</tbody>
</table>
</details>
{%- endfor -%}
</td>
</tr>
{%- endif -%}
{%- endfor -%}
</tbody>
</table>
{%- endif -%}
{%- if operation.x-codeSamples.size > 0 -%}
<h4 id="{{operation.slug}}--code-samples">
<a href="#{{operation.slug}}--code-samples">{%- data ui.products.rest.reference.code_samples -%}</a>
</h4>
{%- for sample in operation.x-codeSamples -%}
{%- unless sample.lang == "Ruby" -%}
<h5>
{%- if sample.lang == "JavaScript" -%}
{{sample.lang}} (<a href="https://github.com/octokit/core.js#readme">@octokit/core.js</a>)
{%- else -%}
{{sample.lang}}
{%- endif -%}
</h5>
{{sample.html}}
{%- endunless -%}
{%- endfor -%}
{%- endif -%}
{%- for response in operation.responses -%}
<h4>{{ response.description }}</h4>
<pre><code>Status: {{ response.httpStatusCode }} {{ response.httpStatusMessage }}</code></pre>
<div class="height-constrained-code-block">{{ response.payload }}</div>
{%- endfor -%}
{%- if operation.notes.size > 0 or operation.x-github.enabledForGitHubApps -%}
<h4>Notes</h4>
<ul class="mt-2">
{%- if operation.x-github.enabledForGitHubApps -%}
<li><a href="{{ restGitHubAppsLink }}">Works with GitHub Apps</a></li>
{%- endif -%}
{%- for note in operation.notes -%}
<li>{{ note }}</li>
{%- endfor -%}
</ul>
{%- endif -%}
{%- if operation.x-github.previews.size > 0 -%}
<h4 id="{{operation.slug}}-preview-notices">
{%- if operation.x-github.previews.size > 1 -%}
{%- data ui.products.rest.reference.preview_notices -%}
{%- else -%}
{%- data ui.products.rest.reference.preview_notice -%}
{%- endif -%}
</h4>
{%- for preview in operation.x-github.previews -%}
<div class="extended-markdown note border rounded-1 mb-4 p-3 color-border-info color-bg-info f5">
{{ preview.html }}
{%- if preview.required -%}☝️ {%- data ui.products.rest.reference.preview_header_is_required -%}.{%- endif -%}
</div>
{%- endfor -%}
{%- endif -%}
</div>
<hr>
</div>