Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion examples/contact_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
},
"on_conflict": "upsert",
"segments": ["60a2ac5e-0774-456e-817d-ebf40f6dba31"],
"segments": [{"id": "60a2ac5e-0774-456e-817d-ebf40f6dba31"}],
"topics": [
{
"id": "6eb54030-9489-4e9c-8de6-cd337c5fef1e",
Expand Down
11 changes: 5 additions & 6 deletions resend/contacts/imports/_contact_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ class CreateParams(TypedDict):
"""
Strategy when an imported contact already exists: 'upsert' or 'skip' (default 'skip').
"""
segments: NotRequired[List[str]]
segments: NotRequired[List[Dict[str, str]]]
"""
List of segment IDs to add imported contacts to.
Will be serialized as [{"id": "..."}] before sending.
List of segment objects to add imported contacts to.
Each entry must have an 'id' key with the segment UUID.
Example: [{"id": "60a2ac5e-0774-456e-817d-ebf40f6dba31"}]
"""
topics: NotRequired[List[Dict[str, str]]]
"""
Expand Down Expand Up @@ -106,9 +107,7 @@ def _build_multipart(
if "on_conflict" in params:
form_data["on_conflict"] = params["on_conflict"]
if "segments" in params:
form_data["segments"] = json_lib.dumps(
[{"id": sid} for sid in params["segments"]]
)
form_data["segments"] = json_lib.dumps(params["segments"])
if "topics" in params:
form_data["topics"] = json_lib.dumps(params["topics"])
return files, form_data
Expand Down
2 changes: 1 addition & 1 deletion resend/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.32.0"
__version__ = "2.32.1"


def get_version() -> str:
Expand Down
2 changes: 1 addition & 1 deletion tests/contact_imports_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_create_contact_import_with_options(self) -> None:
"filename": "contacts.csv",
"on_conflict": "upsert",
"column_map": {"email": "email", "first_name": "first_name"},
"segments": ["seg-123"],
"segments": [{"id": "seg-123"}],
}
resp = resend.Contacts.Imports.create(params)
assert resp["id"] == "479e3145-dd38-476b-932c-529ceb705947"
Expand Down
Loading