cdp_protocol/
device_access.rs1#![allow(dead_code)]
3#[allow(unused_imports)]
4use super::types::*;
5#[allow(unused_imports)]
6use derive_builder::Builder;
7#[allow(unused_imports)]
8use serde::{Deserialize, Serialize};
9#[allow(unused_imports)]
10use serde_json::Value as Json;
11pub type RequestId = String;
12pub type DeviceId = String;
13#[allow(deprecated)]
14#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
15#[builder(setter(into, strip_option))]
16#[serde(rename_all = "camelCase")]
17#[doc = "Device information displayed in a user prompt to select a device."]
18pub struct PromptDevice {
19 pub id: DeviceId,
20 #[serde(default)]
21 #[doc = "Display name as it appears in a device request user prompt."]
22 pub name: String,
23}
24#[allow(deprecated)]
25#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
26pub struct Enable(pub Option<Json>);
27#[allow(deprecated)]
28#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
29pub struct Disable(pub Option<Json>);
30#[allow(deprecated)]
31#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
32#[builder(setter(into, strip_option))]
33#[serde(rename_all = "camelCase")]
34#[doc = "Select a device in response to a DeviceAccess.deviceRequestPrompted event."]
35pub struct SelectPrompt {
36 pub id: RequestId,
37 pub device_id: DeviceId,
38}
39#[allow(deprecated)]
40#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
41#[builder(setter(into, strip_option))]
42#[serde(rename_all = "camelCase")]
43#[doc = "Cancel a prompt in response to a DeviceAccess.deviceRequestPrompted event."]
44pub struct CancelPrompt {
45 pub id: RequestId,
46}
47#[allow(deprecated)]
48#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
49#[doc = "Enable events in this domain."]
50pub struct EnableReturnObject(pub Option<Json>);
51#[allow(deprecated)]
52#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
53#[doc = "Disable events in this domain."]
54pub struct DisableReturnObject(pub Option<Json>);
55#[allow(deprecated)]
56#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
57#[doc = "Select a device in response to a DeviceAccess.deviceRequestPrompted event."]
58pub struct SelectPromptReturnObject(pub Option<Json>);
59#[allow(deprecated)]
60#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
61#[doc = "Cancel a prompt in response to a DeviceAccess.deviceRequestPrompted event."]
62pub struct CancelPromptReturnObject(pub Option<Json>);
63#[allow(deprecated)]
64impl Method for Enable {
65 const NAME: &'static str = "DeviceAccess.enable";
66 type ReturnObject = EnableReturnObject;
67}
68#[allow(deprecated)]
69impl Method for Disable {
70 const NAME: &'static str = "DeviceAccess.disable";
71 type ReturnObject = DisableReturnObject;
72}
73#[allow(deprecated)]
74impl Method for SelectPrompt {
75 const NAME: &'static str = "DeviceAccess.selectPrompt";
76 type ReturnObject = SelectPromptReturnObject;
77}
78#[allow(deprecated)]
79impl Method for CancelPrompt {
80 const NAME: &'static str = "DeviceAccess.cancelPrompt";
81 type ReturnObject = CancelPromptReturnObject;
82}
83#[allow(dead_code)]
84pub mod events {
85 #[allow(unused_imports)]
86 use super::super::types::*;
87 #[allow(unused_imports)]
88 use derive_builder::Builder;
89 #[allow(unused_imports)]
90 use serde::{Deserialize, Serialize};
91 #[allow(unused_imports)]
92 use serde_json::Value as Json;
93 #[allow(deprecated)]
94 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
95 pub struct DeviceRequestPromptedEvent {
96 pub params: DeviceRequestPromptedEventParams,
97 }
98 #[allow(deprecated)]
99 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
100 #[serde(rename_all = "camelCase")]
101 pub struct DeviceRequestPromptedEventParams {
102 pub id: super::RequestId,
103 pub devices: Vec<super::PromptDevice>,
104 }
105}