1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! Crate for interacting with the Salesforce API
//!
//! This crate includes the tools connecting to Salesforce and manipulating
//! Salesforce objects
//!
//! # Example
//!
//! The following example will connect to Salesforce and create an Account
//! object
//!
//!
//! ```rust,no_run
//! use rustforce::{Client, Error};
//! use serde::Deserialize;
//! use std::collections::HashMap;
//! use std::env;
//!
//! #[derive(Deserialize, Debug)]
//! #[serde(rename_all = "PascalCase")]
//! struct Account {
//! #[serde(rename = "attributes")]
//! attributes: Attribute,
//! id: String,
//! name: String,
//! }
//!
//! #[derive(Deserialize, Debug)]
//! struct Attribute {
//! url: String,
//! #[serde(rename = "type")]
//! sobject_type: String,
//! }
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Error> {
//! let client_id = env::var("SFDC_CLIENT_ID").unwrap();
//! let client_secret = env::var("SFDC_CLIENT_SECRET").unwrap();
//! let username = env::var("SFDC_USERNAME").unwrap();
//! let password = env::var("SFDC_PASSWORD").unwrap();
//!
//! let mut client = Client::new(client_id, client_secret);
//! client.login_with_credential(username, password).await?;
//! let mut params = HashMap::new();
//! params.insert("Name", "hello rust");
//! let res = client.create("Account", params).await?;
//! println!("{:?}", res);
//! Ok(())
//! }
//! ```
pub type Client = Client;
pub type Error = Error;