/
deviceaccess.go
104 lines (88 loc) · 2.8 KB
/
deviceaccess.go
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Package deviceaccess provides the Chrome DevTools Protocol
// commands, types, and events for the DeviceAccess domain.
//
// Generated by the cdproto-gen command.
package deviceaccess
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
)
// EnableParams enable events in this domain.
type EnableParams struct{}
// Enable enable events in this domain.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DeviceAccess#method-enable
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes DeviceAccess.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, nil, nil)
}
// DisableParams disable events in this domain.
type DisableParams struct{}
// Disable disable events in this domain.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DeviceAccess#method-disable
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes DeviceAccess.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDisable, nil, nil)
}
// SelectPromptParams select a device in response to a
// DeviceAccess.deviceRequestPrompted event.
type SelectPromptParams struct {
ID RequestID `json:"id"`
DeviceID DeviceID `json:"deviceId"`
}
// SelectPrompt select a device in response to a
// DeviceAccess.deviceRequestPrompted event.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DeviceAccess#method-selectPrompt
//
// parameters:
//
// id
// deviceID
func SelectPrompt(id RequestID, deviceID DeviceID) *SelectPromptParams {
return &SelectPromptParams{
ID: id,
DeviceID: deviceID,
}
}
// Do executes DeviceAccess.selectPrompt against the provided context.
func (p *SelectPromptParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSelectPrompt, p, nil)
}
// CancelPromptParams cancel a prompt in response to a
// DeviceAccess.deviceRequestPrompted event.
type CancelPromptParams struct {
ID RequestID `json:"id"`
}
// CancelPrompt cancel a prompt in response to a
// DeviceAccess.deviceRequestPrompted event.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DeviceAccess#method-cancelPrompt
//
// parameters:
//
// id
func CancelPrompt(id RequestID) *CancelPromptParams {
return &CancelPromptParams{
ID: id,
}
}
// Do executes DeviceAccess.cancelPrompt against the provided context.
func (p *CancelPromptParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandCancelPrompt, p, nil)
}
// Command names.
const (
CommandEnable = "DeviceAccess.enable"
CommandDisable = "DeviceAccess.disable"
CommandSelectPrompt = "DeviceAccess.selectPrompt"
CommandCancelPrompt = "DeviceAccess.cancelPrompt"
)