Beispiel #1
0
    def pushMsgToTag(self, tag, msg, type=1, opts=None):
        """推送消息或通知给指定的标签

        args:
            tag--已创建的tag名称
            msg--json格式的通知数据,详见说明文档
            type--推送的标签类型,目前固定值为1
            opts--可选字段合集,详见说明文档
        return:
            msg_id--消息id
            send_time--消息的实际推送时间
            timer_id(可选)--定时服务ID
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'pushMsgToTag')
        args = self._commonSet()
        args['type'] = type
        args['tag'] = tag
        args['msg'] = msg
        args.update(opts)
        self._product_name = 'push'
        self._resource_name = 'tags'

        return self._commonProcess(args)
Beispiel #2
0
    def pushBatchUniMsg(self, channel_ids, msg, opts=None):
        """推送消息给批量设备(批量单播)

        args:
            channel_ids--一组channel_id(最多为一万个)组成的json数组字符串
            channel_ids--一组channel_id(最少1个,最多为10个)组成的list,对应一批设备
            msg--json格式的通知数据,详见说明文档
            opts--可选字段合集,详见说明文档
        return:
            msg_id--消息id
            send_time--消息的实际推送时间
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'pushBatchUniMsg')
        args = self._commonSet()
        args['channel_ids'] = json.dumps(channel_ids)
        args['msg'] = msg
        # args['topic_id'] = topic_id
        args.update(opts)
        self._product_name = 'push'
        self._resource_name = 'batch_device'

        return self._commonProcess(args)
Beispiel #3
0
    def pushBatchUniMsg(self, channel_ids, msg, opts=None):
        """推送消息给批量设备(批量单播)

        args:
            channel_ids--一组channel_id(最多为一万个)组成的json数组字符串
            channel_ids--一组channel_id(最少1个,最多为10个)组成的list,对应一批设备
            msg--json格式的通知数据,详见说明文档
            opts--可选字段合集,详见说明文档
        return:
            msg_id--消息id
            send_time--消息的实际推送时间
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'pushBatchUniMsg')
        args = self._commonSet()
        args['channel_ids'] = json.dumps(channel_ids)
        args['msg'] = msg
        # args['topic_id'] = topic_id
        args.update(opts)
        self._product_name = 'push'
        self._resource_name = 'batch_device'

        return self._commonProcess(args)
Beispiel #4
0
    def pushMsgToTag(self, tag, msg, type=1, opts=None):
        """推送消息或通知给指定的标签

        args:
            tag--已创建的tag名称
            msg--json格式的通知数据,详见说明文档
            type--推送的标签类型,目前固定值为1
            opts--可选字段合集,详见说明文档
        return:
            msg_id--消息id
            send_time--消息的实际推送时间
            timer_id(可选)--定时服务ID
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'pushMsgToTag')
        args = self._commonSet()
        args['type'] = type
        args['tag'] = tag
        args['msg'] = msg
        args.update(opts)
        self._product_name = 'push'
        self._resource_name = 'tags'

        return self._commonProcess(args)
Beispiel #5
0
    def queryTimerList(self, opts=None):
        """查看还未执行的定时任务,每个应用可设置的有效的定时任务有限制(目前为10个)

        args:
            opts--可选字段合集,详见说明文档
        return:
            total_num--定时推送任务的总数量
            result--数组对象,每项表示一个定时任务的相关信息
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'queryTimerList')
        args = self._commonSet()
        args.update(opts)
        self._product_name = 'timer'
        self._resource_name = 'query_list'

        return self._commonProcess(args)
Beispiel #6
0
    def queryTags(self, opts=None):
        """查询应用的tag

        args:
            opts--可选字段合集,详见说明文档
        return:
            total_num--Tag总数
            result--数组对象,每项内容表示一个Tag的详细信息
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'queryTags')
        args = self._commonSet()
        args.update(opts)
        self._product_name = 'app'
        self._resource_name = 'query_tags'

        return self._commonProcess(args)
Beispiel #7
0
    def queryTopicList(self, opts=None):
        """查询推送过程中使用过的分类主题列表

        args:
            opts--可选字段合集,详见说明文档
        return:
            total_num--所使用过的分类主题总数
            result--json数组,数组中每项内容表示一个分类主题的相关信息
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'queryTopicList')
        args = self._commonSet()
        args.update(opts)
        self._product_name = 'topic'
        self._resource_name = 'query_list'

        return self._commonProcess(args)
Beispiel #8
0
    def queryTimerList(self, opts=None):
        """查看还未执行的定时任务,每个应用可设置的有效的定时任务有限制(目前为10个)

        args:
            opts--可选字段合集,详见说明文档
        return:
            total_num--定时推送任务的总数量
            result--数组对象,每项表示一个定时任务的相关信息
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'queryTimerList')
        args = self._commonSet()
        args.update(opts)
        self._product_name = 'timer'
        self._resource_name = 'query_list'

        return self._commonProcess(args)
