pub struct Locks(pub String, pub String);Tuple Fields§
§0: String§1: StringImplementations§
Source§impl Locks
impl Locks
Sourcepub fn list(self) -> Result<Vec<Device>>
pub fn list(self) -> Result<Vec<Device>>
Examples found in repository?
More examples
examples/locks.rs (line 6)
3fn main() {
4 let seam = Seam::new(None, None).unwrap();
5
6 let all_locks = seam.locks().list().unwrap();
7 if all_locks.len() != 0 {
8 let some_lock = &all_locks[0];
9
10 println!("{:?}", some_lock);
11 } else {
12 println!("No locks");
13 }
14}examples/interactive_set_access_codes.rs (line 52)
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, device_id: String) -> Result<Device>
pub fn lock_door(self, device_id: String) -> Result<ActionAttempt>
pub fn unlock_door(self, device_id: String) -> Result<ActionAttempt>
Auto Trait Implementations§
impl Freeze for Locks
impl RefUnwindSafe for Locks
impl Send for Locks
impl Sync for Locks
impl Unpin for Locks
impl UnsafeUnpin for Locks
impl UnwindSafe for Locks
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