@friggframework/api-module-pipedrive 2.1.0-next.0 → 2.1.0-next.2

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.
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 } from "./types";
3
3
  export declare class Api extends OAuth2Requester {
4
4
  companyDomain: string | null;
5
5
  URLs: {
@@ -11,6 +11,13 @@ 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;
14
21
  };
15
22
  constructor(params: OAuth2RequesterOptions);
16
23
  /**
@@ -31,6 +38,19 @@ export declare class Api extends OAuth2Requester {
31
38
  * @returns Response with deal data array and pagination cursor
32
39
  */
33
40
  listDeals(params?: ListDealsParams): Promise<PipedriveResponse>;
41
+ /**
42
+ * Create a new deal
43
+ * @param params - Deal data
44
+ * @param params.title - Deal title (required)
45
+ * @param params.value - Deal value
46
+ * @param params.currency - Currency code
47
+ * @param params.person_id - Associated person ID
48
+ * @param params.org_id - Associated organization ID
49
+ * @param params.pipeline_id - Pipeline ID
50
+ * @param params.stage_id - Stage ID
51
+ * @returns Response with created deal data
52
+ */
53
+ createDeal(params: CreateDealParams): Promise<PipedriveResponse>;
34
54
  listActivityFields(): Promise<PipedriveResponse>;
35
55
  /**
36
56
  * List activities with v2 API support
@@ -56,4 +76,81 @@ export declare class Api extends OAuth2Requester {
56
76
  * @returns Response with person data
57
77
  */
58
78
  getPerson(personId: string | number, params?: GetPersonParams): Promise<PipedriveResponse>;
79
+ /**
80
+ * Search for persons
81
+ * @param params - Search parameters
82
+ * @param params.term - The search term (minimum 2 characters, or 1 if using exact_match)
83
+ * @param params.fields - Comma-separated fields to search in
84
+ * @param params.exact_match - When enabled, only full exact matches are returned
85
+ * @param params.organization_id - Filter persons by organization ID
86
+ * @param params.include_fields - Optional fields to include (e.g., "person.picture")
87
+ * @param params.limit - Number of entries to return (default 100, max 500)
88
+ * @param params.cursor - Pagination cursor
89
+ * @returns Response with search results including items with result_score and person data
90
+ */
91
+ searchPersons(params: SearchPersonsParams): Promise<PipedriveResponse>;
92
+ /**
93
+ * Search across all items (persons, organizations, deals, etc.)
94
+ * @param params - Search parameters
95
+ * @param params.term - The search term (minimum 2 characters)
96
+ * @param params.item_types - Comma-separated item types to search (e.g., 'person,organization,deal')
97
+ * @param params.exact_match - When enabled, only full exact matches are returned
98
+ * @param params.fields - Comma-separated fields to search in
99
+ * @param params.limit - Number of entries to return (default 10, max 100)
100
+ * @param params.start - Pagination start
101
+ * @returns Response with search results across multiple item types
102
+ */
103
+ search(params: SearchParams): Promise<PipedriveResponse>;
104
+ /**
105
+ * Create a new note
106
+ * @param params - Note data
107
+ * @param params.content - The content of the note in HTML format (required)
108
+ * @param params.lead_id - The ID of the lead (UUID format)
109
+ * @param params.deal_id - The ID of the deal
110
+ * @param params.person_id - The ID of the person
111
+ * @param params.org_id - The ID of the organization
112
+ * @param params.project_id - The ID of the project
113
+ * @param params.user_id - The ID of the user (author)
114
+ * @param params.add_time - Creation date & time in UTC (Format: YYYY-MM-DD HH:MM:SS)
115
+ * @returns Response with created note data
116
+ */
117
+ createNote(params: CreateNoteParams): Promise<PipedriveResponse>;
118
+ /**
119
+ * List organizations with v2 API support
120
+ * @param params - Query parameters for filtering and pagination
121
+ * @returns Response with organization data array and pagination cursor
122
+ */
123
+ listOrganizations(params?: ListOrganizationsParams): Promise<PipedriveResponse>;
124
+ /**
125
+ * Get a single organization by ID
126
+ * @param orgId - The ID of the organization to retrieve
127
+ * @param params - Query parameters for additional fields
128
+ * @returns Response with organization data
129
+ */
130
+ getOrganization(orgId: string | number, params?: GetOrganizationParams): Promise<PipedriveResponse>;
131
+ /**
132
+ * List all webhooks for the company
133
+ * @returns Response with array of webhook configurations
134
+ */
135
+ listWebhooks(): Promise<PipedriveResponse>;
136
+ /**
137
+ * Create a new webhook subscription
138
+ * @param params - Webhook configuration
139
+ * @param params.subscription_url - Public HTTPS URL to receive webhooks
140
+ * @param params.event_action - Event action: added, updated, deleted, merged, *
141
+ * @param params.event_object - Event object: person, organization, deal, activity, product, *
142
+ * @param params.name - Human-readable name for the webhook
143
+ * @param params.user_id - Optional: User ID to authorize webhook with
144
+ * @param params.http_auth_user - Optional: HTTP basic auth username
145
+ * @param params.http_auth_password - Optional: HTTP basic auth password
146
+ * @param params.version - Optional: Webhook version (1.0 or 2.0, default: 2.0)
147
+ * @returns Response with created webhook data
148
+ */
149
+ createWebhook(params: CreateWebhookParams): Promise<PipedriveResponse>;
150
+ /**
151
+ * Delete a webhook by ID
152
+ * @param webhookId - The ID of the webhook to delete
153
+ * @returns Response confirming deletion
154
+ */
155
+ deleteWebhook(webhookId: string | number): Promise<PipedriveResponse>;
59
156
  }
