|
@@ -7,6 +7,22 @@ from SharixAdmin.models import *
|
|
|
from rest_framework.views import APIView
|
|
|
from rest_framework.response import Response
|
|
|
from xmpp import cli
|
|
|
+from drf_yasg.views import get_schema_view
|
|
|
+from drf_yasg import openapi
|
|
|
+from drf_yasg.utils import swagger_auto_schema
|
|
|
+
|
|
|
+schema_view = get_schema_view(
|
|
|
+ openapi.Info(
|
|
|
+ title="ShariX Admin Open API",
|
|
|
+ default_version='v1',
|
|
|
+ description="REST API Documentation",
|
|
|
+ #terms_of_service="https://www.google.com/policies/terms/",
|
|
|
+ #contact=openapi.Contact(email="contact@snippets.local"),
|
|
|
+ #license=openapi.License(name="BSD License"),
|
|
|
+ ),
|
|
|
+ public=False,
|
|
|
+ permission_classes=[permissions.IsAuthenticated],
|
|
|
+)
|
|
|
|
|
|
class SharixUserMVS(viewsets.ModelViewSet):
|
|
|
queryset = SharixUser.objects.all()
|
|
@@ -33,11 +49,17 @@ class GroupMVS(viewsets.ModelViewSet):
|
|
|
|
|
|
|
|
|
class PhoneSender(APIView):
|
|
|
+ """
|
|
|
+ Test description one
|
|
|
+ """
|
|
|
+
|
|
|
permission_classes = [permissions.IsAdminUser, permissions.IsAuthenticated]
|
|
|
-
|
|
|
+
|
|
|
+ @swagger_auto_schema(operation_description="Test description two")
|
|
|
def get(self, request, format=None):
|
|
|
return Response({"message": "Для отправки сообщения используйте POST-запрос"})
|
|
|
|
|
|
+ @swagger_auto_schema(operation_description="Test description three")
|
|
|
def post(self, request, format=None):
|
|
|
cli.send_message("sender", "password", "getter", request.data)
|
|
|
return Response({"message": "Сообщение успешно отправлено!"})
|