Skip to content

Commit 9cd3ea1

Browse files
Add contacts API to services namespace
1 parent 0874cae commit 9cd3ea1

File tree

5 files changed

+1133
-129
lines changed

5 files changed

+1133
-129
lines changed

examples/contacts_example.py

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
#!/usr/bin/env python3
12
import os
23

3-
from devo_global_comms_python import DevoException
4+
from devo_global_comms_python import DevoClient
5+
from devo_global_comms_python.exceptions import DevoException
46

57

68
def main():
@@ -92,12 +94,42 @@ def main():
9294
print("📊 CONTACTS EXAMPLE SUMMARY")
9395
print("-" * 30)
9496
print("⚠️ This is a placeholder example for Contacts functionality.")
95-
print("💡 To implement:")
96-
print(" 1. Define Contacts API endpoints and specifications")
97-
print(" 2. Create Contact Pydantic models")
98-
print(" 3. Implement ContactsResource class")
99-
print(" 4. Update this example with real functionality")
100-
print(" 5. Add support for CRUD operations and contact management")
97+
client = DevoClient(api_key=api_key)
98+
99+
print("� Devo Global Communications - Contacts Management Example")
100+
print("=" * 70)
101+
print("📋 Using services namespace: client.services.contacts")
102+
print()
103+
104+
# Example 1: List existing contacts
105+
print("\n📋 Listing existing contacts...")
106+
try:
107+
contacts_list = client.services.contacts.list(page=1, limit=5)
108+
print(f"✅ Found {contacts_list.total} total contacts")
109+
print(f" Page: {contacts_list.page}/{contacts_list.total_pages}")
110+
print(f" Showing: {len(contacts_list.contacts)} contacts")
111+
112+
for i, contact in enumerate(contacts_list.contacts, 1):
113+
print(f" {i}. 👤 {contact.first_name or ''} {contact.last_name or ''}".strip())
114+
print(f" ID: {contact.id}")
115+
if contact.email:
116+
print(f" 📧 Email: {contact.email}")
117+
if contact.phone_number:
118+
print(f" 📱 Phone: {contact.phone_number}")
119+
if contact.created_at:
120+
print(f" 📅 Created: {contact.created_at}")
121+
122+
except Exception as e:
123+
print(f"❌ Error listing contacts: {str(e)}")
124+
125+
print("\n🎯 Contacts management demo completed!")
126+
print("\nKey Features Available:")
127+
print("• ✅ List contacts with advanced filtering")
128+
print("• ✅ Create and update contacts")
129+
print("• ✅ Contact group assignment/unassignment")
130+
print("• ✅ Custom field management")
131+
print("• ✅ CSV import functionality")
132+
print("• ✅ Bulk operations")
101133

102134

103135
if __name__ == "__main__":

0 commit comments

Comments
 (0)