Firebase API

Apps

Configuration of the Firebase API app

class integreat_cms.firebase_api.apps.FirebaseApiConfig(app_name, app_module)[source]

Bases: AppConfig

Firebase API config inheriting the django AppConfig

name: Final[str] = 'integreat_cms.firebase_api'[source]

Full Python path to the application

ready() None[source]

Checking if API is available

Return type:

None

verbose_name: Final[Promise] = 'Firebase API'[source]

Human-readable name for the application

Firebase API Client

class integreat_cms.firebase_api.firebase_api_client.FirebaseApiClient(push_notification: PushNotification)[source]

Bases: object

Firebase Push Notifications / Firebase Cloud Messaging

Sends push notifications via FCM HTTP API. Definition: https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream-http-messages-json

Warning

We use legacy HTTP-API - Migration to HTTP v1-API will be necessary! https://firebase.google.com/docs/cloud-messaging/migrate-v1

Parameters:

push_notification (PushNotification) –

__init__(push_notification: PushNotification) None[source]

Load relevant push notification translations and prepare content for sending

Parameters:

push_notification (PushNotification) – the push notification that should be sent

Raises:

ImproperlyConfigured – If the auth key is missing or the system runs in debug mode but the test region does not exist.

Return type:

None

is_valid() bool[source]

Check if all data for sending push notifications is available

Returns:

all prepared push notification translations are valid

Return type:

bool

load_secondary_pnts() None[source]

Load push notification translations in other languages

Return type:

None

send_all() bool[source]

Send all prepared push notification translations

Returns:

Success status

Return type:

bool

send_pn(pnt: PushNotificationTranslation, region: Region) Response[source]

Send single push notification translation

Parameters:
  • pnt (PushNotificationTranslation) – The prepared push notification translation to be sent

  • region (Region) – The region for which to send the prepared push notification translation

Returns:

Response of the requests library

Return type:

Response