|
@@ -1,24 +1,33 @@
|
|
-<!-- START_{{$parsedRoute['id']}} -->
|
|
|
|
-@if($parsedRoute['title'] != '')## {{ $parsedRoute['title']}}
|
|
|
|
-@else## {{$parsedRoute['uri']}}
|
|
|
|
|
|
+<!-- START_{{$route['id']}} -->
|
|
|
|
+@if($route['title'] != '')## {{ $route['title']}}
|
|
|
|
+@else## {{$route['uri']}}
|
|
|
|
+@endif @if($route['authenticated'])<small style="
|
|
|
|
+ padding: 1px 9px 2px;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ white-space: nowrap;
|
|
|
|
+ color: #ffffff;
|
|
|
|
+ -webkit-border-radius: 9px;
|
|
|
|
+ -moz-border-radius: 9px;
|
|
|
|
+ border-radius: 9px;
|
|
|
|
+ background-color: #3a87ad;">Requires authentication</small>
|
|
@endif
|
|
@endif
|
|
-@if($parsedRoute['description'])
|
|
|
|
|
|
+@if($route['description'])
|
|
|
|
|
|
-{!! $parsedRoute['description'] !!}
|
|
|
|
|
|
+{!! $route['description'] !!}
|
|
@endif
|
|
@endif
|
|
|
|
|
|
> Example request:
|
|
> Example request:
|
|
|
|
|
|
```bash
|
|
```bash
|
|
-curl -X {{$parsedRoute['methods'][0]}} {{$parsedRoute['methods'][0] == 'GET' ? '-G ' : ''}}"{{ trim(config('app.docs_url') ?: config('app.url'), '/')}}/{{ ltrim($parsedRoute['uri'], '/') }}" \
|
|
|
|
- -H "Accept: application/json"@if(count($parsedRoute['headers'])) \
|
|
|
|
-@foreach($parsedRoute['headers'] as $header => $value)
|
|
|
|
|
|
+curl -X {{$route['methods'][0]}} {{$route['methods'][0] == 'GET' ? '-G ' : ''}}"{{ trim(config('app.docs_url') ?: config('app.url'), '/')}}/{{ ltrim($route['uri'], '/') }}" \
|
|
|
|
+ -H "Accept: application/json"@if(count($route['headers'])) \
|
|
|
|
+@foreach($route['headers'] as $header => $value)
|
|
-H "{{$header}}: {{$value}}" @if(! ($loop->last))\
|
|
-H "{{$header}}: {{$value}}" @if(! ($loop->last))\
|
|
@endif
|
|
@endif
|
|
@endforeach
|
|
@endforeach
|
|
@endif
|
|
@endif
|
|
-@if(count($parsedRoute['parameters'])) \
|
|
|
|
-@foreach($parsedRoute['parameters'] as $attribute => $parameter)
|
|
|
|
|
|
+@if(count($route['parameters'])) \
|
|
|
|
+@foreach($route['parameters'] as $attribute => $parameter)
|
|
-d "{{$attribute}}"={{$parameter['value']}} @if(! ($loop->last))\
|
|
-d "{{$attribute}}"={{$parameter['value']}} @if(! ($loop->last))\
|
|
@endif
|
|
@endif
|
|
@endforeach
|
|
@endforeach
|
|
@@ -30,14 +39,14 @@ curl -X {{$parsedRoute['methods'][0]}} {{$parsedRoute['methods'][0] == 'GET' ? '
|
|
var settings = {
|
|
var settings = {
|
|
"async": true,
|
|
"async": true,
|
|
"crossDomain": true,
|
|
"crossDomain": true,
|
|
- "url": "{{ rtrim(config('app.docs_url') ?: config('app.url'), '/') }}/{{ ltrim($parsedRoute['uri'], '/') }}",
|
|
|
|
- "method": "{{$parsedRoute['methods'][0]}}",
|
|
|
|
- @if(count($parsedRoute['parameters']))
|
|
|
|
-"data": {!! str_replace("\n}","\n }", str_replace(' ',' ',json_encode(array_combine(array_keys($parsedRoute['parameters']), array_map(function($param){ return $param['value']; },$parsedRoute['parameters'])), JSON_PRETTY_PRINT))) !!},
|
|
|
|
|
|
+ "url": "{{ rtrim(config('app.docs_url') ?: config('app.url'), '/') }}/{{ ltrim($route['uri'], '/') }}",
|
|
|
|
+ "method": "{{$route['methods'][0]}}",
|
|
|
|
+ @if(count($route['parameters']))
|
|
|
|
+"data": {!! str_replace("\n}","\n }", str_replace(' ',' ',json_encode(array_combine(array_keys($route['parameters']), array_map(function($param){ return $param['value']; },$route['parameters'])), JSON_PRETTY_PRINT))) !!},
|
|
@endif
|
|
@endif
|
|
"headers": {
|
|
"headers": {
|
|
"accept": "application/json",
|
|
"accept": "application/json",
|
|
-@foreach($parsedRoute['headers'] as $header => $value)
|
|
|
|
|
|
+@foreach($route['headers'] as $header => $value)
|
|
"{{$header}}": "{{$value}}",
|
|
"{{$header}}": "{{$value}}",
|
|
@endforeach
|
|
@endforeach
|
|
}
|
|
}
|
|
@@ -48,31 +57,31 @@ $.ajax(settings).done(function (response) {
|
|
});
|
|
});
|
|
```
|
|
```
|
|
|
|
|
|
-@if(in_array('GET',$parsedRoute['methods']) || (isset($parsedRoute['showresponse']) && $parsedRoute['showresponse']))
|
|
|
|
|
|
+@if(in_array('GET',$route['methods']) || (isset($route['showresponse']) && $route['showresponse']))
|
|
> Example response:
|
|
> Example response:
|
|
|
|
|
|
```json
|
|
```json
|
|
-@if(is_object($parsedRoute['response']) || is_array($parsedRoute['response']))
|
|
|
|
-{!! json_encode($parsedRoute['response'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) !!}
|
|
|
|
|
|
+@if(is_object($route['response']) || is_array($route['response']))
|
|
|
|
+{!! json_encode($route['response'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) !!}
|
|
@else
|
|
@else
|
|
-{!! json_encode(json_decode($parsedRoute['response']), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) !!}
|
|
|
|
|
|
+{!! json_encode(json_decode($route['response']), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) !!}
|
|
@endif
|
|
@endif
|
|
```
|
|
```
|
|
@endif
|
|
@endif
|
|
|
|
|
|
### HTTP Request
|
|
### HTTP Request
|
|
-@foreach($parsedRoute['methods'] as $method)
|
|
|
|
-`{{$method}} {{$parsedRoute['uri']}}`
|
|
|
|
|
|
+@foreach($route['methods'] as $method)
|
|
|
|
+`{{$method}} {{$route['uri']}}`
|
|
|
|
|
|
@endforeach
|
|
@endforeach
|
|
-@if(count($parsedRoute['parameters']))
|
|
|
|
|
|
+@if(count($route['parameters']))
|
|
#### Parameters
|
|
#### Parameters
|
|
|
|
|
|
Parameter | Type | Status | Description
|
|
Parameter | Type | Status | Description
|
|
--------- | ------- | ------- | ------- | -----------
|
|
--------- | ------- | ------- | ------- | -----------
|
|
-@foreach($parsedRoute['parameters'] as $attribute => $parameter)
|
|
|
|
|
|
+@foreach($route['parameters'] as $attribute => $parameter)
|
|
{{$attribute}} | {{$parameter['type']}} | @if($parameter['required']) required @else optional @endif | {!! $parameter['description'] !!}
|
|
{{$attribute}} | {{$parameter['type']}} | @if($parameter['required']) required @else optional @endif | {!! $parameter['description'] !!}
|
|
@endforeach
|
|
@endforeach
|
|
@endif
|
|
@endif
|
|
|
|
|
|
-<!-- END_{{$parsedRoute['id']}} -->
|
|
|
|
|
|
+<!-- END_{{$route['id']}} -->
|