Skip to content

Commit dc4ce98

Browse files
committed
fix: use direct class refs for type annotations, matching ContactSegments pattern
1 parent 6350c89 commit dc4ce98

3 files changed

Lines changed: 9 additions & 11 deletions

File tree

examples/contact_imports.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
with open(csv_path, "rb") as f:
1212
file_content = f.read().replace(b"steve@example.com,Steve,Wozniak", f"steve+{ts}@example.com,Steve,Wozniak".encode())
1313

14-
create_params: resend.Contacts.Imports.CreateParams = {
14+
create_params: resend.ContactImports.CreateParams = {
1515
"file": file_content,
1616
"column_map": {
1717
"email": "Email",
@@ -34,17 +34,17 @@
3434
],
3535
}
3636

37-
import_response: resend.Contacts.Imports.CreateContactImportResponse = (
37+
import_response: resend.ContactImports.CreateContactImportResponse = (
3838
resend.Contacts.Imports.create(create_params)
3939
)
4040
print("Created contact import with ID: {}".format(import_response["id"]))
4141
print(import_response)
4242

43-
contact_import: resend.Contacts.Imports.ContactImport = resend.Contacts.Imports.get(import_response["id"])
43+
contact_import: resend.ContactImport = resend.Contacts.Imports.get(import_response["id"])
4444
print("Retrieved contact import")
4545
print(contact_import)
4646

47-
list_response: resend.Contacts.Imports.ListContactImportsResponse = (
47+
list_response: resend.ContactImports.ListContactImportsResponse = (
4848
resend.Contacts.Imports.list()
4949
)
5050
print(f"Found {len(list_response['data'])} imports")

resend/contacts/imports/_contact_imports.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717

1818
class ContactImports:
19-
ContactImport = ContactImport
20-
2119
class CreateContactImportResponse(BaseResponse):
2220
"""
2321
CreateContactImportResponse wraps the response from a successful import creation.

tests/contact_imports_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ def test_create_contact_import(self) -> None:
1010
{"object": "contact_import", "id": "479e3145-dd38-476b-932c-529ceb705947"}
1111
)
1212

13-
params: resend.Contacts.Imports.CreateParams = {
13+
params: resend.ContactImports.CreateParams = {
1414
"file": b"email,first_name\nsteve@example.com,Steve",
1515
}
16-
resp: resend.Contacts.Imports.CreateContactImportResponse = resend.Contacts.Imports.create(params)
16+
resp: resend.ContactImports.CreateContactImportResponse = resend.Contacts.Imports.create(params)
1717
assert resp["id"] == "479e3145-dd38-476b-932c-529ceb705947"
1818
assert resp["object"] == "contact_import"
1919

@@ -22,7 +22,7 @@ def test_create_contact_import_with_options(self) -> None:
2222
{"object": "contact_import", "id": "479e3145-dd38-476b-932c-529ceb705947"}
2323
)
2424

25-
params: resend.Contacts.Imports.CreateParams = {
25+
params: resend.ContactImports.CreateParams = {
2626
"file": b"email,first_name\nsteve@example.com,Steve",
2727
"filename": "contacts.csv",
2828
"on_conflict": "upsert",
@@ -54,7 +54,7 @@ def test_get_contact_import(self) -> None:
5454
}
5555
)
5656

57-
result: resend.Contacts.Imports.ContactImport = resend.Contacts.Imports.get(
57+
result: resend.ContactImport = resend.Contacts.Imports.get(
5858
"479e3145-dd38-476b-932c-529ceb705947"
5959
)
6060
assert result["id"] == "479e3145-dd38-476b-932c-529ceb705947"
@@ -84,7 +84,7 @@ def test_list_contact_imports(self) -> None:
8484
}
8585
)
8686

87-
result: resend.Contacts.Imports.ListContactImportsResponse = resend.Contacts.Imports.list()
87+
result: resend.ContactImports.ListContactImportsResponse = resend.Contacts.Imports.list()
8888
assert result["object"] == "list"
8989
assert result["has_more"] is False
9090
assert len(result["data"]) == 1

0 commit comments

Comments
 (0)