@php use Knuckles\Scribe\Tools\Utils as u; /** @var Knuckles\Camel\Output\OutputEndpointData $endpoint */ @endphp

{{ $endpoint->name() }}

@component('scribe::components.badges.auth', ['authenticated' => $endpoint->isAuthed()]) @endcomponent

{!! Parsedown::instance()->text($endpoint->metadata->description ?: '') !!}
{{ u::trans("scribe::endpoint.example_request") }}:
@foreach($metadata['example_languages'] as $language)
@include("scribe::partials.example-requests.$language")
@endforeach
@if($endpoint->isGet() || $endpoint->hasResponses()) @foreach($endpoint->responses as $response)

{{ u::trans("scribe::endpoint.example_response") }} ({{ $response->fullDescription() }}):

@if(count($response->headers))
Show headers
@foreach($response->headers as $header => $value)
{{ $header }}: {{ is_array($value) ? implode('; ', $value) : $value }}
@endforeach 
@endif
@if(is_string($response->content) && Str::startsWith($response->content, "<>"))
{!! u::trans("scribe::endpoint.responses.binary") !!} - {{ htmlentities(str_replace("<>", "", $response->content)) }}
@elseif($response->status == 204)
{!! u::trans("scribe::endpoint.responses.empty") !!}
@else
@php($parsed = json_decode($response->content))
{{-- If response is a JSON string, prettify it. Otherwise, just print it --}}
{!! htmlentities($parsed != null ? json_encode($parsed, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) : $response->content) !!}
@endif 
@endforeach @endif

{{ u::trans("scribe::endpoint.request") }}    @if($metadata['try_it_out']['enabled'] ?? false)    @endif

@foreach($endpoint->httpMethods as $method)

@component('scribe::components.badges.http-method', ['method' => $method])@endcomponent {{$endpoint->uri}}

@endforeach @if(count($endpoint->headers))

{{ u::trans("scribe::endpoint.headers") }}

@foreach($endpoint->headers as $name => $example)