# Path: eulfedora/api.py
# class HTTP_API_Base(object):
# class REST_API(HTTP_API_Base):
# class API_A_LITE(HTTP_API_Base):
# class ApiFacade(REST_API, API_A_LITE):
# class UnrecognizedQueryLanguage(EnvironmentError):
# class ResourceIndex(HTTP_API_Base):
#     def __init__(self, base_url, username=None, password=None, retries=None):
#     def absurl(self, rel_url):
#     def prep_url(self, url):
#     def _make_request(self, reqmeth, url, *args, **kwargs):
#     def get(self, *args, **kwargs):
#     def head(self, *args, **kwargs):
#     def put(self, *args, **kwargs):
#     def post(self, *args, **kwargs):
#     def delete(self, *args, **kwargs):
#     def findObjects(self, query=None, terms=None, pid=True, chunksize=None, session_token=None):
#     def getDatastreamDissemination(self, pid, dsID, asOfDateTime=None, stream=False,
#                 head=False, rqst_headers=None):
#     def getDissemination(self, pid, sdefPid, method, method_params=None):
#     def getObjectHistory(self, pid):
#     def getObjectProfile(self, pid, asOfDateTime=None):
#     def listDatastreams(self, pid):
#     def listMethods(self, pid, sdefpid=None):
#     def addDatastream(self, pid, dsID, dsLabel=None, mimeType=None, logMessage=None,
#         controlGroup=None, dsLocation=None, altIDs=None, versionable=None,
#         dsState=None, formatURI=None, checksumType=None, checksum=None, content=None):
#     def addRelationship(self, pid, subject, predicate, object, isLiteral=False,
#                         datatype=None):
#     def compareDatastreamChecksum(self, pid, dsID, asOfDateTime=None): # date time
#     def export(self, pid, context=None, format=None, encoding=None,
#                 stream=False):
#     def getDatastream(self, pid, dsID, asOfDateTime=None, validateChecksum=False):
#     def getDatastreamHistory(self, pid, dsid, format=None):
#     def getNextPID(self, numPIDs=None, namespace=None):
#     def getObjectXML(self, pid):
#     def getRelationships(self, pid, subject=None, predicate=None, format=None):
#     def ingest(self, text, logMessage=None):
#     def modifyDatastream(self, pid, dsID, dsLabel=None, mimeType=None, logMessage=None, dsLocation=None,
#         altIDs=None, versionable=None, dsState=None, formatURI=None, checksumType=None,
#         checksum=None, content=None, force=False):
#     def modifyObject(self, pid, label, ownerId, state, logMessage=None):
#     def purgeDatastream(self, pid, dsID, startDT=None, endDT=None, logMessage=None,
#             force=False):
#     def purgeObject(self, pid, logMessage=None):
#     def purgeRelationship(self, pid, subject, predicate, object, isLiteral=False,
#                         datatype=None):
#     def setDatastreamState(self, pid, dsID, dsState):
#     def setDatastreamVersionable(self, pid, dsID, versionable):
#     def upload(self, data, callback=None, content_type=None,
#                size=None):
#     def describeRepository(self):
#     def __init__(self, base_url, username=None, password=None):
#     def find_statements(self, query, language='spo', type='triples', flush=None,
#                         limit=None):
#     def count_statements(self, query, language='spo', type='triples',
#                          flush=None):
#     def _query(self, format, http_args, flush=None):
#     def spo_search(self, subject=None, predicate=None, object=None):
#     def spoencode(self, val):
#     def get_subjects(self, predicate, object):
#     def get_predicates(self, subject, object):
#     def get_objects(self, subject, predicate):
#     def sparql_query(self, query, flush=None, limit=None):
#     def sparql_count(self, query, flush=None):
#     RISEARCH_FLUSH_ON_QUERY = False


from debug_toolbar import settings as dt_settings
from debug_toolbar.panels import Panel
from debug_toolbar.utils import render_stacktrace, tidy_stacktrace, \
    get_stack
from eulfedora.api import api_called
Panel for use with
`django-debug-toolbar <https://django-debug-toolbar.readthedocs.org/>`_.

To install, add:

    'eulfedora.debug_panel.FedoraPanel',

to your configured **DEBUG_TOOLBAR_PANELS**.

