From a588e7de86b7b8d965be8e1f09ff2ae203ee47c0 Mon Sep 17 00:00:00 2001 From: Don Bowman Date: Thu, 19 Mar 2026 20:17:32 -0400 Subject: [PATCH] feat: relate person to opportunity --- copper_sdk/people.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/copper_sdk/people.py b/copper_sdk/people.py index b5012e9..a13b31f 100644 --- a/copper_sdk/people.py +++ b/copper_sdk/people.py @@ -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. }