示例#1
0
    def __init__(self):
        super(CoreNotifier, self).__init__()

        addEvent('notify', self.notify)
        addEvent('notify.frontend', self.frontend)

        addApiView('notification.markread', self.markAsRead, docs = {
            'desc': 'Mark notifications as read',
            'params': {
                'ids': {'desc': 'Notification id you want to mark as read. All if ids is empty.', 'type': 'int (comma separated)'},
            },
        })

        addApiView('notification.list', self.listView, docs = {
            'desc': 'Get list of notifications',
            'params': {
                'limit_offset': {'desc': 'Limit and offset the notification list. Examples: "50" or "50,30"'},
            },
            'return': {'type': 'object', 'example': """{
    'success': True,
    'empty': bool, any notification returned or not,
    'notifications': array, notifications found,
}"""}
        })

        addNonBlockApiView('notification.listener', (self.addListener, self.removeListener))
        addApiView('notification.listener', self.listener)

        addEvent('app.load', self.clean)
示例#2
0
    def __init__(self):
        super(CoreNotifier, self).__init__()

        addEvent('notify', self.notify)
        addEvent('notify.frontend', self.frontend)

        addApiView('notification.markread', self.markAsRead, docs = {
            'desc': 'Mark notifications as read',
            'params': {
                'ids': {'desc': 'Notification id you want to mark as read. All if ids is empty.', 'type': 'int (comma separated)'},
            },
        })

        addApiView('notification.list', self.listView, docs = {
            'desc': 'Get list of notifications',
            'params': {
                'limit_offset': {'desc': 'Limit and offset the notification list. Examples: "50" or "50,30"'},
            },
            'return': {'type': 'object', 'example': """{
    'success': True,
    'empty': bool, any notification returned or not,
    'notifications': array, notifications found,
}"""}
        })

        addNonBlockApiView('notification.listener', (self.addListener, self.removeListener))
        addApiView('notification.listener', self.listener)

        fireEvent('schedule.interval', 'core.check_messages', self.checkMessages, hours = 12, single = True)

        addEvent('app.load', self.clean)
        addEvent('app.load', self.checkMessages)
示例#3
0
    def __init__(self):
        super(CoreNotifier, self).__init__()

        addEvent("notify", self.notify)
        addEvent("notify.frontend", self.frontend)

        addApiView(
            "notification.markread",
            self.markAsRead,
            docs={
                "desc": "Mark notifications as read",
                "params": {
                    "ids": {
                        "desc": "Notification id you want to mark as read. All if ids is empty.",
                        "type": "int (comma separated)",
                    }
                },
            },
        )

        addApiView(
            "notification.list",
            self.listView,
            docs={
                "desc": "Get list of notifications",
                "params": {
                    "limit_offset": {"desc": 'Limit and offset the notification list. Examples: "50" or "50,30"'}
                },
                "return": {
                    "type": "object",
                    "example": """{
    'success': True,
    'empty': bool, any notification returned or not,
    'notifications': array, notifications found,
}""",
                },
            },
        )

        addNonBlockApiView("notification.listener", (self.addListener, self.removeListener))
        addApiView("notification.listener", self.listener)

        fireEvent("schedule.interval", "core.check_messages", self.checkMessages, hours=12, single=True)
        fireEvent("schedule.interval", "core.clean_messages", self.cleanMessages, seconds=15, single=True)

        addEvent("app.load", self.clean)

        if not Env.get("dev"):
            addEvent("app.load", self.checkMessages)

        self.messages = []
        self.listeners = []
        self.m_lock = threading.Lock()
示例#4
0
    def __init__(self):
        super(CoreNotifier, self).__init__()

        addEvent("notify", self.notify)
        addEvent("notify.frontend", self.frontend)

        addApiView(
            "notification.markread",
            self.markAsRead,
            docs={
                "desc": "Mark notifications as read",
                "params": {
                    "ids": {
                        "desc": "Notification id you want to mark as read. All if ids is empty.",
                        "type": "int (comma separated)",
                    }
                },
            },
        )

        addApiView(
            "notification.list",
            self.listView,
            docs={
                "desc": "Get list of notifications",
                "params": {
                    "limit_offset": {"desc": 'Limit and offset the notification list. Examples: "50" or "50,30"'}
                },
                "return": {
                    "type": "object",
                    "example": """{
    'success': True,
    'empty': bool, any notification returned or not,
    'notifications': array, notifications found,
}""",
                },
            },
        )

        addNonBlockApiView("notification.listener", (self.addListener, self.removeListener))
        addApiView("notification.listener", self.listener)

        addEvent("app.load", self.clean)
示例#5
0
    def __init__(self):
        super(CoreNotifier, self).__init__()

        addEvent('notify', self.notify)
        addEvent('notify.frontend', self.frontend)

        addApiView('notification.markread', self.markAsRead, docs = {
            'desc': 'Mark notifications as read',
            'params': {
                'ids': {'desc': 'Notification id you want to mark as read. All if ids is empty.', 'type': 'int (comma separated)'},
            },
        })

        addApiView('notification.list', self.listView, docs = {
            'desc': 'Get list of notifications',
            'params': {
                'limit_offset': {'desc': 'Limit and offset the notification list. Examples: "50" or "50,30"'},
            },
            'return': {'type': 'object', 'example': """{
    'success': True,
    'empty': bool, any notification returned or not,
    'notifications': array, notifications found,
}"""}
        })

        addNonBlockApiView('notification.listener', (self.addListener, self.removeListener))
        addApiView('notification.listener', self.listener)

        fireEvent('schedule.interval', 'core.check_messages', self.checkMessages, hours = 12, single = True)
        fireEvent('schedule.interval', 'core.clean_messages', self.cleanMessages, seconds = 15, single = True)

        addEvent('app.load', self.clean)

        if not Env.get('dev'):
            addEvent('app.load', self.checkMessages)

        self.messages = []
        self.listeners = []
        self.m_lock = threading.Lock()