From 3d58f87b564f9fafdc97113391e78d3d6f4a4217 Mon Sep 17 00:00:00 2001
From: Agate <me@agate.blue>
Date: Mon, 27 Jul 2020 15:01:35 +0200
Subject: [PATCH] More API docs

---
 api/config/api_urls.py |  2 --
 docs/swagger.yml       | 66 ++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 63 insertions(+), 5 deletions(-)

diff --git a/api/config/api_urls.py b/api/config/api_urls.py
index e67e432f65..c96ca60c9b 100644
--- a/api/config/api_urls.py
+++ b/api/config/api_urls.py
@@ -1,5 +1,4 @@
 from django.conf.urls import include, url
-from dynamic_preferences.api.viewsets import GlobalPreferencesViewSet
 from rest_framework import routers
 from rest_framework.urlpatterns import format_suffix_patterns
 
@@ -14,7 +13,6 @@ from funkwhale_api.tags import views as tags_views
 from funkwhale_api.users import jwt_views
 
 router = common_routers.OptionalSlashRouter()
-router.register(r"settings", GlobalPreferencesViewSet, basename="settings")
 router.register(r"activity", activity_views.ActivityViewSet, "activity")
 router.register(r"tags", tags_views.TagViewSet, "tags")
 router.register(r"plugins", common_views.PluginViewSet, "plugins")
diff --git a/docs/swagger.yml b/docs/swagger.yml
index 67b3191083..d8a41471f4 100644
--- a/docs/swagger.yml
+++ b/docs/swagger.yml
@@ -1,8 +1,5 @@
 # Undocumented endpoints:
-#  /api/v1/settings
-#  /api/v1/activity
 #  /api/v1/playlist-tracks
-#  /api/v1/search
 #  /api/v1/radios
 #  /api/v1/history
 
@@ -1338,6 +1335,69 @@ paths:
       responses:
         204:
           $ref: "#/responses/204"
+          
+  ##########
+  # Others #
+  ##########
+  /api/v1/search:
+    get:
+      tags:
+        - "Other"
+      description:
+        Search artists, tracks, albums and other resources
+      parameters:
+        - $ref: "./api/parameters.yml#/Search"
+      responses:
+        200:
+          $ref: "#/responses/200"
+        400:
+          $ref: "#/responses/400"
+      
+  /api/v1/instance/settings:
+    get:
+      tags:
+        - "Other"
+      description:
+        Retrieve pod-level configuration such as description or max playlist size
+      responses:
+        200:
+          content:
+            application/json:
+              schema:
+                type: "array"
+                description: "List of settings with their id, label and values"
+                items:
+                  type: object
+                  properties:
+                    name:
+                      type: "string"
+                      description: "Name of the setting"
+                      example: "max_channels"
+                    section:
+                      type: "string"
+                      description: "Group of the setting"
+                      example: "audio"
+                    identifier:
+                      type: "string"
+                      description: "Unique identifier of the setting"
+                      example: "audio__max_channels"
+                    default:
+                      description: Default value of the setting
+                    value:
+                      description: Current value of the setting
+                    verbose_name:
+                      type: "string"
+                      description: Human-readable label of the setting
+                    help_text:
+                      type: "string"
+                      description: Human-readable description of the setting
+                    field:
+                      type: "object"
+                      properties:
+                        input_type:
+                          type: string
+                          description: "Input type of the setting"
+                    
 
   /api/v1/attachments/:
     post:
-- 
GitLab