diff options
author | 2018-10-24 14:43:00 +0100 | |
---|---|---|
committer | 2018-10-24 14:43:00 +0100 | |
commit | cac5ea311608508585437481ccb184e376eba36c (patch) | |
tree | 5f94227837de13a2599d976433bbde97892e6e25 /api | |
parent | Added image field (diff) |
Added special snake documentation, fixed linting errors
Diffstat (limited to 'api')
-rw-r--r-- | api/serializers.py | 6 | ||||
-rw-r--r-- | api/viewsets.py | 35 |
2 files changed, 32 insertions, 9 deletions
diff --git a/api/serializers.py b/api/serializers.py index 6c878c5d..69ae1da7 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -2,10 +2,10 @@ from rest_framework.serializers import ModelSerializer, PrimaryKeyRelatedField from rest_framework_bulk import BulkSerializerMixin from .models import ( - DocumentationLink, + DocumentationLink, Member, OffTopicChannelName, - Role, SnakeFact, - SnakeIdiom, SnakeName, + Role, SnakeFact, + SnakeIdiom, SnakeName, SpecialSnake, Tag ) diff --git a/api/viewsets.py b/api/viewsets.py index 098b34f6..70fc96f8 100644 --- a/api/viewsets.py +++ b/api/viewsets.py @@ -11,15 +11,15 @@ from rest_framework_bulk import BulkCreateModelMixin from .models import ( DocumentationLink, Member, - OffTopicChannelName, + OffTopicChannelName, SnakeFact, SnakeIdiom, - SpecialSnake, SnakeName, + SnakeName, SpecialSnake, Tag ) from .serializers import ( - OffTopicChannelNameSerializer, - DocumentationLinkSerializer, MemberSerializer, - SnakeFactSerializer, SnakeIdiomSerializer, + DocumentationLinkSerializer, + MemberSerializer, OffTopicChannelNameSerializer, + SnakeFactSerializer, SnakeIdiomSerializer, SnakeNameSerializer, SpecialSnakeSerializer, TagSerializer ) @@ -204,7 +204,7 @@ class SnakeFactViewSet(ListModelMixin, GenericViewSet): class SnakeIdiomViewSet(ListModelMixin, GenericViewSet): """ - View providing for the snake cog. + View providing snake idioms for the snake cog. ## Routes ### GET /bot/snake-idioms @@ -284,6 +284,29 @@ class SnakeNameViewSet(ViewSet): class SpecialSnakeViewSet(ListModelMixin, GenericViewSet): + """ + View providing special snake names for our bot's snake cog. + + ## Routes + ### GET /bot/special-snakes + Returns a list of special snake names. + + #### Response Format + >>> [ + ... { + ... 'name':'Snakky sneakatus', + ... 'info':'Scary snek', + ... 'image':'https://discordapp.com/assets/53ef346458017da2062aca5c7955946b.svg' + ... }, + ... ] + + #### Status codes + - 200: returned on success + + ## Authentication + Requires an API token. + """ + serializer_class = SpecialSnakeSerializer queryset = SpecialSnake.objects.all() |