I need to reshape my ecto models when responding to API requests, and I also need to create request objects that I want to bind to when I get a API request.
So my API responses in Ruby would look like:
attr_accessor :success, :errors
def initialize(success, errors)
@success = success
@errors = errors
And then say for my /api/users response I would have a users collection also so:
response.success = true
response.errors = 
response.users = users
render json: response
In phoenix/elixir, would I just be creating a module with a struct for each response then to mimic the above?