Mercurial > libervia-backend
comparison libervia/frontends/bridge/pb.py @ 4130:02f0adc745c6
core: notifications implementation, first draft:
add a new table for notifications, and methods/bridge methods to manipulate them.
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 16 Oct 2023 17:29:31 +0200 |
parents | 26b7ed2817da |
children | 730f542e4ad0 |
comparison
equal
deleted
inserted
replaced
4129:51744ad00a42 | 4130:02f0adc745c6 |
---|---|
487 if errback is None: | 487 if errback is None: |
488 d.addErrback(self._generic_errback) | 488 d.addErrback(self._generic_errback) |
489 else: | 489 else: |
490 d.addErrback(self._errback, ori_errback=errback) | 490 d.addErrback(self._errback, ori_errback=errback) |
491 | 491 |
492 def notification_add(self, type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra, callback=None, errback=None): | |
493 d = self.root.callRemote("notification_add", type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra) | |
494 if callback is not None: | |
495 d.addCallback(lambda __: callback()) | |
496 if errback is None: | |
497 d.addErrback(self._generic_errback) | |
498 else: | |
499 d.addErrback(self._errback, ori_errback=errback) | |
500 | |
501 def notification_delete(self, id_, is_global, profile_key, callback=None, errback=None): | |
502 d = self.root.callRemote("notification_delete", id_, is_global, profile_key) | |
503 if callback is not None: | |
504 d.addCallback(lambda __: callback()) | |
505 if errback is None: | |
506 d.addErrback(self._generic_errback) | |
507 else: | |
508 d.addErrback(self._errback, ori_errback=errback) | |
509 | |
510 def notifications_expired_clean(self, limit_timestamp, profile_key, callback=None, errback=None): | |
511 d = self.root.callRemote("notifications_expired_clean", limit_timestamp, profile_key) | |
512 if callback is not None: | |
513 d.addCallback(lambda __: callback()) | |
514 if errback is None: | |
515 d.addErrback(self._generic_errback) | |
516 else: | |
517 d.addErrback(self._errback, ori_errback=errback) | |
518 | |
519 def notifications_get(self, filters, profile_key, callback=None, errback=None): | |
520 d = self.root.callRemote("notifications_get", filters, profile_key) | |
521 if callback is not None: | |
522 d.addCallback(callback) | |
523 if errback is None: | |
524 d.addErrback(self._generic_errback) | |
525 else: | |
526 d.addErrback(self._errback, ori_errback=errback) | |
527 | |
492 def param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@", callback=None, errback=None): | 528 def param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@", callback=None, errback=None): |
493 d = self.root.callRemote("param_get_a", name, category, attribute, profile_key) | 529 d = self.root.callRemote("param_get_a", name, category, attribute, profile_key) |
494 if callback is not None: | 530 if callback is not None: |
495 d.addCallback(callback) | 531 d.addCallback(callback) |
496 if errback is None: | 532 if errback is None: |
967 def namespaces_get(self): | 1003 def namespaces_get(self): |
968 d = self.root.callRemote("namespaces_get") | 1004 d = self.root.callRemote("namespaces_get") |
969 d.addErrback(self._errback) | 1005 d.addErrback(self._errback) |
970 return d.asFuture(asyncio.get_event_loop()) | 1006 return d.asFuture(asyncio.get_event_loop()) |
971 | 1007 |
1008 def notification_add(self, type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra): | |
1009 d = self.root.callRemote("notification_add", type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra) | |
1010 d.addErrback(self._errback) | |
1011 return d.asFuture(asyncio.get_event_loop()) | |
1012 | |
1013 def notification_delete(self, id_, is_global, profile_key): | |
1014 d = self.root.callRemote("notification_delete", id_, is_global, profile_key) | |
1015 d.addErrback(self._errback) | |
1016 return d.asFuture(asyncio.get_event_loop()) | |
1017 | |
1018 def notifications_expired_clean(self, limit_timestamp, profile_key): | |
1019 d = self.root.callRemote("notifications_expired_clean", limit_timestamp, profile_key) | |
1020 d.addErrback(self._errback) | |
1021 return d.asFuture(asyncio.get_event_loop()) | |
1022 | |
1023 def notifications_get(self, filters, profile_key): | |
1024 d = self.root.callRemote("notifications_get", filters, profile_key) | |
1025 d.addErrback(self._errback) | |
1026 return d.asFuture(asyncio.get_event_loop()) | |
1027 | |
972 def param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@"): | 1028 def param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@"): |
973 d = self.root.callRemote("param_get_a", name, category, attribute, profile_key) | 1029 d = self.root.callRemote("param_get_a", name, category, attribute, profile_key) |
974 d.addErrback(self._errback) | 1030 d.addErrback(self._errback) |
975 return d.asFuture(asyncio.get_event_loop()) | 1031 return d.asFuture(asyncio.get_event_loop()) |
976 | 1032 |