CampaignFlow.MockServer.Responses (CampaignFlow Client v2.2.0)
View SourceStandardized response builders for the mock Campaign Flow API.
Summary
Functions
Converts an Ecto.Changeset into the standard mock-server validation
error list (one %{"field", "issue"} map per failure).
Sends an error response.
Sends a JSON response with the given status and data.
Sends a referral creation success response (201).
Sends a referral retrieval success response (200).
Sends a validation error response (422).
Functions
@spec changeset_errors(Ecto.Changeset.t()) :: [map()]
Converts an Ecto.Changeset into the standard mock-server validation
error list (one %{"field", "issue"} map per failure).
@spec error(Plug.Conn.t(), integer(), String.t(), String.t() | nil) :: Plug.Conn.t()
Sends an error response.
@spec json(Plug.Conn.t(), integer(), map() | list()) :: Plug.Conn.t()
Sends a JSON response with the given status and data.
@spec referral_created(Plug.Conn.t(), map()) :: Plug.Conn.t()
Sends a referral creation success response (201).
@spec referral_success(Plug.Conn.t(), map()) :: Plug.Conn.t()
Sends a referral retrieval success response (200).
@spec validation_error(Plug.Conn.t(), list()) :: Plug.Conn.t()
Sends a validation error response (422).