def diff(self, before: Union[(str, dict, List[dict], 'WOQLSchema', 'DocumentTemplate', List['DocumentTemplate'])], after: Union[(str, dict, List[dict], 'WOQLSchema', 'DocumentTemplate', List['DocumentTemplate'])], document_id: Union[(str, None)]=None):
    'Perform diff on 2 set of document(s), result in a Patch object.\n\n        Do not connect when using public API.\n\n        Returns\n        -------\n        obj\n            Patch object\n\n        Examples\n        --------\n        >>> client = WOQLClient("https://127.0.0.1:6363/")\n        >>> client.connect(user="admin", key="root", team="admin", db="some_db")\n        >>> result = client.diff({ "@id" : "Person/Jane", "@type" : "Person", "name" : "Jane"}, { "@id" : "Person/Jane", "@type" : "Person", "name" : "Janine"})\n        >>> result.to_json = \'{ "name" : { "@op" : "SwapValue", "@before" : "Jane", "@after": "Janine" }}\''
    request_dict = {}
    for (key, item) in {'before': before, 'after': after}.items():
        if isinstance(item, str):
            request_dict[f'{key}_data_version'] = item
        else:
            request_dict[key] = self._convert_diff_dcoument(item)
    if (document_id is not None):
        if ('before_data_version' in request_dict):
            if (document_id[:len('terminusdb:///data')] == 'terminusdb:///data'):
                request_dict['document_id'] = document_id
            else:
                raise ValueError(f'Valid document id starts with `terminusdb:///data`, but got {document_id}')
        else:
            raise ValueError('`document_id` can only be used in conjusction with a data version or commit ID as `before`, not a document object')
    if self._connected:
        result = _finish_response(requests.post(self._diff_url(), headers={'user-agent': f'terminusdb-client-python/{__version__}'}, json=request_dict, auth=self._auth()))
    else:
        result = _finish_response(requests.post(self.server_url, headers={'user-agent': f'terminusdb-client-python/{__version__}'}, json=request_dict))
    return Patch(json=result)
Perform diff on 2 set of document(s), result in a Patch object.

Do not connect when using public API.

Returns
-------
obj
    Patch object

Examples
--------
>>> client = WOQLClient("https://127.0.0.1:6363/")
>>> client.connect(user="admin", key="root", team="admin", db="some_db")
>>> result = client.diff({ "@id" : "Person/Jane", "@type" : "Person", "name" : "Jane"}, { "@id" : "Person/Jane", "@type" : "Person", "name" : "Janine"})
>>> result.to_json = '{ "name" : { "@op" : "SwapValue", "@before" : "Jane", "@after": "Janine" }}'
def diff(self, before: Union[(str, dict, List[dict], 'WOQLSchema', 'DocumentTemplate', List['DocumentTemplate'])], after: Union[(str, dict, List[dict], 'WOQLSchema', 'DocumentTemplate', List['DocumentTemplate'])], document_id: Union[(str, None)]=None):
    'Perform diff on 2 set of document(s), result in a Patch object.\n\n        Do not connect when using public API.\n\n        Returns\n        -------\n        obj\n            Patch object\n\n        Examples\n        --------\n        >>> client = WOQLClient("https://127.0.0.1:6363/")\n        >>> client.connect(user="admin", key="root", team="admin", db="some_db")\n        >>> result = client.diff({ "@id" : "Person/Jane", "@type" : "Person", "name" : "Jane"}, { "@id" : "Person/Jane", "@type" : "Person", "name" : "Janine"})\n        >>> result.to_json = \'{ "name" : { "@op" : "SwapValue", "@before" : "Jane", "@after": "Janine" }}\
    request_dict = {}
    for (key, item) in {'before': before, 'after': after}.items():
        if isinstance(item, str):
            request_dict[f'{key}_data_version'] = item
        else:
            request_dict[key] = self._convert_diff_dcoument(item)
    if (document_id is not None):
        if ('before_data_version' in request_dict):
            if (document_id[:len('terminusdb:///data')] == 'terminusdb:///data'):
                request_dict['document_id'] = document_id
            else:
                raise ValueError(f'Valid document id starts with `terminusdb:///data`, but got {document_id}')
        else:
            raise ValueError('`document_id` can only be used in conjusction with a data version or commit ID as `before`, not a document object')
    if self._connected:
        result = _finish_response(requests.post(self._diff_url(), headers={'user-agent': f'terminusdb-client-python/{__version__}'}, json=request_dict, auth=self._auth()))
    else:
        result = _finish_response(requests.post(self.server_url, headers={'user-agent': f'terminusdb-client-python/{__version__}'}, json=request_dict))
    return Patch(json=result)