Download Brain/src/model/contact_model.py from posix4e/brain: direct link, hf CLI and curl.
- Browser
- Download file 961 Bytes
-
https://huggingface.co/spaces/posix4e/brain/resolve/main/Brain/src/model/contact_model.py
- Command line
-
hf download hf://spaces/posix4e/brain/Brain/src/model/contact_model.py
-
curl -L -o contact_model.py https://huggingface.co/spaces/posix4e/brain/resolve/main/Brain/src/model/contact_model.py
961 Bytes
| """contact model: | |
| { | |
| "contactId": "String", | |
| "displayName": "String", | |
| "phoneNumbers": ["String"], | |
| "status": "created | updated | deleted", | |
| }""" | |
| from typing import Any | |
| from Brain.src.model.requests.request_model import TrainContacts | |
| class ContactModel: | |
| def __init__(self): | |
| self.contact_id = "" | |
| self.display_name = "" | |
| self.phone_numbers = [] | |
| self.status = ContactStatus.UPDATED | |
| def get_contact_model(self, data: TrainContacts.ContactReq) -> None: | |
| self.contact_id = data.contactId | |
| self.display_name = data.displayName | |
| self.phone_numbers = [] | |
| for phone in data.phoneNumbers: | |
| self.phone_numbers.append(phone) | |
| self.status = data.status | |
| def get_str_phones(self): | |
| return "".join(self.phone_numbers) | |
| """contact status: created | updated | deleted""" | |
| class ContactStatus: | |
| CREATED = "created" | |
| UPDATED = "updated" | |
| DELETED = "deleted" | |