struct Mailjet::Contact

Overview

Contact objects represent the email addresses you intend to send (or have already sent) messages to.

https://dev.mailjet.com/email/reference/contacts/contact/

Defined in:

mailjet/resources/contact.cr
mailjet/resources/contact/list.cr
mailjet/resources/contact/managecontactlists.cr

Class Method Summary

Instance methods inherited from struct Mailjet::Resource

initialize initialize

Constructor methods inherited from struct Mailjet::Resource

new new

Class Method Detail

def self.all(query : Hash | NamedTuple = Hash(String, String).new, params : Hash | NamedTuple = Hash(String, String).new, client : Client = Client.new) #

Create a contact

response = Mailjet::Contact.all
contacts = response.data
email_addresses = response.map(&.email)

[View source]
def self.create(payload : Hash | NamedTuple, params : Hash | NamedTuple = Hash(String, String).new, client : Client = Client.new) #

Create a contact

contact = Mailjet::Contact.create({
  name:                       "Contact name",
  email:                      "[email protected]",
  is_excluded_from_campaigns: false,
})

[View source]
def self.find(params : Hash | NamedTuple = Hash(String, String).new, query : Hash | NamedTuple = Hash(String, String).new, client : Client = Client.new) #

Find a contact

contact = Mailjet::Contact.find(123456789)

[View source]
def self.find(id : ResourceId, query : Hash | NamedTuple = Hash(String, String).new, client : Client = Client.new) #

Find a contact

contact = Mailjet::Contact.find(123456789)

[View source]
def self.update(params : Hash | NamedTuple = Hash(String, String).new, payload : Hash | NamedTuple = Hash(String, String).new, client : Client = Client.new) #

Update a contact

contact = Mailjet::Contact.update(123456789, {
  name:                       "Another name",
  is_excluded_from_campaigns: true,
})

[View source]
def self.update(id : ResourceId, payload : Hash | NamedTuple = Hash(String, String).new, client : Client = Client.new) #

Update a contact

contact = Mailjet::Contact.update(123456789, {
  name:                       "Another name",
  is_excluded_from_campaigns: true,
})

[View source]