diff --git a/parsons/action_network/action_network.py b/parsons/action_network/action_network.py index aa87880f52..7858f3e3f6 100644 --- a/parsons/action_network/action_network.py +++ b/parsons/action_network/action_network.py @@ -1846,7 +1846,7 @@ def get_tagging(self, tag_id, tagging_id): """ return self.api.get_request(f"tags/{tag_id}/taggings/{tagging_id}") - def create_tagging(self, tag_id, payload): + def create_tagging(self, tag_id, payload, background_processing=False): """ `Args:` tag_id: @@ -1858,26 +1858,42 @@ def create_tagging(self, tag_id, payload): "osdi:person" : { "href" : "https://actionnetwork.org/api/v2/people/id" } } } + background_processing: bool + If set `true`, utilize ActionNetwork's "background processing". This will return + an immediate success, with an empty JSON body, and send your request to the + background queue for eventual processing. + https://actionnetwork.org/docs/v2/#background-processing `Returns:` A JSON response after creating the tagging `Documentation Reference`: https://actionnetwork.org/docs/v2/taggings """ - return self.api.post_request(f"tags/{tag_id}/taggings", data=json.dumps(payload)) + url = f"tags/{tag_id}/taggings" + if background_processing: + url = f"{url}?background_processing=true" + return self.api.post_request(url, data=json.dumps(payload)) - def delete_tagging(self, tag_id, tagging_id): + def delete_tagging(self, tag_id, tagging_id, background_processing=False): """ `Args:` tag_id: The unique id of the tag tagging_id: The unique id of the tagging to be deleted + background_processing: bool + If set `true`, utilize ActionNetwork's "background processing". This will return + an immediate success, with an empty JSON body, and send your request to the + background queue for eventual processing. + https://actionnetwork.org/docs/v2/#background-processing `Returns:` A JSON response after deleting the tagging `Documentation Reference`: https://actionnetwork.org/docs/v2/taggings """ - return self.api.delete_request(f"tags/{tag_id}/taggings/{tagging_id}") + url = f"tags/{tag_id}/taggings/{tagging_id}" + if background_processing: + url = f"{url}?background_processing=true" + return self.api.delete_request(url) # Wrappers def get_wrappers(self, limit=None, per_page=25, page=None, filter=None):