# 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/exceptions.py
# class GroupyError(Exception):
# class MissingMembershipError(GroupyError):
# class FindError(GroupyError):
# class NoMatchesError(FindError):
# class MultipleMatchesError(FindError):
# class ApiError(GroupyError):
# class NoResponse(ApiError):
# class BadResponse(ApiError):
# class InvalidJsonError(BadResponse):
# class MissingResponseError(BadResponse):
# class MissingMetaError(BadResponse):
# class ResultsError(ApiError):
# class ResultsNotReady(ResultsError):
# class ResultsExpired(ResultsError):
#     def __init__(self, message=None):
#     def __init__(self, group_id, user_id, message=None):
#     def __init__(self, message, objects, tests, matches=None):
#     def __init__(self, objects, tests):
#     def __init__(self, objects, tests, matches):
#     def __init__(self, request, *args, **kwargs):
#     def __init__(self, response, message=None):
#     def _extract_message(self, response):
#     def __init__(self, response, message='The JSON was incomplete/invalid'):
#     def __init__(self, response, message='The response contained no response data'):
#     def __init__(self, response, message='The response contained no meta data'):
#     def __init__(self, response, message):
#     def __init__(self, response, message='The results are not ready yet'):
#     def __init__(self, response, message='The results have expired'):


from . import base
from . import bots
from . import messages
from . import memberships
from . import user
from groupy import utils
from groupy import pagers
from groupy import exceptions


class Groups(base.Manager):
    """A group manager."""

    def __init__(self, session):
        super().__init__(session, path='groups')

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

    def list(self, page=1, per_page=10, omit=None):
        """List groups by page.

        The API allows certain fields to be excluded from the results so that
        very large groups can be fetched without exceeding the maximum
        response size. At the time of this writing, only 'memberships' is
        supported.

        :param int page: page number
        :param int per_page: number of groups per page
        :param int omit: a comma-separated list of fields to exclude
        :return: a list of groups
        :rtype: :class:`~groupy.pagers.GroupList`
        """

# 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/exceptions.py
# class GroupyError(Exception):
# class MissingMembershipError(GroupyError):
# class FindError(GroupyError):
# class NoMatchesError(FindError):
# class MultipleMatchesError(FindError):
# class ApiError(GroupyError):
# class NoResponse(ApiError):
# class BadResponse(ApiError):
# class InvalidJsonError(BadResponse):
# class MissingResponseError(BadResponse):
# class MissingMetaError(BadResponse):
# class ResultsError(ApiError):
# class ResultsNotReady(ResultsError):
# class ResultsExpired(ResultsError):
#     def __init__(self, message=None):
#     def __init__(self, group_id, user_id, message=None):
#     def __init__(self, message, objects, tests, matches=None):
#     def __init__(self, objects, tests):
#     def __init__(self, objects, tests, matches):
#     def __init__(self, request, *args, **kwargs):
#     def __init__(self, response, message=None):
#     def _extract_message(self, response):
#     def __init__(self, response, message='The JSON was incomplete/invalid'):
#     def __init__(self, response, message='The response contained no response data'):
#     def __init__(self, response, message='The response contained no meta data'):
#     def __init__(self, response, message):
#     def __init__(self, response, message='The results are not ready yet'):
#     def __init__(self, response, message='The results have expired'):


# Path: groupy/api/groups.py
from . import base
from . import bots
from . import messages
from . import memberships
from . import user
from groupy import utils
from groupy import pagers
from groupy import exceptions



class Groups(base.Manager):
    """A group manager."""

    def __init__(self, session):
        super().__init__(session, path='groups')

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

    def list(self, page=1, per_page=10, omit=None):
        """List groups by page.

        The API allows certain fields to be excluded from the results so that
        very large groups can be fetched without exceeding the maximum
        response size. At the time of this writing, only 'memberships' is
        supported.

        :param int page: page number
        :param int per_page: number of groups per page
        :param int omit: a comma-separated list of fields to exclude
        :return: a list of groups
        :rtype: :class:`~groupy.pagers.GroupList`
        """

        return pagers.GroupList(self, self._raw_list, page=page,