def search(key): _groups = [] r = api.get('groups', 'discover', 'search', params={'q': key}) for group in deserialize(r.content)['groups']: _group = models.Group() _group.import_from_api(group) _groups.append(_group) return _groups
def sync(self): self.data = [] r = get('topics', self.topic.id, 'messages') for _message in deserialize(r.content)['messages']: message = models.Message() message.import_from_api(_message) message.topic = self.topic self.data.append(message)
def get(self, key): error = 'Invalid group slug given.' r = api.get('groups', 'discover', 'category', key, error=error) groups = deserialize(r.content)['groups'] i = [c.slug for c in self.data].index(key) self.data[i].groups = groups return self.data[i]
def sync(self): self.data = [] r = get('groups', self.group.id, 'topics') for _topic in deserialize(r.content)['topics']: topic = models.Topic() topic.import_from_api(_topic) topic.messages = Messages(topic) topic.group = self.group self.data.append(topic)
def sync(self): self.data = [] r = get('groups') for _group in deserialize(r.content)['groups']: group = models.Group() group.import_from_api(_group) group.joined = True group.topics = Topics(group) self.data.append(group)
def _discover_group(self, *cats): _groups = [] r = api.get('groups', 'discover', *cats) for group in deserialize(r.content)['groups']: _group = models.Group() _group.import_from_api(group) _groups.append(_group) #store into groups if not _group.id in self.parent.parent: self.parent.parent.data.append(_group) return _groups
def sync(self): r = api.get('groups', 'discover', 'category') for _cat in deserialize(r.content)['categories']: cat = models.Category() cat.import_from_api(_cat) self.data.append(cat)
def get(self, key): r = get('topics', key) topic = models.Topic() topic.import_from_api(deserialize(r.content)['topic']) return topic
def get(self, key): r = get('groups', key) group = models.Group() group.import_from_api(deserialize(r.content)['group']) return group