-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact_groups.py
More file actions
62 lines (46 loc) · 2.63 KB
/
contact_groups.py
File metadata and controls
62 lines (46 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from datetime import datetime
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, Field
class ContactsGroup(BaseModel):
"""
Contact group model representing a collection of contacts.
"""
id: str = Field(description="Unique identifier for the contact group")
name: str = Field(description="Name of the contact group")
description: Optional[str] = Field(None, description="Description of the contact group")
contacts_count: Optional[int] = Field(None, description="Number of contacts in the group")
created_at: Optional[datetime] = Field(None, description="Creation timestamp")
updated_at: Optional[datetime] = Field(None, description="Last update timestamp")
user_id: Optional[str] = Field(None, description="ID of the user who owns the group")
metadata: Optional[Dict[str, Any]] = Field(None, description="Additional metadata")
class CreateContactsGroupDto(BaseModel):
"""
DTO for creating a new contact group.
"""
name: str = Field(description="Name of the contact group", min_length=1, max_length=255)
description: Optional[str] = Field(None, description="Description of the contact group", max_length=1000)
contact_ids: Optional[List[str]] = Field(None, description="List of contact IDs to add to the group")
metadata: Optional[Dict[str, Any]] = Field(None, description="Additional metadata")
class UpdateContactsGroupDto(BaseModel):
"""
DTO for updating an existing contact group.
"""
name: Optional[str] = Field(None, description="Updated name of the contact group", min_length=1, max_length=255)
description: Optional[str] = Field(None, description="Updated description of the contact group", max_length=1000)
contact_ids: Optional[List[str]] = Field(None, description="Updated list of contact IDs")
metadata: Optional[Dict[str, Any]] = Field(None, description="Updated metadata")
class DeleteContactsGroupsDto(BaseModel):
"""
DTO for bulk deleting contact groups.
"""
group_ids: List[str] = Field(description="List of contact group IDs to delete", min_length=1)
transfer_contacts_to: Optional[str] = Field(None, description="Group ID to transfer contacts to before deletion")
class ContactsGroupListResponse(BaseModel):
"""
Response model for listing contact groups with pagination.
"""
groups: List[ContactsGroup] = Field(description="List of contact groups")
total: int = Field(description="Total number of groups")
page: int = Field(description="Current page number")
limit: int = Field(description="Number of items per page")
total_pages: int = Field(description="Total number of pages")