firebase_functions.alerts.billing_fn module

Cloud functions to handle billing events from Firebase Alerts.

Classes

BillingEvent

class firebase_functions.alerts.billing_fn.BillingEvent(specversion: str, id: str, source: str, type: str, time: datetime, data: T, subject: str | None, alert_type: str)

Bases: CloudEvent[FirebaseAlertData[T]]

A custom CloudEvent for billing Firebase Alerts.

alert_type: str

The type of the alerts that got triggered.

PlanAutomatedUpdatePayload

class firebase_functions.alerts.billing_fn.PlanAutomatedUpdatePayload(billing_plan: str, notification_type: str)

Bases: object

The internal payload object for billing plan automated updates. Payload is wrapped inside a FirebaseAlertData object.

billing_plan: str

A Firebase billing plan, e.g. "spark" or "blaze".

notification_type: str

The type of the notification, e.g. "upgrade_plan" or "downgrade_plan".

PlanUpdatePayload

class firebase_functions.alerts.billing_fn.PlanUpdatePayload(billing_plan: str, notification_type: str, principal_email: str)

Bases: PlanAutomatedUpdatePayload

The internal payload object for billing plan updates. Payload is wrapped inside a FirebaseAlertData object.

principal_email: str

The email address of the person that triggered billing plan change.

Functions

on_plan_automated_update_published

firebase_functions.alerts.billing_fn.on_plan_automated_update_published(**kwargs) Callable[[Callable[[BillingEvent[PlanAutomatedUpdatePayload]], None]], Callable[[BillingEvent[PlanAutomatedUpdatePayload]], None]]

Event handler which triggers when a Firebase Alerts billing event is published.

Example:

import firebase_functions.alerts.billing_fn as billing_fn

@billing_fn.on_plan_automated_update_published()
def example(alert: billing_fn.BillingPlanAutomatedUpdateEvent) -> None:
    print(alert)
Parameters:

**kwargs (as firebase_functions.options.BillingOptions) -- Options.

Return type:

typing.Callable [ [ firebase_functions.alerts.billing_fn.BillingPlanAutomatedUpdateEvent ], None ] A function that takes a BillingPlanUpdateEvent and returns None.

on_plan_update_published

firebase_functions.alerts.billing_fn.on_plan_update_published(**kwargs) Callable[[Callable[[BillingEvent[PlanUpdatePayload]], None]], Callable[[BillingEvent[PlanUpdatePayload]], None]]

Event handler which triggers when a Firebase Alerts billing event is published.

Example:

import firebase_functions.alerts.billing_fn as billing_fn

@billing_fn.on_plan_update_published()
def example(alert: billing_fn.BillingPlanUpdateEvent) -> None:
    print(alert)
Parameters:

**kwargs (as firebase_functions.options.BillingOptions) -- Options.

Return type:

typing.Callable [ [ firebase_functions.alerts.billing_fn.BillingPlanUpdateEvent ], None ] A function that takes a BillingPlanUpdateEvent and returns None.

Constants

BillingPlanAutomatedUpdateEvent

firebase_functions.alerts.billing_fn.BillingPlanAutomatedUpdateEvent

The type of the event for 'on_plan_automated_update_published' functions.

alias of BillingEvent[PlanAutomatedUpdatePayload]

BillingPlanUpdateEvent

firebase_functions.alerts.billing_fn.BillingPlanUpdateEvent

The type of the event for 'on_plan_update_published' functions.

alias of BillingEvent[PlanUpdatePayload]

OnPlanAutomatedUpdatePublishedCallable

firebase_functions.alerts.billing_fn.OnPlanAutomatedUpdatePublishedCallable

The type of the callable for 'on_plan_automated_update_published' functions.

alias of Callable[[BillingEvent[PlanAutomatedUpdatePayload]], None]

OnPlanUpdatePublishedCallable

firebase_functions.alerts.billing_fn.OnPlanUpdatePublishedCallable

The type of the callable for 'on_plan_update_published' functions.

alias of Callable[[BillingEvent[PlanUpdatePayload]], None]