# Path: groupy/api/attachments.py
# class Attachment(base.Resource, metaclass=AttachmentMeta):
#     """Base attachment class.
# 
#     Every attachment has a type and additional data.
# 
#     :param str type: attachment type
#     :param kwargs data: additional attachment data
#     """
# 
#     def __init__(self, type, **data):
#         data['type'] = type
#         self.data = data
# 
#     def to_json(self):
#         """Return the attachment as JSON serializable dict.
# 
#         :return: serializable attachment data
#         :rtype: dict
#         """
#         return self.data
# 
#     @classmethod
#     def from_data(cls, type, **data):
#         """Create an attachment from data.
# 
#         :param str type: attachment type
#         :param kwargs data: additional attachment data
#         :return: an attachment subclass object
#         :rtype: `~groupy.api.attachments.Attachment`
#         """
#         try:
#             return cls._types[type](**data)
#         except KeyError:
#             return cls(type=type, **data)
#         except TypeError as e:
#             error = 'could not create {!r} attachment'.format(type)
#             raise TypeError('{}: {}'.format(error, e.args[0]))
# 
#     @classmethod
#     def from_bulk_data(cls, attachments):
#         """Create multiple attachments from a list of attachment data.
# 
#         :return: attachment sublcass objects
#         :rtype: :class:`list`
#         """
#         return [cls.from_data(**a) for a in attachments]
# 
# Path: groupy/utils.py
# def urljoin(base, path=None):
# def parse_share_url(share_url):
# def get_rfc3339(when):
# def get_datetime(timestamp):
#     def __init__(self, key, value):
#     def __repr__(self):
#     def __call__(self, obj):
#     def __init__(self, tests):
#     def __call__(self, objects):
#     def find(self, objects):
#     def passes(self, obj):
# def make_filter(**tests):
# class AttrTest:
# class Filter:
# 
# Path: groupy/pagers.py
# class Pager:
# class GroupList(Pager):
# class ChatList(GroupList):
# class MessageList(Pager):
# class GalleryList(MessageList):
#     def __init__(self, manager, endpoint, **params):
#     def __getitem__(self, index):
#     def __iter__(self):
#     def set_next_page_params(self):
#     def fetch(self):
#     def fetch_next(self):
#     def autopage(self):
#     def set_next_page_params(self):
#     def __init__(self, manager, endpoint, **params):
#     def detect_mode(cls, **params):
#     def set_next_page_params(self):
#     def get_last_item_index(self):
#     def get_next_page_param(self, item):
#     def fetch_next(self):
#     def get_next_page_param(self, item):


import time
from . import base
from .attachments import Attachment
from groupy import utils
from groupy import pagers

    :param session: the request session
    :type session: :class:`~groupy.session.Session`
    :param str group_id: the group_id of a group
    """

    def __init__(self, session, group_id):
        path = 'groups/{}/messages'.format(group_id)
        super().__init__(session, path=path)

    def _raw_list(self, **params):
        response = self.session.get(self.url, params=params)
        if response.status_code == 304:
            return []
        messages = response.data['messages']
        return [Message(self, **message) for message in messages]

    def list(self, before_id=None, since_id=None, after_id=None, limit=20):
        """Return a page of group messages.

        The messages come in reversed order (newest first). Note you can only
        provide _one_ of ``before_id``, ``since_id``, or ``after_id``.

        :param str before_id: message ID for paging backwards
        :param str after_id: message ID for paging forwards
        :param str since_id: message ID for most recent messages since
        :param int limit: maximum number of messages per page
        :return: group messages
        :rtype: :class:`~groupy.pagers.MessageList`
        """

# Path: groupy/api/attachments.py
# class Attachment(base.Resource, metaclass=AttachmentMeta):
#     """Base attachment class.
# 
#     Every attachment has a type and additional data.
# 
#     :param str type: attachment type
#     :param kwargs data: additional attachment data
#     """
# 
#     def __init__(self, type, **data):
#         data['type'] = type
#         self.data = data
# 
#     def to_json(self):
#         """Return the attachment as JSON serializable dict.
# 
#         :return: serializable attachment data
#         :rtype: dict
#         """
#         return self.data
# 
#     @classmethod
#     def from_data(cls, type, **data):
#         """Create an attachment from data.
# 
#         :param str type: attachment type
#         :param kwargs data: additional attachment data
#         :return: an attachment subclass object
#         :rtype: `~groupy.api.attachments.Attachment`
#         """
#         try:
#             return cls._types[type](**data)
#         except KeyError:
#             return cls(type=type, **data)
#         except TypeError as e:
#             error = 'could not create {!r} attachment'.format(type)
#             raise TypeError('{}: {}'.format(error, e.args[0]))
# 
#     @classmethod
#     def from_bulk_data(cls, attachments):
#         """Create multiple attachments from a list of attachment data.
# 
#         :return: attachment sublcass objects
#         :rtype: :class:`list`
#         """
#         return [cls.from_data(**a) for a in attachments]
# 
# Path: groupy/utils.py
# def urljoin(base, path=None):
# def parse_share_url(share_url):
# def get_rfc3339(when):
# def get_datetime(timestamp):
#     def __init__(self, key, value):
#     def __repr__(self):
#     def __call__(self, obj):
#     def __init__(self, tests):
#     def __call__(self, objects):
#     def find(self, objects):
#     def passes(self, obj):
# def make_filter(**tests):
# class AttrTest:
# class Filter:
# 
# Path: groupy/pagers.py
# class Pager:
# class GroupList(Pager):
# class ChatList(GroupList):
# class MessageList(Pager):
# class GalleryList(MessageList):
#     def __init__(self, manager, endpoint, **params):
#     def __getitem__(self, index):
#     def __iter__(self):
#     def set_next_page_params(self):
#     def fetch(self):
#     def fetch_next(self):
#     def autopage(self):
#     def set_next_page_params(self):
#     def __init__(self, manager, endpoint, **params):
#     def detect_mode(cls, **params):
#     def set_next_page_params(self):
#     def get_last_item_index(self):
#     def get_next_page_param(self, item):
#     def fetch_next(self):
#     def get_next_page_param(self, item):


# Path: groupy/api/messages.py
import time
from . import base
from .attachments import Attachment
from groupy import utils
from groupy import pagers


    :param session: the request session
    :type session: :class:`~groupy.session.Session`
    :param str group_id: the group_id of a group
    """

    def __init__(self, session, group_id):
        path = 'groups/{}/messages'.format(group_id)
        super().__init__(session, path=path)

    def _raw_list(self, **params):
        response = self.session.get(self.url, params=params)
        if response.status_code == 304:
            return []
        messages = response.data['messages']
        return [Message(self, **message) for message in messages]

    def list(self, before_id=None, since_id=None, after_id=None, limit=20):
        """Return a page of group messages.

        The messages come in reversed order (newest first). Note you can only
        provide _one_ of ``before_id``, ``since_id``, or ``after_id``.

        :param str before_id: message ID for paging backwards
        :param str after_id: message ID for paging forwards
        :param str since_id: message ID for most recent messages since
        :param int limit: maximum number of messages per page
        :return: group messages
        :rtype: :class:`~groupy.pagers.MessageList`
        """

        return pagers.MessageList(self, self._raw_list, before_id=before_id,