Skip to content

Response

chad63e edited this page Jan 29, 2024 · 1 revision

Response

Class Description

Response is an Anvil-specific Python wrapper class for Firebase Cloud Messaging (FCM) responses. It's designed to interpret and convert responses from FCM operations into a format native to Anvil, facilitating easier interaction with these responses in Anvil applications. This class is not instantiated directly by developers but is used to interact with and understand the outcomes of message sending operations in FCM.

Attributes

  • success (bool): Indicates whether the FCM operation was successful.
  • message_id (str, optional): The unique message ID assigned by FCM, available if the message was sent successfully.
  • exception (str, optional): Describes any exception or error encountered during the FCM operation. It provides insights into what might have gone wrong if the operation was unsuccessful.

Interaction with FCM Responses

Developers will typically interact with instances of the Response class when dealing with the results of FCM message operations. These instances are automatically created and returned by various Firebase messaging functions within the Anvil Firebase wrapper.

Usage Scenario

  • When a message is sent via FCM using the Anvil Firebase wrapper, the response from FCM is automatically converted to an instance of the Response class.
  • Developers can then use the attributes of this class to check if the operation was successful, retrieve the message ID for successful operations, or understand the nature of any errors that occurred.