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

Implementation of the Contact API.

@classmethod
def create(cls, holder, entity):
17    @classmethod
18    def create(cls, holder, entity):
19        """Create a Contact
20
21        `holder`: `uuId` of the owner
22
23        `entity`: The fields of the entity to be created
24        """
25        holder = holder["uuId"] if isinstance(holder, dict) else holder
26        params = "?holder=" + holder
27        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):
29    @classmethod
30    def clone(cls, uuId, holder, entity):
31        url = "/api/contact/clone?holder={}&reference={}".format(holder, uuId)
32        response = api.post(url, entity)
33        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.