@@ -92,15 +92,15 @@ class Event(_core.CloudEvent[_core.T]):
92
92
93
93
94
94
@_dataclass .dataclass (frozen = True )
95
- class EventWithAuthContext (Event [_core .T ]):
95
+ class AuthEvent (Event [_core .T ]):
96
96
auth_type : AuthType
97
97
"""The type of principal that triggered the event"""
98
98
auth_id : str
99
99
"""The unique identifier for the principal"""
100
100
101
101
102
- _E3 = EventWithAuthContext [Change [DocumentSnapshot | None ]]
103
- _E4 = EventWithAuthContext [DocumentSnapshot | None ]
102
+ _E3 = AuthEvent [Change [DocumentSnapshot | None ]]
103
+ _E4 = AuthEvent [DocumentSnapshot | None ]
104
104
_C3 = _typing .Callable [[_E3 ], None ]
105
105
_C4 = _typing .Callable [[_E4 ], None ]
106
106
@@ -206,10 +206,9 @@ def _firestore_endpoint_handler(
206
206
)
207
207
208
208
if event_type .endswith (".withAuthContext" ):
209
- database_event_with_auth_context = EventWithAuthContext (
210
- ** vars (database_event ),
211
- auth_type = event_auth_type ,
212
- auth_id = event_auth_id )
209
+ database_event_with_auth_context = AuthEvent (** vars (database_event ),
210
+ auth_type = event_auth_type ,
211
+ auth_id = event_auth_id )
213
212
func (database_event_with_auth_context )
214
213
else :
215
214
# mypy cannot infer that the event type is correct, hence the cast
@@ -277,13 +276,13 @@ def on_document_written_with_auth_context(**kwargs
277
276
.. code-block:: python
278
277
279
278
@on_document_written_with_auth_context(document="*")
280
- def example(event: EventWithAuthContext [Change[DocumentSnapshot]]) -> None:
279
+ def example(event: AuthEvent [Change[DocumentSnapshot]]) -> None:
281
280
pass
282
281
283
282
:param \\ *\\ *kwargs: Firestore options.
284
283
:type \\ *\\ *kwargs: as :exc:`firebase_functions.options.FirestoreOptions`
285
284
:rtype: :exc:`typing.Callable`
286
- \\ [ \\ [ :exc:`firebase_functions.firestore_fn.EventWithAuthContext ` \\ [
285
+ \\ [ \\ [ :exc:`firebase_functions.firestore_fn.AuthEvent ` \\ [
287
286
:exc:`firebase_functions.db.Change` \\ ] \\ ], `None` \\ ]
288
287
A function that takes a Firestore event and returns ``None``.
289
288
"""
@@ -376,13 +375,13 @@ def on_document_updated_with_auth_context(**kwargs
376
375
.. code-block:: python
377
376
378
377
@on_document_updated_with_auth_context(document="*")
379
- def example(event: EventWithAuthContext [Change[DocumentSnapshot]]) -> None:
378
+ def example(event: AuthEvent [Change[DocumentSnapshot]]) -> None:
380
379
pass
381
380
382
381
:param \\ *\\ *kwargs: Firestore options.
383
382
:type \\ *\\ *kwargs: as :exc:`firebase_functions.options.FirestoreOptions`
384
383
:rtype: :exc:`typing.Callable`
385
- \\ [ \\ [ :exc:`firebase_functions.firestore_fn.EventWithAuthContext ` \\ [
384
+ \\ [ \\ [ :exc:`firebase_functions.firestore_fn.AuthEvent ` \\ [
386
385
:exc:`firebase_functions.db.Change` \\ ] \\ ], `None` \\ ]
387
386
A function that takes a Firestore event and returns ``None``.
388
387
"""
@@ -475,13 +474,13 @@ def on_document_created_with_auth_context(**kwargs
475
474
.. code-block:: python
476
475
477
476
@on_document_created_with_auth_context(document="*")
478
- def example(event: EventWithAuthContext [DocumentSnapshot]):
477
+ def example(event: AuthEvent [DocumentSnapshot]):
479
478
pass
480
479
481
480
:param \\ *\\ *kwargs: Firestore options.
482
481
:type \\ *\\ *kwargs: as :exc:`firebase_functions.options.FirestoreOptions`
483
482
:rtype: :exc:`typing.Callable`
484
- \\ [ \\ [ :exc:`firebase_functions.firestore_fn.EventWithAuthContext ` \\ [
483
+ \\ [ \\ [ :exc:`firebase_functions.firestore_fn.AuthEvent ` \\ [
485
484
:exc:`object` \\ ] \\ ], `None` \\ ]
486
485
A function that takes a Firestore event and returns ``None``.
487
486
"""
@@ -574,13 +573,13 @@ def on_document_deleted_with_auth_context(**kwargs
574
573
.. code-block:: python
575
574
576
575
@on_document_deleted_with_auth_context(document="*")
577
- def example(event: EventWithAuthContext [DocumentSnapshot]) -> None:
576
+ def example(event: AuthEvent [DocumentSnapshot]) -> None:
578
577
pass
579
578
580
579
:param \\ *\\ *kwargs: Firestore options.
581
580
:type \\ *\\ *kwargs: as :exc:`firebase_functions.options.FirestoreOptions`
582
581
:rtype: :exc:`typing.Callable`
583
- \\ [ \\ [ :exc:`firebase_functions.firestore_fn.EventWithAuthContext ` \\ [
582
+ \\ [ \\ [ :exc:`firebase_functions.firestore_fn.AuthEvent ` \\ [
584
583
:exc:`object` \\ ] \\ ], `None` \\ ]
585
584
A function that takes a Firestore event and returns ``None``.
586
585
"""
0 commit comments