operations_project/apps/gmail/urls.py
2025-05-21 11:14:08 +08:00

41 lines
1.8 KiB
Python

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/<str:conversation_id>/', 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/<str:conversation_id>/', 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)),
]