def search_by_custom_fields(self, list_uid: str, fields: dict, page=1, per_page=10): """ Search in a list by custom fields :param list_uid: :param fields: :param page: :param per_page: :return: """ params_get = fields params_get[page] = page params_get[per_page] = per_page client = Client({ 'method': Client.METHOD_GET, 'url': self.config.get_api_url( 'lists/{list_uid}/subscribers/search-by-custom-fields'.format( list_uid=list_uid)), 'params_get': params_get }) return client.request()
def delete(self, list_uid: str): """ Delete one list :param list_uid: :return: """ client = Client({ 'method': Client.METHOD_DELETE, 'url': self.config.get_api_url('lists/{list_uid}'.format(list_uid=list_uid)), }) return client.request()
def copy(self, list_uid: str): """ Copy one list :param list_uid: :return: """ client = Client({ 'method': Client.METHOD_POST, 'url': self.config.get_api_url('lists/{list_uid}/copy'.format(list_uid=list_uid)), }) return client.request()
def delete(self, template_uid: str): """ Delete one template :param template_uid: :return: """ client = Client({ 'method': Client.METHOD_DELETE, 'url': self.config.get_api_url('templates/{template_uid}'.format(template_uid=template_uid)), }) return client.request()
def delete(self, email_uid: str): """ Delete one email :param email_uid: :return: """ client = Client({ 'method': Client.METHOD_DELETE, 'url': self.config.get_api_url('transactional-emails/{email_uid}'.format(email_uid=email_uid)), }) return client.request()
def get_email(self, email_uid: str): """ Get one email :param email_uid: :return: """ client = Client({ 'method': Client.METHOD_GET, 'url': self.config.get_api_url('transactional-emails/{email_uid}'.format(email_uid=email_uid)), 'params_get': {} }) return client.request()
def create(self, data: dict): """ Create a new template :param data: :return: """ client = Client({ 'method': Client.METHOD_POST, 'url': self.config.get_api_url('templates'), 'params_post': self._prepare_body(data) }) return client.request()
def get_list(self, list_uid: str): """ Get one list :param list_uid: :return: """ client = Client({ 'method': Client.METHOD_GET, 'url': self.config.get_api_url('lists/{list_uid}'.format(list_uid=list_uid)), 'params_get': {} }) return client.request()
def get_template(self, template_uid: str): """ Get one template :param template_uid: :return: """ client = Client({ 'method': Client.METHOD_GET, 'url': self.config.get_api_url('templates/{template_uid}'.format(template_uid=template_uid)), 'params_get': {} }) return client.request()
def update(self, list_uid: str, data: dict): """ Update one list :param list_uid: :param data: :return: """ client = Client({ 'method': Client.METHOD_PUT, 'url': self.config.get_api_url('lists/{list_uid}'.format(list_uid=list_uid)), 'params_put': self._prepare_body(data) }) return client.request()
def update(self, template_uid: str, data: dict): """ Update one template :param template_uid: :param data: :return: """ client = Client({ 'method': Client.METHOD_PUT, 'url': self.config.get_api_url('templates/{template_uid}'.format(template_uid=template_uid)), 'params_put': self._prepare_body(data) }) return client.request()
def copy(self, campaign_uid: str): """ Copy one campaign :param campaign_uid: :return: """ client = Client({ 'method': Client.METHOD_POST, 'url': self.config.get_api_url('campaigns/{campaign_uid}/copy'.format( campaign_uid=campaign_uid)), }) return client.request()
def delete(self, campaign_uid: str): """ Delete one campaign :param campaign_uid: :return: """ client = Client({ 'method': Client.METHOD_DELETE, 'url': self.config.get_api_url( 'campaigns/{campaign_uid}'.format(campaign_uid=campaign_uid)), }) return client.request()
def pause_unpause(self, campaign_uid: str): """ Pause/Unpause one campaign :param campaign_uid: :return: """ client = Client({ 'method': Client.METHOD_PUT, 'url': self.config.get_api_url( 'campaigns/{campaign_uid}/pause-unpause'.format( campaign_uid=campaign_uid)), }) return client.request()
def get_campaign(self, campaign_uid: str): """ Get one campaign :param campaign_uid: :return: """ client = Client({ 'method': Client.METHOD_GET, 'url': self.config.get_api_url( 'campaigns/{campaign_uid}'.format(campaign_uid=campaign_uid)), 'params_get': {} }) return client.request()
def mark_sent(self, campaign_uid: str): """ Mark as sent one campaign :param campaign_uid: :return: """ client = Client({ 'method': Client.METHOD_PUT, 'url': self.config.get_api_url( 'campaigns/{campaign_uid}/mark-sent'.format( campaign_uid=campaign_uid)), }) return client.request()
def get_fields(self, list_uid: str): """ Get fields from a certain mail list :param list_uid: :return: """ client = Client({ 'method': Client.METHOD_GET, 'url': self.config.get_api_url( 'lists/{list_uid}/fields'.format(list_uid=list_uid)), 'params_get': {} }) return client.request()
def get_templates(self, page=1, per_page=10): """ Get all the email templates of the current customer :param page: :param per_page: :return: """ client = Client({ 'method': Client.METHOD_GET, 'url': self.config.get_api_url('templates'), 'params_get': { 'page': page, 'per_page': per_page } }) return client.request()
def get_countries(self, page=1, per_page=10): """ Get all available countries :param page: :param per_page: :return: """ client = Client({ 'method': Client.METHOD_GET, 'url': self.config.get_api_url('countries'), 'params_get': { 'page': page, 'per_page': per_page } }) return client.request()
def get_subscriber(self, list_uid: str, subscriber_uid: str): """ Get one subscriber from a certain mail list :param list_uid: :param subscriber_uid: :return: """ client = Client({ 'method': Client.METHOD_GET, 'url': self.config.get_api_url( 'lists/{list_uid}/subscribers/{subscriber_uid}'.format( list_uid=list_uid, subscriber_uid=subscriber_uid)), 'params_get': {} }) return client.request()
def update(self, campaign_uid: str, data: dict): """ Update one campaign :param campaign_uid: :param data: :return: """ client = Client({ 'method': Client.METHOD_PUT, 'url': self.config.get_api_url( 'campaigns/{campaign_uid}'.format(campaign_uid=campaign_uid)), 'params_put': self._prepare_body(data) }) return client.request()
def unsubscribe(self, list_uid: str, subscriber_uid: str): """ Unsubscribe existing subscriber from given list :param list_uid: :param subscriber_uid: :return: """ client = Client({ 'method': Client.METHOD_PUT, 'url': self.config.get_api_url( 'lists/{list_uid}/subscribers/{subscriber_uid}/unsubscribe'. format(list_uid=list_uid, subscriber_uid=subscriber_uid)), 'params_put': {} }) return client.request()
def unsubscribe_by_email_from_all_lists(self, email_address: str): """ Unsubscribe existing subscriber by email address from all lists :param email_address: :return: """ client = Client({ 'method': Client.METHOD_PUT, 'url': self.config.get_api_url( 'lists/subscribers/unsubscribe-by-email-from-all-lists'), 'params_put': { 'EMAIL': email_address } }) return client.request()
def create(self, data: dict): """ Create a new mail list for the customer The data param must contain following keys: -> general -> defaults -> notifications -> company :param data: :return: """ client = Client({ 'method': Client.METHOD_POST, 'url': self.config.get_api_url('lists'), 'params_post': self._prepare_body(data) }) return client.request()
def delete(self, list_uid: str, subscriber_uid: str): """ Delete existing subscriber from given list :param list_uid: :param subscriber_uid: :return: """ client = Client({ 'method': Client.METHOD_DELETE, 'url': self.config.get_api_url( 'lists/{list_uid}/subscribers/{subscriber_uid}'.format( list_uid=list_uid, subscriber_uid=subscriber_uid)), 'params_delete': {} }) return client.request()
def create(self, list_uid: str, data: dict): """ Create a new subscriber in the given list :param list_uid: :param data: :return: """ client = Client({ 'method': Client.METHOD_POST, 'url': self.config.get_api_url( 'lists/{list_uid}/subscribers'.format(list_uid=list_uid)), 'params_post': data }) return client.request()
def create(self, campaign_uid: str, data: dict): """ Create a new bounce in the given campaign :param campaign_uid: :param data: :return: """ client = Client({ 'method': Client.METHOD_POST, 'url': self.config.get_api_url('campaigns/{campaign_uid}/bounces'.format( campaign_uid=campaign_uid)), 'params_post': self._prepare_body(data) }) return client.request()
def email_search_all_lists(self, email_address: str): """ Search in a all lists for given subscriber by email address Please note that this is available only for mailwizz >= 1.3.6.2 :param email_address: :return: """ client = Client({ 'method': Client.METHOD_GET, 'url': self.config.get_api_url( 'lists/subscribers/search-by-email-in-all-lists'), 'params_get': { 'EMAIL': email_address } }) return client.request()
def track_opening(self, campaign_uid: str, subscriber_uid: str): """ Track campaign url click for certain subscriber :param campaign_uid: :param subscriber_uid: :return: """ client = Client({ 'method': Client.METHOD_GET, 'url': self.config.get_api_url( 'campaigns/{campaign_uid}/track-opening/{subscriber_uid}'.format( campaign_uid=campaign_uid, subscriber_uid=subscriber_uid ) ), 'params_get': {} }) return client.request()
def create_bulk(self, list_uid: str, data): """ Create subscribers in bulk in the given list This feature is available since 1.8.1 :param list_uid: :param data: :return: """ client = Client({ 'method': Client.METHOD_POST, 'url': self.config.get_api_url( 'lists/{list_uid}/subscribers/bulk'.format(list_uid=list_uid)), 'params_post': self._prepare_body(data) }) return client.request()