Skip to content

Commit 6a4f7ed

Browse files
author
Yordy Gelvez
committed
improvements in user guide
1 parent 6511e62 commit 6a4f7ed

File tree

2 files changed

+71
-11
lines changed

2 files changed

+71
-11
lines changed

README.md

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ token = client.get_recent_changes(since_timestamp="YYYY-MM-DD HH:MM:SS")
4848
### Deals section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Deals
4949

5050
#### Get deals
51+
If you need a specific deal send the deal id, if you don't just call the method
5152
```
53+
get_specific_deal = client.get_deals(deal_id="")
54+
5255
get_deals = client.get_deals()
5356
```
5457

@@ -130,7 +133,7 @@ get_products_deal = client.get_deal_products(deal_id="")
130133
### Notes section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Notes
131134

132135
#### Get notes
133-
If you need a specific note send the note id, if you don't just call the method without send anything
136+
If you need a specific note send the note id, if you don't just call the method
134137
```
135138
get_specific_note = client.get_notes(note_id="")
136139
@@ -139,7 +142,7 @@ get_notes = client.get_notes()
139142

140143
#### Add a note
141144
```
142-
add_note = client.create_note(content="")
145+
add_note = client.create_note(content="", org_id="")
143146
```
144147

145148
#### Update a note
@@ -155,7 +158,10 @@ delete_note = client.delete_note(note_id="")
155158
### Organizations section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Organizations
156159

157160
#### Get organizations
161+
If you need a specific organization send the organization id, if you don't just call the method
158162
```
163+
get_specific_organization = client.get_organizations(org_id="")
164+
159165
get_organizations = client.get_organizations()
160166
```
161167

@@ -177,7 +183,7 @@ delete_organization = client.delete_organization(data_id="")
177183
### Persons section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Persons
178184

179185
#### Get persons
180-
If you need the details of a person send the person id, if you don't just call the method without send anything
186+
If you need the details of a person send the person id, if you don't just call the method
181187
```
182188
get_details_person = client.get_persons(person_id="")
183189
@@ -209,10 +215,46 @@ delete_persons = client.delete_person(data_id="")
209215
get_persons_deals = client.get_person_deals(person_id="")
210216
```
211217

218+
219+
### Products section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Products
220+
221+
#### Get products
222+
If you need a specific product send the product id, if you don't just call the method
223+
```
224+
get_specific_product = client.get_products(product_id="")
225+
226+
get_products = client.get_products()
227+
```
228+
229+
#### Get products by name
230+
```
231+
find_product = client.get_product_by_name(term="")
232+
```
233+
234+
#### Create a product
235+
```
236+
add_product = client.create_product(name="")
237+
```
238+
239+
#### Update a product
240+
```
241+
update_product = client.update_product(product_id="", name="")
242+
```
243+
244+
#### Delete a product
245+
```
246+
delete_product = client.delete_product(product_id="")
247+
```
248+
249+
#### Get deals where a product is attached to
250+
```
251+
get_product_deal = client.get_product_deal(product_id="")
252+
```
253+
212254
### Activities section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Activities
213255

214256
#### Get activities
215-
If you need the activity details send the activity id, if you don't just call the method without send anything
257+
If you need the activity details send the activity id, if you don't just call the method
216258
```
217259
get_details_activity = client.get_activities(activity_id="")
218260

pipedrive/client.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ def _post(self, endpoint, data=None, json=None, **kwargs):
4949
def _delete(self, endpoint, **kwargs):
5050
return self.make_request('delete', endpoint, **kwargs)
5151

52-
def _patch(self, endpoint, data=None, json=None, **kwargs):
53-
return self.make_request('patch', endpoint, data=data, json=json, **kwargs)
54-
5552
def _put(self, endpoint, json=None, **kwargs):
5653
return self.make_request('put', endpoint, json=json, **kwargs)
5754

@@ -160,9 +157,27 @@ def get_recent_changes(self, **kwargs):
160157
url = "recents"
161158
return self._get(url, **kwargs)
162159

160+
def get_data(self, endpoint, **kwargs):
161+
if endpoint != "":
162+
return self._get(endpoint, **kwargs)
163+
164+
def get_specific_data(self, endpoint, data_id, **kwargs):
165+
if endpoint != "":
166+
url = "{0}/{1}".format(endpoint, data_id)
167+
return self._get(url, **kwargs)
168+
169+
def create_data(self, endpoint, **kwargs):
170+
if endpoint != "" and kwargs is not None:
171+
params = {}
172+
params.update(kwargs)
173+
return self._post(endpoint, json=params)
174+
163175
# Deals section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Deals
164-
def get_deals(self, **kwargs):
165-
url = "deals"
176+
def get_deals(self, deal_id=None, **kwargs):
177+
if deal_id is not None:
178+
url = "deals/{0}".format(deal_id)
179+
else:
180+
url = "deals"
166181
return self._get(url, **kwargs)
167182

168183
def create_deal(self, **kwargs):
@@ -272,8 +287,11 @@ def delete_note(self, note_id):
272287
return self._delete(url)
273288

274289
# Organizations section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Organizations
275-
def get_organizations(self, **kwargs):
276-
url = "organizations"
290+
def get_organizations(self, org_id=None, **kwargs):
291+
if org_id is not None:
292+
url = "organizations/{0}".format(org_id)
293+
else:
294+
url = "organizations"
277295
return self._get(url, **kwargs)
278296

279297
def create_organization(self, **kwargs):

0 commit comments

Comments
 (0)