Poodle.Response (poodle v1.0.0)
View SourceResponse struct for the Poodle SDK.
Represents successful API responses with rate limit information.
Summary
Functions
Get the response message.
Create a new response from HTTP response data.
Get rate limit information from the response.
Check if the response indicates success.
Types
@type t() :: %Poodle.Response{ message: String.t(), rate_limit: Poodle.RateLimit.t() | nil, raw_response: map() | nil, success: boolean() }
Functions
Get the response message.
Examples
iex> response = %Poodle.Response{message: "Email queued for sending"}
iex> Poodle.Response.message(response)
"Email queued for sending"
Create a new response from HTTP response data.
Examples
iex> body = %{"success" => true, "message" => "Email queued for sending"}
iex> headers = %{"ratelimit-remaining" => "1"}
iex> Poodle.Response.new(body, headers)
%Poodle.Response{success: true, message: "Email queued for sending", ...}
@spec rate_limit(t()) :: Poodle.RateLimit.t() | nil
Get rate limit information from the response.
Examples
iex> response = %Poodle.Response{rate_limit: %Poodle.RateLimit{remaining: 1}}
iex> Poodle.Response.rate_limit(response)
%Poodle.RateLimit{remaining: 1}
Check if the response indicates success.
Examples
iex> response = %Poodle.Response{success: true}
iex> Poodle.Response.success?(response)
true