-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathpersons-api.ts
More file actions
2571 lines (2229 loc) · 124 KB
/
Copy pathpersons-api.ts
File metadata and controls
2571 lines (2229 loc) · 124 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* tslint:disable */
/* eslint-disable */
/**
* Pipedrive API v1
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
// @ts-ignore
import { AddPersonFollowerRequest } from '../models';
// @ts-ignore
import { AddPersonFollowerResponse } from '../models';
// @ts-ignore
import { AddPersonPictureResponse } from '../models';
// @ts-ignore
import { AddPersonRequest } from '../models';
// @ts-ignore
import { AddPersonResponse } from '../models';
// @ts-ignore
import { DeletePersonResponse } from '../models';
// @ts-ignore
import { FailResponse } from '../models';
// @ts-ignore
import { GetAssociatedActivitiesResponse } from '../models';
// @ts-ignore
import { GetAssociatedDealsResponse } from '../models';
// @ts-ignore
import { GetAssociatedFilesResponse } from '../models';
// @ts-ignore
import { GetAssociatedMailMessagesResponse } from '../models';
// @ts-ignore
import { GetAssociatedPersonUpdatesResponse } from '../models';
// @ts-ignore
import { GetChangelogResponse } from '../models';
// @ts-ignore
import { GetListFollowersResponse } from '../models';
// @ts-ignore
import { GetPermittedUsersResponse1 } from '../models';
// @ts-ignore
import { GetPersonDetailsResponse } from '../models';
// @ts-ignore
import { GetPersonProductsResponse } from '../models';
// @ts-ignore
import { GetPersonSearchResponse } from '../models';
// @ts-ignore
import { GetPersonsCollection200Response } from '../models';
// @ts-ignore
import { GetPersonsResponse1 } from '../models';
// @ts-ignore
import { MergePersonsRequest } from '../models';
// @ts-ignore
import { MergePersonsResponse } from '../models';
// @ts-ignore
import { UpdatePersonRequest } from '../models';
// @ts-ignore
import { UpdatePersonResponse } from '../models';
/**
* PersonsApi - axios parameter creator
* @export
*/
export const PersonsApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* Adds a new person. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the personFields and look for `key` values.<br>If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `data.marketing_status` field.
* @summary Add a person
* @param {AddPersonRequest} [AddPersonRequest]
* @deprecated
* @throws {RequiredError}
*/
addPerson: async (AddPersonRequest?: AddPersonRequest, ): Promise<RequestArgs> => {
const localVarPath = `/persons`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["contacts:full"], configuration)
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
localVarRequestOptions.data = serializeDataIfNeeded(AddPersonRequest, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Adds a follower to a person.
* @summary Add a follower to a person
* @param {number} id The ID of the person
* @param {AddPersonFollowerRequest} [AddPersonFollowerRequest]
* @throws {RequiredError}
*/
addPersonFollower: async (id: number, AddPersonFollowerRequest?: AddPersonFollowerRequest, ): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('addPersonFollower', 'id', id)
const localVarPath = `/persons/{id}/followers`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["contacts:full"], configuration)
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
localVarRequestOptions.data = serializeDataIfNeeded(AddPersonFollowerRequest, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Adds a picture to a person. If a picture is already set, the old picture will be replaced. Added image (or the cropping parameters supplied with the request) should have an equal width and height and should be at least 128 pixels. GIF, JPG and PNG are accepted. All added images will be resized to 128 and 512 pixel wide squares.
* @summary Add person picture
* @param {number} id The ID of the person
* @param {File} file One image supplied in the multipart/form-data encoding
* @param {number} [crop_x] X coordinate to where start cropping form (in pixels)
* @param {number} [crop_y] Y coordinate to where start cropping form (in pixels)
* @param {number} [crop_width] The width of the cropping area (in pixels)
* @param {number} [crop_height] The height of the cropping area (in pixels)
* @throws {RequiredError}
*/
addPersonPicture: async (id: number, file: File, crop_x?: number, crop_y?: number, crop_width?: number, crop_height?: number, ): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('addPersonPicture', 'id', id)
// verify required parameter 'file' is not null or undefined
assertParamExists('addPersonPicture', 'file', file)
const localVarPath = `/persons/{id}/picture`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["contacts:full"], configuration)
if (file !== undefined) {
localVarFormParams.append('file', file);
}
if (crop_x !== undefined) {
localVarFormParams.append('crop_x', crop_x as any);
}
if (crop_y !== undefined) {
localVarFormParams.append('crop_y', crop_y as any);
}
if (crop_width !== undefined) {
localVarFormParams.append('crop_width', crop_width as any);
}
if (crop_height !== undefined) {
localVarFormParams.append('crop_height', crop_height as any);
}
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
localVarRequestOptions.data = localVarFormParams;
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Marks a person as deleted. After 30 days, the person will be permanently deleted.
* @summary Delete a person
* @param {number} id The ID of the person
* @deprecated
* @throws {RequiredError}
*/
deletePerson: async (id: number, ): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('deletePerson', 'id', id)
const localVarPath = `/persons/{id}`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'DELETE', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["contacts:full"], configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Deletes a follower from a person.
* @summary Delete a follower from a person
* @param {number} id The ID of the person
* @param {number} follower_id The ID of the relationship between the follower and the person
* @throws {RequiredError}
*/
deletePersonFollower: async (id: number, follower_id: number, ): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('deletePersonFollower', 'id', id)
// verify required parameter 'follower_id' is not null or undefined
assertParamExists('deletePersonFollower', 'follower_id', follower_id)
const localVarPath = `/persons/{id}/followers/{follower_id}`
.replace(`{${"id"}}`, encodeURIComponent(String(id)))
.replace(`{${"follower_id"}}`, encodeURIComponent(String(follower_id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'DELETE', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["contacts:full"], configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Deletes a person’s picture.
* @summary Delete person picture
* @param {number} id The ID of the person
* @throws {RequiredError}
*/
deletePersonPicture: async (id: number, ): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('deletePersonPicture', 'id', id)
const localVarPath = `/persons/{id}/picture`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'DELETE', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["contacts:full"], configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Returns the details of a person. Note that this also returns some additional fields which are not present when asking for all persons. Also note that custom fields appear as long hashes in the resulting data. These hashes can be mapped against the `key` value of personFields.<br>If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `data.marketing_status` field.
* @summary Get details of a person
* @param {number} id The ID of the person
* @deprecated
* @throws {RequiredError}
*/
getPerson: async (id: number, ): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('getPerson', 'id', id)
const localVarPath = `/persons/{id}`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["contacts:read", "contacts:full"], configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Lists activities associated with a person. <br>This endpoint has been deprecated. Please use <a href=\"https://developers.pipedrive.com/docs/api/v1/Activities#getActivities\" target=\"_blank\" rel=\"noopener noreferrer\">GET /api/v2/activities?person_id={id}</a> instead.
* @summary List activities associated with a person
* @param {number} id The ID of the person
* @param {number} [start] Pagination start
* @param {number} [limit] Items shown per page
* @param {0 | 1} [done] Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities.
* @param {string} [exclude] A comma-separated string of activity IDs to exclude from result
* @deprecated
* @throws {RequiredError}
*/
getPersonActivities: async (id: number, start?: number, limit?: number, done?: 0 | 1, exclude?: string, ): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('getPersonActivities', 'id', id)
const localVarPath = `/persons/{id}/activities`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["activities:read", "activities:full"], configuration)
if (start !== undefined) {
localVarQueryParameter['start'] = start;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (done !== undefined) {
localVarQueryParameter['done'] = done;
}
if (exclude !== undefined) {
localVarQueryParameter['exclude'] = exclude;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Lists updates about field values of a person.
* @summary List updates about person field values
* @param {number} id The ID of the person
* @param {string} [cursor] For pagination, the marker (an opaque string value) representing the first item on the next page
* @param {number} [limit] Items shown per page
* @throws {RequiredError}
*/
getPersonChangelog: async (id: number, cursor?: string, limit?: number, ): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('getPersonChangelog', 'id', id)
const localVarPath = `/persons/{id}/changelog`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["recents:read"], configuration)
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Lists deals associated with a person. <br>This endpoint has been deprecated. Please use <a href=\"https://developers.pipedrive.com/docs/api/v1/Deals#getDeals\" target=\"_blank\" rel=\"noopener noreferrer\">GET /api/v2/deals?person_id={id}</a> instead.
* @summary List deals associated with a person
* @param {number} id The ID of the person
* @param {number} [start] Pagination start
* @param {number} [limit] Items shown per page
* @param {'open' | 'won' | 'lost' | 'deleted' | 'all_not_deleted'} [status] Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included.
* @param {string} [sort] The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys).
* @deprecated
* @throws {RequiredError}
*/
getPersonDeals: async (id: number, start?: number, limit?: number, status?: 'open' | 'won' | 'lost' | 'deleted' | 'all_not_deleted', sort?: string, ): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('getPersonDeals', 'id', id)
const localVarPath = `/persons/{id}/deals`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["deals:read", "deals:full"], configuration)
if (start !== undefined) {
localVarQueryParameter['start'] = start;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (status !== undefined) {
localVarQueryParameter['status'] = status;
}
if (sort !== undefined) {
localVarQueryParameter['sort'] = sort;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Lists files associated with a person.
* @summary List files attached to a person
* @param {number} id The ID of the person
* @param {number} [start] Pagination start
* @param {number} [limit] Items shown per page. Please note that a maximum value of 100 is allowed.
* @param {string} [sort] Supported fields: `id`, `update_time`
* @throws {RequiredError}
*/
getPersonFiles: async (id: number, start?: number, limit?: number, sort?: string, ): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('getPersonFiles', 'id', id)
const localVarPath = `/persons/{id}/files`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["contacts:read", "contacts:full"], configuration)
if (start !== undefined) {
localVarQueryParameter['start'] = start;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (sort !== undefined) {
localVarQueryParameter['sort'] = sort;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Lists the followers of a person.
* @summary List followers of a person
* @param {number} id The ID of the person
* @throws {RequiredError}
*/
getPersonFollowers: async (id: number, ): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('getPersonFollowers', 'id', id)
const localVarPath = `/persons/{id}/followers`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["contacts:read", "contacts:full"], configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Lists mail messages associated with a person.
* @summary List mail messages associated with a person
* @param {number} id The ID of the person
* @param {number} [start] Pagination start
* @param {number} [limit] Items shown per page
* @param {0 | 1} [include_body] Whether to include the mail message body content in response. Yes. If omitted, defaults to 0.
* @throws {RequiredError}
*/
getPersonMailMessages: async (id: number, start?: number, limit?: number, include_body?: 0 | 1): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('getPersonMailMessages', 'id', id)
const localVarPath = `/persons/{id}/mailMessages`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["mail:read", "mail:full"], configuration)
if (start !== undefined) {
localVarQueryParameter['start'] = start;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (include_body !== undefined) {
localVarQueryParameter['include_body'] = include_body;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Lists products associated with a person.
* @summary List products associated with a person
* @param {number} id The ID of the person
* @param {number} [start] Pagination start
* @param {number} [limit] Items shown per page
* @throws {RequiredError}
*/
getPersonProducts: async (id: number, start?: number, limit?: number, ): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('getPersonProducts', 'id', id)
const localVarPath = `/persons/{id}/products`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["contacts:read", "contacts:full"], configuration)
if (start !== undefined) {
localVarQueryParameter['start'] = start;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Lists updates about a person.<br>If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint\'s response will also include updates for the `marketing_status` field.
* @summary List updates about a person
* @param {number} id The ID of the person
* @param {number} [start] Pagination start
* @param {number} [limit] Items shown per page
* @param {string} [all_changes] Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates.
* @param {string} [items] A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change).
* @throws {RequiredError}
*/
getPersonUpdates: async (id: number, start?: number, limit?: number, all_changes?: string, items?: string, ): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('getPersonUpdates', 'id', id)
const localVarPath = `/persons/{id}/flow`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["recents:read"], configuration)
if (start !== undefined) {
localVarQueryParameter['start'] = start;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (all_changes !== undefined) {
localVarQueryParameter['all_changes'] = all_changes;
}
if (items !== undefined) {
localVarQueryParameter['items'] = items;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* List users permitted to access a person.
* @summary List permitted users
* @param {number} id The ID of the person
* @throws {RequiredError}
*/
getPersonUsers: async (id: number, ): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('getPersonUsers', 'id', id)
const localVarPath = `/persons/{id}/permittedUsers`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["contacts:read", "contacts:full"], configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Returns all persons.
* @summary Get all persons
* @param {number} [user_id] If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied.
* @param {number} [filter_id] The ID of the filter to use
* @param {string} [first_char] If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive)
* @param {number} [start] Pagination start
* @param {number} [limit] Items shown per page
* @param {string} [sort] The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys).
* @deprecated
* @throws {RequiredError}
*/
getPersons: async (user_id?: number, filter_id?: number, first_char?: string, start?: number, limit?: number, sort?: string, ): Promise<RequestArgs> => {
const localVarPath = `/persons`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["contacts:read", "contacts:full"], configuration)
if (user_id !== undefined) {
localVarQueryParameter['user_id'] = user_id;
}
if (filter_id !== undefined) {
localVarQueryParameter['filter_id'] = filter_id;
}
if (first_char !== undefined) {
localVarQueryParameter['first_char'] = first_char;
}
if (start !== undefined) {
localVarQueryParameter['start'] = start;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (sort !== undefined) {
localVarQueryParameter['sort'] = sort;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Returns all persons. Please note that only global admins (those with global permissions) can access this endpoint. Users with regular permissions will receive a 403 response. Read more about global permissions <a href=\"https://support.pipedrive.com/en/article/global-user-management\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>. <br>This endpoint has been deprecated. Please use <a href=\"https://developers.pipedrive.com/docs/api/v1/Persons#getPersons\" target=\"_blank\" rel=\"noopener noreferrer\">GET /api/v2/persons</a> instead.
* @summary Get all persons collection
* @param {string} [cursor] For pagination, the marker (an opaque string value) representing the first item on the next page
* @param {number} [limit] For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed.
* @param {string} [since] The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field.
* @param {string} [until] The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field.
* @param {number} [owner_id] If supplied, only persons owned by the given user will be returned
* @param {string} [first_char] If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive)
* @deprecated
* @throws {RequiredError}
*/
getPersonsCollection: async (cursor?: string, limit?: number, since?: string, until?: string, owner_id?: number, first_char?: string, ): Promise<RequestArgs> => {
const localVarPath = `/persons/collection`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions };
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
// authentication oauth2 required
// oauth required
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["contacts:read", "contacts:full"], configuration)
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (since !== undefined) {
localVarQueryParameter['since'] = since;
}
if (until !== undefined) {
localVarQueryParameter['until'] = until;
}
if (owner_id !== undefined) {
localVarQueryParameter['owner_id'] = owner_id;
}
if (first_char !== undefined) {