Skip to content

Commit dbf699c

Browse files
committed
feat: rename to AuthEvent
1 parent 0f981e0 commit dbf699c

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

src/firebase_functions/firestore_fn.py

+14-15
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ class Event(_core.CloudEvent[_core.T]):
9292

9393

9494
@_dataclass.dataclass(frozen=True)
95-
class EventWithAuthContext(Event[_core.T]):
95+
class AuthEvent(Event[_core.T]):
9696
auth_type: AuthType
9797
"""The type of principal that triggered the event"""
9898
auth_id: str
9999
"""The unique identifier for the principal"""
100100

101101

102-
_E3 = EventWithAuthContext[Change[DocumentSnapshot | None]]
103-
_E4 = EventWithAuthContext[DocumentSnapshot | None]
102+
_E3 = AuthEvent[Change[DocumentSnapshot | None]]
103+
_E4 = AuthEvent[DocumentSnapshot | None]
104104
_C3 = _typing.Callable[[_E3], None]
105105
_C4 = _typing.Callable[[_E4], None]
106106

@@ -206,10 +206,9 @@ def _firestore_endpoint_handler(
206206
)
207207

208208
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)
213212
func(database_event_with_auth_context)
214213
else:
215214
# mypy cannot infer that the event type is correct, hence the cast
@@ -277,13 +276,13 @@ def on_document_written_with_auth_context(**kwargs
277276
.. code-block:: python
278277
279278
@on_document_written_with_auth_context(document="*")
280-
def example(event: EventWithAuthContext[Change[DocumentSnapshot]]) -> None:
279+
def example(event: AuthEvent[Change[DocumentSnapshot]]) -> None:
281280
pass
282281
283282
:param \\*\\*kwargs: Firestore options.
284283
:type \\*\\*kwargs: as :exc:`firebase_functions.options.FirestoreOptions`
285284
:rtype: :exc:`typing.Callable`
286-
\\[ \\[ :exc:`firebase_functions.firestore_fn.EventWithAuthContext` \\[
285+
\\[ \\[ :exc:`firebase_functions.firestore_fn.AuthEvent` \\[
287286
:exc:`firebase_functions.db.Change` \\] \\], `None` \\]
288287
A function that takes a Firestore event and returns ``None``.
289288
"""
@@ -376,13 +375,13 @@ def on_document_updated_with_auth_context(**kwargs
376375
.. code-block:: python
377376
378377
@on_document_updated_with_auth_context(document="*")
379-
def example(event: EventWithAuthContext[Change[DocumentSnapshot]]) -> None:
378+
def example(event: AuthEvent[Change[DocumentSnapshot]]) -> None:
380379
pass
381380
382381
:param \\*\\*kwargs: Firestore options.
383382
:type \\*\\*kwargs: as :exc:`firebase_functions.options.FirestoreOptions`
384383
:rtype: :exc:`typing.Callable`
385-
\\[ \\[ :exc:`firebase_functions.firestore_fn.EventWithAuthContext` \\[
384+
\\[ \\[ :exc:`firebase_functions.firestore_fn.AuthEvent` \\[
386385
:exc:`firebase_functions.db.Change` \\] \\], `None` \\]
387386
A function that takes a Firestore event and returns ``None``.
388387
"""
@@ -475,13 +474,13 @@ def on_document_created_with_auth_context(**kwargs
475474
.. code-block:: python
476475
477476
@on_document_created_with_auth_context(document="*")
478-
def example(event: EventWithAuthContext[DocumentSnapshot]):
477+
def example(event: AuthEvent[DocumentSnapshot]):
479478
pass
480479
481480
:param \\*\\*kwargs: Firestore options.
482481
:type \\*\\*kwargs: as :exc:`firebase_functions.options.FirestoreOptions`
483482
:rtype: :exc:`typing.Callable`
484-
\\[ \\[ :exc:`firebase_functions.firestore_fn.EventWithAuthContext` \\[
483+
\\[ \\[ :exc:`firebase_functions.firestore_fn.AuthEvent` \\[
485484
:exc:`object` \\] \\], `None` \\]
486485
A function that takes a Firestore event and returns ``None``.
487486
"""
@@ -574,13 +573,13 @@ def on_document_deleted_with_auth_context(**kwargs
574573
.. code-block:: python
575574
576575
@on_document_deleted_with_auth_context(document="*")
577-
def example(event: EventWithAuthContext[DocumentSnapshot]) -> None:
576+
def example(event: AuthEvent[DocumentSnapshot]) -> None:
578577
pass
579578
580579
:param \\*\\*kwargs: Firestore options.
581580
:type \\*\\*kwargs: as :exc:`firebase_functions.options.FirestoreOptions`
582581
:rtype: :exc:`typing.Callable`
583-
\\[ \\[ :exc:`firebase_functions.firestore_fn.EventWithAuthContext` \\[
582+
\\[ \\[ :exc:`firebase_functions.firestore_fn.AuthEvent` \\[
584583
:exc:`object` \\] \\], `None` \\]
585584
A function that takes a Firestore event and returns ``None``.
586585
"""

0 commit comments

Comments
 (0)