Function batch

Source
pub fn batch(
    client: &impl Requests,
    messages: &mut Vec<MessageBody>,
) -> Result<Vec<MessageId>, Box<dyn Error>>
Expand description

Send multiple messages

use intistelecom_rs::{
    client::Client,
    message::batch,
    model::message::MessageBody,
};
  
fn main() {
    let client: Client = Client::new("YOUR_USERNAME", "YOUR_API_KEY");
    let m1 = MessageBody {
        destination: String::from("+79178880143"),
        originator: String::from("test"),
        text: String::from("test"),
        time_to_send: String::from(""),
        validity_period: 0,
        callback_url: String::from("value"),
        use_local_time: false,
    };
    let m2 = MessageBody {
        destination: String::from("+79178880143"),
        originator: String::from("test"),
        text: String::from("test"),
        time_to_send: String::from(""),
        validity_period: 0,
        callback_url: String::from("value"),
        use_local_time: false,
    };
     
    let res = batch(&client, &mut vec![m1, m2]);
    println!("{:#?}", res);
}
Examples found in repository?
examples/message.rs (line 42)
7fn main() {
8    let client: Client = Client::new("YOUR_USERNAME", "YOUR_API_KEY");
9    let res = send(
10        &client,
11        &mut MessageBody {
12            destination: String::from(""),
13            originator: String::from("test"),
14            text: String::from("test"),
15            time_to_send: String::from(""),
16            validity_period: 0,
17            callback_url: String::from("value"),
18            use_local_time: false,
19        },
20    );
21    println!("{:#?}", res);
22
23    let m1 = MessageBody {
24        destination: String::from(""),
25        originator: String::from("test"),
26        text: String::from("test"),
27        time_to_send: String::from(""),
28        validity_period: 0,
29        callback_url: String::from("value"),
30        use_local_time: false,
31    };
32    let m2 = MessageBody {
33        destination: String::from(""),
34        originator: String::from("test"),
35        text: String::from("test"),
36        time_to_send: String::from(""),
37        validity_period: 0,
38        callback_url: String::from("value"),
39        use_local_time: false,
40    };
41
42    let res = batch(&client, &mut vec![m1, m2]);
43    println!("{:?}", res);
44
45    let res = status(
46        &client,
47        &MessageId {
48            id: "MESSAGE_ID".to_string(),
49        },
50    );
51    println!("{:?}", res);
52
53    let res = cancel(
54        &client,
55        &MessageId {
56            id: "MESSAGE_ID".to_string(),
57        },
58    );
59    println!("{:?}", res);
60
61    let res = status_of_part(
62        &client,
63        &PartId {
64            id: "PART_ID".to_string(),
65        },
66    );
67    println!("{:?}", res);
68}