deviceaccess.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // Package deviceaccess provides the Chrome DevTools Protocol
  2. // commands, types, and events for the DeviceAccess domain.
  3. //
  4. // Generated by the cdproto-gen command.
  5. package deviceaccess
  6. // Code generated by cdproto-gen. DO NOT EDIT.
  7. import (
  8. "context"
  9. "github.com/chromedp/cdproto/cdp"
  10. )
  11. // EnableParams enable events in this domain.
  12. type EnableParams struct{}
  13. // Enable enable events in this domain.
  14. //
  15. // See: https://chromedevtools.github.io/devtools-protocol/tot/DeviceAccess#method-enable
  16. func Enable() *EnableParams {
  17. return &EnableParams{}
  18. }
  19. // Do executes DeviceAccess.enable against the provided context.
  20. func (p *EnableParams) Do(ctx context.Context) (err error) {
  21. return cdp.Execute(ctx, CommandEnable, nil, nil)
  22. }
  23. // DisableParams disable events in this domain.
  24. type DisableParams struct{}
  25. // Disable disable events in this domain.
  26. //
  27. // See: https://chromedevtools.github.io/devtools-protocol/tot/DeviceAccess#method-disable
  28. func Disable() *DisableParams {
  29. return &DisableParams{}
  30. }
  31. // Do executes DeviceAccess.disable against the provided context.
  32. func (p *DisableParams) Do(ctx context.Context) (err error) {
  33. return cdp.Execute(ctx, CommandDisable, nil, nil)
  34. }
  35. // SelectPromptParams select a device in response to a
  36. // DeviceAccess.deviceRequestPrompted event.
  37. type SelectPromptParams struct {
  38. ID RequestID `json:"id"`
  39. DeviceID DeviceID `json:"deviceId"`
  40. }
  41. // SelectPrompt select a device in response to a
  42. // DeviceAccess.deviceRequestPrompted event.
  43. //
  44. // See: https://chromedevtools.github.io/devtools-protocol/tot/DeviceAccess#method-selectPrompt
  45. //
  46. // parameters:
  47. //
  48. // id
  49. // deviceID
  50. func SelectPrompt(id RequestID, deviceID DeviceID) *SelectPromptParams {
  51. return &SelectPromptParams{
  52. ID: id,
  53. DeviceID: deviceID,
  54. }
  55. }
  56. // Do executes DeviceAccess.selectPrompt against the provided context.
  57. func (p *SelectPromptParams) Do(ctx context.Context) (err error) {
  58. return cdp.Execute(ctx, CommandSelectPrompt, p, nil)
  59. }
  60. // CancelPromptParams cancel a prompt in response to a
  61. // DeviceAccess.deviceRequestPrompted event.
  62. type CancelPromptParams struct {
  63. ID RequestID `json:"id"`
  64. }
  65. // CancelPrompt cancel a prompt in response to a
  66. // DeviceAccess.deviceRequestPrompted event.
  67. //
  68. // See: https://chromedevtools.github.io/devtools-protocol/tot/DeviceAccess#method-cancelPrompt
  69. //
  70. // parameters:
  71. //
  72. // id
  73. func CancelPrompt(id RequestID) *CancelPromptParams {
  74. return &CancelPromptParams{
  75. ID: id,
  76. }
  77. }
  78. // Do executes DeviceAccess.cancelPrompt against the provided context.
  79. func (p *CancelPromptParams) Do(ctx context.Context) (err error) {
  80. return cdp.Execute(ctx, CommandCancelPrompt, p, nil)
  81. }
  82. // Command names.
  83. const (
  84. CommandEnable = "DeviceAccess.enable"
  85. CommandDisable = "DeviceAccess.disable"
  86. CommandSelectPrompt = "DeviceAccess.selectPrompt"
  87. CommandCancelPrompt = "DeviceAccess.cancelPrompt"
  88. )