|
| 1 | +"""Cloud function samples for Firebase Alerts.""" |
| 2 | + |
| 3 | +from firebase_functions import alerts_fn |
| 4 | +from firebase_functions.alerts import app_distribution_fn |
| 5 | +from firebase_functions.alerts import billing_fn |
| 6 | +from firebase_functions.alerts import crashlytics_fn |
| 7 | +from firebase_functions.alerts import performance_fn |
| 8 | + |
| 9 | + |
| 10 | +@alerts_fn.on_alert_published(alert_type=alerts_fn.AlertType.BILLING_PLAN_UPDATE |
| 11 | + ) |
| 12 | +def onalertpublished( |
| 13 | + alert: alerts_fn.AlertEvent[alerts_fn.FirebaseAlertData[ |
| 14 | + billing_fn.PlanUpdatePayload]] |
| 15 | +) -> None: |
| 16 | + print(alert) |
| 17 | + |
| 18 | + |
| 19 | +@app_distribution_fn.on_in_app_feedback_published() |
| 20 | +def appdistributioninappfeedback( |
| 21 | + alert: app_distribution_fn.InAppFeedbackEvent) -> None: |
| 22 | + print(alert) |
| 23 | + |
| 24 | + |
| 25 | +@app_distribution_fn.on_new_tester_ios_device_published() |
| 26 | +def appdistributionnewrelease( |
| 27 | + alert: app_distribution_fn.NewTesterDeviceEvent) -> None: |
| 28 | + print(alert) |
| 29 | + |
| 30 | + |
| 31 | +@billing_fn.on_plan_automated_update_published() |
| 32 | +def billingautomatedplanupdate( |
| 33 | + alert: billing_fn.BillingPlanAutomatedUpdateEvent) -> None: |
| 34 | + print(alert) |
| 35 | + |
| 36 | + |
| 37 | +@billing_fn.on_plan_update_published() |
| 38 | +def billingplanupdate(alert: billing_fn.BillingPlanUpdateEvent) -> None: |
| 39 | + print(alert) |
| 40 | + |
| 41 | + |
| 42 | +@crashlytics_fn.on_new_fatal_issue_published() |
| 43 | +def crashlyticsnewfatalissue( |
| 44 | + alert: crashlytics_fn.CrashlyticsNewFatalIssueEvent) -> None: |
| 45 | + print(alert) |
| 46 | + |
| 47 | + |
| 48 | +@crashlytics_fn.on_new_nonfatal_issue_published() |
| 49 | +def crashlyticsnewnonfatalissue( |
| 50 | + alert: crashlytics_fn.CrashlyticsNewNonfatalIssueEvent) -> None: |
| 51 | + print(alert) |
| 52 | + |
| 53 | + |
| 54 | +@crashlytics_fn.on_new_anr_issue_published() |
| 55 | +def crashlyticsnewanrissue( |
| 56 | + alert: crashlytics_fn.CrashlyticsNewAnrIssueEvent) -> None: |
| 57 | + print(alert) |
| 58 | + |
| 59 | + |
| 60 | +@crashlytics_fn.on_regression_alert_published() |
| 61 | +def crashlyticsregression( |
| 62 | + alert: crashlytics_fn.CrashlyticsRegressionAlertEvent) -> None: |
| 63 | + print(alert) |
| 64 | + |
| 65 | + |
| 66 | +@crashlytics_fn.on_stability_digest_published() |
| 67 | +def crashlyticsstabilitydigest( |
| 68 | + alert: crashlytics_fn.CrashlyticsStabilityDigestEvent) -> None: |
| 69 | + print(alert) |
| 70 | + |
| 71 | + |
| 72 | +@crashlytics_fn.on_velocity_alert_published() |
| 73 | +def crashlyticsvelocity( |
| 74 | + alert: crashlytics_fn.CrashlyticsVelocityAlertEvent) -> None: |
| 75 | + print(alert) |
| 76 | + |
| 77 | + |
| 78 | +@performance_fn.on_threshold_alert_published() |
| 79 | +def performancethreshold( |
| 80 | + alert: performance_fn.PerformanceThresholdAlertEvent) -> None: |
| 81 | + print(alert) |
0 commit comments