BookStack/resources/views/api-docs/parts/endpoint.blade.php
Dan Brown 6f1bdbf771
Added API search endpoint
Is a little awkward, emulates a 'list' API endpoint but has unstable
paging and does not support filters/sort. This is detailed on the
endpoint though.

Made some updates to the docs system to better support parameters
and examples on GET requests.

Includes tests to cover.

For #909
2021-11-14 16:28:01 +00:00

52 lines
1.8 KiB
PHP

<h6 class="text-uppercase text-muted float right">{{ $endpoint['controller_method_kebab'] }}</h6>
<h5 id="{{ $endpoint['name'] }}" class="text-mono mb-m">
<span class="api-method" data-method="{{ $endpoint['method'] }}">{{ $endpoint['method'] }}</span>
@if($endpoint['controller_method_kebab'] === 'list')
<a style="color: inherit;" target="_blank" rel="noopener" href="{{ url($endpoint['uri']) }}">{{ url($endpoint['uri']) }}</a>
@else
{{ url($endpoint['uri']) }}
@endif
</h5>
<p class="mb-m">{{ $endpoint['description'] ?? '' }}</p>
@if($endpoint['body_params'] ?? false)
<details class="mb-m">
<summary class="text-muted">{{ $endpoint['method'] === 'GET' ? 'Query' : 'Body' }} Parameters</summary>
<table class="table">
<tr>
<th>Param Name</th>
<th>Value Rules</th>
</tr>
@foreach($endpoint['body_params'] as $paramName => $rules)
<tr>
<td>{{ $paramName }}</td>
<td>
@foreach($rules as $rule)
<code class="mr-xs">{{ $rule }}</code>
@endforeach
</td>
</tr>
@endforeach
</table>
</details>
@endif
@if($endpoint['example_request'] ?? false)
<details details-highlighter class="mb-m">
<summary class="text-muted">Example Request</summary>
<pre><code class="language-json">{{ $endpoint['example_request'] }}</code></pre>
</details>
@endif
@if($endpoint['example_response'] ?? false)
<details details-highlighter class="mb-m">
<summary class="text-muted">Example Response</summary>
<pre><code class="language-json">{{ $endpoint['example_response'] }}</code></pre>
</details>
@endif
@if(!$loop->last)
<hr>
@endif