CampaignFlow.MockServer.Handlers.Campaigns (CampaignFlow Client v2.2.0)
View SourceHandles campaign-related endpoints for the mock server.
Summary
Functions
Handles GET /api/v2/campaigns/:id - Get a campaign by ID.
Handles POST /api/v2/campaigns/:id/set-status - Change a campaign's status.
Functions
@spec get(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
Handles GET /api/v2/campaigns/:id - Get a campaign by ID.
@spec set_status(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
Handles POST /api/v2/campaigns/:id/set-status - Change a campaign's status.
Validates the requested status against the OpenAPI Campaign.status
enum, updates the campaign in the DB, and enqueues a
campaign_status_change webhook event.
Mirrors the real CampaignFlow API: returns the updated Campaign on
success, 422 if the status value is invalid, 404 if the campaign
doesn't exist.