Skip to content

Commit

Permalink
Fix incorrect documentation on ActionNetwork upsert_person argument (m…
Browse files Browse the repository at this point in the history
…ove-coop#915)

* Fix incorrect documentation on ActionNetwork upsert_person argument

* Fix type hints for compatibility

---------

Co-authored-by: Shauna <[email protected]>
  • Loading branch information
austinweisgrau and shaunagm authored Dec 19, 2023
1 parent e631500 commit b8b3d05
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions parsons/action_network/action_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import re
import warnings
from typing import Dict, List, Union

from parsons import Table
from parsons.utilities import check_env
Expand Down Expand Up @@ -755,7 +756,7 @@ def get_person(self, person_id):

def upsert_person(
self,
email_address=None,
email_address: Union[str, List[str], List[Dict[str, str]]] = None,
given_name=None,
family_name=None,
tags=None,
Expand All @@ -781,8 +782,8 @@ def upsert_person(
Either email_address or mobile_number are required. Can be any of the following
- a string with the person's email
- a list of strings with a person's emails
- a dictionary with the following fields
- email_address (REQUIRED)
- a list of dictionaries with the following fields
- address (REQUIRED)
- primary (OPTIONAL): Boolean indicating the user's primary email address
- status (OPTIONAL): can taken on any of these values
- "subscribed"
Expand Down Expand Up @@ -836,6 +837,11 @@ def upsert_person(
email_addresses_field[0]["primary"] = True
if isinstance(email_address[0], dict):
email_addresses_field = email_address
else:
raise ValueError(
f"Unexpected type for email_address. Got {type(email_address)}, "
"expected str or list."
)

mobile_numbers_field = None
if isinstance(mobile_number, str):
Expand Down

0 comments on commit b8b3d05

Please sign in to comment.