Struct ContactRequest

Source
pub struct ContactRequest {
    pub is_excluded_from_campaigns: Option<bool>,
    pub name: Option<String>,
    pub email: Option<String>,
}
Expand description

The contact creation/update request

§Create a contact

use mailjet_api_wrapper::requests::ContactRequest;
use mailjet_api_wrapper::Mailjet;

// Create mailjet client
let mailjet = Mailjet::from_api_keys("your_key", "your_secret");

/// Create new contact
let contact = ContactRequest {
    is_excluded_from_campaigns: Some(true),
    name: Some("New Contact".to_string()),
    email: Some("passenger@mailjet.com".to_string()),
};

/// Execution
let response = mailjet.contact_create(&contact).unwrap_or_default();

§GDPR Delete contacts

use mailjet_api_wrapper::Mailjet;

// Create mailjet client
let mailjet = Mailjet::from_api_keys("your_key", "your_secret");

// Delete contact from id
mailjet.contact_delete(187464256).unwrap_or_default();

Fields§

§is_excluded_from_campaigns: Option<bool>

Indicates whether the contact is added to the exclusion list for campaigns or not

An excluded contact will not be receiving any marketing emails

§name: Option<String>

User-selected name for this contact

§email: Option<String>

Contact email address

This field is mandatory for creation. Mailjet doesn’t tell you but you can update an email with this

Trait Implementations§

Source§

impl Default for ContactRequest

Source§

fn default() -> ContactRequest

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ContactRequest

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ContactRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,