Struct mailchimp::MailchimpApi

source ·
pub struct MailchimpApi { /* private fields */ }
Expand description

Mailchimp API

Permite el acceso al API de Mailchimp si conoces bien los diferentes endpoints. Para más información sobre los endpoints ir a la página de desarrollos mailchimp Developers Mailchimp

Ejemplo

extern crate mailchimp;
use mailchimp::MailchimpApi;

let api = MailchimpApi::new("<API Key>");
println!("Api version: {}", api.version());
println!("Api domain: {}", api.domain());

Implementations

Crea la nueva instancia del API

Argumentos api_key: Mailchimp API KEY http_transport: Interfaz por donde se harían las peticiones Get y Post al servicio

Devuelve el dominio

Devuelve la version del API

Realiza una petición de tipo POST

extern crate mailchimp;
use std::collections::HashMap;
use mailchimp::MailchimpApi;
use mailchimp::types::AuthorizedAppsType;
fn main() {
    let api = MailchimpApi::new("aac1e319006883125e18a89e529b5abb73de4c81-usX");
    let data = api.post::<AuthorizedAppsType, HashMap<String, String>>("authorized-apps", HashMap::new());
    match data {
        Ok(resp) => {
            for app in resp.apps.iter() {
                println!("{:?}", app)
            }
        },
        Err(e) => println!("Error Title: {:?} \n Error detail {:?}", e.title, e.detail)
    }
}

#Argumentos endpoint: Cadena de texto con el endpoint de la API al que se requiere acceder, no debe comenzar por “/” payload: Dato a enviar al servidor

Función para actualizar los recursos en el servidor

#Argumentos endpoint: Cadena de texto con el endpoint de la API al que se requiere acceder, no debe comenzar por “/” payload: Dato a enviar al servidor

Función para actualizar los recursos en el servidor

#Argumentos endpoint: Cadena de texto con el endpoint de la API al que se requiere acceder, no debe comenzar por “/” payload: Dato a enviar al servidor

Realiza una petición de tipo GET

extern crate mailchimp;
use std::collections::HashMap;
use mailchimp::MailchimpApi;
use mailchimp::types::AuthorizedAppType;

fn main() {
    let api = MailchimpApi::new("aac1e319006883125e18a89e529b5abb73de4c81-usX");
    let mut params = HashMap::new();
    params.insert("client_id".to_string(), "".to_string());
    params.insert("client_secret".to_string(), "".to_string());
    let data = api.get::<AuthorizedAppType>("authorized-apps", params);
    match data {
        Ok(resp) => {
           println!("{:?}", resp)
        },
        Err(e) => println!("Error Title: {:?} \n Error detail {:?}", e.title, e.detail)
    }
}

#Argumentos endpoint: Cadena de texto con el endpoint de la API al que se requiere acceder, no debe comenzar por “/” payload: Listado llave valor de los parametros o data

Realiza una petición de tipo GET

extern crate mailchimp;
use std::collections::HashMap;
use mailchimp::MailchimpApi;
use mailchimp::types::AuthorizedAppType;

fn main() {
    let api = MailchimpApi::new("aac1e319006883125e18a89e529b5abb73de4c81-usX");
    let mut params = HashMap::new();
    params.insert("client_id".to_string(), "".to_string());
    params.insert("client_secret".to_string(), "".to_string());
    let data = api.get::<AuthorizedAppType>("authorized-apps", params);
    match data {
        Ok(resp) => {
           println!("{:?}", resp)
        },
        Err(e) => println!("Error Title: {:?} \n Error detail {:?}", e.title, e.detail)
    }
}

#Argumentos endpoint: Cadena de texto con el endpoint de la API al que se requiere acceder, no debe comenzar por “/” payload: Listado llave valor de los parametros o data

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.