il2_rest/client.py
def documents_transaction_add_item(self, transaction_id, name, filepath, content_type=None, comment=None) :
        """
        Adds another document to a pending transaction of multi-documents.

        Args:
            transaction_id (:obj:`str`): Id of the ongoing transaction.
            name (:obj:`str`): File name.
            filepath (:obj:`str`): Path to the file to upload.
            content_type (:obj:`str`, optional): File mime-type. 
                If None, it will try to guess the mime-type based on the file extension.
            comment (:obj:`str`, optional): Additional comment.
        Returns:
            :obj:`bool`: True if success

        Example:
            After beginning a transaction, you can add as many items as you wish:
            >>> node = RestNode(cert_file='documenter.pfx', cert_pass='password')
            >>> chain = node.chain_by_id('A1wCG9hHhuVNb8hyOALHokYsWyTumHU0vRxtcK-iDKE')
            >>> resp = chain.documents_begin_transaction(comment='Using parameters')
            >>> transaction_id = resp.transactionId
            >>> chain.documents_transaction_add_item(transaction_id, "item1.txt", "./test.txt")
            >>> chain.documents_transaction_add_item(transaction_id, "item2.txt", "./test2.txt", comment="This file has a comment.")
        """
        query = f"/documents/transaction/{transaction_id}?name={name}"
        if comment :
            query += f"&comment={comment}"
        
        if not content_type :
            content_type = mimetypes.MimeTypes().guess_type(filepath)[0]
        
        resp = self.__rest._post_file(query, filepath, content_type)
        if resp.status_code == 200 :
            return True
        else :
            return False

        Adds another document to a pending transaction of multi-documents.

        Args:
            transaction_id (:obj:`str`): Id of the ongoing transaction.
            name (:obj:`str`): File name.
            filepath (:obj:`str`): Path to the file to upload.
            content_type (:obj:`str`, optional): File mime-type. 
                If None, it will try to guess the mime-type based on the file extension.
            comment (:obj:`str`, optional): Additional comment.
        Returns:
            :obj:`bool`: True if success

        Example:
            After beginning a transaction, you can add as many items as you wish:
            >>> node = RestNode(cert_file='documenter.pfx', cert_pass='password')
            >>> chain = node.chain_by_id('A1wCG9hHhuVNb8hyOALHokYsWyTumHU0vRxtcK-iDKE')
            >>> resp = chain.documents_begin_transaction(comment='Using parameters')
            >>> transaction_id = resp.transactionId
            >>> chain.documents_transaction_add_item(transaction_id, "item1.txt", "./test.txt")
            >>> chain.documents_transaction_add_item(transaction_id, "item2.txt", "./test2.txt", comment="This file has a comment.")
        
Adds another document to a pending transaction of multi-documents.
Adds another document to a pending transaction of multi - documents .
def documents_transaction_add_item(self, transaction_id, name, filepath, content_type=None, comment=None) :
        query = f"/documents/transaction/{transaction_id}?name={name}"
        if comment :
            query += f"&comment={comment}"
        if not content_type :
            content_type = mimetypes.MimeTypes().guess_type(filepath)[0]
        resp = self.__rest._post_file(query, filepath, content_type)
        if resp.status_code == 200 :
            return True
        else :
            return False
def documents_transaction_add_item ( self , transaction_id , name , filepath , content_type = None , comment = None ) : query = f"/documents/transaction/{transaction_id}?name={name}" if comment : query += f"&comment={comment}" if not content_type : content_type = mimetypes . MimeTypes ( ) . guess_type ( filepath ) [ 0 ] resp = self . __rest . _post_file ( query , filepath , content_type ) if resp . status_code == 200 : return True else : return False
Adds another document to a pending transaction of multi-documents.
Adds another document to a pending transaction of multi - documents .
"""
        Adds another document to a pending transaction of multi-documents.

        Args:
            transaction_id (:obj:`str`): Id of the ongoing transaction.
            name (:obj:`str`): File name.
            filepath (:obj:`str`): Path to the file to upload.
            content_type (:obj:`str`, optional): File mime-type. 
                If None, it will try to guess the mime-type based on the file extension.
            comment (:obj:`str`, optional): Additional comment.
        Returns:
            :obj:`bool`: True if success

        Example:
            After beginning a transaction, you can add as many items as you wish:
            >>> node = RestNode(cert_file='documenter.pfx', cert_pass='password')
            >>> chain = node.chain_by_id('A1wCG9hHhuVNb8hyOALHokYsWyTumHU0vRxtcK-iDKE')
            >>> resp = chain.documents_begin_transaction(comment='Using parameters')
            >>> transaction_id = resp.transactionId
            >>> chain.documents_transaction_add_item(transaction_id, "item1.txt", "./test.txt")
            >>> chain.documents_transaction_add_item(transaction_id, "item2.txt", "./test2.txt", comment="This file has a comment.")
        """
:obj:`bool`: True if success
: obj : ` bool ` : True if success
self
transaction_id
name
filepath
content_type
comment
transaction_id (
`str`): Id of the ongoing transaction.
` str ` ) : Id of the ongoing transaction .
name (
`str`): File name.
` str ` ) : File name .
filepath (
`str`): Path to the file to upload.
` str ` ) : Path to the file to upload .
content_type (
`str`, optional): File mime-type.
If None, it will try to guess the mime-type based on the file extension.
` str ` optional ) : File mime - type . If None it will try to guess the mime - type based on the file extension .
comment (
`str`, optional): Additional comment.
` str ` optional ) : Additional comment .
examples
After beginning a transaction, you can add as many items as you wish:
>>> node = RestNode(cert_file='documenter.pfx', cert_pass='password')
>>> chain = node.chain_by_id('A1wCG9hHhuVNb8hyOALHokYsWyTumHU0vRxtcK-iDKE')
>>> resp = chain.documents_begin_transaction(comment='Using parameters')
>>> transaction_id = resp.transactionId
>>> chain.documents_transaction_add_item(transaction_id, "item1.txt", "./test.txt")
>>> chain.documents_transaction_add_item(transaction_id, "item2.txt", "./test2.txt", comment="This file has a comment.")
After beginning a transaction you can add as many items as you wish : >>> node = RestNode ( cert_file = ' documenter . pfx ' cert_pass = ' password ' ) >>> chain = node . chain_by_id ( ' A1wCG9hHhuVNb8hyOALHokYsWyTumHU0vRxtcK - iDKE ' ) >>> resp = chain . documents_begin_transaction ( comment = ' Using parameters ' ) >>> transaction_id = resp . transactionId >>> chain . documents_transaction_add_item ( transaction_id " item1 . txt " " . / test . txt " ) >>> chain . documents_transaction_add_item ( transaction_id " item2 . txt " " . / test2 . txt " comment = " This file has a comment . " )