operations_project/apps/gmail/urls.py

39 lines
1.7 KiB
Python
Raw Normal View History

2025-05-20 15:57:10 +08:00
from django.urls import path, include
from rest_framework.routers import DefaultRouter
2025-05-13 11:58:17 +08:00
from .views import (
GmailAuthInitiateView,
GmailAuthCompleteView,
GmailConversationView,
GmailAttachmentListView,
GmailPubSubView,
2025-05-13 18:36:06 +08:00
GmailSendEmailView,
GmailWebhookView,
2025-05-20 15:57:10 +08:00
GmailConversationSummaryView,
GmailGoalView,
SimpleRecommendedReplyView,
GmailCredentialViewSet
2025-05-13 11:58:17 +08:00
)
app_name = 'gmail'
2025-05-20 15:57:10 +08:00
# 创建Router并注册ViewSet
router = DefaultRouter()
router.register(r'credentials', GmailCredentialViewSet, basename='credential')
# 基本URL模式
2025-05-13 11:58:17 +08:00
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'),
2025-05-13 18:36:06 +08:00
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'),
2025-05-20 15:57:10 +08:00
path('goals/', GmailGoalView.as_view(), name='user_goals'),
path('recommended-reply/', SimpleRecommendedReplyView.as_view(), name='recommended_reply'),
# 包含Router生成的URL
path('', include(router.urls)),
2025-05-13 11:58:17 +08:00
]