def get_group_posts(self, group_id, start=0, count=10, order='recency', role=None, modified_since=None): if order not in ('recency', 'popularity'): raise ValueError('Sort order must be either recency or popularity') _args = {'modified-since': modified_since} args = args_to_dict(start=start, count=count, order=order, role=role, **_args) base = endpoints.GROUP_FEED.format(group_id=group_id) url = build_url_with_qs(base, args) return self._make_request(url)
def get_network_updates(self, update_type=None, before=None, after=None, count=10, start=0): update_type = update_type or [] if not isinstance(update_type, (list, tuple, basestring)): raise TypeError('update_type must be a list or a string') if before: before = date_to_str(before) if after: after = date_to_str(after) args = args_to_dict(type=update_type, before=before, after=after, count=count, start=start) url = build_url_with_qs(endpoints.NETWORK_UPDATES, args) return self._make_request(url)
def create_comment(self, post_id, text): args = args_to_dict(text=text) body = json.dumps(args) url = endpoints.CREATE_COMMENT.format(post_id=post_id) return self._make_request(url, method='POST', body=body)
def get_comments_for_post(self, post_id, count=10, start=0): args = args_to_dict(count=count, start=start) base = endpoints.POST_COMMENTS.format(post_id=post_id) url = build_url_with_qs(base, args) return self._make_request(url)
def create_group_post(self, group_id, title, summary): args = args_to_dict(title=title, summary=summary) body = json.dumps(args) url = endpoints.CREATE_POST.format(group_id=group_id) return self._make_request(url, method='POST', body=body)