taskbridgeapp.reminders.model.reminder.Reminder
- class taskbridgeapp.reminders.model.reminder.Reminder(uuid, name, created_date, modified_date, completed_date, body, remind_me_date, due_date, all_day=False, completed=False)
Bases:
objectRepresents a reminder. Used to create reminders from the local machine via AppleScript or reminders from a remote CalDav server.
Methods
Creates a Reminder instance from the given values.
Creates a Reminder instance from a CalDav task.
Returns a representation of this reminder as an iCal string.
Updates the UUID of a reminder.
Creates or updates a local reminder.
Creates or updates a remote reminder.
- __get_task_due_date()
Get the due date for this task in string format
- Return type:
tuple[bool,str]- Returns:
-success (
bool) - true if the due date is successfully retrieved.-data (
str) - error message on failure, or task due date.
- __get_tasks_in_caldav(container)
Fetch an existing remote task in CalDav
- Parameters:
container (model.ReminderContainer) – The parameter to search
- Return type:
caldav.CalendarObjectResource | None
- Returns:
the task in CalDAV matching this tasks UUID/name, or None.
- __init__(uuid, name, created_date, modified_date, completed_date, body, remind_me_date, due_date, all_day=False, completed=False)
Create a new reminder.
- Parameters:
uuid (
str|None) – the UUID of this reminder.name (
str) – the name (i.e. many text/summary) of this reminder.created_date (
datetime|None) – the datetime when this reminder was created.modified_date (
datetime) – the datetime when this reminder was last modified.completed_date (
datetime|None) – if completed, the datetime when this reminder was completed.body (
str|None) – the body of the reminder (i.e. the description).remind_me_date (
datetime|None) – the datetime when the user should be alerted.due_date (
datetime|date|None) – the datetime or date when the reminder is due.all_day (
bool) – ifdue_dateis a date, rather than a datetime, this is set to True.completed (
bool) – True if this reminder has been completed.
- _parse_alarm()
Parse this reminder’s alarm date into iCal format.
- Return type:
tuple[bool,str] |tuple[bool,None]- Returns:
-success (
bool) - true if the reminder’s alarm date is successfully parsed.-data (
str| None) - error message on failure or the iCal string, or None if no remind me date.
- _parse_due_date()
Parse this reminder’s due date into iCal format.
- Return type:
tuple[bool,str] |tuple[bool,None]- Returns:
-success (
bool) - true if the reminder’s due date is successfully parsed.-data (
str| None) - error message on failure or the iCal string, or None if no due date.
- static create_from_local(values)
Creates a Reminder instance from the given values.
The
valueslist must be as follows (all strings):Reminder UUID.
Reminder name (i.e. summary).
Reminder creation date.
True if reminder is completed.
Reminder due date.
True if this is an all day reminder.
Reminder alarm date.
Reminder modified date.
Completion date of reminder (ignored)
Body (i.e. description) of the reminder.
- Parameters:
values (
List[str]) – the list of values as described above.- Return type:
- Returns:
a Reminder instance representing the content of the values given.
- static create_from_remote(caldav_task)
Creates a Reminder instance from a CalDav task.
- Parameters:
caldav_task (
CalendarObjectResource) – a task fetched from the CalDav calendar.- Return type:
- Returns:
a Reminder instance representing the CalDav task.
- get_ical_string()
Returns a representation of this reminder as an iCal string. Used for upserting remote reminders.
- Return type:
tuple[bool,str]- Returns:
-success (
bool) - true if the reminder is successfully parsed to an iCal string.-data (
str) - error message on failure or the iCal string.
- update_uuid(container, new_uuid)
Updates the UUID of a reminder. This is used when a remote reminder is synchronised locally. The locally-assigned UUID is used to set the UID of the remote reminder. This is done since the local UUID is read-only.
- Parameters:
container (
ReminderContainer) – the container containing this reminder.new_uuid (
str) – the UUID to assign to the reminder.
- Return type:
tuple[bool,str]- Returns:
-success (
bool) - true if the reminder’s UUID is successfully upserted.-data (
str) - error message on failure or success message.
- upsert_local(container)
Creates or updates a local reminder.
- Parameters:
container (
ReminderContainer) – the container containing this reminder.- Return type:
tuple[bool,str]- Returns:
-success (
bool) - true if the reminder is successfully upserted.-data (
str) - error message on failure, or reminder’s UUID.
- upsert_remote(container)
Creates or updates a remote reminder.
- Parameters:
container (
ReminderContainer) – the container containing this reminder.- Return type:
tuple[bool,str]- Returns:
-success (
bool) - true if the reminder is successfully upserted.-data (
str) - error message on failure or success message.