(self, request:Request, project_id)
return Response({
            'delete': delete,
        })
Revoke a project token.
        ---
        parameters:
          - name: token
            required: true

        serializer: SimpleProjectTokenSerializer
Revoke a project token.
        ---
        parameters:
          - name: token
            required: true
Revoke a project token . --- parameters : - name : token required : true
def post(self, request:Request, project_id) -> Response:
        """Revoke a project token.
        ---
        parameters:
          - name: token
            required: true

        serializer: SimpleProjectTokenSerializer
        """
        if request.user.is_anonymous:
            raise PermissionError("Anonymous users can't revoke tokens")

        token = get_object_or_404(ProjectToken, pk=request.POST.get('token_id'))

        for perm in token.default_permissions:
            remove_perm(perm, request.user, token.project)

        delete = UserProjectToken.objects.filter(project_token=token,
                user_id=request.user.id).delete()

        return Response({
            'delete': delete,
        })
def post ( self , request : Request , project_id ) -> Response : if request . user . is_anonymous : raise PermissionError ( "Anonymous users can't revoke tokens" ) token = get_object_or_404 ( ProjectToken , pk = request . POST . get ( 'token_id' ) ) for perm in token . default_permissions : remove_perm ( perm , request . user , token . project ) delete = UserProjectToken . objects . filter ( project_token = token , user_id = request . user . id ) . delete ( ) return Response ( { 'delete' : delete , } )