Browse Source

add future api spec design

Nick Sweeting 4 years ago
parent
commit
6edae6a17f
2 changed files with 43 additions and 2 deletions
  1. 10 0
      archivebox/core/admin.py
  2. 33 2
      archivebox/core/urls.py

+ 10 - 0
archivebox/core/admin.py

@@ -24,6 +24,16 @@ from main import add, remove
 from config import OUTPUT_DIR
 from config import OUTPUT_DIR
 from extractors import archive_links
 from extractors import archive_links
 
 
+# Admin URLs
+# /admin/
+# /admin/login/
+# /admin/core/
+# /admin/core/snapshot/
+# /admin/core/snapshot/:uuid/
+# /admin/core/tag/
+# /admin/core/tag/:uuid/
+
+
 # TODO: https://stackoverflow.com/questions/40760880/add-custom-button-to-django-admin-panel
 # TODO: https://stackoverflow.com/questions/40760880/add-custom-button-to-django-admin-panel
 
 
 def update_snapshots(modeladmin, request, queryset):
 def update_snapshots(modeladmin, request, queryset):

+ 33 - 2
archivebox/core/urls.py

@@ -33,6 +33,37 @@ urlpatterns = [
     
     
     path('index.html', RedirectView.as_view(url='/')),
     path('index.html', RedirectView.as_view(url='/')),
     path('index.json', static.serve, {'document_root': settings.OUTPUT_DIR, 'path': 'index.json'}),
     path('index.json', static.serve, {'document_root': settings.OUTPUT_DIR, 'path': 'index.json'}),
-    path('', MainIndex.as_view(), name='Home'),
-    path('public/', PublicArchiveView.as_view(), name='public-index'),
+    path('', HomepageView.as_view(), name='Home'),
 ]
 ]
+
+    # # Proposed UI URLs spec
+    # path('',                 HomepageView)
+    # path('/add',             AddView)
+    # path('/public',          PublicIndexView)
+    # path('/snapshot/:slug',  SnapshotView)
+    
+    # path('/admin',           admin.site.urls)
+    # path('/accounts',        django.contrib.auth.urls)
+
+    # # Prposed REST API spec
+    # # :slugs can be uuid, short_uuid, or any of the unique index_fields
+    # path('api/v1/'),
+    # path('api/v1/core/'                      [GET])
+    # path('api/v1/core/snapshot/',            [GET, POST, PUT]),
+    # path('api/v1/core/snapshot/:slug',       [GET, PATCH, DELETE]),
+    # path('api/v1/core/archiveresult',        [GET, POST, PUT]),
+    # path('api/v1/core/archiveresult/:slug',  [GET, PATCH, DELETE]),
+    # path('api/v1/core/tag/',                 [GET, POST, PUT]),
+    # path('api/v1/core/tag/:slug',            [GET, PATCH, DELETE]),
+
+    # path('api/v1/cli/',                      [GET])
+    # path('api/v1/cli/{add,list,config,...}', [POST]),  # pass query as kwargs directly to `run_subcommand` and return stdout, stderr, exitcode
+
+    # path('api/v1/extractors/',                    [GET])
+    # path('api/v1/extractors/:extractor/',         [GET]),
+    # path('api/v1/extractors/:extractor/:func',    [GET, POST]),  # pass query as args directly to chosen function
+
+    # future, just an idea:
+    # path('api/v1/scheduler/',                [GET])
+    # path('api/v1/scheduler/task/',           [GET, POST, PUT]),
+    # path('api/v1/scheduler/task/:slug',      [GET, PATCH, DELETE]),