from django.urls import path, include from rest_framework.routers import DefaultRouter from .views import ( GmailAuthInitiateView, GmailAuthCompleteView, GmailConversationView, GmailAttachmentListView, GmailPubSubView, GmailSendEmailView, GmailWebhookView, GmailConversationSummaryView, GmailGoalView, SimpleRecommendedReplyView, GmailCredentialViewSet, GmailExportView ) app_name = 'gmail' # 创建Router并注册ViewSet router = DefaultRouter() router.register(r'credentials', GmailCredentialViewSet, basename='credential') # 基本URL模式 urlpatterns = [ path('auth/initiate/', GmailAuthInitiateView.as_view(), name='auth_initiate'), path('auth/complete/', GmailAuthCompleteView.as_view(), name='auth_complete'), path('conversations/', GmailConversationView.as_view(), name='conversation_list'), path('attachments/', GmailAttachmentListView.as_view(), name='attachment_list'), path('attachments//', GmailAttachmentListView.as_view(), name='attachment_list_by_conversation'), path('notifications/setup/', GmailPubSubView.as_view(), name='pubsub_setup'), path('send/', GmailSendEmailView.as_view(), name='send_email'), path('webhook/', GmailWebhookView.as_view(), name='webhook'), path('conversations/summary/', GmailConversationSummaryView.as_view(), name='conversation_summary_list'), path('conversations/summary//', GmailConversationSummaryView.as_view(), name='conversation_summary_detail'), path('goals/', GmailGoalView.as_view(), name='user_goals'), path('recommended-reply/', SimpleRecommendedReplyView.as_view(), name='recommended_reply'), path('export/', GmailExportView.as_view(), name='export_replied_influencers'), # 包含Router生成的URL path('', include(router.urls)), ]