-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathkind
More file actions
131 lines (104 loc) · 4.42 KB
/
Copy pathkind
File metadata and controls
131 lines (104 loc) · 4.42 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
"""Reminders resource for Kindred SDK."""
from personal_crm_client import AuthenticatedClient, Client
from personal_crm_client.models import (
ReminderCreate,
ReminderUpdate,
ReminderPublic,
RemindersPublic,
HTTPValidationError,
)
from uuid import UUID
from typing import Optional
class RemindersResource:
"""Resource for managing reminders."""
def __init__(self, client: AuthenticatedClient | Client) -> None:
self._client = client
def list(
self,
*,
skip: int = 0,
limit: int = 100,
contact_id: Optional[UUID] = None,
) -> RemindersPublic | HTTPValidationError | None:
"""List reminders."""
from personal_crm_client.api.reminders.reminders_list_reminders import sync
return sync(
client=self._client,
skip=skip,
limit=limit,
contact_id=contact_id,
)
async def list_async(
self,
*,
skip: int = 0,
limit: int = 100,
contact_id: Optional[UUID] = None,
) -> RemindersPublic | HTTPValidationError | None:
"""Async version of list()."""
from personal_crm_client.api.reminders.reminders_list_reminders import asyncio
return await asyncio(
client=self._client,
skip=skip,
limit=limit,
contact_id=contact_id,
)
def get(self, reminder_id: UUID) -> ReminderPublic | HTTPValidationError | None:
"""Get a single reminder by ID."""
from personal_crm_client.api.reminders.reminders_list_reminders import sync
reminders = self.list()
if reminders and hasattr(reminders, 'data'):
for reminder in reminders.data:
if reminder.id == reminder_id:
return reminder
return None
def create(self, item: ReminderCreate) -> ReminderPublic | HTTPValidationError | None:
"""Create a new reminder."""
from personal_crm_client.api.reminders.reminders_create_reminder_route import sync
return sync(client=self._client, body=item)
async def create_async(self, item: ReminderCreate) -> ReminderPublic | HTTPValidationError | None:
"""Async version of create()."""
from personal_crm_client.api.reminders.reminders_create_reminder_route import asyncio
return await asyncio(client=self._client, body=item)
def update(
self, reminder_id: UUID, item: ReminderUpdate
) -> ReminderPublic | HTTPValidationError | None:
"""Update an existing reminder."""
from personal_crm_client.api.reminders.reminders_update_reminder import sync
return sync(client=self._client, reminder_id=reminder_id, body=item)
async def update_async(
self, reminder_id: UUID, item: ReminderUpdate
) -> ReminderPublic | HTTPValidationError | None:
"""Async version of update()."""
from personal_crm_client.api.reminders.reminders_update_reminder import asyncio
return await asyncio(client=self._client, reminder_id=reminder_id, body=item)
def delete(self, reminder_id: UUID) -> ReminderPublic | HTTPValidationError | None:
"""Delete a reminder."""
from personal_crm_client.api.reminders.reminders_delete_reminder import sync
return sync(client=self._client, reminder_id=reminder_id)
async def delete_async(
self, reminder_id: UUID
) -> ReminderPublic | HTTPValidationError | None:
"""Async version of delete()."""
from personal_crm_client.api.reminders.reminders_delete_reminder import asyncio
return await asyncio(client=self._client, reminder_id=reminder_id)
def snooze(
self, reminder_id: UUID, *, snooze_until: str
) -> ReminderPublic | HTTPValidationError | None:
"""Snooze a reminder until a specified time."""
from personal_crm_client.api.reminders.reminders_snooze_reminder import sync
return sync(
client=self._client,
reminder_id=reminder_id,
snooze_until=snooze_until,
)
async def snooze_async(
self, reminder_id: UUID, *, snooze_until: str
) -> ReminderPublic | HTTPValidationError | None:
"""Async version of snooze()."""
from personal_crm_client.api.reminders.reminders_snooze_reminder import asyncio
return await asyncio(
client=self._client,
reminder_id=reminder_id,
snooze_until=snooze_until,
)