endpoint.blade.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. ## {{ $route['metadata']['title'] ?: $route['uri']}}
  2. @component('scribe::components.badges.auth', ['authenticated' => $route['metadata']['authenticated']])
  3. @endcomponent
  4. {!! $route['metadata']['description'] ?: ''!!}
  5. > Example request:
  6. @foreach($settings['languages'] as $language)
  7. @include("scribe::partials.example-requests.$language")
  8. @endforeach
  9. @if(in_array('GET',$route['methods']) || (isset($route['showresponse']) && $route['showresponse']))
  10. @foreach($route['responses'] as $response)
  11. > Example response ({{$response['description'] ?? $response['status']}}):
  12. ```json
  13. @if(is_object($response['content']) || is_array($response['content']))
  14. {!! json_encode($response['content'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) !!}
  15. @elseif(is_string($response['content']) && \Illuminate\Support\Str::startsWith($response['content'], "<<binary>>"))
  16. <Binary data> - {{ str_replace("<<binary>>","",$response['content']) }}
  17. @elseif($response['status'] == 204)
  18. <Empty response>
  19. @elseif(is_string($response['content']) && json_decode($response['content']) == null && $response['content'] !== null)
  20. {{-- If response is a non-JSON string, just print it --}}
  21. {!! $response['content'] !!}
  22. @else
  23. {!! json_encode(json_decode($response['content']), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) !!}
  24. @endif
  25. ```
  26. @endforeach
  27. @endif
  28. ### Request
  29. @foreach($route['methods'] as $method)
  30. @component('scribe::components.badges.http-method', ['method' => $method])@endcomponent **`{{$route['uri']}}`**
  31. @endforeach
  32. @if(count($route['urlParameters']))
  33. <h4 class="fancy-heading-panel"><b>URL Parameters</b></h4>
  34. @foreach($route['urlParameters'] as $attribute => $parameter)
  35. @component('scribe::components.field-details', [
  36. 'name' => $attribute,
  37. 'type' => null,
  38. 'required' => $parameter['required'] ?? true,
  39. 'description' => $parameter['description'],
  40. ])
  41. @endcomponent
  42. @endforeach
  43. @endif
  44. @if(count($route['queryParameters']))
  45. <h4 class="fancy-heading-panel"><b>Query Parameters</b></h4>
  46. @foreach($route['queryParameters'] as $attribute => $parameter)
  47. @component('scribe::components.field-details', [
  48. 'name' => $attribute,
  49. 'type' => null,
  50. 'required' => $parameter['required'] ?? true,
  51. 'description' => $parameter['description'],
  52. ])
  53. @endcomponent
  54. @endforeach
  55. @endif
  56. @if(count($route['bodyParameters']))
  57. <h4 class="fancy-heading-panel"><b>Body Parameters</b></h4>
  58. @foreach($route['bodyParameters'] as $attribute => $parameter)
  59. @component('scribe::components.field-details', [
  60. 'name' => $attribute,
  61. 'type' => $parameter['type'] ?? null,
  62. 'required' => $parameter['required'] ?? true,
  63. 'description' => $parameter['description'],
  64. ])
  65. @endcomponent
  66. @endforeach
  67. @endif
  68. @if(count($route['responseFields'] ?? []))
  69. <h4 class="fancy-heading-panel"><b>Response Fields</b></h4>
  70. @foreach($route['responseFields'] as $name => $field)
  71. @component('scribe::components.field-details', [
  72. 'name' => $name,
  73. 'type' => $field['type'],
  74. 'required' => true,
  75. 'description' => $field['description'],
  76. ])
  77. @endcomponent
  78. @endforeach
  79. @endif