@friggframework/api-module-pipedrive 2.0.1-canary.56.5db6eda.0 → 2.0.1-canary.68.2c3f598.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/api.d.ts +147 -1
  2. package/dist/api.js +251 -0
  3. package/package.json +2 -2
package/dist/api.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { OAuth2Requester } from "@friggframework/core";
2
- import { OAuth2RequesterOptions, ActivityParams, ListActivitiesParams, ListDealsParams, ListPersonsParams, GetPersonParams, PipedriveResponse, PipedriveUser, PipedriveTokenResponse } from "./types";
2
+ import { OAuth2RequesterOptions, ActivityParams, ListActivitiesParams, ListDealsParams, CreateDealParams, ListPersonsParams, GetPersonParams, SearchPersonsParams, SearchParams, CreateNoteParams, ListOrganizationsParams, GetOrganizationParams, PipedriveResponse, PipedriveUser, PipedriveTokenResponse, CreateWebhookParams, CreateCallLogParams, UpdateCallLogParams, ListCallLogsParams } from "./types";
3
3
  export declare class Api extends OAuth2Requester {
4
4
  companyDomain: string | null;
5
5
  URLs: {
@@ -11,6 +11,15 @@ export declare class Api extends OAuth2Requester {
11
11
  deals: string;
12
12
  persons: string;
13
13
  personById: (personId: string | number) => string;
14
+ personsSearch: string;
15
+ organizations: string;
16
+ organizationById: (orgId: string | number) => string;
17
+ notes: string;
18
+ webhooks: string;
19
+ webhookById: (webhookId: string | number) => string;
20
+ search: string;
21
+ callLogs: string;
22
+ callLogById: (callLogId: string) => string;
14
23
  };
15
24
  constructor(params: OAuth2RequesterOptions);
16
25
  /**
@@ -31,6 +40,19 @@ export declare class Api extends OAuth2Requester {
31
40
  * @returns Response with deal data array and pagination cursor
32
41
  */
33
42
  listDeals(params?: ListDealsParams): Promise<PipedriveResponse>;
43
+ /**
44
+ * Create a new deal
45
+ * @param params - Deal data
46
+ * @param params.title - Deal title (required)
47
+ * @param params.value - Deal value
48
+ * @param params.currency - Currency code
49
+ * @param params.person_id - Associated person ID
50
+ * @param params.org_id - Associated organization ID
51
+ * @param params.pipeline_id - Pipeline ID
52
+ * @param params.stage_id - Stage ID
53
+ * @returns Response with created deal data
54
+ */
55
+ createDeal(params: CreateDealParams): Promise<PipedriveResponse>;
34
56
  listActivityFields(): Promise<PipedriveResponse>;
35
57
  /**
36
58
  * List activities with v2 API support
@@ -56,4 +78,128 @@ export declare class Api extends OAuth2Requester {
56
78
  * @returns Response with person data
57
79
  */
58
80
  getPerson(personId: string | number, params?: GetPersonParams): Promise<PipedriveResponse>;
81
+ /**
82
+ * Search for persons
83
+ * @param params - Search parameters
84
+ * @param params.term - The search term (minimum 2 characters, or 1 if using exact_match)
85
+ * @param params.fields - Comma-separated fields to search in
86
+ * @param params.exact_match - When enabled, only full exact matches are returned
87
+ * @param params.organization_id - Filter persons by organization ID
88
+ * @param params.include_fields - Optional fields to include (e.g., "person.picture")
89
+ * @param params.limit - Number of entries to return (default 100, max 500)
90
+ * @param params.cursor - Pagination cursor
91
+ * @returns Response with search results including items with result_score and person data
92
+ */
93
+ searchPersons(params: SearchPersonsParams): Promise<PipedriveResponse>;
94
+ /**
95
+ * Search across all items (persons, organizations, deals, etc.)
96
+ * @param params - Search parameters
97
+ * @param params.term - The search term (minimum 2 characters)
98
+ * @param params.item_types - Comma-separated item types to search (e.g., 'person,organization,deal')
99
+ * @param params.exact_match - When enabled, only full exact matches are returned
100
+ * @param params.fields - Comma-separated fields to search in
101
+ * @param params.limit - Number of entries to return (default 10, max 100)
102
+ * @param params.start - Pagination start
103
+ * @returns Response with search results across multiple item types
104
+ */
105
+ search(params: SearchParams): Promise<PipedriveResponse>;
106
+ /**
107
+ * Create a new note
108
+ * @param params - Note data
109
+ * @param params.content - The content of the note in HTML format (required)
110
+ * @param params.lead_id - The ID of the lead (UUID format)
111
+ * @param params.deal_id - The ID of the deal
112
+ * @param params.person_id - The ID of the person
113
+ * @param params.org_id - The ID of the organization
114
+ * @param params.project_id - The ID of the project
115
+ * @param params.user_id - The ID of the user (author)
116
+ * @param params.add_time - Creation date & time in UTC (Format: YYYY-MM-DD HH:MM:SS)
117
+ * @returns Response with created note data
118
+ */
119
+ createNote(params: CreateNoteParams): Promise<PipedriveResponse>;
120
+ /**
121
+ * List organizations with v2 API support
122
+ * @param params - Query parameters for filtering and pagination
123
+ * @returns Response with organization data array and pagination cursor
124
+ */
125
+ listOrganizations(params?: ListOrganizationsParams): Promise<PipedriveResponse>;
126
+ /**
127
+ * Get a single organization by ID
128
+ * @param orgId - The ID of the organization to retrieve
129
+ * @param params - Query parameters for additional fields
130
+ * @returns Response with organization data
131
+ */
132
+ getOrganization(orgId: string | number, params?: GetOrganizationParams): Promise<PipedriveResponse>;
133
+ /**
134
+ * List all webhooks for the company
135
+ * @returns Response with array of webhook configurations
136
+ */
137
+ listWebhooks(): Promise<PipedriveResponse>;
138
+ /**
139
+ * Create a new webhook subscription
140
+ * @param params - Webhook configuration
141
+ * @param params.subscription_url - Public HTTPS URL to receive webhooks
142
+ * @param params.event_action - Event action: added, updated, deleted, merged, *
143
+ * @param params.event_object - Event object: person, organization, deal, activity, product, *
144
+ * @param params.name - Human-readable name for the webhook
145
+ * @param params.user_id - Optional: User ID to authorize webhook with
146
+ * @param params.http_auth_user - Optional: HTTP basic auth username
147
+ * @param params.http_auth_password - Optional: HTTP basic auth password
148
+ * @param params.version - Optional: Webhook version (1.0 or 2.0, default: 2.0)
149
+ * @returns Response with created webhook data
150
+ */
151
+ createWebhook(params: CreateWebhookParams): Promise<PipedriveResponse>;
152
+ /**
153
+ * Delete a webhook by ID
154
+ * @param webhookId - The ID of the webhook to delete
155
+ * @returns Response confirming deletion
156
+ */
157
+ deleteWebhook(webhookId: string | number): Promise<PipedriveResponse>;
158
+ /**
159
+ * List all call logs
160
+ * @param params - Pagination parameters
161
+ * @param params.start - Pagination start position (default: 0)
162
+ * @param params.limit - Max entries per page (max: 50)
163
+ * @returns Response with call log data array
164
+ */
165
+ listCallLogs(params?: ListCallLogsParams): Promise<PipedriveResponse>;
166
+ /**
167
+ * Get a single call log by ID
168
+ * @param callLogId - The ID of the call log to retrieve
169
+ * @returns Response with call log data
170
+ */
171
+ getCallLog(callLogId: string): Promise<PipedriveResponse>;
172
+ /**
173
+ * Create a new call log
174
+ * @param params - Call log data
175
+ * @param params.to_phone_number - The number called (required)
176
+ * @param params.outcome - Call result: connected, no_answer, left_message, left_voicemail, wrong_number, busy (required)
177
+ * @param params.start_time - Call start in UTC YYYY-MM-DD HH:MM:SS (required)
178
+ * @param params.end_time - Call end in UTC YYYY-MM-DD HH:MM:SS (required)
179
+ * @param params.person_id - Associated person ID
180
+ * @param params.org_id - Associated organization ID
181
+ * @param params.deal_id - Associated deal ID
182
+ * @param params.subject - Activity name/subject
183
+ * @param params.duration - Duration in seconds
184
+ * @param params.from_phone_number - Caller's number
185
+ * @param params.note - Notes in HTML format
186
+ * @returns Response with created call log data
187
+ */
188
+ createCallLog(params: CreateCallLogParams): Promise<PipedriveResponse>;
189
+ /**
190
+ * Update an existing call log
191
+ * @param callLogId - The ID of the call log to update
192
+ * @param params - Fields to update
193
+ * @param params.outcome - Call result
194
+ * @param params.subject - Activity name/subject
195
+ * @param params.note - Notes in HTML format
196
+ * @returns Response with updated call log data
197
+ */
198
+ updateCallLog(callLogId: string, params: UpdateCallLogParams): Promise<PipedriveResponse>;
199
+ /**
200
+ * Delete a call log by ID
201
+ * @param callLogId - The ID of the call log to delete
202
+ * @returns Response confirming deletion
203
+ */
204
+ deleteCallLog(callLogId: string): Promise<PipedriveResponse>;
59
205
  }
package/dist/api.js CHANGED
@@ -16,6 +16,15 @@ class Api extends core_1.OAuth2Requester {
16
16
  deals: "/v2/deals",
17
17
  persons: "/v2/persons",
18
18
  personById: (personId) => `/v2/persons/${personId}`,
19
+ personsSearch: "/v2/persons/search",
20
+ organizations: "/v2/organizations",
21
+ organizationById: (orgId) => `/v2/organizations/${orgId}`,
22
+ notes: "/v1/notes",
23
+ webhooks: "/v1/webhooks",
24
+ webhookById: (webhookId) => `/v1/webhooks/${webhookId}`,
25
+ search: "/v1/search",
26
+ callLogs: "/v1/callLogs",
27
+ callLogById: (callLogId) => `/v1/callLogs/${callLogId}`,
19
28
  };
20
29
  this.authorizationUri = encodeURI(`https://oauth.pipedrive.com/oauth/authorize?client_id=${this.client_id}&redirect_uri=${this.redirect_uri}&response_type=code&scope=${this.scope}`);
21
30
  this.tokenUri = "https://oauth.pipedrive.com/oauth/token";
@@ -64,6 +73,28 @@ class Api extends core_1.OAuth2Requester {
64
73
  }
65
74
  return this._get(options);
66
75
  }
