
    dUh                     2    d dl mZ d dlmZ  G d de      Zy)   )BaseAPI)InvalidDataErrorc                   6    e Zd Z	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddZy)FCMNotificationNc                     | j                  |||||||||
|	||      }| j                  ||      }| j                  |      S )a&  
        Send push notification to a single device

        Args:
            fcm_token (str, optional): FCM device registration ID
            notification_title (str, optional): Message title to display in the notification tray
            notification_body (str, optional): Message string to display in the notification tray
            notification_image (str, optional): Icon that appears next to the notification

            data_payload (dict, optional): Arbitrary key/value payload, which must be UTF-8 encoded

            topic_name (str, optional): Name of the topic to deliver messages to e.g. "weather".
            topic_condition (str, optional): Condition to broadcast a message to, e.g. "'foo' in topics && 'bar' in topics".

            android_config (dict, optional): Android specific options for messages - https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidconfig
            apns_config (dict, optional): Apple Push Notification Service specific options - https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#apnsconfig
            webpush_config (dict, optional): Webpush protocol options - https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#webpushconfig
            fcm_options (dict, optional): Platform independent options for features provided by the FCM SDKs - https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#fcmoptions

            timeout (int, optional): Set time limit for the request

        Returns:
            dict: name (str) - The identifier of the message sent, in the format of projects/*/messages/{message_id}

        Raises:
            FCMServerError: FCM is temporary not available
            AuthenticationError: error authenticating the sender account
            InvalidDataError: data passed to FCM was incorrecly structured
            FCMSenderIdMismatchError: the authenticated sender is different from the sender registered to the token
            FCMNotRegisteredError: device token is missing, not registered, or invalid
        )	fcm_tokennotification_titlenotification_bodynotification_imagedata_payload
topic_nametopic_conditionandroid_configapns_configwebpush_configfcm_optionsdry_run)parse_payloadsend_requestparse_response)selfr   r	   r
   r   r   r   r   r   r   r   r   r   timeoutpayloadresponses                   I/var/www/html/Ryun_Seer/newvenv/lib/python3.12/site-packages/pyfcm/fcm.pynotifyzFCMNotification.notify   sc    ^ $$1/1%!+)#)# % 
 $$Wg6""8,,    c                 0    |g }| j                  ||      S )a  
        Sends push notification to multiple devices with personalized templates

        Args:
            params_list (list): list of parameters (the same as notify_multiple_devices)
            timeout (int, optional): set time limit for the request
        )params_listr   )send_async_request)r   r   r   s      r   async_notify_multiple_devicesz-FCMNotification.async_notify_multiple_devicesF   s%     K&&;&PPr   )NNNNNNNNNNNFx   )N   )__name__
__module____qualname__r   r!    r   r   r   r      s7     >-@Qr   r   N)baseapir   errorsr   r   r'   r   r   <module>r*      s     $LQg LQr   