module Resend::Contacts

def create(params)

https://resend.com/docs/api-reference/contacts/create-contact
def create(params)
  path = "audiences/#{params[:audience_id]}/contacts"
  Resend::Request.new(path, params, "post").perform
end

def get(audience_id, id)

https://resend.com/docs/api-reference/contacts/get-contact
def get(audience_id, id)
  path = "audiences/#{audience_id}/contacts/#{id}"
  Resend::Request.new(path, {}, "get").perform
end

def list(audience_id)

https://resend.com/docs/api-reference/contacts/list-contacts
def list(audience_id)
  path = "audiences/#{audience_id}/contacts"
  Resend::Request.new(path, {}, "get").perform
end

def remove(audience_id, contact_id)

Parameters:
  • contact_id (String) -- either the contact id or contact email
  • audience_id (String) -- the audience id
def remove(audience_id, contact_id)
  path = "audiences/#{audience_id}/contacts/#{contact_id}"
  Resend::Request.new(path, {}, "delete").perform
end

def update(params)

https://resend.com/docs/api-reference/contacts/update-contact
def update(params)
  path = "audiences/#{params[:audience_id]}/contacts/#{params[:id]}"
  Resend::Request.new(path, params, "patch").perform
end