From 8ed138f371b99e0c0dfeb4a5215b3d6ccc69413e Mon Sep 17 00:00:00 2001 From: Arnaud Rouanet Date: Mon, 8 Mar 2021 14:52:08 +0100 Subject: [PATCH 1/3] Add new /search API endpoints --- pipedrive/deals.py | 4 ++++ pipedrive/organizations.py | 4 ++++ pipedrive/persons.py | 4 ++++ pipedrive/products.py | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/pipedrive/deals.py b/pipedrive/deals.py index 2f4b3f7..ad963d9 100644 --- a/pipedrive/deals.py +++ b/pipedrive/deals.py @@ -34,6 +34,10 @@ def get_deal_details(self, deal_id, **kwargs): url = 'deals/{}'.format(deal_id) return self._client._get(self._client.BASE_URL + url, **kwargs) + def search_deals(self, params=None, **kwargs): + url = 'deals/search' + return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) + def get_deals_by_name(self, params=None, **kwargs): url = 'deals/find' return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) diff --git a/pipedrive/organizations.py b/pipedrive/organizations.py index 8cb2ac2..98a6e42 100644 --- a/pipedrive/organizations.py +++ b/pipedrive/organizations.py @@ -26,6 +26,10 @@ def get_organization_fields(self, params=None, **kwargs): url = 'organizationFields' return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) + def search_organizations(self, params=None, **kwargs): + url = 'organizations/search' + return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) + def find_organization_by_name(self, **kwargs): url = 'organizations/find' return self._client._get(self._client.BASE_URL + url, **kwargs) diff --git a/pipedrive/persons.py b/pipedrive/persons.py index 20f3c43..a5ab754 100644 --- a/pipedrive/persons.py +++ b/pipedrive/persons.py @@ -10,6 +10,10 @@ def get_all_persons(self, params=None, **kwargs): url = 'persons' return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) + def search_persons(self, params=None, **kwargs): + url = 'persons/search' + return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) + def get_persons_by_name(self, params=None, **kwargs): url = 'persons/find' return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) diff --git a/pipedrive/products.py b/pipedrive/products.py index 49870c5..f19a620 100644 --- a/pipedrive/products.py +++ b/pipedrive/products.py @@ -10,6 +10,10 @@ def get_all_products(self, **kwargs): url = 'products' return self._client._get(self._client.BASE_URL + url, **kwargs) + def search_products(self, params=None, **kwargs): + url = 'products/search' + return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) + def get_product_by_name(self, **kwargs): url = 'products/find' return self._client._get(self._client.BASE_URL + url, **kwargs) From cc086df6cc9a2534807e66e80e05a9441ea50649 Mon Sep 17 00:00:00 2001 From: Arnaud Rouanet Date: Mon, 8 Mar 2021 15:24:26 +0100 Subject: [PATCH 2/3] Update documentation with new endpoints --- README.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 490d42e..faf3aa8 100644 --- a/README.md +++ b/README.md @@ -144,12 +144,12 @@ response = client.deals.duplicate_deal('DEAL_ID') response = client.deals.get_deal_details('DEAL_ID') ``` -#### Find deals by name +#### Search deals ``` params = { 'term': '' } -response = client.deals.get_deals_by_name(params=params) +response = client.deals.search_deals(params=params) ``` #### Get followers of a deal @@ -295,6 +295,14 @@ response = client.organizations.get_organization('ORGANIZATION_ID') response = client.organizations.get_all_organizations() ``` +#### Search organizations +``` +params = { + 'term': '' +} +response = client.products.search_organizations(params=params) +``` + #### Add organization ``` data = { @@ -335,12 +343,12 @@ response = client.persons.get_person('PERSON_ID') response = client.persons.get_all_persons() ``` -#### Get persons by name +#### Search persons ``` params = { 'term': '' } -response = client.persons.get_persons_by_name(params=params) +response = client.persons.search_persons(params=params) ``` #### Create person @@ -407,12 +415,12 @@ response = client.products.get_product('PRODUCT_ID') response = client.products.get_all_products() ``` -#### Get products by name +#### Search products ``` params = { 'term': '' } -response = client.products.get_product_by_name(params=params) +response = client.products.search_products(params=params) ``` #### Create a product From 2396c461f82c74fa87124b7e7109457d0041587b Mon Sep 17 00:00:00 2001 From: Arnaud Rouanet Date: Mon, 8 Mar 2021 15:39:20 +0100 Subject: [PATCH 3/3] Remove deprecated /find endpoints --- pipedrive/deals.py | 4 ---- pipedrive/organizations.py | 4 ---- pipedrive/persons.py | 4 ---- pipedrive/products.py | 4 ---- 4 files changed, 16 deletions(-) diff --git a/pipedrive/deals.py b/pipedrive/deals.py index ad963d9..9c86153 100644 --- a/pipedrive/deals.py +++ b/pipedrive/deals.py @@ -38,10 +38,6 @@ def search_deals(self, params=None, **kwargs): url = 'deals/search' return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) - def get_deals_by_name(self, params=None, **kwargs): - url = 'deals/find' - return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) - def get_deal_followers(self, deal_id, **kwargs): url = 'deals/{}/followers'.format(deal_id) return self._client._get(self._client.BASE_URL + url, **kwargs) diff --git a/pipedrive/organizations.py b/pipedrive/organizations.py index 98a6e42..04e27b4 100644 --- a/pipedrive/organizations.py +++ b/pipedrive/organizations.py @@ -29,7 +29,3 @@ def get_organization_fields(self, params=None, **kwargs): def search_organizations(self, params=None, **kwargs): url = 'organizations/search' return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) - - def find_organization_by_name(self, **kwargs): - url = 'organizations/find' - return self._client._get(self._client.BASE_URL + url, **kwargs) diff --git a/pipedrive/persons.py b/pipedrive/persons.py index a5ab754..7984791 100644 --- a/pipedrive/persons.py +++ b/pipedrive/persons.py @@ -14,10 +14,6 @@ def search_persons(self, params=None, **kwargs): url = 'persons/search' return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) - def get_persons_by_name(self, params=None, **kwargs): - url = 'persons/find' - return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) - def create_person(self, data, **kwargs): url = 'persons' return self._client._post(self._client.BASE_URL + url, json=data, **kwargs) diff --git a/pipedrive/products.py b/pipedrive/products.py index f19a620..db5808e 100644 --- a/pipedrive/products.py +++ b/pipedrive/products.py @@ -14,10 +14,6 @@ def search_products(self, params=None, **kwargs): url = 'products/search' return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) - def get_product_by_name(self, **kwargs): - url = 'products/find' - return self._client._get(self._client.BASE_URL + url, **kwargs) - def create_product(self, data, **kwargs): url = 'products' return self._client._post(self._client.BASE_URL + url, json=data, **kwargs)