#NEWLINE# def sync( self , commands = None , **kwargs ) : #NEWLINE# #INDENT# '\n        Sends to the server the changes that were made locally, and also\n        fetches the latest updated data from the server.\n        ' #NEWLINE# data = { #NEWLINE# #INDENT# 'token' : self . token , #NEWLINE# 'commands' : json . dumps ( ( commands or [ ] ) , separators = ',:' , default = self . _json_serializer ) , #NEWLINE# 'day_orders_timestamp' : kwargs . state [ 'DayOrdersTimestamp' ] , #NEWLINE# #UNINDENT# } #NEWLINE# if ( not commands ) : #NEWLINE# #INDENT# ( data [ 'seq_no' ] , data [ 'seq_no_global' ] ) = self . _get_seq_no ( kwargs . get ( 'resource_types' , None ) ) #NEWLINE# #UNINDENT# if ( 'include_notification_settings' in kwargs ) : #NEWLINE# #INDENT# data [ 'include_notification_settings' ] = 1 #NEWLINE# #UNINDENT# if ( 'resource_types' in kwargs ) : #NEWLINE# #INDENT# data [ 'resource_types' ] = json . dumps ( kwargs [ 'resource_types' ] , separators = ',:' ) #NEWLINE# #UNINDENT# data = self . _post ( 'sync' , data = data ) #NEWLINE# self . _update_state ( data ) #NEWLINE# if ( not commands ) : #NEWLINE# #INDENT# self . _update_seq_no ( data . get ( 'seq_no' , None ) , data . get ( 'seq_no_global' , None ) , kwargs . get ( 'resource_types' , None ) ) #NEWLINE# #UNINDENT# return data