1121 lines
30 KiB
Go
1121 lines
30 KiB
Go
// Code generated by goctl. DO NOT EDIT.
|
|
// goctl 1.10.1
|
|
|
|
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
ai "haixun-backend/internal/handler/ai"
|
|
auth "haixun-backend/internal/handler/auth"
|
|
brand "haixun-backend/internal/handler/brand"
|
|
copy_mission "haixun-backend/internal/handler/copy_mission"
|
|
job "haixun-backend/internal/handler/job"
|
|
member "haixun-backend/internal/handler/member"
|
|
normal "haixun-backend/internal/handler/normal"
|
|
permission "haixun-backend/internal/handler/permission"
|
|
persona "haixun-backend/internal/handler/persona"
|
|
placement_topic "haixun-backend/internal/handler/placement_topic"
|
|
setting "haixun-backend/internal/handler/setting"
|
|
threads_account "haixun-backend/internal/handler/threads_account"
|
|
"haixun-backend/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
)
|
|
|
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/providers",
|
|
Handler: ai.ListAiProvidersHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/v1/ai"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.MemberAuth},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/chat",
|
|
Handler: ai.ChatHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/chat/stream",
|
|
Handler: ai.ChatStreamHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/providers/:provider/models",
|
|
Handler: ai.ListAiProviderModelsHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/v1/ai"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/islander/chat/stream",
|
|
Handler: ai.IslanderChatStreamHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/v1/ai"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/login",
|
|
Handler: auth.LoginHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/refresh",
|
|
Handler: auth.RefreshHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/v1/auth"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/logout",
|
|
Handler: auth.LogoutHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/register",
|
|
Handler: auth.RegisterHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/resend-verification-email",
|
|
Handler: auth.ResendVerificationEmailHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/verify-email",
|
|
Handler: auth.VerifyEmailHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/v1/auth"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/",
|
|
Handler: brand.ListBrandsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/",
|
|
Handler: brand.CreateBrandHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id",
|
|
Handler: brand.GetBrandHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:id",
|
|
Handler: brand.UpdateBrandHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/:id",
|
|
Handler: brand.DeleteBrandHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/content-matrix",
|
|
Handler: brand.GetBrandContentMatrixHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/content-matrix/generate",
|
|
Handler: brand.GenerateBrandContentMatrixHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/knowledge-graph",
|
|
Handler: brand.GetKnowledgeGraphHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/knowledge-graph/expand",
|
|
Handler: brand.ExpandKnowledgeGraphHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:id/knowledge-graph/nodes",
|
|
Handler: brand.PatchKnowledgeGraphNodesHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:id/outreach-drafts/:draftId",
|
|
Handler: brand.UpdateOutreachDraftHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/outreach-drafts/generate",
|
|
Handler: brand.GenerateOutreachDraftsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/outreach-drafts/publish",
|
|
Handler: brand.PublishOutreachDraftHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/products",
|
|
Handler: brand.ListBrandProductsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/products",
|
|
Handler: brand.CreateBrandProductHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:id/products/:productId",
|
|
Handler: brand.UpdateBrandProductHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/:id/products/:productId",
|
|
Handler: brand.DeleteBrandProductHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/scan-jobs",
|
|
Handler: brand.StartBrandScanJobHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/scan-posts",
|
|
Handler: brand.ListBrandScanPostsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:id/scan-posts/:postId",
|
|
Handler: brand.PatchScanPostOutreachHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/scan-schedule",
|
|
Handler: brand.GetBrandScanScheduleHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/:id/scan-schedule",
|
|
Handler: brand.UpsertBrandScanScheduleHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/v1/brands"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
[]rest.Route{
|
|
// Flow A copy_mission CRUD/jobs removed (stubs returned false success).
|
|
// Keep inspire only until Post Project replaces Missions inspiration.
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:personaId/copy-mission-inspiration",
|
|
Handler: copy_mission.InspireCopyMissionHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/v1/personas"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.WorkerSecret},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/workers/jobs/:id/analyze-style8d",
|
|
Handler: job.AnalyzeStyle8DFromWorkerHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/workers/jobs/:id/cancel-ack",
|
|
Handler: job.AckWorkerJobCancelHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/workers/jobs/:id/cancel-check",
|
|
Handler: job.CheckWorkerJobCancelHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/workers/jobs/:id/complete",
|
|
Handler: job.CompleteWorkerJobHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/workers/jobs/:id/fail",
|
|
Handler: job.FailWorkerJobHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/workers/jobs/:id/heartbeat",
|
|
Handler: job.RefreshWorkerJobLockHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/workers/jobs/:id/progress",
|
|
Handler: job.UpdateWorkerJobProgressHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/workers/jobs/claim",
|
|
Handler: job.ClaimWorkerJobHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/workers/personas/:id/style-profile",
|
|
Handler: job.StorePersonaStyleProfileFromWorkerHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/workers/threads-accounts/:id/session",
|
|
Handler: job.GetWorkerThreadsAccountSessionHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/v1/internal"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/job/schedules",
|
|
Handler: job.ListJobSchedulesHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/job/schedules",
|
|
Handler: job.CreateJobScheduleHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/job/schedules/:id",
|
|
Handler: job.UpdateJobScheduleHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/job/schedules/:id",
|
|
Handler: job.DeleteJobScheduleHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/job/schedules/:id/disable",
|
|
Handler: job.DisableJobScheduleHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/job/schedules/:id/enable",
|
|
Handler: job.EnableJobScheduleHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/job/templates",
|
|
Handler: job.ListJobTemplatesHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/job/templates/:type",
|
|
Handler: job.GetJobTemplateHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/job/templates/:type",
|
|
Handler: job.UpsertJobTemplateHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/jobs",
|
|
Handler: job.CreateJobHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/jobs",
|
|
Handler: job.ListJobsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/jobs/:id",
|
|
Handler: job.GetJobHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/jobs/:id/cancel",
|
|
Handler: job.CancelJobHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/jobs/:id/events",
|
|
Handler: job.ListJobEventsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/jobs/:id/retry",
|
|
Handler: job.RetryJobHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/v1"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/",
|
|
Handler: member.ListMembersHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:uid/password",
|
|
Handler: member.UpdateMemberPasswordHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:uid/profile",
|
|
Handler: member.UpdateMemberProfileHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:uid/roles",
|
|
Handler: member.UpdateMemberRolesHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/me",
|
|
Handler: member.GetMemberMeHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/me",
|
|
Handler: member.UpdateMemberMeHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/me/ai-settings",
|
|
Handler: member.GetMemberAiSettingsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/me/ai-settings",
|
|
Handler: member.UpdateMemberAiSettingsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/me/ai-settings/providers/:provider/models",
|
|
Handler: member.ListMemberAiProviderModelsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/me/avatar",
|
|
Handler: member.UploadMemberAvatarHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/me/capabilities",
|
|
Handler: member.GetMemberCapabilitiesHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/me/placement-settings",
|
|
Handler: member.GetMemberPlacementSettingsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/me/placement-settings",
|
|
Handler: member.UpdateMemberPlacementSettingsHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/v1/members"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/health",
|
|
Handler: normal.HealthHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/v1"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/catalog",
|
|
Handler: permission.GetPermissionCatalogHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/me",
|
|
Handler: permission.GetMePermissionsHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/v1/permissions"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/",
|
|
Handler: persona.ListPersonasHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/",
|
|
Handler: persona.CreatePersonaHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id",
|
|
Handler: persona.GetPersonaHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:id",
|
|
Handler: persona.UpdatePersonaHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/:id",
|
|
Handler: persona.DeletePersonaHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/content-formulas/:formulaId/generate",
|
|
Handler: persona.GenerateFromContentFormulaHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/content-inbox",
|
|
Handler: persona.ListPersonaContentInboxHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/content-plans",
|
|
Handler: persona.ListContentPlansHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/content-plans",
|
|
Handler: persona.CreateContentPlanHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:id/content-plans/:contentPlanId",
|
|
Handler: persona.UpdateContentPlanHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/copy-drafts",
|
|
Handler: persona.ListPersonaCopyDraftsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:id/copy-drafts/:draftId",
|
|
Handler: persona.UpdatePersonaCopyDraftHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/:id/copy-drafts/:draftId",
|
|
Handler: persona.DeletePersonaCopyDraftHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/copy-drafts/:draftId/publish",
|
|
Handler: persona.PublishPersonaCopyDraftHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/copy-drafts/:draftId/schedule",
|
|
Handler: persona.SchedulePersonaCopyDraftHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/copy-drafts/generate",
|
|
Handler: persona.GeneratePersonaCopyDraftHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/copy-drafts/prune",
|
|
Handler: persona.PrunePersonaCopyDraftsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/copy-drafts/schedule",
|
|
Handler: persona.SchedulePersonaDraftsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/feedback-events",
|
|
Handler: persona.CreateFeedbackEventHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/formula-draft/jobs",
|
|
Handler: persona.StartPersonaFormulaDraftJobHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/formula-pools",
|
|
Handler: persona.ListFormulaPoolsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/formula-pools",
|
|
Handler: persona.CreateFormulaPoolHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/knowledge-chunks",
|
|
Handler: persona.ListKnowledgeChunksHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/knowledge-sources",
|
|
Handler: persona.CreateKnowledgeSourceHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/knowledge-sources",
|
|
Handler: persona.ListKnowledgeSourcesHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/rewrite-draft/jobs",
|
|
Handler: persona.StartPersonaRewriteDraftJobHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/style-analysis",
|
|
Handler: persona.StartPersonaStyleAnalysisHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/style-analysis-from-text",
|
|
Handler: persona.StartPersonaStyleAnalysisFromTextHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/style-presets",
|
|
Handler: persona.ListStylePresetsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/:id/style-presets/:presetId",
|
|
Handler: persona.UpsertStylePresetHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/:id/style-presets/:presetId",
|
|
Handler: persona.DeleteStylePresetHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/topic-candidates",
|
|
Handler: persona.ListTopicCandidatesHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/topic-matrix/generate",
|
|
Handler: persona.GeneratePersonaTopicMatrixHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/topic-matrix/jobs",
|
|
Handler: persona.StartPersonaTopicMatrixJobHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/viral-scan-jobs",
|
|
Handler: persona.StartPersonaViralScanJobHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/viral-scan-posts",
|
|
Handler: persona.ListPersonaViralScanPostsHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/v1/personas"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/",
|
|
Handler: placement_topic.ListPlacementTopicsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/",
|
|
Handler: placement_topic.CreatePlacementTopicHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id",
|
|
Handler: placement_topic.GetPlacementTopicHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:id",
|
|
Handler: placement_topic.UpdatePlacementTopicHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/:id",
|
|
Handler: placement_topic.DeletePlacementTopicHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/content-matrix",
|
|
Handler: placement_topic.GetPlacementTopicContentMatrixHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/content-matrix/generate",
|
|
Handler: placement_topic.GeneratePlacementTopicContentMatrixHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/knowledge-graph",
|
|
Handler: placement_topic.GetPlacementTopicGraphHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/knowledge-graph/expand",
|
|
Handler: placement_topic.ExpandPlacementTopicGraphHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:id/knowledge-graph/nodes",
|
|
Handler: placement_topic.PatchPlacementTopicGraphNodesHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/outreach-draft-jobs",
|
|
Handler: placement_topic.StartPlacementTopicOutreachDraftJobHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:id/outreach-drafts/:draftId",
|
|
Handler: placement_topic.UpdatePlacementTopicOutreachDraftHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/outreach-drafts/generate",
|
|
Handler: placement_topic.GeneratePlacementTopicOutreachDraftsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/outreach-drafts/publish",
|
|
Handler: placement_topic.PublishPlacementTopicOutreachDraftHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/scan-jobs",
|
|
Handler: placement_topic.StartPlacementTopicScanJobHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/scan-posts",
|
|
Handler: placement_topic.ListPlacementTopicScanPostsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:id/scan-posts/:postId",
|
|
Handler: placement_topic.PatchPlacementTopicScanPostOutreachHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/:id/scan-posts/:postId",
|
|
Handler: placement_topic.DeletePlacementTopicScanPostHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/scan-posts/batch-delete",
|
|
Handler: placement_topic.BatchDeletePlacementTopicScanPostsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/scan-schedule",
|
|
Handler: placement_topic.GetPlacementTopicScanScheduleHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/:id/scan-schedule",
|
|
Handler: placement_topic.UpsertPlacementTopicScanScheduleHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/v1/placement/topics"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:scope/:scope_id",
|
|
Handler: setting.ListSettingsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:scope/:scope_id/:key",
|
|
Handler: setting.GetSettingHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/:scope/:scope_id/:key",
|
|
Handler: setting.UpsertSettingHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/:scope/:scope_id/:key",
|
|
Handler: setting.DeleteSettingHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/v1/settings"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/",
|
|
Handler: threads_account.ListThreadsAccountsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/",
|
|
Handler: threads_account.CreateThreadsAccountHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id",
|
|
Handler: threads_account.GetThreadsAccountHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:id",
|
|
Handler: threads_account.UpdateThreadsAccountHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/:id",
|
|
Handler: threads_account.DeleteThreadsAccountHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/activate",
|
|
Handler: threads_account.ActivateThreadsAccountHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/ai-settings",
|
|
Handler: threads_account.GetThreadsAccountAiSettingsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/:id/ai-settings",
|
|
Handler: threads_account.UpdateThreadsAccountAiSettingsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/ai-settings/providers/:provider/models",
|
|
Handler: threads_account.ListThreadsAccountAiProviderModelsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/api/disconnect",
|
|
Handler: threads_account.DisconnectThreadsApiHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/api/playground",
|
|
Handler: threads_account.RunThreadsApiPlaygroundHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/api/smoke-test",
|
|
Handler: threads_account.RunThreadsApiSmokeTestHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/connection",
|
|
Handler: threads_account.GetThreadsAccountConnectionHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:id/connection",
|
|
Handler: threads_account.UpdateThreadsAccountConnectionHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/content-formulas",
|
|
Handler: threads_account.ListContentFormulasHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/content-formulas/:formulaId",
|
|
Handler: threads_account.GetContentFormulaHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:id/content-formulas/:formulaId",
|
|
Handler: threads_account.PatchContentFormulaHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/:id/content-formulas/:formulaId",
|
|
Handler: threads_account.DeleteContentFormulaHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/content-formulas/analyze",
|
|
Handler: threads_account.AnalyzeContentFormulaHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/content-formulas/import-own-post",
|
|
Handler: threads_account.ImportOwnPostToContentFormulaHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/content-formulas/search-posts",
|
|
Handler: threads_account.SearchContentFormulaPostsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/diagnostics",
|
|
Handler: threads_account.GetThreadsDiagnosticsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/mention-inbox",
|
|
Handler: threads_account.ListMentionInboxHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/mention-inbox/:media_id/reply",
|
|
Handler: threads_account.PublishMentionReplyHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/mention-inbox/sync",
|
|
Handler: threads_account.SyncMentionInboxHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/own-post-formula",
|
|
Handler: threads_account.GenerateOwnPostFormulaHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/own-post-formulas",
|
|
Handler: threads_account.ListOwnPostFormulasHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/own-post-reply-draft",
|
|
Handler: threads_account.GenerateOwnPostReplyDraftHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/post-performance",
|
|
Handler: threads_account.ListThreadsPostPerformanceHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/publish-alerts",
|
|
Handler: threads_account.ListPublishAlertsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/publish-attachments",
|
|
Handler: threads_account.UploadPublishAttachmentHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/publish-reply",
|
|
Handler: threads_account.PublishThreadsReplyHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/publish-calendar",
|
|
Handler: threads_account.ListPublishQueueRangeHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/publish-guard-policy",
|
|
Handler: threads_account.GetPublishGuardPolicyHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/:id/publish-guard-policy",
|
|
Handler: threads_account.UpsertPublishGuardPolicyHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/publish-guard/resume",
|
|
Handler: threads_account.ResumePublishGuardHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/publish-health",
|
|
Handler: threads_account.ListThreadsPublishHealthHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/publish-inventory-policy",
|
|
Handler: threads_account.GetPublishInventoryPolicyHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/:id/publish-inventory-policy",
|
|
Handler: threads_account.UpsertPublishInventoryPolicyHandler(serverCtx),
|
|
},
|
|
// refill-publish-inventory job removed (no step handler / template not seeded)
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/publish-queue",
|
|
Handler: threads_account.CreatePublishQueueItemHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/publish-queue",
|
|
Handler: threads_account.ListPublishQueueItemsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/publish-queue/:qid",
|
|
Handler: threads_account.GetPublishQueueItemHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPatch,
|
|
Path: "/:id/publish-queue/:qid",
|
|
Handler: threads_account.PatchPublishQueueItemHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/:id/publish-queue/:qid",
|
|
Handler: threads_account.DeletePublishQueueItemHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/publish-queue/:qid/cancel",
|
|
Handler: threads_account.CancelPublishQueueItemHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/publish-queue/:qid/events",
|
|
Handler: threads_account.ListPublishQueueEventsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/publish-queue/:qid/retry",
|
|
Handler: threads_account.RetryPublishQueueItemHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/:id/publish-slot-insights",
|
|
Handler: threads_account.GetPublishSlotInsightsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/:id/session/import",
|
|
Handler: threads_account.ImportThreadsAccountSessionHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/oauth/config",
|
|
Handler: threads_account.GetThreadsOauthConfigHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/oauth/logs",
|
|
Handler: threads_account.ListThreadsOauthLogsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/oauth/start",
|
|
Handler: threads_account.StartThreadsOauthHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/publish-dashboard-summary",
|
|
Handler: threads_account.GetPublishDashboardSummaryHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/v1/threads-accounts"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/oauth/callback",
|
|
Handler: threads_account.ThreadsOauthCallbackHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/v1/threads-accounts"),
|
|
)
|
|
}
|