pub struct AccessCodes(pub String, pub String);Tuple Fields§
§0: String§1: StringImplementations§
Source§impl AccessCodes
impl AccessCodes
Sourcepub fn list(self, device_id: String) -> Result<Vec<AccessCode>>
pub fn list(self, device_id: String) -> Result<Vec<AccessCode>>
Examples found in repository?
examples/interactive_set_access_codes.rs (line 76)
4fn main() {
5 println!("This will reset your workspace sandbox, continure? (Y/n)");
6 let mut guess = String::new();
7 io::stdin()
8 .read_line(&mut guess)
9 .expect("failed to read line");
10
11 println!("{guess}");
12 if guess != "Y\n" {
13 panic!();
14 }
15
16 let seam = Seam::new(None, None).unwrap();
17
18 println!("Reseting sandbox...");
19 seam.workspace().reset_sandbox();
20
21 println!("creating a Connect Webview...");
22 let webview = seam
23 .connect_webviews()
24 .create(vec!["august".to_string()], None, None)
25 .unwrap();
26
27 println!("This is my webview: \n{:?}", webview);
28
29 println!(
30 "Got the URL below and login\n\n{}\n\njane@example.com\n123\n\n",
31 webview.url
32 );
33
34 let mut enter = String::new();
35 io::stdin()
36 .read_line(&mut enter)
37 .expect("failed to read line");
38
39 let updated_webview = seam
40 .connect_webviews()
41 .get(webview.connect_webview_id)
42 .unwrap();
43
44 print!("This is my updated webview: \n {:?}", updated_webview);
45
46 if updated_webview.login_successful {
47 println!("Successfully logged in!");
48 } else {
49 panic!("Webview wasn't logged in");
50 }
51
52 let locks = seam.locks().list().unwrap();
53 println!(
54 "Listing all the connected locks for our new account: {:?}",
55 locks
56 );
57
58 let mut front_door = String::new();
59 for lock in locks {
60 if lock.properties.august_metadata.unwrap().device_name == "FRONT DOOR" {
61 front_door = lock.device_id;
62 }
63 }
64
65 println!("Settings the code 123459 on FRONT DOOR");
66 seam.access_codes()
67 .create(
68 front_door.clone(),
69 Some("My personal entry code".to_string()),
70 Some("123459".to_string()),
71 None,
72 None,
73 )
74 .unwrap();
75
76 let all_access_codes_on_front_door = seam.access_codes().list(front_door.clone()).unwrap();
77 println!("{:?}", all_access_codes_on_front_door);
78}pub fn get(self, access_code_id: String) -> Result<AccessCode>
Sourcepub fn create(
self,
device: String,
name: Option<String>,
code: Option<String>,
starts_at: Option<String>,
ends_at: Option<String>,
) -> Result<ActionAttempt>
pub fn create( self, device: String, name: Option<String>, code: Option<String>, starts_at: Option<String>, ends_at: Option<String>, ) -> Result<ActionAttempt>
Examples found in repository?
examples/interactive_set_access_codes.rs (lines 67-73)
4fn main() {
5 println!("This will reset your workspace sandbox, continure? (Y/n)");
6 let mut guess = String::new();
7 io::stdin()
8 .read_line(&mut guess)
9 .expect("failed to read line");
10
11 println!("{guess}");
12 if guess != "Y\n" {
13 panic!();
14 }
15
16 let seam = Seam::new(None, None).unwrap();
17
18 println!("Reseting sandbox...");
19 seam.workspace().reset_sandbox();
20
21 println!("creating a Connect Webview...");
22 let webview = seam
23 .connect_webviews()
24 .create(vec!["august".to_string()], None, None)
25 .unwrap();
26
27 println!("This is my webview: \n{:?}", webview);
28
29 println!(
30 "Got the URL below and login\n\n{}\n\njane@example.com\n123\n\n",
31 webview.url
32 );
33
34 let mut enter = String::new();
35 io::stdin()
36 .read_line(&mut enter)
37 .expect("failed to read line");
38
39 let updated_webview = seam
40 .connect_webviews()
41 .get(webview.connect_webview_id)
42 .unwrap();
43
44 print!("This is my updated webview: \n {:?}", updated_webview);
45
46 if updated_webview.login_successful {
47 println!("Successfully logged in!");
48 } else {
49 panic!("Webview wasn't logged in");
50 }
51
52 let locks = seam.locks().list().unwrap();
53 println!(
54 "Listing all the connected locks for our new account: {:?}",
55 locks
56 );
57
58 let mut front_door = String::new();
59 for lock in locks {
60 if lock.properties.august_metadata.unwrap().device_name == "FRONT DOOR" {
61 front_door = lock.device_id;
62 }
63 }
64
65 println!("Settings the code 123459 on FRONT DOOR");
66 seam.access_codes()
67 .create(
68 front_door.clone(),
69 Some("My personal entry code".to_string()),
70 Some("123459".to_string()),
71 None,
72 None,
73 )
74 .unwrap();
75
76 let all_access_codes_on_front_door = seam.access_codes().list(front_door.clone()).unwrap();
77 println!("{:?}", all_access_codes_on_front_door);
78}pub fn delete(self, access_code_id: String) -> Result<ActionAttempt>
pub fn update( self, access_code_id: String, name: Option<String>, code: Option<String>, starts_at: Option<String>, ends_at: Option<String>, ) -> Result<ActionAttempt>
Auto Trait Implementations§
impl Freeze for AccessCodes
impl RefUnwindSafe for AccessCodes
impl Send for AccessCodes
impl Sync for AccessCodes
impl Unpin for AccessCodes
impl UnsafeUnpin for AccessCodes
impl UnwindSafe for AccessCodes
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