def get_comments(self, resp):
        """This method parses the given json string and returns comments list.

        Args:
            resp(dict): Response containing json object for comments.

        Returns:
            instance: Comments list object.

        """
        comments = CommentList()
        for value in resp['comments']:
            comment = Comment()
            comment.set_comment_id(value['comment_id'])
            comment.set_expense_id(value['expense_id'])
            comment.set_description(value['description'])
            comment.set_commented_by_id(value['commented_by_id'])
            comment.set_commented_by(value['commented_by'])
            comment.set_date(value['date'])
            comment.set_date_description(value['date_description'])
            comment.set_time(value['time'])
            comment.set_operation_type(value['operation_type'])
            comment.set_transaction_id(value['transaction_id'])
            comment.set_transaction_type(value['transaction_type'])
            comments.set_comments(comment)
        return comments
    def get_comment_list(self, response):
        """This method parses the given response and creates object for 
            comments list.

        Args:
            response(dict): Response containing json object for comments list.

        Returns:
            instance: cComments list object.

        """
        comment_list = CommentList()
        contact_comments = response['contact_comments']
        for value in contact_comments:
            contact_comment = Comment() 
            contact_comment.set_comment_id(value['comment_id'])
            contact_comment.set_contact_id(value['contact_id'])
            contact_comment.set_contact_name(value['contact_name'])
            contact_comment.set_description(value['description'])
            contact_comment.set_commented_by_id(value['commented_by_id'])
            contact_comment.set_commented_by(value['commented_by'])
            contact_comment.set_date(value['date'])
            contact_comment.set_date_description(value['date_description'])
            contact_comment.set_time(value['time'])
            contact_comment.set_transaction_id(value['transaction_id'])
            contact_comment.set_transaction_type(value['transaction_type'])
            contact_comment.set_is_entity_deleted(value['is_entity_deleted'])
            contact_comment.set_operation_type(value['operation_type'])
            comment_list.set_comments(contact_comment)
        page_context = response['page_context']
        page_context_object = PageContext()
        page_context_object.set_page(page_context['page'])
        page_context_object.set_per_page(page_context['per_page'])
        page_context_object.set_has_more_page(page_context['has_more_page'])
        page_context_object.set_applied_filter(page_context['applied_filter'])
        page_context_object.set_sort_column(page_context['sort_column'])
        page_context_object.set_sort_order(page_context['sort_order'])
        comment_list.set_page_context(page_context_object)
    
        return comment_list
# delete expense receipt

print invoice_api.delete_expense_receipt(expense_id)
'''
#------------------------------------------------------------------------------------------------------------------------------------------

# Comments and History
'''
comment_id = invoice_api.list_invoice_comments_history(invoice_id).get_comments()[0].get_comment_id()
#list invoice comments & history

print invoice_api.list_invoice_comments_history(invoice_id)

#Add Comment

comments = Comment()
comments.set_description('this is a comment')
comments.set_show_comment_to_clients(False)
comments.set_payment_expected_date('')
print invoice_api.add_comment(invoice_id, comments)

# Update Comment
comments = Comment()
comments.set_description('Invoice marked as sent')
comments.set_show_comment_to_clients(False)
print invoice_api.update_comment(invoice_id, comment_id, comments)

#delete Comment

print invoice_api.delete_comment(invoice_id, comment_id)
print projects_api.get_timer()

#start timer

print projects_api.start_timer(time_entry_id)

#Stop timer

print projects_api.stop_timer()
'''
#List comments

print projects_api.get_comments(project_id)
'''
#Post comments

comment = Comment()
comment.set_description("Based on hours")
print projects_api.post_comment(project_id, comment)

#Delete comments
comment_id = projects_api.get_comments(project_id).get_comments()[0].get_comment_id()

print projects_api.delete_comment(project_id,comment_id)

# List Invoices

print projects_api.get_invoices(project_id)

refund.set_exchange_rate(8.0)
refund.set_from_account_id('71127000000000361')
refund.set_description('')
print credit_notes_api.update_credit_note_refund(credit_note_id,creditnote_refund_id,refund)

# Delete credit note refund

print credit_notes_api.delete_credit_note_refund(credit_note_id,creditnote_refund_id)


#---------------------------------------------------------------------------

# Comments and History
comment_id = credit_notes_api.list_creditnote_comments_history(credit_note_id).get_comments()[0].get_comment_id()

# list credit note comment and history

print credit_notes_api.list_creditnote_comments_history(credit_note_id)

# Add Comment

comment=Comment()
comment.set_description('credits applied')
print credit_notes_api.add_comment(creditnote_id,comment)

# Delete a comment

