# Path: src/cloudant/_common_util.py
# def response_to_json_dict(response, **kwargs):
#     """
#     Standard place to convert responses to JSON.
# 
#     :param response: requests response object
#     :param **kwargs: arguments accepted by json.loads
# 
#     :returns: dict of JSON response
#     """
#     if response.encoding is None:
#         response.encoding = 'utf-8'
#     return json.loads(response.text, **kwargs)


from ._common_util import response_to_json_dict
        self._client = client
        self._r_session = client.r_session
        self._scheduler = '/'.join([self._client.server_url, '_scheduler'])

    def list_docs(self, limit=None, skip=None):
        """
        Lists replication documents. Includes information
        about all the documents, even in completed and failed
        states. For each document it returns the document ID, the
        database, the replication ID, source and target, and other
        information.

        :param limit: How many results to return.
        :param skip: How many result to skip starting at the beginning, if ordered by document ID.
        """
        params = dict()
        if limit is not None:
            params["limit"] = limit
        if skip is not None:
            params["skip"] = skip
        resp = self._r_session.get('/'.join([self._scheduler, 'docs']), params=params)
        resp.raise_for_status()
        return response_to_json_dict(resp)

    def get_doc(self, doc_id):
        """
        Get replication document state for a given replication document ID.
        """
        resp = self._r_session.get('/'.join([self._scheduler, 'docs', '_replicator', doc_id]))
        resp.raise_for_status()

# Path: src/cloudant/_common_util.py
# def response_to_json_dict(response, **kwargs):
#     """
#     Standard place to convert responses to JSON.
# 
#     :param response: requests response object
#     :param **kwargs: arguments accepted by json.loads
# 
#     :returns: dict of JSON response
#     """
#     if response.encoding is None:
#         response.encoding = 'utf-8'
#     return json.loads(response.text, **kwargs)


# Path: src/cloudant/scheduler.py
from ._common_util import response_to_json_dict

        self._client = client
        self._r_session = client.r_session
        self._scheduler = '/'.join([self._client.server_url, '_scheduler'])

    def list_docs(self, limit=None, skip=None):
        """
        Lists replication documents. Includes information
        about all the documents, even in completed and failed
        states. For each document it returns the document ID, the
        database, the replication ID, source and target, and other
        information.

        :param limit: How many results to return.
        :param skip: How many result to skip starting at the beginning, if ordered by document ID.
        """
        params = dict()
        if limit is not None:
            params["limit"] = limit
        if skip is not None:
            params["skip"] = skip
        resp = self._r_session.get('/'.join([self._scheduler, 'docs']), params=params)
        resp.raise_for_status()
        return response_to_json_dict(resp)

    def get_doc(self, doc_id):
        """
        Get replication document state for a given replication document ID.
        """
        resp = self._r_session.get('/'.join([self._scheduler, 'docs', '_replicator', doc_id]))
        resp.raise_for_status()

        return response_to_json_dict(resp)