|
25 | 25 | import cloudevents.http as _ce
|
26 | 26 |
|
27 | 27 | from firebase_functions.options import DatabaseOptions
|
| 28 | +from firebase_functions.core import Change, T |
28 | 29 |
|
29 | 30 | _event_type_written = "google.firebase.database.ref.v1.written"
|
30 | 31 | _event_type_created = "google.firebase.database.ref.v1.created"
|
|
33 | 34 |
|
34 | 35 |
|
35 | 36 | @_dataclass.dataclass(frozen=True)
|
36 |
| -class Change(_typing.Generic[_core.T]): |
37 |
| - """ |
38 |
| - * The Functions interface for events that change state, such as |
39 |
| - * Realtime Database `on_value_written`. |
40 |
| - """ |
41 |
| - |
42 |
| - before: _core.T |
43 |
| - """ |
44 |
| - The state of data before the change. |
45 |
| - """ |
46 |
| - |
47 |
| - after: _core.T |
48 |
| - """ |
49 |
| - The state of data after the change. |
50 |
| - """ |
51 |
| - |
52 |
| - |
53 |
| -@_dataclass.dataclass(frozen=True) |
54 |
| -class Event(_core.CloudEvent[_core.T]): |
| 37 | +class Event(_core.CloudEvent[T]): |
55 | 38 | """
|
56 | 39 | A CloudEvent that contains a DataSnapshot or a Change<DataSnapshot>.
|
57 | 40 | """
|
@@ -155,8 +138,8 @@ def example(event: Event[Change[object]]) -> None:
|
155 | 138 | :param \\*\\*kwargs: Database options.
|
156 | 139 | :type \\*\\*kwargs: as :exc:`firebase_functions.options.DatabaseOptions`
|
157 | 140 | :rtype: :exc:`typing.Callable`
|
158 |
| - \\[ \\[ :exc:`firebase_functions.db.Event` \\[ |
159 |
| - :exc:`firebase_functions.db.Change` \\] \\], `None` \\] |
| 141 | + \\[ \\[ :exc:`firebase_functions.db_fn.Event` \\[ |
| 142 | + :exc:`firebase_functions.core.Change` \\] \\], `None` \\] |
160 | 143 | A function that takes a Database Event and returns None.
|
161 | 144 | """
|
162 | 145 | options = DatabaseOptions(**kwargs)
|
@@ -205,8 +188,8 @@ def example(event: Event[Change[object]]) -> None:
|
205 | 188 | :param \\*\\*kwargs: Database options.
|
206 | 189 | :type \\*\\*kwargs: as :exc:`firebase_functions.options.DatabaseOptions`
|
207 | 190 | :rtype: :exc:`typing.Callable`
|
208 |
| - \\[ \\[ :exc:`firebase_functions.db.Event` \\[ |
209 |
| - :exc:`firebase_functions.db.Change` \\] \\], `None` \\] |
| 191 | + \\[ \\[ :exc:`firebase_functions.db_fn.Event` \\[ |
| 192 | + :exc:`firebase_functions.core.Change` \\] \\], `None` \\] |
210 | 193 | A function that takes a Database Event and returns None.
|
211 | 194 | """
|
212 | 195 | options = DatabaseOptions(**kwargs)
|
@@ -255,7 +238,7 @@ def example(event: Event[object]):
|
255 | 238 | :param \\*\\*kwargs: Database options.
|
256 | 239 | :type \\*\\*kwargs: as :exc:`firebase_functions.options.DatabaseOptions`
|
257 | 240 | :rtype: :exc:`typing.Callable`
|
258 |
| - \\[ \\[ :exc:`firebase_functions.db.Event` \\[ |
| 241 | + \\[ \\[ :exc:`firebase_functions.db_fn.Event` \\[ |
259 | 242 | :exc:`object` \\] \\], `None` \\]
|
260 | 243 | A function that takes a Database Event and returns None.
|
261 | 244 | """
|
@@ -305,7 +288,7 @@ def example(event: Event[object]) -> None:
|
305 | 288 | :param \\*\\*kwargs: Database options.
|
306 | 289 | :type \\*\\*kwargs: as :exc:`firebase_functions.options.DatabaseOptions`
|
307 | 290 | :rtype: :exc:`typing.Callable`
|
308 |
| - \\[ \\[ :exc:`firebase_functions.db.Event` \\[ |
| 291 | + \\[ \\[ :exc:`firebase_functions.db_fn.Event` \\[ |
309 | 292 | :exc:`object` \\] \\], `None` \\]
|
310 | 293 | A function that takes a Database Event and returns None.
|
311 | 294 | """
|
|
0 commit comments