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
- title (str) – Job title the contact has
- job_position (str) – Name of the job position this contact has
- mobile_phone (str) – Mobile phone number the contact has
- work_fax (str) – Work fax number
- work_phone (str) – Work phone number
- work_email (str) – Work email address
- work_address (str) – Physical work address
- home_address (str) – Physical home address
- home_email (str) – Home email address
- birthday (datetime.date, str) – Birthday date
- info (str) – More information about the contact
- tags (list) – Array of additional tags
Returns: The created contact object
-
get
(contact_id: int)¶ Retrieve a single contact object
Parameters: contact_id (int) – Id of the contact Returns: The contact object
-
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
- term (str) – Full text search (fields that are searched are name, firstname, work_email and company)
- phone (str) – Reverse lookup for work_phone or mobile_phone
- sort_by (str) – Field to the results by
- sort_order (str) – asc or desc
- page (int) – Page number (default 1)
Returns: List of contact objects
-
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
- lastname (str) – The last name of the contact
- gender (
ContactGender
, str) – Gender of the contact. For allowed values seeContactGender
. - company_id (int) – Id of the company the contact belongs to
- title (str) – Job title the contact has
- job_position (str) – name of the job position this contact has
- mobile_phone (str) – Mobile phone number the contact has
- work_fax (str) – Work fax number
- work_phone (str) – Work phone number
- work_email (str) – Work email address
- work_address (str) – Physical work address
- home_address (str) – Physical home address
- home_email (str) – Home email address
- birthday (datetime.date, str) – Birthday date
- info (str) – More information about the contact
- tags (list) – Array of additional tags
Returns: The updated contact object
-
-
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'¶
-