Struct Client

Source
pub struct Client { /* private fields */ }

Implementations§

Source§

impl Client

Source

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?
examples/routing.rs (line 4)
3fn main() {
4    let client: Client = Client::new("YOUR_USERNAME", "YOUR_API_KEY");
5    let res = cost(&client, "PHONE_NUMBER");
6    println!("{:#?}", res);
7}
More examples
Hide additional examples
examples/user.rs (line 7)
6fn main() {
7    let client: Client = Client::new("YOUR_USERNAME", "YOUR_API_KEY");
8
9    let res = me(&client);
10    println!("{:#?}", res);
11
12    let res = balance(&client);
13    println!("{:#?}", res);
14}
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 Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Requests for Client

Source§

fn request( &self, method: Method, path: &str, body: Option<String>, ) -> Result<String, Box<dyn Error>>

Source§

fn basic_authorization(&self) -> String

Source§

fn get(&self, path: &str) -> Result<String, Box<dyn Error>>

Source§

fn post(&self, path: &str, body: String) -> Result<String, Box<dyn Error>>

Source§

fn patch(&self, path: &str) -> Result<String, Box<dyn Error>>

Source§

fn delete(&self, path: &str) -> Result<String, Box<dyn Error>>

Source§

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> 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,