Reports on the Fedora API requests used run to generate a page, including
time to run the query, arguments passed, and response returned.
'''



# implementation based on django-debug-toolbar cache panel


class FedoraPanel(Panel):

    name = 'Fedora'
    has_content = True

    template = 'eulfedora/debug_panel.html'

    def __init__(self, *args, **kwargs):
        super(FedoraPanel, self).__init__(*args, **kwargs)
        self.total_time = 0
        self.api_calls = []


# Path: eulfedora/api.py
# class HTTP_API_Base(object):
# class REST_API(HTTP_API_Base):
# class API_A_LITE(HTTP_API_Base):
# class ApiFacade(REST_API, API_A_LITE):
# class UnrecognizedQueryLanguage(EnvironmentError):
# class ResourceIndex(HTTP_API_Base):
#     def __init__(self, base_url, username=None, password=None, retries=None):
#     def absurl(self, rel_url):
#     def prep_url(self, url):
#     def _make_request(self, reqmeth, url, *args, **kwargs):
#     def get(self, *args, **kwargs):
#     def head(self, *args, **kwargs):
#     def put(self, *args, **kwargs):
#     def post(self, *args, **kwargs):
#     def delete(self, *args, **kwargs):
#     def findObjects(self, query=None, terms=None, pid=True, chunksize=None, session_token=None):
#     def getDatastreamDissemination(self, pid, dsID, asOfDateTime=None, stream=False,
#                 head=False, rqst_headers=None):
#     def getDissemination(self, pid, sdefPid, method, method_params=None):
#     def getObjectHistory(self, pid):
#     def getObjectProfile(self, pid, asOfDateTime=None):
#     def listDatastreams(self, pid):
#     def listMethods(self, pid, sdefpid=None):
#     def addDatastream(self, pid, dsID, dsLabel=None, mimeType=None, logMessage=None,
#         controlGroup=None, dsLocation=None, altIDs=None, versionable=None,
#         dsState=None, formatURI=None, checksumType=None, checksum=None, content=None):
#     def addRelationship(self, pid, subject, predicate, object, isLiteral=False,
#                         datatype=None):
#     def compareDatastreamChecksum(self, pid, dsID, asOfDateTime=None): # date time
#     def export(self, pid, context=None, format=None, encoding=None,
#                 stream=False):
#     def getDatastream(self, pid, dsID, asOfDateTime=None, validateChecksum=False):
#     def getDatastreamHistory(self, pid, dsid, format=None):
#     def getNextPID(self, numPIDs=None, namespace=None):
#     def getObjectXML(self, pid):
#     def getRelationships(self, pid, subject=None, predicate=None, format=None):
#     def ingest(self, text, logMessage=None):
#     def modifyDatastream(self, pid, dsID, dsLabel=None, mimeType=None, logMessage=None, dsLocation=None,
#         altIDs=None, versionable=None, dsState=None, formatURI=None, checksumType=None,
#         checksum=None, content=None, force=False):
#     def modifyObject(self, pid, label, ownerId, state, logMessage=None):
#     def purgeDatastream(self, pid, dsID, startDT=None, endDT=None, logMessage=None,
#             force=False):
#     def purgeObject(self, pid, logMessage=None):
#     def purgeRelationship(self, pid, subject, predicate, object, isLiteral=False,
#                         datatype=None):
#     def setDatastreamState(self, pid, dsID, dsState):
#     def setDatastreamVersionable(self, pid, dsID, versionable):
#     def upload(self, data, callback=None, content_type=None,
#                size=None):
#     def describeRepository(self):
#     def __init__(self, base_url, username=None, password=None):
#     def find_statements(self, query, language='spo', type='triples', flush=None,
#                         limit=None):
#     def count_statements(self, query, language='spo', type='triples',
#                          flush=None):
#     def _query(self, format, http_args, flush=None):
#     def spo_search(self, subject=None, predicate=None, object=None):
#     def spoencode(self, val):
#     def get_subjects(self, predicate, object):
#     def get_predicates(self, subject, object):
#     def get_objects(self, subject, predicate):
#     def sparql_query(self, query, flush=None, limit=None):
#     def sparql_count(self, query, flush=None):
#     RISEARCH_FLUSH_ON_QUERY = False


# Path: eulfedora/debug_panel.py
from debug_toolbar import settings as dt_settings
from debug_toolbar.panels import Panel
from debug_toolbar.utils import render_stacktrace, tidy_stacktrace, \
    get_stack
from eulfedora.api import api_called

Panel for use with
`django-debug-toolbar <https://django-debug-toolbar.readthedocs.org/>`_.

To install, add:

    'eulfedora.debug_panel.FedoraPanel',

to your configured **DEBUG_TOOLBAR_PANELS**.

Reports on the Fedora API requests used run to generate a page, including
time to run the query, arguments passed, and response returned.
'''



# implementation based on django-debug-toolbar cache panel


class FedoraPanel(Panel):

    name = 'Fedora'
    has_content = True

    template = 'eulfedora/debug_panel.html'

    def __init__(self, *args, **kwargs):
        super(FedoraPanel, self).__init__(*args, **kwargs)
        self.total_time = 0
        self.api_calls = []


        api_called.connect(self._store_api_info)