示例#1
0
class Message(HipChatObject):
    sort = 'message'


class MessageSentStatus(HipChatObject):
    sort = 'status'

    def __init__(self, jsono):
        self.jsono = jsono
        self.status = jsono.get('status')


Room.history = \
    classmethod(partial(call_hipchat, 
                        ReturnType=lambda x: map(Room,
                                                 map(lambda y: {'message': y},
                                                     x['messages'])),
                        url="https://api.hipchat.com/v1/rooms/history",
                        data=False))
Room.list = \
    classmethod(partial(call_hipchat, 
                        ReturnType=lambda x: map(Room,
                                                 map(lambda y: {'room': y},
                                                     x['rooms'])),
                        url="https://api.hipchat.com/v1/rooms/list",
                        data=False))
Room.message = \
    classmethod(partial(call_hipchat,
                        ReturnType=MessageSentStatus,
                        url="https://api.hipchat.com/v1/rooms/message",
                        data=True))
Room.show = \
示例#2
0

class Message(HipChatObject):
    sort = 'message'


class MessageSentStatus(HipChatObject):
    sort = 'status'
    def __init__(self, jsono):
        self.jsono = jsono
        self.status = jsono.get('status')


Room.history = \
    classmethod(partial(call_hipchat, 
                        ReturnType=lambda x: map(Message, map(lambda y: {'message': y}, x['messages'])), 
                        url="https://api.hipchat.com/v1/rooms/history", 
                        data=False))
Room.list = \
    classmethod(partial(call_hipchat, 
                        ReturnType=lambda x: map(Room, map(lambda y: {'room': y}, x['rooms'])), 
                        url="https://api.hipchat.com/v1/rooms/list", 
                        data=False))
Room.message = classmethod(partial(call_hipchat, ReturnType=MessageSentStatus, url="https://api.hipchat.com/v1/rooms/message", data=True))
Room.show = classmethod(partial(call_hipchat, Room, url="https://api.hipchat.com/v1/rooms/show", data=False))

########NEW FILE########
__FILENAME__ = user
from hipchat.connection import partial, call_hipchat, HipChatObject

class UserDeleteStatus(HipChatObject):
    sort = 'delete'
示例#3
0
class Message(HipChatObject):
    sort = 'message'


class MessageSentStatus(HipChatObject):
    sort = 'status'

    def __init__(self, jsono):
        self.jsono = jsono
        self.status = jsono.get('status')


Room.history = \
    classmethod(partial(call_hipchat,
                        ReturnType=lambda x: map(Message, map(lambda y: {'message': y}, x['messages'])),
                        url="https://api.hipchat.com/v1/rooms/history",
                        data=False))
Room.list = \
    classmethod(partial(call_hipchat,
                        ReturnType=lambda x: map(Room, map(lambda y: {'room': y}, x['rooms'])),
                        url="https://api.hipchat.com/v1/rooms/list",
                        data=False))

Room.create = classmethod(
    partial(call_hipchat,
            Room,
            url="https://api.hipchat.com/v1/rooms/create",
            data=True))
Room.topic = classmethod(
    partial(call_hipchat,
            ReturnType=lambda x: x['status'],
示例#4
0
class UserDeleteStatus(HipChatObject):
    sort = 'delete'

    def __init__(self, jsono):
        self.jsono = jsono
        self.deleted = jsono.get('deleted')


class User(HipChatObject):
    sort = 'user'


User.create = classmethod(
    partial(call_hipchat,
            User,
            url="https://api.hipchat.com/v1/users/create",
            data=True))
User.delete = \
    classmethod(partial(call_hipchat,
                        ReturnType=UserDeleteStatus,
                        url="https://api.hipchat.com/v1/users/delete",
                        data=True))
User.undelete = \
    classmethod(partial(call_hipchat,
                        ReturnType=UserDeleteStatus,
                        url="https://api.hipchat.com/v1/users/undelete",
                        data=True))
User.list = \
    classmethod(partial(call_hipchat,
                        ReturnType=lambda x: map(User, map(lambda y: {'user': y}, x['users'])),
                        url="https://api.hipchat.com/v1/users/list",
示例#5
0

class Message(HipChatObject):
    sort = 'message'


class MessageSentStatus(HipChatObject):
    sort = 'status'
    def __init__(self, jsono):
        self.jsono = jsono
        self.status = jsono.get('status')


Room.history = \
    classmethod(partial(call_hipchat, 
                        ReturnType=lambda x: map(Message, map(lambda y: {'message': y}, x['messages'])), 
                        url="rooms/history", 
                        data=False))
Room.list = \
    classmethod(partial(call_hipchat, 
                        ReturnType=lambda x: map(Room, map(lambda y: {'room': y}, x['rooms'])), 
                        url="rooms/list", 
                        data=False))

Room.create = classmethod(
    partial(call_hipchat, Room, url="rooms/create", data=True)
)
Room.topic = classmethod(
    partial(call_hipchat, ReturnType=lambda x: x['status'], url="rooms/topic", data=True)
)

Room.message = classmethod(partial(call_hipchat, ReturnType=MessageSentStatus, url="rooms/message", data=True))
示例#6
0
from hipchat.connection import partial, call_hipchat, HipChatObject

class UserDeleteStatus(HipChatObject):
    sort = 'delete'
    def __init__(self, jsono):
        self.jsono = jsono
        self.deleted = jsono.get('deleted')


class User(HipChatObject):
    sort = 'user'

User.create = classmethod(partial(call_hipchat, User, url="users/create", data=True))

User.delete = \
    classmethod(partial(call_hipchat, 
                ReturnType=UserDeleteStatus, 
                url="users/delete", 
                data=True))

User.undelete = \
    classmethod(partial(call_hipchat, 
                ReturnType=UserDeleteStatus, 
                url="users/undelete", 
                data=True))

User.list = \
    classmethod(partial(call_hipchat, 
                ReturnType=lambda x: map(User, map(lambda y: {'user': y}, x['users'])), 
                url="users/list", 
                data=False))