Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion copper_sdk/people.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,33 @@ def unrelate_to_company(self, id, company_id):

return self.copper.delete(f'/people/{id}/related', json_body=body)

def relate_to_opportunity(self, id, opportunity_id):
body = {
'resource': {
'id': opportunity_id,
'type': 'opportunity'
}
}

return self.copper.post(f'/people/{id}/related', body)

def unrelate_to_opportunity(self, id, opportunity_id):
body = {
'resource': {
'id': opportunity_id,
'type': 'opportunity'
}
}

return self.copper.delete(f'/people/{id}/related', json_body=body)

def list(self, body=None):
if body is None:
body = {}
default_body = {
'page_number': 1, # number The page number (starting with 1) that you would like to view. 1
'page_size': 20, # number The number of entries included in a page of results 20
'sort_by': 'first_name', # string The field on which to sort the results (see footnote 1).
'sort_by': 'date_modified', # string The field on which to sort the results (see footnote 1).
'sort_direction': 'asc', # string The direction in which to sort the results. Possible values are: asc or desc.
}

Expand Down