vendor/github.com/go-rod/rod/lib/proto/background_service.go
157 lines · 5317 bytes
1// This file is generated by "./lib/proto/generate"
2
3package proto
4
5/*
6
7BackgroundService
8
9Defines events for background web platform features.
10
11*/
12
13// BackgroundServiceServiceName The Background Service that will be associated with the commands/events.
14// Every Background Service operates independently, but they share the same
15// API.
16type BackgroundServiceServiceName string
17
18const (
19 // BackgroundServiceServiceNameBackgroundFetch enum const.
20 BackgroundServiceServiceNameBackgroundFetch BackgroundServiceServiceName = "backgroundFetch"
21
22 // BackgroundServiceServiceNameBackgroundSync enum const.
23 BackgroundServiceServiceNameBackgroundSync BackgroundServiceServiceName = "backgroundSync"
24
25 // BackgroundServiceServiceNamePushMessaging enum const.
26 BackgroundServiceServiceNamePushMessaging BackgroundServiceServiceName = "pushMessaging"
27
28 // BackgroundServiceServiceNameNotifications enum const.
29 BackgroundServiceServiceNameNotifications BackgroundServiceServiceName = "notifications"
30
31 // BackgroundServiceServiceNamePaymentHandler enum const.
32 BackgroundServiceServiceNamePaymentHandler BackgroundServiceServiceName = "paymentHandler"
33
34 // BackgroundServiceServiceNamePeriodicBackgroundSync enum const.
35 BackgroundServiceServiceNamePeriodicBackgroundSync BackgroundServiceServiceName = "periodicBackgroundSync"
36)
37
38// BackgroundServiceEventMetadata A key-value pair for additional event information to pass along.
39type BackgroundServiceEventMetadata struct {
40 // Key ...
41 Key string `json:"key"`
42
43 // Value ...
44 Value string `json:"value"`
45}
46
47// BackgroundServiceBackgroundServiceEvent ...
48type BackgroundServiceBackgroundServiceEvent struct {
49 // Timestamp of the event (in seconds).
50 Timestamp TimeSinceEpoch `json:"timestamp"`
51
52 // Origin The origin this event belongs to.
53 Origin string `json:"origin"`
54
55 // ServiceWorkerRegistrationID The Service Worker ID that initiated the event.
56 ServiceWorkerRegistrationID ServiceWorkerRegistrationID `json:"serviceWorkerRegistrationId"`
57
58 // Service The Background Service this event belongs to.
59 Service BackgroundServiceServiceName `json:"service"`
60
61 // EventName A description of the event.
62 EventName string `json:"eventName"`
63
64 // InstanceID An identifier that groups related events together.
65 InstanceID string `json:"instanceId"`
66
67 // EventMetadata A list of event-specific information.
68 EventMetadata []*BackgroundServiceEventMetadata `json:"eventMetadata"`
69
70 // StorageKey Storage key this event belongs to.
71 StorageKey string `json:"storageKey"`
72}
73
74// BackgroundServiceStartObserving Enables event updates for the service.
75type BackgroundServiceStartObserving struct {
76 // Service ...
77 Service BackgroundServiceServiceName `json:"service"`
78}
79
80// ProtoReq name.
81func (m BackgroundServiceStartObserving) ProtoReq() string { return "BackgroundService.startObserving" }
82
83// Call sends the request.
84func (m BackgroundServiceStartObserving) Call(c Client) error {
85 return call(m.ProtoReq(), m, nil, c)
86}
87
88// BackgroundServiceStopObserving Disables event updates for the service.
89type BackgroundServiceStopObserving struct {
90 // Service ...
91 Service BackgroundServiceServiceName `json:"service"`
92}
93
94// ProtoReq name.
95func (m BackgroundServiceStopObserving) ProtoReq() string { return "BackgroundService.stopObserving" }
96
97// Call sends the request.
98func (m BackgroundServiceStopObserving) Call(c Client) error {
99 return call(m.ProtoReq(), m, nil, c)
100}
101
102// BackgroundServiceSetRecording Set the recording state for the service.
103type BackgroundServiceSetRecording struct {
104 // ShouldRecord ...
105 ShouldRecord bool `json:"shouldRecord"`
106
107 // Service ...
108 Service BackgroundServiceServiceName `json:"service"`
109}
110
111// ProtoReq name.
112func (m BackgroundServiceSetRecording) ProtoReq() string { return "BackgroundService.setRecording" }
113
114// Call sends the request.
115func (m BackgroundServiceSetRecording) Call(c Client) error {
116 return call(m.ProtoReq(), m, nil, c)
117}
118
119// BackgroundServiceClearEvents Clears all stored data for the service.
120type BackgroundServiceClearEvents struct {
121 // Service ...
122 Service BackgroundServiceServiceName `json:"service"`
123}
124
125// ProtoReq name.
126func (m BackgroundServiceClearEvents) ProtoReq() string { return "BackgroundService.clearEvents" }
127
128// Call sends the request.
129func (m BackgroundServiceClearEvents) Call(c Client) error {
130 return call(m.ProtoReq(), m, nil, c)
131}
132
133// BackgroundServiceRecordingStateChanged Called when the recording state for the service has been updated.
134type BackgroundServiceRecordingStateChanged struct {
135 // IsRecording ...
136 IsRecording bool `json:"isRecording"`
137
138 // Service ...
139 Service BackgroundServiceServiceName `json:"service"`
140}
141
142// ProtoEvent name.
143func (evt BackgroundServiceRecordingStateChanged) ProtoEvent() string {
144 return "BackgroundService.recordingStateChanged"
145}
146
147// BackgroundServiceBackgroundServiceEventReceived Called with all existing backgroundServiceEvents when enabled, and all new
148// events afterwards if enabled and recording.
149type BackgroundServiceBackgroundServiceEventReceived struct {
150 // BackgroundServiceEvent ...
151 BackgroundServiceEvent *BackgroundServiceBackgroundServiceEvent `json:"backgroundServiceEvent"`
152}
153
154// ProtoEvent name.
155func (evt BackgroundServiceBackgroundServiceEventReceived) ProtoEvent() string {
156 return "BackgroundService.backgroundServiceEventReceived"
157}