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

__init__(app_name, app_module)[source]
classmethod create(entry)[source]

Factory that creates an app config from an entry in INSTALLED_APPS.

default_auto_field[source]
get_model(model_name, require_ready=True)[source]

Return the model with the given case-insensitive model_name.

Raise LookupError if no model exists with this name.

get_models(include_auto_created=False, include_swapped=False)[source]

Return an iterable of models.

By default, the following models aren’t included:

  • auto-created models for many-to-many relations without an explicit intermediate table,

  • models that have been swapped out.

Set the corresponding keyword argument to True to include such models. Keyword arguments aren’t documented; they’re a private API.

import_models()[source]
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