Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing 'Tag Search' endpoint #237

Open
leon-matthews opened this issue Jun 14, 2021 · 2 comments
Open

Add missing 'Tag Search' endpoint #237

leon-matthews opened this issue Jun 14, 2021 · 2 comments

Comments

@leon-matthews
Copy link

Apologies if I've missed something obvious, but the end point to list all of the tags belonging to an audience/list, as documented here in the Mailchimp API docs, seems to be missing.

It's an easy one. The list_id is required. There is one optional query parameter name which is used as a prefix search. I've written an API class which works for my application, and it seems to work... :-)

class SearchTags(mailchimp3.baseapi.BaseApi):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.endpoint = 'lists'
        self.list_id = None

    def all(self, list_id, get_all=False, **queryparams):
        self.list_id = list_id
        url = self._build_path(list_id, 'tag-search')
        if get_all:
            return self._iterate(url=url, **queryparams)
        else:
            return self._mc_client._get(url=url, **queryparams)

If you'd like, I could try and match your documentation style and create a pull-request instead of this issue. I've never done so before, but it is probably about time that I learnt how! Please let me know.

@stephenross
Copy link
Collaborator

Please replicate the structure of the current API providers and make a pull request. The filename should be listtagsearch.py and you can mimic the structure of https://github.com/VingtCinq/python-mailchimp/blob/master/mailchimp3/entities/listclients.py when constructing the class. Make sure that it is properly plugged in to the https://github.com/VingtCinq/python-mailchimp/blob/master/mailchimp3/__init__.py and that both README docs are updated with the information about the new endpoint and we can get that put out. Looking forward to your contribution.

@leon-matthews
Copy link
Author

Great! Thank you for the detailed notes. It's now on my task list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants