Skip to content

Commit 3133542

Browse files
Merge pull request #7 from Devotel/feature/contact-groups-api
feat: implement complete contact groups API
2 parents 86480b4 + 8721c10 commit 3133542

9 files changed

Lines changed: 1249 additions & 14 deletions

File tree

examples/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ This directory contains comprehensive examples for using the Devo Global Communi
2626

2727
### 👥 Management Resources
2828
- **`contacts_example.py`** - 🚧 **Placeholder** (Contact management)
29+
- **`contact_groups_example.py`** - ✅ **Complete Contact Groups API implementation**
30+
- CRUD operations for contact groups
31+
- Bulk operations and contact transfer
32+
- Search and pagination features
33+
- Metadata management and workflow examples
2934

3035
## 🚀 Getting Started
3136

@@ -66,6 +71,9 @@ python examples/rcs_example.py
6671
python examples/email_example.py
6772
python examples/whatsapp_example.py
6873
python examples/contacts_example.py
74+
75+
# Contact groups functionality (fully implemented)
76+
python examples/contact_groups_example.py
6977
```
7078

7179
## 🌐 Omni-channel Messaging Examples (Fully Implemented)
@@ -145,6 +153,73 @@ The following examples show the structure and planned functionality but are not
145153
- **RCS**: Rich messaging, cards, carousels, capability checks
146154
- **Contacts**: CRUD operations, contact management
147155

156+
## 📁 Contact Groups Examples (Fully Implemented)
157+
158+
The contact groups resource is fully implemented with all CRUD operations:
159+
160+
### 🔧 Available Functions
161+
1. **List Groups** - `client.contact_groups.list()`
162+
- Uses GET `/api/v1/contacts-groups`
163+
- Pagination and search support
164+
- Field filtering capabilities
165+
166+
2. **Create Group** - `client.contact_groups.create()`
167+
- Uses POST `/api/v1/contacts-groups`
168+
- Metadata and contact assignment
169+
- Validation and error handling
170+
171+
3. **Update Group** - `client.contact_groups.update()`
172+
- Uses PUT `/api/v1/contacts-groups/{group_id}`
173+
- Partial updates with metadata
174+
- Flexible field modification
175+
176+
4. **Get Group** - `client.contact_groups.get_by_id()`
177+
- Uses GET `/api/v1/contacts-groups/{group_id}`
178+
- Complete group information retrieval
179+
180+
5. **Delete Group** - `client.contact_groups.delete_by_id()`
181+
- Uses DELETE `/api/v1/contacts-groups/{group_id}`
182+
- Individual group deletion with approval
183+
184+
6. **Bulk Delete** - `client.contact_groups.delete_bulk()`
185+
- Uses DELETE `/api/v1/contacts-groups`
186+
- Multiple group deletion with contact transfer
187+
188+
7. **Search Groups** - `client.contact_groups.search()`
189+
- Uses GET `/api/v1/contacts-groups`
190+
- Advanced search with field filtering
191+
192+
### 💡 Key Features
193+
- **Complete CRUD Operations**: Full lifecycle management
194+
- **Bulk Operations**: Efficient multi-group operations
195+
- **Contact Transfer**: Safe deletion with contact preservation
196+
- **Metadata Support**: Custom metadata for business logic
197+
- **Search & Filter**: Advanced query capabilities
198+
- **Pagination**: Efficient large dataset handling
199+
200+
### 📝 Example Usage
201+
```python
202+
from devo_global_comms_python.models.contact_groups import CreateContactsGroupDto
203+
204+
# Create new contact group
205+
group_data = CreateContactsGroupDto(
206+
name="VIP Customers",
207+
description="High-value customers",
208+
contact_ids=["contact1", "contact2"],
209+
metadata={"priority": "high"}
210+
)
211+
group = client.contact_groups.create(group_data)
212+
213+
# List with pagination
214+
groups = client.contact_groups.list(page=1, limit=10, search="VIP")
215+
216+
# Search groups
217+
search_results = client.contact_groups.search(
218+
query="priority",
219+
fields=["name", "description"]
220+
)
221+
```
222+
148223
## 🔧 Configuration Notes
149224

150225
### Phone Numbers

examples/basic_usage.py

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ def main():
3737
resources.append(("💬 WhatsApp", "Placeholder", "whatsapp_example.py"))
3838
if hasattr(client, "contacts"):
3939
resources.append(("👥 Contacts", "Placeholder", "contacts_example.py"))
40+
if hasattr(client, "contact_groups"):
41+
resources.append(("🗂️ Contact Groups", "Implemented", "contact_groups_example.py"))
4042
if hasattr(client, "rcs"):
4143
resources.append(("🎴 RCS", "Placeholder", "rcs_example.py"))
44+
if hasattr(client, "messages"):
45+
resources.append(("📬 Messages", "Implemented", "omni_channel_example.py"))
4246

4347
for resource, status, example_file in resources:
4448
print(f" {resource:<12} - {status:<12} -> {example_file}")
@@ -66,11 +70,13 @@ def main():
6670
print("\n💡 Getting Started:")
6771
print("-" * 30)
6872
print("1. Run individual resource examples:")
69-
print(" python examples/sms_example.py # Complete SMS functionality")
70-
print(" python examples/email_example.py # Email examples (placeholder)")
71-
print(" python examples/whatsapp_example.py # WhatsApp examples (placeholder)")
72-
print(" python examples/contacts_example.py # Contact management (placeholder)")
73-
print(" python examples/rcs_example.py # RCS examples (placeholder)")
73+
print(" python examples/sms_example.py # Complete SMS functionality")
74+
print(" python examples/contact_groups_example.py # Complete Contact Groups functionality")
75+
print(" python examples/omni_channel_example.py # Complete Omni-channel messaging")
76+
print(" python examples/email_example.py # Email examples (placeholder)")
77+
print(" python examples/whatsapp_example.py # WhatsApp examples (placeholder)")
78+
print(" python examples/contacts_example.py # Contact management (placeholder)")
79+
print(" python examples/rcs_example.py # RCS examples (placeholder)")
7480
print()
7581
print("2. Quick SMS example:")
7682
print(" from devo_global_comms_python import DevoClient")
@@ -86,20 +92,24 @@ def main():
8692
print("-" * 30)
8793
print("Would you like to run a specific example?")
8894
print("1. SMS Example (full functionality)")
89-
print("2. Email Example (placeholder)")
90-
print("3. WhatsApp Example (placeholder)")
91-
print("4. Contacts Example (placeholder)")
92-
print("5. RCS Example (placeholder)")
95+
print("2. Contact Groups Example (full functionality)")
96+
print("3. Omni-channel Messaging Example (full functionality)")
97+
print("4. Email Example (placeholder)")
98+
print("5. WhatsApp Example (placeholder)")
99+
print("6. Contacts Example (placeholder)")
100+
print("7. RCS Example (placeholder)")
93101
print("0. Exit")
94102

95103
try:
96-
choice = input("\nEnter your choice (0-5): ").strip()
104+
choice = input("\nEnter your choice (0-7): ").strip()
97105
example_files = {
98106
"1": "sms_example.py",
99-
"2": "email_example.py",
100-
"3": "whatsapp_example.py",
101-
"4": "contacts_example.py",
102-
"5": "rcs_example.py",
107+
"2": "contact_groups_example.py",
108+
"3": "omni_channel_example.py",
109+
"4": "email_example.py",
110+
"5": "whatsapp_example.py",
111+
"6": "contacts_example.py",
112+
"7": "rcs_example.py",
103113
}
104114

105115
if choice in example_files:

0 commit comments

Comments
 (0)