forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rest_operation.html
151 lines (151 loc) · 5.96 KB
/
rest_operation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<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"><h4 id="{{ childParamsGroup.id }}">Properties of the <code>{{ childParamsGroup.parentName }}</code> {{ childParamsGroup.parentType }}</h4></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>