Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions parsons/action_network/action_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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):
Expand Down
Loading