from django.urls import path, include from labs.api.endpoints import ( user, root, cert, lab, billing, ssh_server, lab_v2, lark, certificate, exam, live_demo_project, ) from labs.prometheus.views import PrometheusMetricsView urlpatterns = [ path("social/", include("social_django.urls", namespace="social")), ] urlpatterns += [ path("metrics", PrometheusMetricsView.as_view()), ] urlpatterns += [ path("health", root.HealthCheckEndpoint.as_view()), path("site/maintenance", root.SiteMaintenanceEndpoint.as_view()), path("install-caddy.sh", root.CaddyInstallScriptEndpoint.as_view()), ] urlpatterns += [ path("user/me", user.MeEndpoint.as_view()), path("user/logout", user.LogoutEndpoint.as_view()), path("user/settings", user.UserProfileEndpoint.as_view()), path("user/workshops", user.UserWorkshopListEndpoint.as_view()), path("user/chat", user.LogUserChatEndpoint.as_view()), path("user/groups", user.UserGroupListEndpoint.as_view()), ] urlpatterns += [ path("billing/config", billing.BillingConfigEndpoint.as_view()), path("billing/credits/balance", billing.BalanceEndpoint.as_view()), path("billing/credits/transactions", billing.TransactionListEndpoint.as_view()), path("billing/user/profile", billing.UserProfileEndpoint.as_view()), path( "billing/user/profile/billing-details", billing.UserProfileUpdateBillingDetailsEndpoint.as_view(), ), path( "billing/user/profile/validate-billing-details", billing.UserProfileValidateBillingDetailsEndpoint.as_view(), ), path( "billing/user/profile/stripe/create-setup-intent", billing.UserStripeCreateSetupIntentEndpoint.as_view(), ), path( "billing/user/profile/stripe/attach-payment-method", billing.UserStripeAttachPaymentMethodEndpoint.as_view(), ), path( "billing/user/profile/stripe/detach-payment-method", billing.UserStripeDetachPaymentMethodEndpoint.as_view(), ), path("billing/payment/calculate-price", billing.CalculatePriceEndpoint.as_view()), path("billing/payment/orders", billing.BillingCreditOrderEndpoint.as_view()), path( "billing/payment/orders//checkout", billing.BillingCreditOrderCheckoutEndpoint.as_view(), ), path( "billing/payment/orders/", billing.BillingGetOrderDetailsEndpoint.as_view(), ), path( "billing/stripe/webhook", billing.StripeWebhookEndpoint.as_view(), ), ] urlpatterns += [ path("cert/tlms-callback", cert.TLMSCallbackEndpoint.as_view()), path("certificate-types", certificate.CertificateTypeListEndpoint.as_view()), path( "certificates/tlms-to-cert-number", certificate.TLMSToCertificateNumberEndpoint.as_view(), ), path( "certificates/search-cert-number", certificate.CertificateNumberSearchEndpoint.as_view(), ), path( "certificates/", certificate.CertificateIssuanceDetailEndpoint.as_view(), ), ] urlpatterns += [ path("labs", lab.LabListEndpoint.as_view()), path("labs/categories", lab.LabCategoryListEndpoint.as_view()), path("labs/pinned", lab.LabPinnedListEndpoint.as_view()), path("labs/regions", lab.LabRegionListEndpoint.as_view()), path("labs/languages", lab.LabLanguageListEndpoint.as_view()), path("labs/redeem_event", lab.RedeemEventEndpoint.as_view()), path("labs/oauth/tidbcloud/start", lab.TiDBCloudOAuthStartEndpoint.as_view()), path( "labs/oauth/tidbcloud/", lab.TiDBCloudOAuthCompleteEndpoint.as_view(), name="labs-oauth-tidbcloud-complete", ), path( "labs/oauth/tidbcloud/grants//serverless/clusters", lab.TiDBCloudServerlessClusterListEndpoint.as_view(), ), path( "labs/oauth/tidbcloud/grants//serverless/create-lab-cluster", lab.TiDBCloudCreateLabServerlessClusterEndpoint.as_view(), ), path("labs//feedback", lab.LabFeedbackEndpoint.as_view()), ] urlpatterns += [ path( "v2/labs/validate-spec", lab_v2.LabValidateSpecEndpoint.as_view(), ), path( "v2/labs/", lab_v2.LabDetailEndpoint.as_view(), ), path( "v2/labs//parts", lab_v2.LabGuidePartEndpoint.as_view(), ), path( "v2/labs//redeem", lab_v2.LabRedeemEndpoint.as_view(), ), path( "v2/lab-instances", lab_v2.LabInstanceCreateEndpoint.as_view(), ), path( "v2/lab-instances/active", lab_v2.LabInstanceActiveEndpoint.as_view(), ), path( "v2/lab-instances/", lab_v2.LabInstanceDetailEndpoint.as_view(), ), path( "v2/lab-instances//parts", lab_v2.LabInstanceGuidePartEndpoint.as_view(), ), path( "v2/lab-instances//resources", lab_v2.LabInstanceResourceEndpoint.as_view(), ), path( "v2/lab-instances//variables", lab_v2.LabInstanceEnvironmentVariablesEndpoint.as_view(), ), path( "v2/lab-instances//https-reverse-proxy", lab_v2.LabInstanceHTTPSReverseProxyEndpoint.as_view(), name="labs-instance-https-reverse-proxy", ), path( "v2/lab-instances//quizzes///submission", lab_v2.LabInstanceQuizSubmissionEndpoint.as_view(), ), path( "v2/lab-guide/uploads", lab_v2.LabGuideUploadEndpoint.as_view(), ), path( "v2/bulk-generate-credits-vouchers", lab_v2.BulkGenerateCreditsVoucherEndpoint.as_view(), ), ] urlpatterns += [ path( "v2/ssh-servers/registration", ssh_server.SSHServerRegisterEndpoint.as_view(), ), path( "v2/ssh-servers//report", ssh_server.SSHServerReportEndpoint.as_view(), ), ] urlpatterns += [ # Ref: https://feishu.feishu.cn/docx/GwBXdq7cmoZahfx8faQchcS2nXf path("lark/table/meta.json", lark.LarkTableMetaEndpoint.as_view()), path("lark/table/definition", lark.LarkTableDefinitionEndpoint.as_view()), path("lark/table/records", lark.LarkTableRecordsEndpoint.as_view()), ] urlpatterns += [ path( "live-demo-projects//actions", live_demo_project.ProjectActionCreateEndpoint.as_view(), ), path( "live-demo-projects/projects/", live_demo_project.ProjectByKeyEndpoint.as_view(), ), ] urlpatterns += [ path("exams", exam.ExamListEndpoint.as_view()), path("exams/", exam.ExamDetailEndpoint.as_view()), path("exams//redeem", exam.ExamRedeemEndpoint.as_view()), path("exams/attempts", exam.ExamAttemptCreateEndpoint.as_view()), path( "exams/attempts/", exam.ExamAttemptDetailEndpoint.as_view() ), path( "exams/attempts//sections", exam.ExamAttemptSectionListEndpoint.as_view(), ), path( "exams/attempts//sections/", exam.ExamAttemptSectionDetailEndpoint.as_view(), ), path( "exams/attempts//sections//submit", exam.ExamAttemptSectionSubmitEndpoint.as_view(), ), path( "exams/attempts//sections//questions", exam.ExamAttemptSectionQuestionListEndpoint.as_view(), ), path( "exams/attempts//sections//questions/", exam.ExamAttemptSectionQuestionDetailEndpoint.as_view(), ), ]