endpoint.blade.php 2.7 KB

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