rustforce/
lib.rs

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