mirror of
				https://github.com/sissbruecker/linkding.git
				synced 2025-11-04 04:54:09 +01:00 
			
		
		
		
	Add archive endpoints
This commit is contained in:
		
							
								
								
									
										18
									
								
								API.md
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								API.md
									
									
									
									
									
								
							@@ -59,7 +59,7 @@ Example response:
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
**Archived**
 | 
			
		||||
**List Archived**
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
GET /api/bookmarks/archived/
 | 
			
		||||
@@ -121,6 +121,22 @@ Example payload:
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
**Archive**
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
POST /api/bookmarks/<id>/archive/
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Archives a bookmark.
 | 
			
		||||
 | 
			
		||||
**Unarchive**
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
POST /api/bookmarks/<id>/unarchive/
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Unarchives a bookmark.
 | 
			
		||||
 | 
			
		||||
**Delete**
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,7 @@ from rest_framework.routers import DefaultRouter
 | 
			
		||||
from bookmarks import queries
 | 
			
		||||
from bookmarks.api.serializers import BookmarkSerializer, TagSerializer
 | 
			
		||||
from bookmarks.models import Bookmark, Tag
 | 
			
		||||
from bookmarks.services.bookmarks import archive_bookmark, unarchive_bookmark
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class BookmarkViewSet(viewsets.GenericViewSet,
 | 
			
		||||
@@ -39,6 +40,18 @@ class BookmarkViewSet(viewsets.GenericViewSet,
 | 
			
		||||
        data = serializer(page, many=True).data
 | 
			
		||||
        return self.get_paginated_response(data)
 | 
			
		||||
 | 
			
		||||
    @action(methods=['post'], detail=True)
 | 
			
		||||
    def archive(self, request, pk):
 | 
			
		||||
        bookmark = self.get_object()
 | 
			
		||||
        archive_bookmark(bookmark)
 | 
			
		||||
        return Response(status=status.HTTP_204_NO_CONTENT)
 | 
			
		||||
 | 
			
		||||
    @action(methods=['post'], detail=True)
 | 
			
		||||
    def unarchive(self, request, pk):
 | 
			
		||||
        bookmark = self.get_object()
 | 
			
		||||
        unarchive_bookmark(bookmark)
 | 
			
		||||
        return Response(status=status.HTTP_204_NO_CONTENT)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TagViewSet(viewsets.GenericViewSet,
 | 
			
		||||
                 mixins.ListModelMixin,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user