projectal.entities.contact

 1from projectal.entity import Entity
 2from projectal import api
 3from projectal.linkers import *
 4
 5
 6class Contact(Entity, CompanyLinker, CustomerLinker, NoteLinker, TagLinker):
 7    """
 8    Implementation of the [Contact](https://projectal.com/docs/latest/#tag/Contact) API.
 9    """
10    _path = 'contact'
11    _name = 'contact'
12    _links = [NoteLinker, TagLinker]
13    _links_reverse = [CompanyLinker, CustomerLinker]
14
15    @classmethod
16    def create(cls, holder, entity):
17        """Create a Contact
18
19        `holder`: `uuId` of the owner
20
21        `entity`: The fields of the entity to be created
22        """
23        holder = holder['uuId'] if isinstance(holder, dict) else holder
24        params = "?holder=" + holder
25        return super().create(entity, params)
26
27    @classmethod
28    def clone(cls, uuId, holder, entity):
29        url = '/api/contact/clone?holder={}&reference={}'.format(holder, uuId)
30        response = api.post(url, entity)
31        return response['jobClue']['uuId']
 7class Contact(Entity, CompanyLinker, CustomerLinker, NoteLinker, TagLinker):
 8    """
 9    Implementation of the [Contact](https://projectal.com/docs/latest/#tag/Contact) API.
10    """
11    _path = 'contact'
12    _name = 'contact'
13    _links = [NoteLinker, TagLinker]
14    _links_reverse = [CompanyLinker, CustomerLinker]
15
16    @classmethod
17    def create(cls, holder, entity):
18        """Create a Contact
19
20        `holder`: `uuId` of the owner
21
22        `entity`: The fields of the entity to be created
23        """
24        holder = holder['uuId'] if isinstance(holder, dict) else holder
25        params = "?holder=" + holder
26        return super().create(entity, params)
27
28    @classmethod
29    def clone(cls, uuId, holder, entity):
30        url = '/api/contact/clone?holder={}&reference={}'.format(holder, uuId)
31        response = api.post(url, entity)
32        return response['jobClue']['uuId']

Implementation of the Contact API.

@classmethod
def create(cls, holder, entity):
16    @classmethod
17    def create(cls, holder, entity):
18        """Create a Contact
19
20        `holder`: `uuId` of the owner
21
22        `entity`: The fields of the entity to be created
23        """
24        holder = holder['uuId'] if isinstance(holder, dict) else holder
25        params = "?holder=" + holder
26        return super().create(entity, params)

Create a Contact

holder: uuId of the owner

entity: The fields of the entity to be created

@classmethod
def clone(cls, uuId, holder, entity):
28    @classmethod
29    def clone(cls, uuId, holder, entity):
30        url = '/api/contact/clone?holder={}&reference={}'.format(holder, uuId)
31        response = api.post(url, entity)
32        return response['jobClue']['uuId']

Clones an entity and returns its uuId.

Each entity has its own set of required values when cloning. Check the API documentation of that entity for details.