|
| 1 | +#!/usr/bin/env python3 |
1 | 2 | import os |
2 | 3 |
|
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 |
4 | 6 |
|
5 | 7 |
|
6 | 8 | def main(): |
@@ -92,12 +94,42 @@ def main(): |
92 | 94 | print("📊 CONTACTS EXAMPLE SUMMARY") |
93 | 95 | print("-" * 30) |
94 | 96 | 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") |
101 | 133 |
|
102 | 134 |
|
103 | 135 | if __name__ == "__main__": |
|
0 commit comments