route.blade.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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['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(\Illuminate\Support\Str::startsWith($response['content'], "<<binary>>"))
  16. Binary data - {{ str_replace("<<binary>>","",$response['content']) }}
  17. @else
  18. {!! json_encode(json_decode($response['content']), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) !!}
  19. @endif
  20. ```
  21. @endforeach
  22. @endif
  23. ### Request
  24. @foreach($route['methods'] as $method)
  25. @component('scribe::components.badges.http-method', ['method' => $method])@endcomponent **`{{$route['uri']}}`**
  26. @endforeach
  27. @if(count($route['urlParameters']))
  28. <h4 class="fancy-heading-panel"><b>URL Parameters</b></h4>
  29. @foreach($route['urlParameters'] as $attribute => $parameter)
  30. @component('scribe::components.field-description', [
  31. 'name' => $attribute,
  32. 'type' => null,
  33. 'required' => $parameter['required'] ?? true,
  34. 'description' => $parameter['description'],
  35. ])
  36. @endcomponent
  37. @endforeach
  38. @endif
  39. @if(count($route['queryParameters']))
  40. <h4 class="fancy-heading-panel"><b>Query Parameters</b></h4>
  41. @foreach($route['queryParameters'] as $attribute => $parameter)
  42. @component('scribe::components.field-description', [
  43. 'name' => $attribute,
  44. 'type' => null,
  45. 'required' => $parameter['required'] ?? true,
  46. 'description' => $parameter['description'],
  47. ])
  48. @endcomponent
  49. @endforeach
  50. @endif
  51. @if(count($route['bodyParameters']))
  52. <h4 class="fancy-heading-panel"><b>Body Parameters</b></h4>
  53. @foreach($route['bodyParameters'] as $attribute => $parameter)
  54. @component('scribe::components.field-description', [
  55. 'name' => $attribute,
  56. 'type' => $parameter['type'] ?? null,
  57. 'required' => $parameter['required'] ?? true,
  58. 'description' => $parameter['description'],
  59. ])
  60. @endcomponent
  61. @endforeach
  62. @endif
  63. @if(count($route['responseFields'] ?? []))
  64. <h4 class="fancy-heading-panel"><b>Response Fields</b></h4>
  65. @foreach($route['responseFields'] as $attribute => $parameter)
  66. @component('scribe::components.field-description', [
  67. 'name' => $attribute,
  68. 'type' => null,
  69. 'required' => true,
  70. 'description' => $parameter['description'],
  71. ])
  72. @endcomponent
  73. @endforeach
  74. @endif