pub struct Client { /* private fields */ }
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(username: &str, api_key: &str) -> Self
pub fn new(username: &str, api_key: &str) -> Self
Init new Client
use intistelecom_rs::client::client::Client;
let client: Client = Client::new("YOUR_USERNAME", "YOUR_API_KEY");
Examples found in repository?
More examples
examples/originator.rs (line 8)
7fn main() {
8 let client: Client = Client::new("YOUR_USERNAME", "YOUR_API_KEY");
9
10 let res = all(&client);
11 println!("{:#?}", res);
12
13 let res = create(
14 &client,
15 &BaseOriginator {
16 originator: String::from("test_originator"),
17 default: false,
18 },
19 );
20 println!("{:#?}", res);
21
22 let res = set_default(&client, "test_originator");
23 println!("{:#?}", res);
24
25 let res = delete(&client, "test_originator");
26 println!("{:#?}", res);
27}
examples/template.rs (line 8)
7fn main() {
8 let client: Client = Client::new("YOUR_USERNAME", "YOUR_API_KEY");
9
10 let res = all(&client);
11 println!("{:#?}", res);
12
13 let res = create(
14 &client,
15 &BaseTemplate {
16 template: String::from("some template text"),
17 title: String::from("some title"),
18 id: 0,
19 },
20 );
21 println!("{:#?}", res);
22
23 let res = edit(
24 &client,
25 &BaseTemplate {
26 template: String::from("some template text"),
27 title: String::from("some title"),
28 id: 1,
29 },
30 );
31 println!("{:#?}", res);
32
33 let res = delete(&client, 123);
34 println!("{:#?}", res);
35}
examples/message.rs (line 8)
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}
Trait Implementations§
Source§impl Requests for Client
impl Requests for Client
fn request( &self, method: Method, path: &str, body: Option<String>, ) -> Result<String, Box<dyn Error>>
fn get(&self, path: &str) -> Result<String, Box<dyn Error>>
fn post(&self, path: &str, body: String) -> Result<String, Box<dyn Error>>
fn patch(&self, path: &str) -> Result<String, Box<dyn Error>>
fn delete(&self, path: &str) -> Result<String, Box<dyn Error>>
fn put( &self, path: &str, body: Option<String>, ) -> Result<String, Box<dyn Error>>
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more