commit 46034f8bc8d163eac9fad1153ed06966ce7afc7a
parent 1af5c7b1ab91c836244ec4df7f22e03baa55420b
Author: MTRNord <mtrnord1@gmail.com>
Date: Sat, 21 Oct 2023 19:42:31 +0200
Further API cleanup
Diffstat:
7 files changed, 236 insertions(+), 213 deletions(-)
diff --git a/.scribe/endpoints.cache/00.yaml b/.scribe/endpoints.cache/00.yaml
@@ -35,106 +35,7 @@ endpoints:
cache-control: 'no-cache, private'
content-type: application/json
x-ratelimit-limit: '60'
- x-ratelimit-remaining: '56'
- access-control-allow-origin: '*'
- description: null
- custom: []
- responseFields: []
- auth:
- - headers
- - Authorization
- - 'Bearer 15|cc3PlQdafhg0xhyGUwPQxyc8SOoOxwIyA1TAushU76aa56bc'
- controller: null
- method: null
- route: null
- custom: []
- -
- httpMethods:
- - GET
- uri: 'api/rooms/{room_id}'
- metadata:
- groupName: Endpoints
- groupDescription: ''
- subgroup: ''
- subgroupDescription: ''
- title: ''
- description: ''
- authenticated: true
- custom: []
- headers:
- Authorization: 'Bearer {YOUR_AUTH_KEY}'
- Content-Type: application/json
- Accept: application/json
- urlParameters:
- room_id:
- name: room_id
- description: 'The UUID of the room.'
- required: true
- example: 9a6c7eaa-c73e-46cf-b625-a52eec78c62d
- type: string
- enumValues: []
- custom: []
- cleanUrlParameters:
- room_id: 9a6c7eaa-c73e-46cf-b625-a52eec78c62d
- queryParameters: []
- cleanQueryParameters: []
- bodyParameters: []
- cleanBodyParameters: []
- fileParameters: []
- responses:
- -
- status: 200
- content: '{"id":"9a6c7eaa-c73e-46cf-b625-a52eec78c62d","created_at":"2023-10-21T17:02:02.000000Z","updated_at":"2023-10-21T17:02:02.000000Z","name":"Test","description":"test","cabinet_id":null}'
- headers:
- cache-control: 'no-cache, private'
- content-type: application/json
- x-ratelimit-limit: '60'
- x-ratelimit-remaining: '55'
- access-control-allow-origin: '*'
- description: null
- custom: []
- responseFields: []
- auth:
- - headers
- - Authorization
- - 'Bearer 15|cc3PlQdafhg0xhyGUwPQxyc8SOoOxwIyA1TAushU76aa56bc'
- controller: null
- method: null
- route: null
- custom: []
- -
- httpMethods:
- - GET
- uri: api/rooms
- metadata:
- groupName: Endpoints
- groupDescription: ''
- subgroup: ''
- subgroupDescription: ''
- title: ''
- description: ''
- authenticated: true
- custom: []
- headers:
- Authorization: 'Bearer {YOUR_AUTH_KEY}'
- Content-Type: application/json
- Accept: application/json
- urlParameters: []
- cleanUrlParameters: []
- queryParameters: []
- cleanQueryParameters: []
- bodyParameters: []
- cleanBodyParameters: []
- fileParameters: []
- responses:
- -
- status: 200
- content: '[{"id":"9a6c7eaa-c73e-46cf-b625-a52eec78c62d","created_at":"2023-10-21T17:02:02.000000Z","updated_at":"2023-10-21T17:02:02.000000Z","name":"Test","description":"test","cabinet_id":null},{"id":"9a6c7f77-6a5b-4f2d-83dd-f7f10b9ce375","created_at":"2023-10-21T17:04:16.000000Z","updated_at":"2023-10-21T17:04:16.000000Z","name":"Test1","description":"Test","cabinet_id":null}]'
- headers:
- cache-control: 'no-cache, private'
- content-type: application/json
- x-ratelimit-limit: '60'
- x-ratelimit-remaining: '54'
+ x-ratelimit-remaining: '59'
access-control-allow-origin: '*'
description: null
custom: []
diff --git a/.scribe/endpoints.cache/01.yaml b/.scribe/endpoints.cache/01.yaml
@@ -0,0 +1,104 @@
+## Autogenerated by Scribe. DO NOT MODIFY.
+
+name: Rooms
+description: ''
+endpoints:
+ -
+ httpMethods:
+ - GET
+ uri: 'api/rooms/{room_id}'
+ metadata:
+ groupName: Rooms
+ groupDescription: ''
+ subgroup: ''
+ subgroupDescription: ''
+ title: ''
+ description: ''
+ authenticated: true
+ custom: []
+ headers:
+ Authorization: 'Bearer {YOUR_AUTH_KEY}'
+ Content-Type: application/json
+ Accept: application/json
+ urlParameters:
+ room_id:
+ name: room_id
+ description: 'The UUID of the room.'
+ required: true
+ example: 9a6c7eaa-c73e-46cf-b625-a52eec78c62d
+ type: string
+ enumValues: []
+ custom: []
+ cleanUrlParameters:
+ room_id: 9a6c7eaa-c73e-46cf-b625-a52eec78c62d
+ queryParameters: []
+ cleanQueryParameters: []
+ bodyParameters: []
+ cleanBodyParameters: []
+ fileParameters: []
+ responses:
+ -
+ status: 200
+ content: '{"id":"9a6c7eaa-c73e-46cf-b625-a52eec78c62d","created_at":"2023-10-21T17:02:02.000000Z","updated_at":"2023-10-21T17:02:02.000000Z","name":"Test","description":"test","cabinet_id":null}'
+ headers:
+ cache-control: 'no-cache, private'
+ content-type: application/json
+ x-ratelimit-limit: '60'
+ x-ratelimit-remaining: '58'
+ access-control-allow-origin: '*'
+ description: null
+ custom: []
+ responseFields: []
+ auth:
+ - headers
+ - Authorization
+ - 'Bearer 15|cc3PlQdafhg0xhyGUwPQxyc8SOoOxwIyA1TAushU76aa56bc'
+ controller: null
+ method: null
+ route: null
+ custom: []
+ -
+ httpMethods:
+ - GET
+ uri: api/rooms
+ metadata:
+ groupName: Rooms
+ groupDescription: ''
+ subgroup: ''
+ subgroupDescription: ''
+ title: ''
+ description: ''
+ authenticated: true
+ custom: []
+ headers:
+ Authorization: 'Bearer {YOUR_AUTH_KEY}'
+ Content-Type: application/json
+ Accept: application/json
+ urlParameters: []
+ cleanUrlParameters: []
+ queryParameters: []
+ cleanQueryParameters: []
+ bodyParameters: []
+ cleanBodyParameters: []
+ fileParameters: []
+ responses:
+ -
+ status: 200
+ content: '[{"id":"9a6c7eaa-c73e-46cf-b625-a52eec78c62d","created_at":"2023-10-21T17:02:02.000000Z","updated_at":"2023-10-21T17:02:02.000000Z","name":"Test","description":"test","cabinet_id":null},{"id":"9a6c7f77-6a5b-4f2d-83dd-f7f10b9ce375","created_at":"2023-10-21T17:04:16.000000Z","updated_at":"2023-10-21T17:04:16.000000Z","name":"Test1","description":"Test","cabinet_id":null}]'
+ headers:
+ cache-control: 'no-cache, private'
+ content-type: application/json
+ x-ratelimit-limit: '60'
+ x-ratelimit-remaining: '57'
+ access-control-allow-origin: '*'
+ description: null
+ custom: []
+ responseFields: []
+ auth:
+ - headers
+ - Authorization
+ - 'Bearer 15|cc3PlQdafhg0xhyGUwPQxyc8SOoOxwIyA1TAushU76aa56bc'
+ controller: null
+ method: null
+ route: null
+ custom: []
diff --git a/.scribe/endpoints/00.yaml b/.scribe/endpoints/00.yaml
@@ -33,106 +33,7 @@ endpoints:
cache-control: 'no-cache, private'
content-type: application/json
x-ratelimit-limit: '60'
- x-ratelimit-remaining: '56'
- access-control-allow-origin: '*'
- description: null
- custom: []
- responseFields: []
- auth:
- - headers
- - Authorization
- - 'Bearer 15|cc3PlQdafhg0xhyGUwPQxyc8SOoOxwIyA1TAushU76aa56bc'
- controller: null
- method: null
- route: null
- custom: []
- -
- httpMethods:
- - GET
- uri: 'api/rooms/{room_id}'
- metadata:
- groupName: Endpoints
- groupDescription: ''
- subgroup: ''
- subgroupDescription: ''
- title: ''
- description: ''
- authenticated: true
- custom: []
- headers:
- Authorization: 'Bearer {YOUR_AUTH_KEY}'
- Content-Type: application/json
- Accept: application/json
- urlParameters:
- room_id:
- name: room_id
- description: 'The UUID of the room.'
- required: true
- example: 9a6c7eaa-c73e-46cf-b625-a52eec78c62d
- type: string
- enumValues: []
- custom: []
- cleanUrlParameters:
- room_id: 9a6c7eaa-c73e-46cf-b625-a52eec78c62d
- queryParameters: []
- cleanQueryParameters: []
- bodyParameters: []
- cleanBodyParameters: []
- fileParameters: []
- responses:
- -
- status: 200
- content: '{"id":"9a6c7eaa-c73e-46cf-b625-a52eec78c62d","created_at":"2023-10-21T17:02:02.000000Z","updated_at":"2023-10-21T17:02:02.000000Z","name":"Test","description":"test","cabinet_id":null}'
- headers:
- cache-control: 'no-cache, private'
- content-type: application/json
- x-ratelimit-limit: '60'
- x-ratelimit-remaining: '55'
- access-control-allow-origin: '*'
- description: null
- custom: []
- responseFields: []
- auth:
- - headers
- - Authorization
- - 'Bearer 15|cc3PlQdafhg0xhyGUwPQxyc8SOoOxwIyA1TAushU76aa56bc'
- controller: null
- method: null
- route: null
- custom: []
- -
- httpMethods:
- - GET
- uri: api/rooms
- metadata:
- groupName: Endpoints
- groupDescription: ''
- subgroup: ''
- subgroupDescription: ''
- title: ''
- description: ''
- authenticated: true
- custom: []
- headers:
- Authorization: 'Bearer {YOUR_AUTH_KEY}'
- Content-Type: application/json
- Accept: application/json
- urlParameters: []
- cleanUrlParameters: []
- queryParameters: []
- cleanQueryParameters: []
- bodyParameters: []
- cleanBodyParameters: []
- fileParameters: []
- responses:
- -
- status: 200
- content: '[{"id":"9a6c7eaa-c73e-46cf-b625-a52eec78c62d","created_at":"2023-10-21T17:02:02.000000Z","updated_at":"2023-10-21T17:02:02.000000Z","name":"Test","description":"test","cabinet_id":null},{"id":"9a6c7f77-6a5b-4f2d-83dd-f7f10b9ce375","created_at":"2023-10-21T17:04:16.000000Z","updated_at":"2023-10-21T17:04:16.000000Z","name":"Test1","description":"Test","cabinet_id":null}]'
- headers:
- cache-control: 'no-cache, private'
- content-type: application/json
- x-ratelimit-limit: '60'
- x-ratelimit-remaining: '54'
+ x-ratelimit-remaining: '59'
access-control-allow-origin: '*'
description: null
custom: []
diff --git a/.scribe/endpoints/01.yaml b/.scribe/endpoints/01.yaml
@@ -0,0 +1,102 @@
+name: Rooms
+description: ''
+endpoints:
+ -
+ httpMethods:
+ - GET
+ uri: 'api/rooms/{room_id}'
+ metadata:
+ groupName: Rooms
+ groupDescription: ''
+ subgroup: ''
+ subgroupDescription: ''
+ title: ''
+ description: ''
+ authenticated: true
+ custom: []
+ headers:
+ Authorization: 'Bearer {YOUR_AUTH_KEY}'
+ Content-Type: application/json
+ Accept: application/json
+ urlParameters:
+ room_id:
+ name: room_id
+ description: 'The UUID of the room.'
+ required: true
+ example: 9a6c7eaa-c73e-46cf-b625-a52eec78c62d
+ type: string
+ enumValues: []
+ custom: []
+ cleanUrlParameters:
+ room_id: 9a6c7eaa-c73e-46cf-b625-a52eec78c62d
+ queryParameters: []
+ cleanQueryParameters: []
+ bodyParameters: []
+ cleanBodyParameters: []
+ fileParameters: []
+ responses:
+ -
+ status: 200
+ content: '{"id":"9a6c7eaa-c73e-46cf-b625-a52eec78c62d","created_at":"2023-10-21T17:02:02.000000Z","updated_at":"2023-10-21T17:02:02.000000Z","name":"Test","description":"test","cabinet_id":null}'
+ headers:
+ cache-control: 'no-cache, private'
+ content-type: application/json
+ x-ratelimit-limit: '60'
+ x-ratelimit-remaining: '58'
+ access-control-allow-origin: '*'
+ description: null
+ custom: []
+ responseFields: []
+ auth:
+ - headers
+ - Authorization
+ - 'Bearer 15|cc3PlQdafhg0xhyGUwPQxyc8SOoOxwIyA1TAushU76aa56bc'
+ controller: null
+ method: null
+ route: null
+ custom: []
+ -
+ httpMethods:
+ - GET
+ uri: api/rooms
+ metadata:
+ groupName: Rooms
+ groupDescription: ''
+ subgroup: ''
+ subgroupDescription: ''
+ title: ''
+ description: ''
+ authenticated: true
+ custom: []
+ headers:
+ Authorization: 'Bearer {YOUR_AUTH_KEY}'
+ Content-Type: application/json
+ Accept: application/json
+ urlParameters: []
+ cleanUrlParameters: []
+ queryParameters: []
+ cleanQueryParameters: []
+ bodyParameters: []
+ cleanBodyParameters: []
+ fileParameters: []
+ responses:
+ -
+ status: 200
+ content: '[{"id":"9a6c7eaa-c73e-46cf-b625-a52eec78c62d","created_at":"2023-10-21T17:02:02.000000Z","updated_at":"2023-10-21T17:02:02.000000Z","name":"Test","description":"test","cabinet_id":null},{"id":"9a6c7f77-6a5b-4f2d-83dd-f7f10b9ce375","created_at":"2023-10-21T17:04:16.000000Z","updated_at":"2023-10-21T17:04:16.000000Z","name":"Test1","description":"Test","cabinet_id":null}]'
+ headers:
+ cache-control: 'no-cache, private'
+ content-type: application/json
+ x-ratelimit-limit: '60'
+ x-ratelimit-remaining: '57'
+ access-control-allow-origin: '*'
+ description: null
+ custom: []
+ responseFields: []
+ auth:
+ - headers
+ - Authorization
+ - 'Bearer 15|cc3PlQdafhg0xhyGUwPQxyc8SOoOxwIyA1TAushU76aa56bc'
+ controller: null
+ method: null
+ route: null
+ custom: []
diff --git a/app/Http/Controllers/RoomController.php b/app/Http/Controllers/RoomController.php
@@ -27,14 +27,18 @@ class RoomController extends Controller
/**
* @urlParam room_id string required The UUID of the room. Example: 9a6c7eaa-c73e-46cf-b625-a52eec78c62d
+ * @group Rooms
*/
- public function get_room_json(string $room_id): Room
+ public function get_room(string $room_id): Room
{
$room = Room::find($room_id);
return $room;
}
- public function get_rooms_json(): Collection
+ /**
+ * @group Rooms
+ */
+ public function get_rooms(): Collection
{
$rooms = Room::all();
return $rooms;
diff --git a/resources/views/scribe/index.blade.php b/resources/views/scribe/index.blade.php
@@ -74,11 +74,18 @@
<li class="tocify-item level-2" data-unique="endpoints-GETapi-user">
<a href="#endpoints-GETapi-user">GET api/user</a>
</li>
- <li class="tocify-item level-2" data-unique="endpoints-GETapi-rooms--room_id-">
- <a href="#endpoints-GETapi-rooms--room_id-">GET api/rooms/{room_id}</a>
+ </ul>
+ </ul>
+ <ul id="tocify-header-rooms" class="tocify-header">
+ <li class="tocify-item level-1" data-unique="rooms">
+ <a href="#rooms">Rooms</a>
+ </li>
+ <ul id="tocify-subheader-rooms" class="tocify-subheader">
+ <li class="tocify-item level-2" data-unique="rooms-GETapi-rooms--room_id-">
+ <a href="#rooms-GETapi-rooms--room_id-">GET api/rooms/{room_id}</a>
</li>
- <li class="tocify-item level-2" data-unique="endpoints-GETapi-rooms">
- <a href="#endpoints-GETapi-rooms">GET api/rooms</a>
+ <li class="tocify-item level-2" data-unique="rooms-GETapi-rooms">
+ <a href="#rooms-GETapi-rooms">GET api/rooms</a>
</li>
</ul>
</ul>
@@ -162,7 +169,7 @@ fetch(url, {
<pre><code class="language-http">cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
-x-ratelimit-remaining: 56
+x-ratelimit-remaining: 59
access-control-allow-origin: *
</code></pre></details> <pre>
@@ -258,7 +265,11 @@ You can check the Dev Tools console for debugging information.</code></pre>
</div>
</form>
- <h2 id="endpoints-GETapi-rooms--room_id-">GET api/rooms/{room_id}</h2>
+ <h1 id="rooms">Rooms</h1>
+
+
+
+ <h2 id="rooms-GETapi-rooms--room_id-">GET api/rooms/{room_id}</h2>
<p>
<small class="badge badge-darkred">requires authentication</small>
@@ -307,7 +318,7 @@ fetch(url, {
<pre><code class="language-http">cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
-x-ratelimit-remaining: 55
+x-ratelimit-remaining: 58
access-control-allow-origin: *
</code></pre></details> <pre>
@@ -415,7 +426,7 @@ You can check the Dev Tools console for debugging information.</code></pre>
</div>
</form>
- <h2 id="endpoints-GETapi-rooms">GET api/rooms</h2>
+ <h2 id="rooms-GETapi-rooms">GET api/rooms</h2>
<p>
<small class="badge badge-darkred">requires authentication</small>
@@ -464,7 +475,7 @@ fetch(url, {
<pre><code class="language-http">cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
-x-ratelimit-remaining: 54
+x-ratelimit-remaining: 57
access-control-allow-origin: *
</code></pre></details> <pre>
diff --git a/routes/api.php b/routes/api.php
@@ -19,5 +19,5 @@ Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
return $request->user();
});
-Route::middleware('auth:sanctum')->get('/rooms/{room_id}', [RoomController::class, 'get_room_json']);
-Route::middleware('auth:sanctum')->get('/rooms/', [RoomController::class, 'get_rooms_json']);
+Route::middleware('auth:sanctum')->get('/rooms/{room_id}', [RoomController::class, 'get_room']);
+Route::middleware('auth:sanctum')->get('/rooms/', [RoomController::class, 'get_rooms']);