package/dist/api.js CHANGED
@@ -16,6 +16,13 @@ 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",
19
26
  };
20
27
  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
28
  this.tokenUri = "https://oauth.pipedrive.com/oauth/token";
@@ -64,6 +71,28 @@ class Api extends core_1.OAuth2Requester {
64
71
  }
65
72
  return this._get(options);
66
73
  }
74
+ /**
75
+ * Create a new deal
76
+ * @param params - Deal data
77
+ * @param params.title - Deal title (required)
78
+ * @param params.value - Deal value
79
+ * @param params.currency - Currency code
80
+ * @param params.person_id - Associated person ID
81
+ * @param params.org_id - Associated organization ID
82
+ * @param params.pipeline_id - Pipeline ID
83
+ * @param params.stage_id - Stage ID
84
+ * @returns Response with created deal data
85
+ */
86
+ async createDeal(params) {
87
+ const options = {
88
+ url: this.baseUrl + this.URLs.deals,
89
+ body: params,
90
+ headers: {
91
+ "Content-Type": "application/json",
92
+ },
93
+ };
94
+ return this._post(options);
95
+ }
67
96
  // ************************** Activities **********************************
68
97
  async listActivityFields() {
69
98
  const options = {
@@ -154,5 +183,141 @@ class Api extends core_1.OAuth2Requester {
154
183
  }
155
184
  return this._get(options);
156
185
  }
186
+ /**
187
+ * Search for persons
188
+ * @param params - Search parameters
189
+ * @param params.term - The search term (minimum 2 characters, or 1 if using exact_match)
190
+ * @param params.fields - Comma-separated fields to search in
191
+ * @param params.exact_match - When enabled, only full exact matches are returned
192
+ * @param params.organization_id - Filter persons by organization ID
193
+ * @param params.include_fields - Optional fields to include (e.g., "person.picture")
194
+ * @param params.limit - Number of entries to return (default 100, max 500)
195
+ * @param params.cursor - Pagination cursor
196
+ * @returns Response with search results including items with result_score and person data
197
+ */
198
+ async searchPersons(params) {
199
+ const options = {
200
+ url: this.baseUrl + this.URLs.personsSearch,
201
+ query: params,
202
+ };
203
+ return this._get(options);
204
+ }
205
+ /**
206
+ * Search across all items (persons, organizations, deals, etc.)
207
+ * @param params - Search parameters
208
+ * @param params.term - The search term (minimum 2 characters)
209
+ * @param params.item_types - Comma-separated item types to search (e.g., 'person,organization,deal')
210
+ * @param params.exact_match - When enabled, only full exact matches are returned
211
+ * @param params.fields - Comma-separated fields to search in
212
+ * @param params.limit - Number of entries to return (default 10, max 100)
213
+ * @param params.start - Pagination start
214
+ * @returns Response with search results across multiple item types
215
+ */
216
+ async search(params) {
217
+ const options = {
218
+ url: this.baseUrl + this.URLs.search,
219
+ query: params,
220
+ };
221
+ return this._get(options);
222
+ }
223
+ // ************************** Notes **********************************
224
+ /**
225
+ * Create a new note
226
+ * @param params - Note data
227
+ * @param params.content - The content of the note in HTML format (required)
228
+ * @param params.lead_id - The ID of the lead (UUID format)
229
+ * @param params.deal_id - The ID of the deal
230
+ * @param params.person_id - The ID of the person
231
+ * @param params.org_id - The ID of the organization
232
+ * @param params.project_id - The ID of the project
233
+ * @param params.user_id - The ID of the user (author)
234
+ * @param params.add_time - Creation date & time in UTC (Format: YYYY-MM-DD HH:MM:SS)
235
+ * @returns Response with created note data
236
+ */
237
+ async createNote(params) {
238
+ const options = {
239
+ url: this.baseUrl + this.URLs.notes,
240
+ body: params,
241
+ headers: {
242
+ "Content-Type": "application/json",
243
+ },
244
+ };
245
+ return this._post(options);
246
+ }
247
+ // ************************** Organizations **********************************
248
+ /**
249
+ * List organizations with v2 API support
250
+ * @param params - Query parameters for filtering and pagination
251
+ * @returns Response with organization data array and pagination cursor
252
+ */
253
+ async listOrganizations(params) {
254
+ const options = {
255
+ url: this.baseUrl + this.URLs.organizations,
256
+ };
257
+ if (params && Object.keys(params).length > 0) {
258
+ options.query = params;
259
+ }
260
+ return this._get(options);
261
+ }
262
+ /**
263
+ * Get a single organization by ID
264
+ * @param orgId - The ID of the organization to retrieve
265
+ * @param params - Query parameters for additional fields
266
+ * @returns Response with organization data
267
+ */
268
+ async getOrganization(orgId, params) {
269
+ const options = {
270
+ url: this.baseUrl + this.URLs.organizationById(orgId),
271
+ };
272
+ if (params && Object.keys(params).length > 0) {
273
+ options.query = params;
274
+ }
275
+ return this._get(options);
276
+ }
277
+ // ************************** Webhooks **********************************
278
+ /**
279
+ * List all webhooks for the company
280
+ * @returns Response with array of webhook configurations
281
+ */
282
+ async listWebhooks() {
283
+ const options = {
284
+ url: this.baseUrl + this.URLs.webhooks,
285
+ };
286
+ return this._get(options);
287
+ }
288
+ /**
289
+ * Create a new webhook subscription
290
+ * @param params - Webhook configuration
291
+ * @param params.subscription_url - Public HTTPS URL to receive webhooks
292
+ * @param params.event_action - Event action: added, updated, deleted, merged, *
293
+ * @param params.event_object - Event object: person, organization, deal, activity, product, *
294
+ * @param params.name - Human-readable name for the webhook
295
+ * @param params.user_id - Optional: User ID to authorize webhook with
296
+ * @param params.http_auth_user - Optional: HTTP basic auth username
297
+ * @param params.http_auth_password - Optional: HTTP basic auth password
298
+ * @param params.version - Optional: Webhook version (1.0 or 2.0, default: 2.0)
299
+ * @returns Response with created webhook data
300
+ */
301
+ async createWebhook(params) {
302
+ const options = {
303
+ url: this.baseUrl + this.URLs.webhooks,
304
+ body: params,
305
+ headers: {
306
+ "Content-Type": "application/json",
307
+ },
308
+ };
309
+ return this._post(options);
310
+ }
311
+ /**
312
+ * Delete a webhook by ID
313
+ * @param webhookId - The ID of the webhook to delete
314
+ * @returns Response confirming deletion
315
+ */
316
+ async deleteWebhook(webhookId) {
317
+ const options = {
318
+ url: this.baseUrl + this.URLs.webhookById(webhookId),
319
+ };
320
+ return this._delete(options);
321
+ }
157
322
  }
158
323
  exports.Api = Api;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@friggframework/api-module-pipedrive",
3
- "version": "2.1.0-next.0",
3
+ "version": "2.1.0-next.2",
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": "6b9c14cf15aeea687f20104edf08ac39d89b9f88"
33
+ "gitHead": "fa3f5ec40cbb9300511849233bddb0c463bfab2a"
34
34
  }