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 – The first name of the contact
  • lastname – The last name of the contact
  • gender – Gender of the contact. For allowed values see ContactGender.
  • company_id – Id of the company the contact belongs to
  • title – Job title the contact has
  • job_position – Name of the job position this contact has
  • mobile_phone – Mobile phone number the contact has
  • work_fax – Work fax number
  • work_phone – Work phone number
  • work_email – Work email address
  • work_address – Physical work address
  • home_address – Physical home address
  • home_email – Home email address
  • birthday – Birthday date
  • info – More information about the contact
  • tags – Array of additional tags
Returns:

The created contact object

get(id: int)

Retrieve a single contact object

Parameters:id – Id of the contact
Returns:The contact object
getlist(tags: list = None, sort_by: str = None, sort_order: str = 'asc', page: int = 1)

Retrieve a list of contact objects

Parameters:
  • tags – Array of tags
  • sort_by – Field to the results by
  • sort_order – asc or desc
  • page – Page number (default 1)
Returns:

List of contact objects

update(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:
  • id – Id of the contact
  • firstname – The first name of the contact
  • lastname – The last name of the contact
  • gender – Gender of the contact. For allowed values see ContactGender.
  • company_id – Id of the company the contact belongs to
  • title – Job title the contact has
  • job_position – name of the job position this contact has
  • mobile_phone – Mobile phone number the contact has
  • work_fax – Work fax number
  • work_phone – Work phone number
  • work_email – Work email address
  • work_address – Physical work address
  • home_address – Physical home address
  • home_email – Home email address
  • birthday – Birthday date
  • info – More information about the contact
  • tags – Array of additional tags
Returns:

The updated contact object

class moco_wrapper.models.contact.ContactGender

Enumeration for allowed values that can be supplired for gender argument in Contact.create and Contact.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'