76
+ /**
77
+ * Create a new deal
78
+ * @param params - Deal data
79
+ * @param params.title - Deal title (required)
80
+ * @param params.value - Deal value
81
+ * @param params.currency - Currency code
82
+ * @param params.person_id - Associated person ID
83
+ * @param params.org_id - Associated organization ID
84
+ * @param params.pipeline_id - Pipeline ID
85
+ * @param params.stage_id - Stage ID
86
+ * @returns Response with created deal data
87
+ */
88
+ async createDeal(params) {
89
+ const options = {
90
+ url: this.baseUrl + this.URLs.deals,
91
+ body: params,
92
+ headers: {
93
+ "Content-Type": "application/json",
94
+ },
95
+ };
96
+ return this._post(options);
97
+ }
67
98
  // ************************** Activities **********************************
68
99
  async listActivityFields() {
69
100
  const options = {
@@ -154,5 +185,225 @@ class Api extends core_1.OAuth2Requester {
154
185
  }
155
186
  return this._get(options);
156
187
  }
188
+ /**
189
+ * Search for persons
190
+ * @param params - Search parameters
191
+ * @param params.term - The search term (minimum 2 characters, or 1 if using exact_match)
192
+ * @param params.fields - Comma-separated fields to search in
193
+ * @param params.exact_match - When enabled, only full exact matches are returned
194
+ * @param params.organization_id - Filter persons by organization ID
195
+ * @param params.include_fields - Optional fields to include (e.g., "person.picture")
196
+ * @param params.limit - Number of entries to return (default 100, max 500)
197
+ * @param params.cursor - Pagination cursor
198
+ * @returns Response with search results including items with result_score and person data
199
+ */
200
+ async searchPersons(params) {
201
+ const options = {
202
+ url: this.baseUrl + this.URLs.personsSearch,
203
+ query: params,
204
+ };
205
+ return this._get(options);
206
+ }
207
+ /**
208
+ * Search across all items (persons, organizations, deals, etc.)
209
+ * @param params - Search parameters
210
+ * @param params.term - The search term (minimum 2 characters)
211
+ * @param params.item_types - Comma-separated item types to search (e.g., 'person,organization,deal')
212
+ * @param params.exact_match - When enabled, only full exact matches are returned
213
+ * @param params.fields - Comma-separated fields to search in
214
+ * @param params.limit - Number of entries to return (default 10, max 100)
215
+ * @param params.start - Pagination start
216
+ * @returns Response with search results across multiple item types
217
+ */
218
+ async search(params) {
219
+ const options = {
220
+ url: this.baseUrl + this.URLs.search,
221
+ query: params,
222
+ };
223
+ return this._get(options);
224
+ }
225
+ // ************************** Notes **********************************
226
+ /**
227
+ * Create a new note
228
+ * @param params - Note data
229
+ * @param params.content - The content of the note in HTML format (required)
230
+ * @param params.lead_id - The ID of the lead (UUID format)
231
+ * @param params.deal_id - The ID of the deal
232
+ * @param params.person_id - The ID of the person
233
+ * @param params.org_id - The ID of the organization
234
+ * @param params.project_id - The ID of the project
235
+ * @param params.user_id - The ID of the user (author)
236
+ * @param params.add_time - Creation date & time in UTC (Format: YYYY-MM-DD HH:MM:SS)
237
+ * @returns Response with created note data
238
+ */
239
+ async createNote(params) {
240
+ const options = {
241
+ url: this.baseUrl + this.URLs.notes,
242
+ body: params,
243
+ headers: {
244
+ "Content-Type": "application/json",
245
+ },
246
+ };
247
+ return this._post(options);
248
+ }
249
+ // ************************** Organizations **********************************
250
+ /**
251
+ * List organizations with v2 API support
252
+ * @param params - Query parameters for filtering and pagination
253
+ * @returns Response with organization data array and pagination cursor
254
+ */
255
+ async listOrganizations(params) {
256
+ const options = {
257
+ url: this.baseUrl + this.URLs.organizations,
258
+ };
259
+ if (params && Object.keys(params).length > 0) {
260
+ options.query = params;
261
+ }
262
+ return this._get(options);
263
+ }
264
+ /**
265
+ * Get a single organization by ID
266
+ * @param orgId - The ID of the organization to retrieve
267
+ * @param params - Query parameters for additional fields
268
+ * @returns Response with organization data
269
+ */
270
+ async getOrganization(orgId, params) {
271
+ const options = {
272
+ url: this.baseUrl + this.URLs.organizationById(orgId),
273
+ };
274
+ if (params && Object.keys(params).length > 0) {
275
+ options.query = params;
276
+ }
277
+ return this._get(options);
278
+ }
279
+ // ************************** Webhooks **********************************
280
+ /**
281
+ * List all webhooks for the company
282
+ * @returns Response with array of webhook configurations
283
+ */
284
+ async listWebhooks() {
285
+ const options = {
286
+ url: this.baseUrl + this.URLs.webhooks,
287
+ };
288
+ return this._get(options);
289
+ }
290
+ /**
291
+ * Create a new webhook subscription
292
+ * @param params - Webhook configuration
293
+ * @param params.subscription_url - Public HTTPS URL to receive webhooks
294
+ * @param params.event_action - Event action: added, updated, deleted, merged, *
295
+ * @param params.event_object - Event object: person, organization, deal, activity, product, *
296
+ * @param params.name - Human-readable name for the webhook
297
+ * @param params.user_id - Optional: User ID to authorize webhook with
298
+ * @param params.http_auth_user - Optional: HTTP basic auth username
299
+ * @param params.http_auth_password - Optional: HTTP basic auth password
300
+ * @param params.version - Optional: Webhook version (1.0 or 2.0, default: 2.0)
301
+ * @returns Response with created webhook data
302
+ */
303
+ async createWebhook(params) {
304
+ const options = {
305
+ url: this.baseUrl + this.URLs.webhooks,
306
+ body: params,
307
+ headers: {
308
+ "Content-Type": "application/json",
309
+ },
310
+ };
311
+ return this._post(options);
312
+ }
313
+ /**
314
+ * Delete a webhook by ID
315
+ * @param webhookId - The ID of the webhook to delete
316
+ * @returns Response confirming deletion
317
+ */
318
+ async deleteWebhook(webhookId) {
319
+ const options = {
320
+ url: this.baseUrl + this.URLs.webhookById(webhookId),
321
+ };
322
+ return this._delete(options);
323
+ }
324
+ // ************************** Call Logs **********************************
325
+ /**
326
+ * List all call logs
327
+ * @param params - Pagination parameters
328
+ * @param params.start - Pagination start position (default: 0)
329
+ * @param params.limit - Max entries per page (max: 50)
330
+ * @returns Response with call log data array
331
+ */
332
+ async listCallLogs(params) {
333
+ const options = {
334
+ url: this.baseUrl + this.URLs.callLogs,
335
+ };
336
+ if (params && Object.keys(params).length > 0) {
337
+ options.query = params;
338
+ }
339
+ return this._get(options);
340
+ }
341
+ /**
342
+ * Get a single call log by ID
343
+ * @param callLogId - The ID of the call log to retrieve
344
+ * @returns Response with call log data
345
+ */
346
+ async getCallLog(callLogId) {
347
+ const options = {
348
+ url: this.baseUrl + this.URLs.callLogById(callLogId),
349
+ };
350
+ return this._get(options);
351
+ }
352
+ /**
353
+ * Create a new call log
354
+ * @param params - Call log data
355
+ * @param params.to_phone_number - The number called (required)
356
+ * @param params.outcome - Call result: connected, no_answer, left_message, left_voicemail, wrong_number, busy (required)
357
+ * @param params.start_time - Call start in UTC YYYY-MM-DD HH:MM:SS (required)
358
+ * @param params.end_time - Call end in UTC YYYY-MM-DD HH:MM:SS (required)
359
+ * @param params.person_id - Associated person ID
360
+ * @param params.org_id - Associated organization ID
361
+ * @param params.deal_id - Associated deal ID
362
+ * @param params.subject - Activity name/subject
363
+ * @param params.duration - Duration in seconds
364
+ * @param params.from_phone_number - Caller's number
365
+ * @param params.note - Notes in HTML format
366
+ * @returns Response with created call log data
367
+ */
368
+ async createCallLog(params) {
369
+ const options = {
370
+ url: this.baseUrl + this.URLs.callLogs,
371
+ body: params,
372
+ headers: {
373
+ "Content-Type": "application/json",
374
+ },
375
+ };
376
+ return this._post(options);
377
+ }
378
+ /**
379
+ * Update an existing call log
380
+ * @param callLogId - The ID of the call log to update
381
+ * @param params - Fields to update
382
+ * @param params.outcome - Call result
383
+ * @param params.subject - Activity name/subject
384
+ * @param params.note - Notes in HTML format
385
+ * @returns Response with updated call log data
386
+ */
387
+ async updateCallLog(callLogId, params) {
388
+ const options = {
389
+ url: this.baseUrl + this.URLs.callLogById(callLogId),
390
+ body: params,
391
+ headers: {
392
+ "Content-Type": "application/json",
393
+ },
394
+ };
395
+ return this._patch(options);
396
+ }
397
+ /**
398
+ * Delete a call log by ID
399
+ * @param callLogId - The ID of the call log to delete
400
+ * @returns Response confirming deletion
401
+ */
402
+ async deleteCallLog(callLogId) {
403
+ const options = {
404
+ url: this.baseUrl + this.URLs.callLogById(callLogId),
405
+ };
406
+ return this._delete(options);
407
+ }
157
408
  }
158
409
  exports.Api = Api;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@friggframework/api-module-pipedrive",
3
- "version": "2.0.1-canary.56.5db6eda.0",
3
+ "version": "2.0.1-canary.68.2c3f598.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -30,5 +30,5 @@
30
30
  "publishConfig": {
31
31
  "access": "public"
32
32
  },
33
- "gitHead": "5db6eda2544990b22eba8f305e435f6b269d839b"
33
+ "gitHead": "2c3f598492170e4d8e77261a9e51cd352c469dfb"
34
34
  }