Beispiel #9
0
    def queryTopicList(self, opts=None):
        """查询推送过程中使用过的分类主题列表

        args:
            opts--可选字段合集,详见说明文档
        return:
            total_num--所使用过的分类主题总数
            result--json数组,数组中每项内容表示一个分类主题的相关信息
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'queryTopicList')
        args = self._commonSet()
        args.update(opts)
        self._product_name = 'topic'
        self._resource_name = 'query_list'

        return self._commonProcess(args)
Beispiel #10
0
    def queryTags(self, opts=None):
        """查询应用的tag

        args:
            opts--可选字段合集,详见说明文档
        return:
            total_num--Tag总数
            result--数组对象,每项内容表示一个Tag的详细信息
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'queryTags')
        args = self._commonSet()
        args.update(opts)
        self._product_name = 'app'
        self._resource_name = 'query_tags'

        return self._commonProcess(args)
Beispiel #11
0
    def queryTopicRecords(self, topic_id, opts=None):
        """根据分类主题获取消息推送记录

        args:
            topic_id--分类主题名称
            opts--可选字段合集,详见说明文档
        return:
            topic_id--分类主题名称
            result--数组对象,每项内容为该分类主题下的一条消息的相关信息
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'queryTopicRecords')
        args = self._commonSet()
        args['topic_id'] = topic_id
        args.update(opts)
        self._product_name = 'report'
        self._resource_name = 'query_topic_records'

        return self._commonProcess(args)
Beispiel #12
0
    def queryTimerRecords(self, timer_id, opts=None):
        """根据timer_id获取消息推送记录

        args:
            timer_id--推送接口返回的timer_id
            opts--可选字段合集,详见说明文档
        return:
            timer_id--定时任务id
            result--数组对象,每项内容为该定时任务所产生的一条消息的状态
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'queryTimerRecords')
        args = self._commonSet()
        args['timer_id'] = timer_id
        args.update(opts)
        self._product_name = 'report'
        self._resource_name = 'query_timer_records'

        return self._commonProcess(args)
Beispiel #13
0
    def queryTopicRecords(self, topic_id, opts=None):
        """根据分类主题获取消息推送记录

        args:
            topic_id--分类主题名称
            opts--可选字段合集,详见说明文档
        return:
            topic_id--分类主题名称
            result--数组对象,每项内容为该分类主题下的一条消息的相关信息
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'queryTopicRecords')
        args = self._commonSet()
        args['topic_id'] = topic_id
        args.update(opts)
        self._product_name = 'report'
        self._resource_name = 'query_topic_records'

        return self._commonProcess(args)
Beispiel #14
0
    def queryTimerRecords(self, timer_id, opts=None):
        """根据timer_id获取消息推送记录

        args:
            timer_id--推送接口返回的timer_id
            opts--可选字段合集,详见说明文档
        return:
            timer_id--定时任务id
            result--数组对象,每项内容为该定时任务所产生的一条消息的状态
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'queryTimerRecords')
        args = self._commonSet()
        args['timer_id'] = timer_id
        args.update(opts)
        self._product_name = 'report'
        self._resource_name = 'query_timer_records'

        return self._commonProcess(args)
Beispiel #15
0
    def pushMsgToAll(self, msg, opts=None):
        """向当前app下所有设备推送一条消息

        args:
            msg--json格式的通知数据,详见说明文档
            opts--可选字段合集,详见说明文档
        return:
            msg_id--消息id
            send_time--消息的实际推送时间
            timer_id(可选)--定时服务ID
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'pushMsgToAll')
        args = self._commonSet()
        args['msg'] = msg
        args.update(opts)
        self._product_name = 'push'
        self._resource_name = 'all'

        return self._commonProcess(args)
Beispiel #16
0
    def pushMsgToAll(self, msg, opts=None):
        """向当前app下所有设备推送一条消息

        args:
            msg--json格式的通知数据,详见说明文档
            opts--可选字段合集,详见说明文档
        return:
            msg_id--消息id
            send_time--消息的实际推送时间
            timer_id(可选)--定时服务ID
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'pushMsgToAll')
        args = self._commonSet()
        args['msg'] = msg
        args.update(opts)
        self._product_name = 'push'
        self._resource_name = 'all'

        return self._commonProcess(args)
Beispiel #17
0
    def pushMsgToSingleDevice(self, channel_id, msg, opts=None):
        """向单个设备推送消息

        args:
            channel_id--客户端初始化成功之后返回的channelId
            msg--json格式的通知数据,详见说明文档
            opts--可选字段合集,详见说明文档
        return:
            msg_id--消息id
            send_time--消息的实际推送时间
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'pushMsgToSingleDevice')
        args = self._commonSet()
        args['channel_id'] = channel_id
        args['msg'] = msg
        args.update(opts)
        self._product_name = 'push'
        self._resource_name = 'single_device'

        return self._commonProcess(args)
Beispiel #18
0
    def pushMsgToSingleDevice(self, channel_id, msg, opts=None):
        """向单个设备推送消息

        args:
            channel_id--客户端初始化成功之后返回的channelId
            msg--json格式的通知数据,详见说明文档
            opts--可选字段合集,详见说明文档
        return:
            msg_id--消息id
            send_time--消息的实际推送时间
        Exception:
            参数错误或者http错误,会抛出此异常,异常信息详见说明文档"""

        self._checkConf()

        validOptDict(opts, 'pushMsgToSingleDevice')
        args = self._commonSet()
        args['channel_id'] = channel_id
        args['msg'] = msg
        args.update(opts)
        self._product_name = 'push'
        self._resource_name = 'single_device'

        return self._commonProcess(args)