print credit_notes_api.delete_comment(creditnote_id,comment_id)


    def get_comment(self,response):
        """This method parses the given response and returns comments object.

        Args:
            response(dict): Response containing json object for comments.

        Returns:
            instance: Comments object.

        """
        comment = response['comment']
        comment_obj = Comment()
        comment_obj.set_comment_id(comment['comment_id'])
        comment_obj.set_invoice_id(comment['invoice_id'])
        comment_obj.set_description(comment['description'])
        comment_obj.set_commented_by_id(comment['commented_by_id'])
        comment_obj.set_commented_by(comment['commented_by'])
        comment_obj.set_date(comment['date'])
        comment_obj.set_date_description(comment['date_description'])
        comment_obj.set_time(comment['time'])
        comment_obj.set_comment_type(comment['comment_type'])
        return comment_obj 
 def get_comment(self, resp):
     comment = resp['comment']
     comment_obj = Comment()
     comment_obj.set_comment_id(comment['comment_id'])
     comment_obj.set_bill_id(comment['bill_id'])
     comment_obj.set_description(comment['description']) 
     comment_obj.set_commented_by_id(comment['commented_by_id'])
     comment_obj.set_commented_by(comment['commented_by'])
     comment_obj.set_comment_type(comment['comment_type'])
     comment_obj.set_date(comment['date'])
     comment_obj.set_date_description(comment['date_description'])
     comment_obj.set_time(comment['time'])
     comment_obj.set_comment_type(comment['comment_type'])
     return comment_obj
    def get_comments(self, resp):
        """This method parses the given response and returns comments list 
            object.

        Args: 
            resp(dict): Response containing json object for comments list.

        Returns:
            list of instance: Comments list object.

        """
        comments = CommentList()
        for value in resp['comments']:
            comment = Comment()
            comment.set_comment_id(value['comment_id'])
            comment.set_project_id(value['project_id'])
            comment.set_description(value['description'])
            comment.set_commented_by_id(value['commented_by_id'])
            comment.set_commented_by(value['commented_by'])
            comment.set_is_current_user(value['is_current_user'])
            comment.set_date(value['date'])
            comment.set_date_description(value['date_description'])
            comment.set_time(value['time'])
            comments.set_comments(comment)
        return comments
 def get_comments(self, resp):
     comments = CommentList()
     for value in resp['comments']:
         comment = Comment()
         comment.set_comment_id(value['comment_id'])
         comment.set_bill_id(value['bill_id'])
         comment.set_description(value['description'])
         comment.set_commented_by_id(value['commented_by_id'])
         comment.set_commented_by(value['commented_by'])
         comment.set_comment_type(value['comment_type'])
         comment.set_date(value['date'])
         comment.set_date_description(value['date_description'])
         comment.set_time(value['time'])
         comment.set_operation_type(value['operation_type'])
         comment.set_transaction_id(value['transaction_id'])
         comment.set_transaction_type(value['transaction_type'])
         comments.set_comments(comment)
     return comments
    def comments_list(self,response):
        """This method parses the given response and returns the comments list.

        Args:
            response(dict): Response containing json object for comments list.
 
        Returns:
            list of instance: List of comments object.

        """ 
        comments_list = CommentList()
        for value in response['comments']:
            comment = Comment() 
            comment.set_comment_id(value['comment_id'])
            comment.set_creditnote_id(value['creditnote_id'])
            comment.set_description(value['description'])
            comment.set_commented_by_id(value['commented_by_id'])
            comment.set_commented_by(value['commented_by'])
            comment.set_comment_type(value['comment_type'])
            comment.set_date(value['date'])
            comment.set_date_description(value['date_description'])
            comment.set_time(value['time'])
            comment.set_operation_type(value['operation_type'])
            comment.set_transaction_id(value['transaction_id'])
            comment.set_transaction_type(value['transaction_type'])
            comments_list.set_comments(comment)
        return comments_list
 def get_comments(self, resp):
     comments = CommentList()
     for value in resp['comments']:
         comment = Comment()
         comment.set_comment_id(value['comment_id'])
         comment.set_bill_id(value['bill_id'])
         comment.set_description(value['description'])
         comment.set_commented_by_id(value['commented_by_id'])
         comment.set_commented_by(value['commented_by'])
         comment.set_comment_type(value['comment_type'])
         comment.set_date(value['date'])
         comment.set_date_description(value['date_description'])
         comment.set_time(value['time'])
         comment.set_operation_type(value['operation_type'])
         comment.set_transaction_id(value['transaction_id'])
         comment.set_transaction_type(value['transaction_type'])
         comments.set_comments(comment)
     return comments
    def get_comments(self, resp):
        """This method parses the given response and returns comments list 
            object.

        Args: 
            resp(dict): Response containing json object for comments list.

        Returns:
            list of instance: Comments list object.

        """
        comments = CommentList()
        for value in resp['comments']:
            comment = Comment()
            comment.set_comment_id(value['comment_id'])
            comment.set_project_id(value['project_id'])
            comment.set_description(value['description'])
            comment.set_commented_by_id(value['commented_by_id'])
            comment.set_commented_by(value['commented_by'])
            comment.set_is_current_user(value['is_current_user'])
            comment.set_date(value['date'])
            comment.set_date_description(value['date_description'])
            comment.set_time(value['time'])
            comments.set_comments(comment)
        return comments
    def recurring_invoice_history_list(self, response):
        """This method parses the json object and returns list of comments 
            object.

        Args: 
            response(dict): Response containing json object.
 
        Returns:
            instance: Comments list object.

        """
        comments = CommentList()
        for value in response['comments']:
            comment = Comment()
            comment.set_comment_id(value['comment_id'])
            comment.set_recurring_invoice_id(value['recurring_invoice_id'])
            comment.set_description(value['description'])
            comment.set_commented_by_id(value['commented_by_id'])
            comment.set_commented_by(value['commented_by'])
            comment.set_comment_type(value['comment_type'])
            comment.set_date(value['date'])
            comment.set_date_description(value['date_description'])
            comment.set_time(value['time'])
            comment.set_operation_type(value['operation_type'])
            comment.set_transaction_id(value['transaction_id'])
            comment.set_transaction_type(value['transaction_type'])
            comments.set_comments(comment)
        return comments