Contact¶
-
class
moco_wrapper.models.
Contact
(moco)¶ Class for handling contacts.
-
create
(firstname: str, lastname: str, gender: moco_wrapper.models.contact.ContactGender, company_id: int = None, title: str = None, job_position: str = None, mobile_phone: str = None, work_fax: str = None, work_phone: str = None, work_email: str = None, work_address: str = None, home_address: str = None, home_email: str = None, birthday: datetime.date = None, info: str = None, tags: list = None)¶ Creates a contact.
Parameters: - firstname (str) – The first name of the contact
- lastname (str) – The last name of the contact
- gender (
ContactGender
, str) – Gender of the contact - company_id (int) – Id of the company the contact belongs to (default
None
) - title (str) – Job title the contact has (default
None
) - job_position (str) – Name of the job position this contact has (default
None
) - mobile_phone (str) – Mobile phone number the contact has (default
None
) - work_fax (str) – Work fax number (default
None
) - work_phone (str) – Work phone number (default
None
) - work_email (str) – Work email address (default
None
) - work_address (str) – Physical work address (default
None
) - home_address (str) – Physical home address (default
None
) - home_email (str) – Home email address (default
None
) - birthday (datetime.date, str) – Birthday date (default
None
) - info (str) – More information about the contact (default
None
) - tags (list) – Array of additional tags (default
None
)
Returns: The created contact object
Return type:
-
get
(contact_id: int)¶ Retrieve a single contact object
Parameters: contact_id (int) – Id of the contact Returns: The contact object Return type: moco_wrapper.util.response.ObjectResponse
-
getlist
(tags: list = None, term: str = None, phone: str = None, sort_by: str = None, sort_order: str = 'asc', page: int = 1)¶ Retrieve a list of contact objects
Parameters: - tags (list) – Array of tags (default
None
) - term (str) – Full text search
(fields that are searched are name, firstname, work_email and company) (default
None
) - phone (str) – Reverse lookup for work_phone or mobile_phone (default
None
) - sort_by (str) – Field to the results by (default
None
) - sort_order (str) – asc or desc (default
"asc"
) - page (int) – Page number (default
1
)
Returns: List of contact objects
Return type: - tags (list) – Array of tags (default
-
update
(contact_id: int, firstname: str = None, lastname: str = None, gender: moco_wrapper.models.contact.ContactGender = None, company_id: int = None, title: str = None, job_position: str = None, mobile_phone: str = None, work_fax: str = None, work_phone: str = None, work_email: str = None, work_address: str = None, home_address: str = None, home_email: str = None, birthday: datetime.date = None, info: str = None, tags: list = None)¶ Updates a contact.
Parameters: - contact_id (int) – Id of the contact
- firstname (str) – The first name of the contact (default
None
) - lastname (str) – The last name of the contact (default
None
) - gender (
ContactGender
, str) – Gender of the contact (defaultNone
) - company_id (int) – Id of the company the contact belongs to (default
None
) - title (str) – Job title the contact has (default
None
) - job_position (str) – name of the job position this contact has (default
None
) - mobile_phone (str) – Mobile phone number the contact has (default
None
) - work_fax (str) – Work fax number (default
None
) - work_phone (str) – Work phone number (default
None
) - work_email (str) – Work email address (default
None
) - work_address (str) – Physical work address (default
None
) - home_address (str) – Physical home address (default
None
) - home_email (str) – Home email address (default
None
) - birthday (datetime.date, str) – Birthday date (default
None
) - info (str) – More information about the contact (default
None
) - tags (list) – Array of additional tags (default
None
)
Returns: The updated contact object
Return type:
-
-
class
moco_wrapper.models.contact.
ContactGender
¶ Enumeration for allowed values that can be supplied for the
gender
argument inContact.create
andContact.update
.Example Usage:
from moco_wrapper.models.contact import ContactGender from moco_wrapper import Moco m = Moco() new_contact = m.Contact.create( .. gender = ContactGender.MALE )
-
FEMALE
= 'F'¶
-
MALE
= 'M'¶
-
UNDEFINED
= 'U'¶
-