Enhance API structure and documentation: Added new tags for Account, Integration, Automation, Linker, Optimizer, and Publisher; updated billing endpoints for admin and customer; improved API reference documentation; fixed endpoint paths in frontend services.
This commit is contained in:
@@ -26,7 +26,7 @@ from .exceptions import InsufficientCreditsError
|
||||
|
||||
|
||||
@extend_schema_view(
|
||||
list=extend_schema(tags=['Billing']),
|
||||
list=extend_schema(tags=['Billing'], summary='Get credit balance'),
|
||||
)
|
||||
class CreditBalanceViewSet(viewsets.ViewSet):
|
||||
"""
|
||||
@@ -38,8 +38,7 @@ class CreditBalanceViewSet(viewsets.ViewSet):
|
||||
throttle_scope = 'billing'
|
||||
throttle_classes = [DebugScopedRateThrottle]
|
||||
|
||||
@action(detail=False, methods=['get'])
|
||||
def balance(self, request):
|
||||
def list(self, request):
|
||||
"""Get current credit balance and usage"""
|
||||
account = getattr(request, 'account', None)
|
||||
if not account:
|
||||
@@ -125,6 +124,7 @@ class CreditUsageViewSet(AccountModelViewSet):
|
||||
|
||||
return queryset.order_by('-created_at')
|
||||
|
||||
@extend_schema(tags=['Billing'], summary='Get usage summary')
|
||||
@action(detail=False, methods=['get'])
|
||||
def summary(self, request):
|
||||
"""Get usage summary for date range"""
|
||||
@@ -214,6 +214,7 @@ class CreditUsageViewSet(AccountModelViewSet):
|
||||
serializer = UsageSummarySerializer(data)
|
||||
return success_response(data=serializer.data, request=request)
|
||||
|
||||
@extend_schema(tags=['Billing'], summary='Get usage limits')
|
||||
@action(detail=False, methods=['get'], url_path='limits', url_name='limits')
|
||||
def limits(self, request):
|
||||
"""
|
||||
@@ -434,6 +435,13 @@ class BillingOverviewViewSet(viewsets.ViewSet):
|
||||
return Response(data)
|
||||
|
||||
|
||||
@extend_schema_view(
|
||||
stats=extend_schema(tags=['Admin Billing'], summary='Admin billing stats'),
|
||||
list_users=extend_schema(tags=['Admin Billing'], summary='List users with credit info'),
|
||||
adjust_credits=extend_schema(tags=['Admin Billing'], summary='Adjust user credits'),
|
||||
list_credit_costs=extend_schema(tags=['Admin Billing'], summary='List credit cost configurations'),
|
||||
update_credit_costs=extend_schema(tags=['Admin Billing'], summary='Update credit cost configurations'),
|
||||
)
|
||||
class AdminBillingViewSet(viewsets.ViewSet):
|
||||
"""Admin-only billing management API"""
|
||||
permission_classes = [IsAuthenticatedAndActive, permissions.IsAdminUser]
|
||||
|
||||
Reference in New Issue
Block a user