firebase / firebase/firebase-admin-python

[FR] Allow `messaging.subscribe_to_topic` to return more verbose information on failure

未關閉
#690 7 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
api: messaging needs-triage type: feature request
主要語言
Python
星號
1.2k
分支
359
平均合併
5 天 6 分鐘
30 天內合併 PR
2

描述

**Is your feature request related to a problem? Please describe.**
It frustrates our team that each time our mobile app is updated and our users open the app, a new `device_id` is generated. We are saving this new device_id to the user, because we can't know **for sure** that the user haven't just bought a new phone and installed the app into that new phone as well. This leads to the problem that when we subscribe users to a topic, with all their device ids, we get many `Errors ['NOT_FOUND', 'NOT_FOUND', 'NOT_FOUND', 'NOT_FOUND', 'NOT_FOUND', 'NOT_FOUND']` returned.

**Describe the solution you'd like**
We'd like that the API returns a list of failed `device_id`s so that we can delete those from our database. We'd love to see this extended to `messaging.unsubscribe_from_topic` as well.

**Describe alternatives you've considered**
Digging through the firebase code doesn't give any hints that the information we're looking for is discarded in transit.

**Additional context**
Code example:
```python
from firebase_admin import messaging

def do_subscribe(tokens, topic):
response = messaging.subscribe_to_topic(tokens, topic)
if response.failure_count > 0:
logger.error(
f"Errors {list(map(lambda e: e.reason, response.errors))}",
exc_info=False,
)
```

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。