def get_events(self, customer_id, event_type=None, context=None, event_mode=None, date_from=None, date_to=None, page=None, size=None): """ Get all events associated to a customer. :param customer_id: The id of the customer owner of the event :param event_type: the type of the event present in Event.TYPES :param context: the context of the event present in Event.CONTEXT :param event_mode: the mode of event. ACTIVE if the customer made the event, PASSIVE if the customer recive the event :param date_from: From string or datetime for search of event :param date_to: From string or datetime for search of event :param size: the size of the pages containing events :param page: the number of the page for retrieve event data :return: a list containing the fetched events associated to the given customer id """ return PaginatedList(node=self, function=self.event_api_manager.get_all, entity_class=Event, customer_id=customer_id, type=event_type, mode=event_mode, dateFrom=date_from, dateTo=date_to, page=page, size=size, context=context)
def get_events(self): """ Get all the events associated to this Customer. :rtype: list :return: A list containing Events object associated to this Customer """ if self.node and 'id' in self.attributes: return PaginatedList(node=self.node, function=self.event_api_manager.get_all, entity_class=Event, customer_id=self.attributes['id']) raise OperationNotPermitted('Cannot retrieve events from a new customer created.')
def all(self): """ Get all queried data of an entity from the API :return: a ReadOnly list with all object queried """ complete_query = { 'name': 'query', 'query': self.inner_query } if self.inner_query else None if self.entity is Customer: return PaginatedList(node=self.node, function=_CustomerAPIManager( self.node).get_all, entity_class=Customer, query=complete_query)
def get_customers(self, external_id=None, page=None, size=None, fields=None): """ Get all the customers in this node :param external_id: the external id of the customer to retrieve :param size: the size of the pages containing customers :param page: the number of the page for retrieve customer data :param fields: : a list of strings representing the properties to include in the response :return: A list containing Customer object of a node """ return PaginatedList(node=self, function=self.customer_api_manager.get_all, entity_class=Customer, externalId=external_id, page=page, size=size, fields=fields)