Skip to content

Commit 761bf2f

Browse files
author
Yordy Gelvez
committed
README user guide
1 parent 3fd2987 commit 761bf2f

File tree

2 files changed

+227
-20
lines changed

2 files changed

+227
-20
lines changed

README.md

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,217 @@ token = client.refresh_token('REFRESH TOKEN')
3131
token = client.set_token('TOKEN')
3232
```
3333

34+
#### Get recent changes
35+
```
36+
token = client.get_recent_changes(since_timestamp="YYYY-MM-DD HH:MM:SS")
37+
```
38+
39+
### Deals section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Deals
40+
41+
#### Get deals
42+
```
43+
get_deals = client.get_deals()
44+
```
45+
46+
#### Create deal
47+
```
48+
create_deal = client.create_deal(title="")
49+
```
50+
51+
#### Update deal
52+
```
53+
update_deal = client.update_deal(deal_id="")
54+
```
55+
56+
#### Delete deal
57+
```
58+
delete_deal = client.delete_deal(deal_id="")
59+
```
60+
61+
#### Duplicate deal
62+
```
63+
duplicate_deal = client.duplicate_deal(deal_id="")
64+
```
65+
66+
#### Get details of a deal
67+
```
68+
details_deal = client.get_deal_details(deal_id="")
69+
```
70+
71+
#### Find deals by name
72+
```
73+
find_deal = client.get_deals_by_name(term="")
74+
```
75+
76+
#### Get followers of a deal
77+
```
78+
followers_deal = client.get_deal_followers(deal_id="")
79+
```
80+
81+
#### Add a follower to a deal
82+
```
83+
add_follower_deal = client.add_follower_to_deal(deal_id="", user_id="")
84+
```
85+
86+
#### Delete a follower from a deal
87+
```
88+
delete_followers_deal = client.delete_follower_to_deal(deal_id="", follower_id="")
89+
```
90+
91+
#### Get participants of a deal
92+
```
93+
get_participants_deal = client.get_deal_participants(deal_id="")
94+
```
95+
96+
#### Add a participant to a deal
97+
```
98+
add_participants_deal = client.add_participants_to_deal(deal_id="", person_id="")
99+
```
100+
101+
#### Delete a participant from a deal
102+
```
103+
delete_participants_deal = client.delete_participant_to_deal(deal_id="", participant_id="")
104+
```
105+
106+
#### Get activities associated with a deal
107+
```
108+
get_activities_deal = client.get_deal_activities(deal_id="")
109+
```
110+
111+
#### Get mail messages associated with a deal
112+
```
113+
get_messages_deal = client.get_deal_mail_messages(deal_id="")
114+
```
115+
116+
#### Get products attached to a deal
117+
```
118+
get_products_deal = client.get_deal_products(deal_id="")
119+
```
120+
121+
### Notes section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Notes
122+
123+
#### Get notes
124+
If you need a specific note send the note id, if you don't just call the method without send anything
125+
```
126+
get_specific_note = client.get_notes(note_id="")
127+
128+
get_notes = client.get_notes()
129+
```
130+
131+
#### Add a note
132+
```
133+
add_note = client.create_note(content="")
134+
```
135+
136+
#### Update a note
137+
```
138+
update_note = client.update_note(note_id="", content="")
139+
```
140+
141+
#### Delete a note
142+
```
143+
delete_note = client.delete_note(note_id="")
144+
```
145+
146+
### Organizations section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Organizations
147+
148+
#### Get organizations
149+
```
150+
get_organizations = client.get_organizations()
151+
```
152+
153+
#### Add organization
154+
```
155+
add_organization = client.create_organization(name="")
156+
```
157+
158+
#### Update organization
159+
```
160+
update_organization = client.update_organization(data_id="", name="")
161+
```
162+
163+
#### Delete an organization
164+
```
165+
delete_organization = client.delete_organization(data_id="")
166+
```
167+
168+
### Persons section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Persons
169+
170+
#### Get persons
171+
If you need the details of a person send the person id, if you don't just call the method without send anything
172+
```
173+
get_details_person = client.get_persons(person_id="")
174+
175+
get_persons = client.get_persons()
176+
```
177+
178+
#### Get persons by name
179+
```
180+
find_persons = client.get_persons_by_name(term="")
181+
```
182+
183+
#### Create person
184+
```
185+
add_persons = client.create_person(name="")
186+
```
187+
188+
#### Update person
189+
```
190+
update_persons = client.update_person(data_id="", name="")
191+
```
192+
193+
#### Delete person
194+
```
195+
delete_persons = client.delete_person(data_id="")
196+
```
197+
198+
#### Get deals associated with a person
199+
```
200+
get_persons_deals = client.get_person_deals(person_id="")
201+
```
202+
203+
### Activities section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Activities
204+
205+
#### Get activities
206+
If you need the activity details send the activity id, if you don't just call the method without send anything
207+
```
208+
get_details_activity = client.get_activities(activity_id="")
209+
210+
get_activities = client.get_activities()
211+
```
212+
213+
#### Create an activity
214+
```
215+
add_activity = client.create_activity(subject="", type="")
216+
```
217+
218+
#### Update an activity
219+
```
220+
edit_activity = client.update_activity(activity_id="")
221+
```
222+
223+
#### Delete an activity
224+
```
225+
delete_activity = client.delete_activity(activity_id="")
226+
```
227+
228+
### Webhook section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Webhooks
229+
230+
#### Get webhooks
231+
```
232+
get_hooks = client.get_hooks_subscription()
233+
```
234+
235+
#### Add webhook
236+
```
237+
add_hook = client.create_hook_subscription(subscription_url="", event_action="", event_object="")
238+
```
239+
240+
#### Delete webhook
241+
```
242+
delete_hooks = client.delete_hook_subscription(hook_id="")
243+
```
244+
34245
## Requirements
35246
- requests
36247
- base64 -- b64encode

pipedrive/client.py

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ def get_deal_details(self, deal_id):
191191
url = "deals/{0}".format(deal_id)
192192
return self._get(url)
193193

194-
def get_deals_by_name(self, params=None):
195-
if params is not None:
194+
def get_deals_by_name(self, **kwargs):
195+
if kwargs is not None:
196196
url = "deals/find"
197-
return self._get(url, params=params)
197+
return self._get(url, **kwargs)
198198

199199
def get_deal_followers(self, deal_id):
200200
if deal_id is not None:
@@ -216,10 +216,10 @@ def get_deal_participants(self, deal_id, **kwargs):
216216
url = "deals/{0}/participants".format(deal_id)
217217
return self._get(url, **kwargs)
218218

219-
def add_participants_to_deal(self, deal_id, participant_id):
220-
if deal_id is not None and participant_id is not None:
219+
def add_participants_to_deal(self, deal_id, person_id):
220+
if deal_id is not None and person_id is not None:
221221
url = "deals/{0}/participants".format(deal_id)
222-
return self._post(url, json=participant_id)
222+
return self._post(url, json=person_id)
223223

224224
def delete_participant_to_deal(self, deal_id, participant_id):
225225
if deal_id is not None and participant_id is not None:
@@ -293,20 +293,18 @@ def delete_organization(self, data_id):
293293
return self._delete(url)
294294

295295
# Persons section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Persons
296-
def get_persons(self, **kwargs):
297-
url = "persons"
296+
def get_persons(self, person_id=None, **kwargs):
297+
if person_id is not None:
298+
url = "persons/{0}".format(person_id)
299+
else:
300+
url = "persons"
298301
return self._get(url, **kwargs)
299302

300303
def get_persons_by_name(self, params=None):
301304
if params is not None:
302305
url = "persons/find"
303306
return self._get(url, params=params)
304307

305-
def get_person_details(self, person_id):
306-
if person_id is not None:
307-
url = "persons/{0}".format(person_id)
308-
return self._get(url)
309-
310308
def create_person(self, **kwargs):
311309
if kwargs is not None:
312310
url = "persons"
@@ -369,14 +367,12 @@ def get_product_deal(self, product_id, **kwargs):
369367
return self._get(url, **kwargs)
370368

371369
# Activities section, see the api documentation: https://developers.pipedrive.com/docs/api/v1/#!/Activities
372-
def get_activities(self, **kwargs):
373-
url = "activities"
374-
return self._get(url, **kwargs)
375-
376-
def get_activity_details(self, activity_id):
370+
def get_activities(self, activity_id=None, **kwargs):
377371
if activity_id is not None:
378372
url = "activities/{0}".format(activity_id)
379-
return self._get(url)
373+
else:
374+
url = "activities"
375+
return self._get(url, **kwargs)
380376

381377
def create_activity(self, **kwargs):
382378
if kwargs is not None:
@@ -386,7 +382,7 @@ def create_activity(self, **kwargs):
386382
return self._post(url, json=params)
387383

388384
def update_activity(self, activity_id, **kwargs):
389-
if activity_id is not None and kwargs is not None:
385+
if activity_id is not None:
390386
url = "activities/{0}".format(activity_id)
391387
params = {}
392388
params.update(kwargs)

0 commit comments

Comments
 (0)