From 9d193c11e998bf44ea9d28bcc34f0481a75fe899 Mon Sep 17 00:00:00 2001 From: pipedrive-bot Date: Wed, 25 Nov 2026 10:39:49 +0000 Subject: [PATCH] Build 364 - version-major --- CHANGELOG.md | 5 ++ README.md | 44 +++++++++++++ src/versions/v1/api/deals-api.ts | 16 ++--- src/versions/v1/api/person-fields-api.ts | 8 +-- src/versions/v1/api/persons-api.ts | 16 ++--- src/versions/v1/configuration.ts | 64 ++++++++++++++++++- .../models/base-organization-item-all-of.ts | 2 +- ...nization-count-and-address-info-all-of1.ts | 22 +++---- ...ationship-with-calculated-fields-all-of.ts | 2 +- .../models/recents-data-inner-any-of9-data.ts | 8 +-- src/versions/v2/api/persons-api.ts | 60 ++++++++--------- src/versions/v2/configuration.ts | 64 ++++++++++++++++++- src/versions/v2/models/add-person-request.ts | 24 +++++++ src/versions/v2/models/person.ts | 26 ++++++++ .../v2/models/update-person-request.ts | 24 +++++++ 15 files changed, 316 insertions(+), 69 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cbd5323..6a33ad6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ The file format of it is based on [Keep a Changelog](http://keepachangelog.com/e For public Changelog covering all changes done to Pipedrive’s API, webhooks and app extensions platforms, see [public Changelog](https://pipedrive.readme.io/docs/changelog) with discussion area in [Developers Community](https://devcommunity.pipedrive.com/c/documentation/changelog/19). ## [Unreleased] +### Added +- Documented new `track_open` and `track_click` fields on the Person object (enum: `no_preference_set`, `consent_given`, `consent_declined`). They are returned and accepted only if the company has the "Email tracking consent" setting enabled. +### Changed +- Updated v2 Persons endpoints to include the new fields: `GET /api/v2/persons`, `GET /api/v2/persons/{id}`, `POST /api/v2/persons` and `PATCH /api/v2/persons/{id}`. The `include_fields` query parameter now also accepts `track_open` and `track_click`. +- Added `email_tracking_preference_change` to the possible values of the `items` query parameter of `GET /v1/persons/{id}/flow` and `GET /v1/deals/{id}/flow`, and updated the description of `GET /v1/personFields` (`getPersonFields`) to mention the new fields. ## [36.3.1] - 2026-11-06 ### Fixed diff --git a/README.md b/README.md index f617ee84..d59b8322 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,22 @@ To obtain user's consent, you must redirect the user to the authorization page. const authUrl = oauth2.authorizationUrl; ``` +To add a `state` value (recommended, to protect against CSRF) or PKCE parameters, use `getAuthorizationUrl()` instead. See [Using PKCE](#using-pkce). + +```typescript +import { randomUUID } from 'crypto'; + +// generate an unpredictable state per login and keep it until the user comes back +const state = randomUUID(); +req.session.oauthState = state; +const authUrl = oauth2.getAuthorizationUrl({ state }); + +// in the redirect URI handler, reject the callback unless the state matches +if (!req.session.oauthState || req.query.state !== req.session.oauthState) { + throw new Error('Invalid OAuth state'); +} +``` + #### 2. Handle the OAuth server response Once the user responds to the consent request, the OAuth 2.0 server responds to your application's access request by using the URL specified in the request. @@ -130,6 +146,34 @@ const token = await oauth2.authorize(code); The Node.js SDK supports only promises. So, the authorize call returns a promise. +### Using PKCE + +PKCE ([RFC 7636](https://datatracker.ietf.org/doc/html/rfc7636)) protects the authorization code from being used by anyone other than the app that requested it. PKCE is optional unless your app requires it, and then the `S256` method must be used. + +1. Generate a code verifier and its code challenge, and keep the verifier (for example, in the user's session) until the user comes back to your redirect URI. +2. Send the code challenge to the authorization page. +3. Send the code verifier when you exchange the authorization code. + +```typescript +import { randomUUID } from 'crypto'; + +const state = randomUUID(); +const { codeVerifier, codeChallenge } = await OAuth2Configuration.generatePkce(); +req.session.oauthState = state; +req.session.codeVerifier = codeVerifier; + +// codeChallengeMethod defaults to 'S256' +const authUrl = oauth2.getAuthorizationUrl({ state, codeChallenge }); + +// later, in the redirect URI handler +if (!req.session.oauthState || req.query.state !== req.session.oauthState) { + throw new Error('Invalid OAuth state'); +} +const token = await oauth2.authorize(req.query.code, req.session.codeVerifier); +``` + +`generatePkce()` uses the Web Crypto API (`globalThis.crypto`), available in Node.js 19 and later. + ### Refreshing token Access tokens may expire after sometime, if it necessary you can do it manually. diff --git a/src/versions/v1/api/deals-api.ts b/src/versions/v1/api/deals-api.ts index 1fdb4f49..0db45f50 100644 --- a/src/versions/v1/api/deals-api.ts +++ b/src/versions/v1/api/deals-api.ts @@ -744,7 +744,7 @@ export const DealsApiAxiosParamCreator = function (configuration?: Configuration }; }, /** - * Lists the participants associated with a deal.
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. + * Lists the participants associated with a deal.
If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `marketing_status` field. * @summary List participants of a deal * @param {number} id The ID of the deal * @param {number} [start] Pagination start @@ -852,7 +852,7 @@ export const DealsApiAxiosParamCreator = function (configuration?: Configuration * @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 {Set} [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). + * @param {Set} [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, email_tracking_preference_change). * @throws {RequiredError} */ @@ -1492,7 +1492,7 @@ export const DealsApiFp = function(configuration?: Configuration) { return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration, true); }, /** - * Lists the participants associated with a deal.
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. + * Lists the participants associated with a deal.
If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `marketing_status` field. * @summary List participants of a deal * @param {number} id The ID of the deal * @param {number} [start] Pagination start @@ -1550,7 +1550,7 @@ export const DealsApiFp = function(configuration?: Configuration) { * @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 {Set} [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). + * @param {Set} [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, email_tracking_preference_change). * @throws {RequiredError} */ @@ -1565,7 +1565,7 @@ export const DealsApiFp = function(configuration?: Configuration) { * @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 {Set} [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). + * @param {Set} [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, email_tracking_preference_change). * @throws {RequiredError} */ @@ -1854,7 +1854,7 @@ export const DealsApiFactory = function (configuration?: Configuration, basePath return localVarFp.getDealMailMessagesWithHttpInfo(requestParameters.id, requestParameters.start, requestParameters.limit, requestParameters.include_body, ).then((request) => request(axios, basePath)); }, /** - * Lists the participants associated with a deal.
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. + * Lists the participants associated with a deal.
If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `marketing_status` field. * @summary List participants of a deal * @param {DealsApiGetDealParticipantsRequest} requestParameters Request parameters. @@ -2451,7 +2451,7 @@ export interface DealsApiGetDealUpdatesRequest { readonly all_changes?: string /** - * 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). + * 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, email_tracking_preference_change). * @type {Set} * @memberof DealsApiGetDealUpdates */ @@ -2901,7 +2901,7 @@ export class DealsApi extends BaseAPI { } /** - * Lists the participants associated with a deal.
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. + * Lists the participants associated with a deal.
If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `marketing_status` field. * @summary List participants of a deal * @param {DealsApiGetDealParticipantsRequest} requestParameters Request parameters. diff --git a/src/versions/v1/api/person-fields-api.ts b/src/versions/v1/api/person-fields-api.ts index f77b429e..f77c8f27 100644 --- a/src/versions/v1/api/person-fields-api.ts +++ b/src/versions/v1/api/person-fields-api.ts @@ -207,7 +207,7 @@ export const PersonFieldsApiAxiosParamCreator = function (configuration?: Config }; }, /** - * Returns data about all person fields.
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. + * Returns data about all person fields.
If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `marketing_status` field.
If the company has the Email tracking consent setting enabled, then this endpoint will also return the `track_open` and `track_click` fields. * @summary Get all person fields * @param {number} [start] Pagination start * @param {number} [limit] Items shown per page @@ -398,7 +398,7 @@ export const PersonFieldsApiFp = function(configuration?: Configuration) { return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration, true); }, /** - * Returns data about all person fields.
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. + * Returns data about all person fields.
If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `marketing_status` field.
If the company has the Email tracking consent setting enabled, then this endpoint will also return the `track_open` and `track_click` fields. * @summary Get all person fields * @param {number} [start] Pagination start * @param {number} [limit] Items shown per page @@ -508,7 +508,7 @@ export const PersonFieldsApiFactory = function (configuration?: Configuration, b return localVarFp.getPersonFieldWithHttpInfo(requestParameters.id, ).then((request) => request(axios, basePath)); }, /** - * Returns data about all person fields.
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. + * Returns data about all person fields.
If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `marketing_status` field.
If the company has the Email tracking consent setting enabled, then this endpoint will also return the `track_open` and `track_click` fields. * @summary Get all person fields * @param {PersonFieldsApiGetPersonFieldsRequest} requestParameters Request parameters. @@ -738,7 +738,7 @@ export class PersonFieldsApi extends BaseAPI { } /** - * Returns data about all person fields.
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. + * Returns data about all person fields.
If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `marketing_status` field.
If the company has the Email tracking consent setting enabled, then this endpoint will also return the `track_open` and `track_click` fields. * @summary Get all person fields * @param {PersonFieldsApiGetPersonFieldsRequest} requestParameters Request parameters. diff --git a/src/versions/v1/api/persons-api.ts b/src/versions/v1/api/persons-api.ts index b879c49d..4cd9424d 100644 --- a/src/versions/v1/api/persons-api.ts +++ b/src/versions/v1/api/persons-api.ts @@ -512,13 +512,13 @@ export const PersonsApiAxiosParamCreator = function (configuration?: Configurati }; }, /** - * Lists updates about a person.
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. + * Lists updates about a person.
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.
If the company has the Email tracking consent setting enabled, the response can also include updates to `track_open` and `track_click` fields. * @summary List updates about a person * @param {number} id The unique 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 {Set} [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). + * @param {Set} [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, email_tracking_preference_change). * @throws {RequiredError} */ @@ -902,13 +902,13 @@ export const PersonsApiFp = function(configuration?: Configuration) { return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration, true); }, /** - * Lists updates about a person.
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. + * Lists updates about a person.
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.
If the company has the Email tracking consent setting enabled, the response can also include updates to `track_open` and `track_click` fields. * @summary List updates about a person * @param {number} id The unique 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 {Set} [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). + * @param {Set} [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, email_tracking_preference_change). * @throws {RequiredError} */ @@ -923,7 +923,7 @@ export const PersonsApiFp = function(configuration?: Configuration) { * @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 {Set} [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). + * @param {Set} [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, email_tracking_preference_change). * @throws {RequiredError} */ @@ -1105,7 +1105,7 @@ export const PersonsApiFactory = function (configuration?: Configuration, basePa return localVarFp.getPersonProductsWithHttpInfo(requestParameters.id, requestParameters.start, requestParameters.limit, ).then((request) => request(axios, basePath)); }, /** - * Lists updates about a person.
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. + * Lists updates about a person.
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.
If the company has the Email tracking consent setting enabled, the response can also include updates to `track_open` and `track_click` fields. * @summary List updates about a person * @param {PersonsApiGetPersonUpdatesRequest} requestParameters Request parameters. @@ -1426,7 +1426,7 @@ export interface PersonsApiGetPersonUpdatesRequest { readonly all_changes?: string /** - * 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). + * 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, email_tracking_preference_change). * @type {Set} * @memberof PersonsApiGetPersonUpdates */ @@ -1692,7 +1692,7 @@ export class PersonsApi extends BaseAPI { } /** - * Lists updates about a person.
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. + * Lists updates about a person.
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.
If the company has the Email tracking consent setting enabled, the response can also include updates to `track_open` and `track_click` fields. * @summary List updates about a person * @param {PersonsApiGetPersonUpdatesRequest} requestParameters Request parameters. diff --git a/src/versions/v1/configuration.ts b/src/versions/v1/configuration.ts index 0038a274..d0b3da56 100644 --- a/src/versions/v1/configuration.ts +++ b/src/versions/v1/configuration.ts @@ -35,6 +35,22 @@ export interface Parameters { export type ParamKey = keyof Parameters; +export type CodeChallengeMethod = 'S256' | 'plain'; + +export interface AuthorizationUrlParameters { + /** Opaque value returned unchanged to the redirect URI. Use it to protect against CSRF. */ + state?: string; + /** PKCE code challenge derived from the code verifier. See `OAuth2Configuration.generatePkce()`. */ + codeChallenge?: string; + /** PKCE code challenge method. Sent only when `codeChallenge` is set. Defaults to `S256`. */ + codeChallengeMethod?: CodeChallengeMethod; +} + +export type PkcePair = { + codeVerifier: string; + codeChallenge: string; +} + export class OAuth2Configuration { public host: string; public clientId: string; @@ -68,6 +84,50 @@ export class OAuth2Configuration { }&redirect_uri=${encodeURIComponent(this.redirectUri)}`; } + /** + * Builds the URL of the authorization page, optionally with `state` and PKCE parameters. + * @param {AuthorizationUrlParameters} params Optional `state`, `codeChallenge` and `codeChallengeMethod`. + * @returns {String} The authorization page URL. + */ + public getAuthorizationUrl(params: AuthorizationUrlParameters = {}): string { + const { state, codeChallenge, codeChallengeMethod = 'S256' } = params; + const query: Record = { + client_id: this.clientId, + redirect_uri: this.redirectUri, + response_type: 'code', + }; + + if (state) { + query.state = state; + } + + if (codeChallenge) { + query.code_challenge = codeChallenge; + query.code_challenge_method = codeChallengeMethod; + } + + return `${this.host}/oauth/authorize?${stringify(query)}`; + } + + /** + * Generates a PKCE code verifier and its S256 code challenge (RFC 7636). + * Send `codeChallenge` with `getAuthorizationUrl()`, keep `codeVerifier` and pass it to `authorize()`. + * @returns {Promise} The code verifier and code challenge, both base64url encoded. + */ + public static async generatePkce(): Promise { + const webCrypto = globalThis.crypto; + + if (!webCrypto?.subtle) { + throw new Error("PKCE generation requires the Web Crypto API (globalThis.crypto)."); + } + + const codeVerifier = Buffer.from(webCrypto.getRandomValues(new Uint8Array(32))).toString("base64url"); + const digest = await webCrypto.subtle.digest("SHA-256", new TextEncoder().encode(codeVerifier)); + const codeChallenge = Buffer.from(digest).toString("base64url"); + + return { codeVerifier, codeChallenge }; + } + public getAccessToken = async (): Promise => { if (this.shouldRefreshToken()) { const newToken = await this.tokenRefresh(); @@ -86,9 +146,10 @@ export class OAuth2Configuration { /** * Authorizes the authorization code sent by the server and returns OAuth 2 token. * @param {String} code The authorization code sent by the OAuth server. + * @param {String} codeVerifier The PKCE code verifier. Required if a code challenge was sent to the authorization page. * @returns {Object} The OAuth 2 token. */ - public authorize = async (code: string): Promise => { + public authorize = async (code: string, codeVerifier?: string): Promise => { if (!code) { throw new Error("Authorization failed. Authorization code is not set."); } @@ -105,6 +166,7 @@ export class OAuth2Configuration { code, redirect_uri: this.redirectUri, grant_type: "authorization_code", + ...(codeVerifier ? { code_verifier: codeVerifier } : {}), }), { headers: { diff --git a/src/versions/v1/models/base-organization-item-all-of.ts b/src/versions/v1/models/base-organization-item-all-of.ts index fc915c03..2311e321 100644 --- a/src/versions/v1/models/base-organization-item-all-of.ts +++ b/src/versions/v1/models/base-organization-item-all-of.ts @@ -85,7 +85,7 @@ export interface BaseOrganizationItemAllOf { * The label assigned to the organization. When the `label` field is updated, the `label_ids` field value will be overwritten by the `label` field value. * @type {number} */ - 'label'?: number; + 'label'?: number | null; /** * The IDs of labels assigned to the organization. When the `label_ids` field is updated, the `label` field value will be set to the first value of the `label_ids` field. * @type {Array} diff --git a/src/versions/v1/models/organization-count-and-address-info-all-of1.ts b/src/versions/v1/models/organization-count-and-address-info-all-of1.ts index 7495ac49..1ef34227 100644 --- a/src/versions/v1/models/organization-count-and-address-info-all-of1.ts +++ b/src/versions/v1/models/organization-count-and-address-info-all-of1.ts @@ -24,56 +24,56 @@ export interface OrganizationCountAndAddressInfoAllOf1 { * The full address of the organization * @type {string} */ - 'address'?: string; + 'address'?: string | null; /** * The sub-premise of the organization location * @type {string} */ - 'address_subpremise'?: string; + 'address_subpremise'?: string | null; /** * The street number of the organization location * @type {string} */ - 'address_street_number'?: string; + 'address_street_number'?: string | null; /** * The route of the organization location * @type {string} */ - 'address_route'?: string; + 'address_route'?: string | null; /** * The sub-locality of the organization location * @type {string} */ - 'address_sublocality'?: string; + 'address_sublocality'?: string | null; /** * The locality of the organization location * @type {string} */ - 'address_locality'?: string; + 'address_locality'?: string | null; /** * The level 1 admin area of the organization location * @type {string} */ - 'address_admin_area_level_1'?: string; + 'address_admin_area_level_1'?: string | null; /** * The level 2 admin area of the organization location * @type {string} */ - 'address_admin_area_level_2'?: string; + 'address_admin_area_level_2'?: string | null; /** * The country of the organization location * @type {string} */ - 'address_country'?: string; + 'address_country'?: string | null; /** * The postal code of the organization location * @type {string} */ - 'address_postal_code'?: string; + 'address_postal_code'?: string | null; /** * The formatted organization location * @type {string} */ - 'address_formatted_address'?: string; + 'address_formatted_address'?: string | null; } diff --git a/src/versions/v1/models/organization-relationship-with-calculated-fields-all-of.ts b/src/versions/v1/models/organization-relationship-with-calculated-fields-all-of.ts index 663f6a16..34018c86 100644 --- a/src/versions/v1/models/organization-relationship-with-calculated-fields-all-of.ts +++ b/src/versions/v1/models/organization-relationship-with-calculated-fields-all-of.ts @@ -52,7 +52,7 @@ export interface OrganizationRelationshipWithCalculatedFieldsAllOf { * The last updated date and time of the relationship * @type {string} */ - 'update_time'?: string; + 'update_time'?: string | null; /** * Whether the relationship is active or not * @type {string} diff --git a/src/versions/v1/models/recents-data-inner-any-of9-data.ts b/src/versions/v1/models/recents-data-inner-any-of9-data.ts index 80a96f66..85ec9665 100644 --- a/src/versions/v1/models/recents-data-inner-any-of9-data.ts +++ b/src/versions/v1/models/recents-data-inner-any-of9-data.ts @@ -34,17 +34,17 @@ export interface RecentsDataInnerAnyOf9Data { * The product code * @type {string} */ - 'code'?: string; + 'code'?: string | null; /** * The description of the product * @type {string} */ - 'description'?: string; + 'description'?: string | null; /** * The unit in which this product is sold * @type {string} */ - 'unit'?: string; + 'unit'?: string | null; /** * The tax percentage * @type {number} @@ -54,7 +54,7 @@ export interface RecentsDataInnerAnyOf9Data { * The category of the product * @type {string} */ - 'category'?: string; + 'category'?: string | null; /** * Whether this product will be made active or not * @type {boolean} diff --git a/src/versions/v2/api/persons-api.ts b/src/versions/v2/api/persons-api.ts index fc4ca434..3cb93a75 100644 --- a/src/versions/v2/api/persons-api.ts +++ b/src/versions/v2/api/persons-api.ts @@ -52,7 +52,7 @@ import { UpsertPersonResponse } from '../models'; export const PersonsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** - * Adds a new person.
If the company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `marketing_status` field.
The `im`, `postal_address`, `notes`, `birthday` and `job_title` fields don\'t exist by default in Pipedrive and are only created when you set up your contact sync — attempting to set any of them without contact sync enabled returns a 403. + * Adds a new person.
The `im`, `postal_address`, `notes`, `birthday` and `job_title` fields don\'t exist by default in Pipedrive and are only created when you set up your contact sync — attempting to set any of them without contact sync enabled returns a 403.
If the company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `marketing_status` field.
If the company has the Email tracking consent setting enabled, then this endpoint will also accept and return the `track_open` and `track_click` fields. * @summary Add a new person * @param {AddPersonRequest} [AddPersonRequest] @@ -224,17 +224,17 @@ export const PersonsApiAxiosParamCreator = function (configuration?: Configurati }; }, /** - * Returns the details of a specific person. Fields `ims`, `postal_address`, `notes`, `birthday`, and `job_title` are only included if contact sync is enabled for the company. + * Returns the details of a specific person.
Fields `ims`, `postal_address`, `notes`, `birthday`, and `job_title` are only included if contact sync is enabled for the company. * @summary Get details of a person * @param {number} id The ID of the person - * @param {Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'smart_bcc_email'>} [include_fields] Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. + * @param {Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'track_open' | 'track_click' | 'smart_bcc_email'>} [include_fields] Optional comma separated string array of additional fields to include. <br>`marketing_status` and `doi_status` can only be included if the company has marketing app enabled. <br>`track_open` and `track_click` can only be included if the company has the Email tracking consent setting enabled. * @param {Set} [custom_fields] Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. * @param {boolean} [include_option_labels] When provided with a \'true\' value, single option and multiple option custom fields values contain objects in the form of \'{ id: number, label: string }\' instead of plain id * @param {boolean} [include_labels] When provided with \'true\' value, response will include an array of label objects in the form of \'{ id: number, label: string }\' * @throws {RequiredError} */ - getPerson: async (id: number, include_fields?: Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'smart_bcc_email'>, custom_fields?: Set, include_option_labels?: boolean, include_labels?: boolean, ): Promise => { + getPerson: async (id: number, include_fields?: Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'track_open' | 'track_click' | 'smart_bcc_email'>, custom_fields?: Set, include_option_labels?: boolean, include_labels?: boolean, ): Promise => { // verify required parameter 'id' is not null or undefined assertParamExists('getPerson', 'id', id) const localVarPath = `/persons/{id}` @@ -439,7 +439,7 @@ export const PersonsApiAxiosParamCreator = function (configuration?: Configurati * @param {string} [updated_until] If set, only persons with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. * @param {'id' | 'update_time' | 'add_time'} [sort_by] The field to sort by. Supported fields: `id`, `update_time`, `add_time`. * @param {'asc' | 'desc'} [sort_direction] The sorting direction. Supported values: `asc`, `desc`. - * @param {Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'smart_bcc_email'>} [include_fields] Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. + * @param {Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'track_open' | 'track_click' | 'smart_bcc_email'>} [include_fields] Optional comma separated string array of additional fields to include. <br>`marketing_status` and `doi_status` can only be included if the company has marketing app enabled. <br>`track_open` and `track_click` can only be included if the company has the Email tracking consent setting enabled. * @param {Set} [custom_fields] Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. * @param {boolean} [include_option_labels] When provided with a \'true\' value, single option and multiple option custom fields values contain objects in the form of \'{ id: number, label: string }\' instead of plain id * @param {boolean} [include_labels] When provided with \'true\' value, response will include an array of label objects in the form of \'{ id: number, label: string }\' @@ -448,7 +448,7 @@ export const PersonsApiAxiosParamCreator = function (configuration?: Configurati * @throws {RequiredError} */ - getPersons: async (filter_id?: number, ids?: Set, owner_id?: number, org_id?: number, deal_id?: number, updated_since?: string, updated_until?: string, sort_by?: 'id' | 'update_time' | 'add_time', sort_direction?: 'asc' | 'desc', include_fields?: Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'smart_bcc_email'>, custom_fields?: Set, include_option_labels?: boolean, include_labels?: boolean, limit?: number, cursor?: string, ): Promise => { + getPersons: async (filter_id?: number, ids?: Set, owner_id?: number, org_id?: number, deal_id?: number, updated_since?: string, updated_until?: string, sort_by?: 'id' | 'update_time' | 'add_time', sort_direction?: 'asc' | 'desc', include_fields?: Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'track_open' | 'track_click' | 'smart_bcc_email'>, custom_fields?: Set, include_option_labels?: boolean, include_labels?: boolean, limit?: number, cursor?: string, ): Promise => { const localVarPath = `/persons`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -614,7 +614,7 @@ export const PersonsApiAxiosParamCreator = function (configuration?: Configurati }; }, /** - * Updates the properties of a person.
If the company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `marketing_status` field.
The `im`, `postal_address`, `notes`, `birthday` and `job_title` fields don\'t exist by default in Pipedrive and are only created when you set up your contact sync — attempting to set any of them without contact sync enabled returns a 403. + * Updates the properties of a person.
The `im`, `postal_address`, `notes`, `birthday` and `job_title` fields don\'t exist by default in Pipedrive and are only created when you set up your contact sync — attempting to set any of them without contact sync enabled returns a 403.
If the company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `marketing_status` field.
If the company has the Email tracking consent setting enabled, then this endpoint will also accept and return the `track_open` and `track_click` fields. * @summary Update a person * @param {number} id The ID of the person * @param {UpdatePersonRequest} [UpdatePersonRequest] @@ -670,7 +670,7 @@ export const PersonsApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = PersonsApiAxiosParamCreator(configuration) return { /** - * Adds a new person.
If the company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `marketing_status` field.
The `im`, `postal_address`, `notes`, `birthday` and `job_title` fields don\'t exist by default in Pipedrive and are only created when you set up your contact sync — attempting to set any of them without contact sync enabled returns a 403. + * Adds a new person.
The `im`, `postal_address`, `notes`, `birthday` and `job_title` fields don\'t exist by default in Pipedrive and are only created when you set up your contact sync — attempting to set any of them without contact sync enabled returns a 403.
If the company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `marketing_status` field.
If the company has the Email tracking consent setting enabled, then this endpoint will also accept and return the `track_open` and `track_click` fields. * @summary Add a new person * @param {AddPersonRequest} [AddPersonRequest] @@ -762,17 +762,17 @@ export const PersonsApiFp = function(configuration?: Configuration) { return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration, true); }, /** - * Returns the details of a specific person. Fields `ims`, `postal_address`, `notes`, `birthday`, and `job_title` are only included if contact sync is enabled for the company. + * Returns the details of a specific person.
Fields `ims`, `postal_address`, `notes`, `birthday`, and `job_title` are only included if contact sync is enabled for the company. * @summary Get details of a person * @param {number} id The ID of the person - * @param {Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'smart_bcc_email'>} [include_fields] Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. + * @param {Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'track_open' | 'track_click' | 'smart_bcc_email'>} [include_fields] Optional comma separated string array of additional fields to include. <br>`marketing_status` and `doi_status` can only be included if the company has marketing app enabled. <br>`track_open` and `track_click` can only be included if the company has the Email tracking consent setting enabled. * @param {Set} [custom_fields] Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. * @param {boolean} [include_option_labels] When provided with a \'true\' value, single option and multiple option custom fields values contain objects in the form of \'{ id: number, label: string }\' instead of plain id * @param {boolean} [include_labels] When provided with \'true\' value, response will include an array of label objects in the form of \'{ id: number, label: string }\' * @throws {RequiredError} */ - async getPerson(id: number, include_fields?: Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'smart_bcc_email'>, custom_fields?: Set, include_option_labels?: boolean, include_labels?: boolean, ): Promise<(axios?: AxiosInstance, basePath?: string) => Promise> { + async getPerson(id: number, include_fields?: Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'track_open' | 'track_click' | 'smart_bcc_email'>, custom_fields?: Set, include_option_labels?: boolean, include_labels?: boolean, ): Promise<(axios?: AxiosInstance, basePath?: string) => Promise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getPerson(id, include_fields, custom_fields, include_option_labels, include_labels, ); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -780,14 +780,14 @@ export const PersonsApiFp = function(configuration?: Configuration) { * Same as `getPerson`, but resolves with the response body together with the HTTP status and headers. * @summary Get details of a person * @param {number} id The ID of the person - * @param {Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'smart_bcc_email'>} [include_fields] Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. + * @param {Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'track_open' | 'track_click' | 'smart_bcc_email'>} [include_fields] Optional comma separated string array of additional fields to include. <br>`marketing_status` and `doi_status` can only be included if the company has marketing app enabled. <br>`track_open` and `track_click` can only be included if the company has the Email tracking consent setting enabled. * @param {Set} [custom_fields] Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. * @param {boolean} [include_option_labels] When provided with a \'true\' value, single option and multiple option custom fields values contain objects in the form of \'{ id: number, label: string }\' instead of plain id * @param {boolean} [include_labels] When provided with \'true\' value, response will include an array of label objects in the form of \'{ id: number, label: string }\' * @throws {RequiredError} */ - async getPersonWithHttpInfo(id: number, include_fields?: Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'smart_bcc_email'>, custom_fields?: Set, include_option_labels?: boolean, include_labels?: boolean, ): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + async getPersonWithHttpInfo(id: number, include_fields?: Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'track_open' | 'track_click' | 'smart_bcc_email'>, custom_fields?: Set, include_option_labels?: boolean, include_labels?: boolean, ): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getPerson(id, include_fields, custom_fields, include_option_labels, include_labels, ); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration, true); }, @@ -877,7 +877,7 @@ export const PersonsApiFp = function(configuration?: Configuration) { * @param {string} [updated_until] If set, only persons with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. * @param {'id' | 'update_time' | 'add_time'} [sort_by] The field to sort by. Supported fields: `id`, `update_time`, `add_time`. * @param {'asc' | 'desc'} [sort_direction] The sorting direction. Supported values: `asc`, `desc`. - * @param {Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'smart_bcc_email'>} [include_fields] Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. + * @param {Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'track_open' | 'track_click' | 'smart_bcc_email'>} [include_fields] Optional comma separated string array of additional fields to include. <br>`marketing_status` and `doi_status` can only be included if the company has marketing app enabled. <br>`track_open` and `track_click` can only be included if the company has the Email tracking consent setting enabled. * @param {Set} [custom_fields] Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. * @param {boolean} [include_option_labels] When provided with a \'true\' value, single option and multiple option custom fields values contain objects in the form of \'{ id: number, label: string }\' instead of plain id * @param {boolean} [include_labels] When provided with \'true\' value, response will include an array of label objects in the form of \'{ id: number, label: string }\' @@ -886,7 +886,7 @@ export const PersonsApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ - async getPersons(filter_id?: number, ids?: Set, owner_id?: number, org_id?: number, deal_id?: number, updated_since?: string, updated_until?: string, sort_by?: 'id' | 'update_time' | 'add_time', sort_direction?: 'asc' | 'desc', include_fields?: Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'smart_bcc_email'>, custom_fields?: Set, include_option_labels?: boolean, include_labels?: boolean, limit?: number, cursor?: string, ): Promise<(axios?: AxiosInstance, basePath?: string) => Promise> { + async getPersons(filter_id?: number, ids?: Set, owner_id?: number, org_id?: number, deal_id?: number, updated_since?: string, updated_until?: string, sort_by?: 'id' | 'update_time' | 'add_time', sort_direction?: 'asc' | 'desc', include_fields?: Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'track_open' | 'track_click' | 'smart_bcc_email'>, custom_fields?: Set, include_option_labels?: boolean, include_labels?: boolean, limit?: number, cursor?: string, ): Promise<(axios?: AxiosInstance, basePath?: string) => Promise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getPersons(filter_id, ids, owner_id, org_id, deal_id, updated_since, updated_until, sort_by, sort_direction, include_fields, custom_fields, include_option_labels, include_labels, limit, cursor, ); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -902,7 +902,7 @@ export const PersonsApiFp = function(configuration?: Configuration) { * @param {string} [updated_until] If set, only persons with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. * @param {'id' | 'update_time' | 'add_time'} [sort_by] The field to sort by. Supported fields: `id`, `update_time`, `add_time`. * @param {'asc' | 'desc'} [sort_direction] The sorting direction. Supported values: `asc`, `desc`. - * @param {Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'smart_bcc_email'>} [include_fields] Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. + * @param {Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'track_open' | 'track_click' | 'smart_bcc_email'>} [include_fields] Optional comma separated string array of additional fields to include. <br>`marketing_status` and `doi_status` can only be included if the company has marketing app enabled. <br>`track_open` and `track_click` can only be included if the company has the Email tracking consent setting enabled. * @param {Set} [custom_fields] Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. * @param {boolean} [include_option_labels] When provided with a \'true\' value, single option and multiple option custom fields values contain objects in the form of \'{ id: number, label: string }\' instead of plain id * @param {boolean} [include_labels] When provided with \'true\' value, response will include an array of label objects in the form of \'{ id: number, label: string }\' @@ -911,7 +911,7 @@ export const PersonsApiFp = function(configuration?: Configuration) { * @throws {RequiredError} */ - async getPersonsWithHttpInfo(filter_id?: number, ids?: Set, owner_id?: number, org_id?: number, deal_id?: number, updated_since?: string, updated_until?: string, sort_by?: 'id' | 'update_time' | 'add_time', sort_direction?: 'asc' | 'desc', include_fields?: Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'smart_bcc_email'>, custom_fields?: Set, include_option_labels?: boolean, include_labels?: boolean, limit?: number, cursor?: string, ): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + async getPersonsWithHttpInfo(filter_id?: number, ids?: Set, owner_id?: number, org_id?: number, deal_id?: number, updated_since?: string, updated_until?: string, sort_by?: 'id' | 'update_time' | 'add_time', sort_direction?: 'asc' | 'desc', include_fields?: Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'track_open' | 'track_click' | 'smart_bcc_email'>, custom_fields?: Set, include_option_labels?: boolean, include_labels?: boolean, limit?: number, cursor?: string, ): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getPersons(filter_id, ids, owner_id, org_id, deal_id, updated_since, updated_until, sort_by, sort_direction, include_fields, custom_fields, include_option_labels, include_labels, limit, cursor, ); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration, true); }, @@ -950,7 +950,7 @@ export const PersonsApiFp = function(configuration?: Configuration) { return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration, true); }, /** - * Updates the properties of a person.
If the company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `marketing_status` field.
The `im`, `postal_address`, `notes`, `birthday` and `job_title` fields don\'t exist by default in Pipedrive and are only created when you set up your contact sync — attempting to set any of them without contact sync enabled returns a 403. + * Updates the properties of a person.
The `im`, `postal_address`, `notes`, `birthday` and `job_title` fields don\'t exist by default in Pipedrive and are only created when you set up your contact sync — attempting to set any of them without contact sync enabled returns a 403.
If the company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `marketing_status` field.
If the company has the Email tracking consent setting enabled, then this endpoint will also accept and return the `track_open` and `track_click` fields. * @summary Update a person * @param {number} id The ID of the person * @param {UpdatePersonRequest} [UpdatePersonRequest] @@ -984,7 +984,7 @@ export const PersonsApiFactory = function (configuration?: Configuration, basePa const localVarFp = PersonsApiFp(configuration) return { /** - * Adds a new person.
If the company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `marketing_status` field.
The `im`, `postal_address`, `notes`, `birthday` and `job_title` fields don\'t exist by default in Pipedrive and are only created when you set up your contact sync — attempting to set any of them without contact sync enabled returns a 403. + * Adds a new person.
The `im`, `postal_address`, `notes`, `birthday` and `job_title` fields don\'t exist by default in Pipedrive and are only created when you set up your contact sync — attempting to set any of them without contact sync enabled returns a 403.
If the company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `marketing_status` field.
If the company has the Email tracking consent setting enabled, then this endpoint will also accept and return the `track_open` and `track_click` fields. * @summary Add a new person * @param {PersonsApiAddPersonRequest} requestParameters Request parameters. @@ -1036,7 +1036,7 @@ export const PersonsApiFactory = function (configuration?: Configuration, basePa return localVarFp.deletePersonFollowerWithHttpInfo(requestParameters.id, requestParameters.follower_id, ).then((request) => request(axios, basePath)); }, /** - * Returns the details of a specific person. Fields `ims`, `postal_address`, `notes`, `birthday`, and `job_title` are only included if contact sync is enabled for the company. + * Returns the details of a specific person.
Fields `ims`, `postal_address`, `notes`, `birthday`, and `job_title` are only included if contact sync is enabled for the company. * @summary Get details of a person * @param {PersonsApiGetPersonRequest} requestParameters Request parameters. @@ -1114,7 +1114,7 @@ export const PersonsApiFactory = function (configuration?: Configuration, basePa return localVarFp.searchPersonsWithHttpInfo(requestParameters.term, requestParameters.fields, requestParameters.exact_match, requestParameters.organization_id, requestParameters.include_fields, requestParameters.limit, requestParameters.cursor, ).then((request) => request(axios, basePath)); }, /** - * Updates the properties of a person.
If the company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `marketing_status` field.
The `im`, `postal_address`, `notes`, `birthday` and `job_title` fields don\'t exist by default in Pipedrive and are only created when you set up your contact sync — attempting to set any of them without contact sync enabled returns a 403. + * Updates the properties of a person.
The `im`, `postal_address`, `notes`, `birthday` and `job_title` fields don\'t exist by default in Pipedrive and are only created when you set up your contact sync — attempting to set any of them without contact sync enabled returns a 403.
If the company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `marketing_status` field.
If the company has the Email tracking consent setting enabled, then this endpoint will also accept and return the `track_open` and `track_click` fields. * @summary Update a person * @param {PersonsApiUpdatePersonRequest} requestParameters Request parameters. @@ -1213,11 +1213,11 @@ export interface PersonsApiGetPersonRequest { readonly id: number /** - * Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. - * @type {Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'smart_bcc_email'>} + * Optional comma separated string array of additional fields to include. <br>`marketing_status` and `doi_status` can only be included if the company has marketing app enabled. <br>`track_open` and `track_click` can only be included if the company has the Email tracking consent setting enabled. + * @type {Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'track_open' | 'track_click' | 'smart_bcc_email'>} * @memberof PersonsApiGetPerson */ - readonly include_fields?: Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'smart_bcc_email'> + readonly include_fields?: Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'track_open' | 'track_click' | 'smart_bcc_email'> /** * Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. @@ -1381,11 +1381,11 @@ export interface PersonsApiGetPersonsRequest { readonly sort_direction?: 'asc' | 'desc' /** - * Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. - * @type {Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'smart_bcc_email'>} + * Optional comma separated string array of additional fields to include. <br>`marketing_status` and `doi_status` can only be included if the company has marketing app enabled. <br>`track_open` and `track_click` can only be included if the company has the Email tracking consent setting enabled. + * @type {Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'track_open' | 'track_click' | 'smart_bcc_email'>} * @memberof PersonsApiGetPersons */ - readonly include_fields?: Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'smart_bcc_email'> + readonly include_fields?: Set<'next_activity_id' | 'last_activity_id' | 'open_deals_count' | 'related_open_deals_count' | 'closed_deals_count' | 'related_closed_deals_count' | 'participant_open_deals_count' | 'participant_closed_deals_count' | 'email_messages_count' | 'activities_count' | 'done_activities_count' | 'undone_activities_count' | 'files_count' | 'notes_count' | 'followers_count' | 'won_deals_count' | 'related_won_deals_count' | 'lost_deals_count' | 'related_lost_deals_count' | 'last_incoming_mail_time' | 'last_outgoing_mail_time' | 'marketing_status' | 'doi_status' | 'track_open' | 'track_click' | 'smart_bcc_email'> /** * Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. @@ -1508,7 +1508,7 @@ export interface PersonsApiUpdatePersonRequest { */ export class PersonsApi extends BaseAPI { /** - * Adds a new person.
If the company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `marketing_status` field.
The `im`, `postal_address`, `notes`, `birthday` and `job_title` fields don\'t exist by default in Pipedrive and are only created when you set up your contact sync — attempting to set any of them without contact sync enabled returns a 403. + * Adds a new person.
The `im`, `postal_address`, `notes`, `birthday` and `job_title` fields don\'t exist by default in Pipedrive and are only created when you set up your contact sync — attempting to set any of them without contact sync enabled returns a 403.
If the company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `marketing_status` field.
If the company has the Email tracking consent setting enabled, then this endpoint will also accept and return the `track_open` and `track_click` fields. * @summary Add a new person * @param {PersonsApiAddPersonRequest} requestParameters Request parameters. @@ -1604,7 +1604,7 @@ export class PersonsApi extends BaseAPI { } /** - * Returns the details of a specific person. Fields `ims`, `postal_address`, `notes`, `birthday`, and `job_title` are only included if contact sync is enabled for the company. + * Returns the details of a specific person.
Fields `ims`, `postal_address`, `notes`, `birthday`, and `job_title` are only included if contact sync is enabled for the company. * @summary Get details of a person * @param {PersonsApiGetPersonRequest} requestParameters Request parameters. @@ -1748,7 +1748,7 @@ export class PersonsApi extends BaseAPI { } /** - * Updates the properties of a person.
If the company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `marketing_status` field.
The `im`, `postal_address`, `notes`, `birthday` and `job_title` fields don\'t exist by default in Pipedrive and are only created when you set up your contact sync — attempting to set any of them without contact sync enabled returns a 403. + * Updates the properties of a person.
The `im`, `postal_address`, `notes`, `birthday` and `job_title` fields don\'t exist by default in Pipedrive and are only created when you set up your contact sync — attempting to set any of them without contact sync enabled returns a 403.
If the company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `marketing_status` field.
If the company has the Email tracking consent setting enabled, then this endpoint will also accept and return the `track_open` and `track_click` fields. * @summary Update a person * @param {PersonsApiUpdatePersonRequest} requestParameters Request parameters. diff --git a/src/versions/v2/configuration.ts b/src/versions/v2/configuration.ts index 9e794930..b4dd4f4e 100644 --- a/src/versions/v2/configuration.ts +++ b/src/versions/v2/configuration.ts @@ -35,6 +35,22 @@ export interface Parameters { export type ParamKey = keyof Parameters; +export type CodeChallengeMethod = 'S256' | 'plain'; + +export interface AuthorizationUrlParameters { + /** Opaque value returned unchanged to the redirect URI. Use it to protect against CSRF. */ + state?: string; + /** PKCE code challenge derived from the code verifier. See `OAuth2Configuration.generatePkce()`. */ + codeChallenge?: string; + /** PKCE code challenge method. Sent only when `codeChallenge` is set. Defaults to `S256`. */ + codeChallengeMethod?: CodeChallengeMethod; +} + +export type PkcePair = { + codeVerifier: string; + codeChallenge: string; +} + export class OAuth2Configuration { public host: string; public clientId: string; @@ -68,6 +84,50 @@ export class OAuth2Configuration { }&redirect_uri=${encodeURIComponent(this.redirectUri)}`; } + /** + * Builds the URL of the authorization page, optionally with `state` and PKCE parameters. + * @param {AuthorizationUrlParameters} params Optional `state`, `codeChallenge` and `codeChallengeMethod`. + * @returns {String} The authorization page URL. + */ + public getAuthorizationUrl(params: AuthorizationUrlParameters = {}): string { + const { state, codeChallenge, codeChallengeMethod = 'S256' } = params; + const query: Record = { + client_id: this.clientId, + redirect_uri: this.redirectUri, + response_type: 'code', + }; + + if (state) { + query.state = state; + } + + if (codeChallenge) { + query.code_challenge = codeChallenge; + query.code_challenge_method = codeChallengeMethod; + } + + return `${this.host}/oauth/authorize?${stringify(query)}`; + } + + /** + * Generates a PKCE code verifier and its S256 code challenge (RFC 7636). + * Send `codeChallenge` with `getAuthorizationUrl()`, keep `codeVerifier` and pass it to `authorize()`. + * @returns {Promise} The code verifier and code challenge, both base64url encoded. + */ + public static async generatePkce(): Promise { + const webCrypto = globalThis.crypto; + + if (!webCrypto?.subtle) { + throw new Error("PKCE generation requires the Web Crypto API (globalThis.crypto)."); + } + + const codeVerifier = Buffer.from(webCrypto.getRandomValues(new Uint8Array(32))).toString("base64url"); + const digest = await webCrypto.subtle.digest("SHA-256", new TextEncoder().encode(codeVerifier)); + const codeChallenge = Buffer.from(digest).toString("base64url"); + + return { codeVerifier, codeChallenge }; + } + public getAccessToken = async (): Promise => { if (this.shouldRefreshToken()) { const newToken = await this.tokenRefresh(); @@ -86,9 +146,10 @@ export class OAuth2Configuration { /** * Authorizes the authorization code sent by the server and returns OAuth 2 token. * @param {String} code The authorization code sent by the OAuth server. + * @param {String} codeVerifier The PKCE code verifier. Required if a code challenge was sent to the authorization page. * @returns {Object} The OAuth 2 token. */ - public authorize = async (code: string): Promise => { + public authorize = async (code: string, codeVerifier?: string): Promise => { if (!code) { throw new Error("Authorization failed. Authorization code is not set."); } @@ -105,6 +166,7 @@ export class OAuth2Configuration { code, redirect_uri: this.redirectUri, grant_type: "authorization_code", + ...(codeVerifier ? { code_verifier: codeVerifier } : {}), }), { headers: { diff --git a/src/versions/v2/models/add-person-request.ts b/src/versions/v2/models/add-person-request.ts index c73a12c3..b0a329ad 100644 --- a/src/versions/v2/models/add-person-request.ts +++ b/src/versions/v2/models/add-person-request.ts @@ -103,6 +103,16 @@ export interface AddPersonRequest { */ 'marketing_status'?: AddPersonRequestMarketingStatusConst; /** + * The email open tracking consent of the person. Only accepted if the company has the Email tracking consent setting enabled.
ValueDescription
`no_preference_set`The person has not set a preference
`consent_given`The person has given consent
`consent_declined`The person has declined consent
+ * @type {string} + */ + 'track_open'?: AddPersonRequestTrackOpenConst; + /** + * The email link click tracking consent of the person. Only accepted if the company has the Email tracking consent setting enabled.
ValueDescription
`no_preference_set`The person has not set a preference
`consent_given`The person has given consent
`consent_declined`The person has declined consent
+ * @type {string} + */ + 'track_click'?: AddPersonRequestTrackClickConst; + /** * An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * @type {{ [key: string]: any | undefined; }} */ @@ -117,5 +127,19 @@ export interface AddPersonRequest { } as const; export type AddPersonRequestMarketingStatusConst = typeof AddPersonRequestMarketingStatusConst[keyof typeof AddPersonRequestMarketingStatusConst]; + export const AddPersonRequestTrackOpenConst = { + no_preference_set: 'no_preference_set', + consent_given: 'consent_given', + consent_declined: 'consent_declined' + } as const; + + export type AddPersonRequestTrackOpenConst = typeof AddPersonRequestTrackOpenConst[keyof typeof AddPersonRequestTrackOpenConst]; + export const AddPersonRequestTrackClickConst = { + no_preference_set: 'no_preference_set', + consent_given: 'consent_given', + consent_declined: 'consent_declined' + } as const; + + export type AddPersonRequestTrackClickConst = typeof AddPersonRequestTrackClickConst[keyof typeof AddPersonRequestTrackClickConst]; diff --git a/src/versions/v2/models/person.ts b/src/versions/v2/models/person.ts index aa9e0283..7ce55e63 100644 --- a/src/versions/v2/models/person.ts +++ b/src/versions/v2/models/person.ts @@ -128,9 +128,35 @@ export interface Person { */ 'job_title'?: string; /** + * The email open tracking consent of the person, included if the company has the Email tracking consent setting enabled + * @type {string} + */ + 'track_open'?: PersonTrackOpenConst; + /** + * The email link click tracking consent of the person, included if the company has the Email tracking consent setting enabled + * @type {string} + */ + 'track_click'?: PersonTrackClickConst; + /** * An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * @type {{ [key: string]: any | undefined; }} */ 'custom_fields'?: { [key: string]: any | undefined; }; } + export const PersonTrackOpenConst = { + no_preference_set: 'no_preference_set', + consent_given: 'consent_given', + consent_declined: 'consent_declined' + } as const; + + export type PersonTrackOpenConst = typeof PersonTrackOpenConst[keyof typeof PersonTrackOpenConst]; + export const PersonTrackClickConst = { + no_preference_set: 'no_preference_set', + consent_given: 'consent_given', + consent_declined: 'consent_declined' + } as const; + + export type PersonTrackClickConst = typeof PersonTrackClickConst[keyof typeof PersonTrackClickConst]; + + diff --git a/src/versions/v2/models/update-person-request.ts b/src/versions/v2/models/update-person-request.ts index 001dc207..0356c50e 100644 --- a/src/versions/v2/models/update-person-request.ts +++ b/src/versions/v2/models/update-person-request.ts @@ -98,6 +98,16 @@ export interface UpdatePersonRequest { */ 'marketing_status'?: UpdatePersonRequestMarketingStatusConst; /** + * The email open tracking consent of the person. Only accepted if the company has the Email tracking consent setting enabled.
ValueDescription
`no_preference_set`The person has not set a preference
`consent_given`The person has given consent
`consent_declined`The person has declined consent
+ * @type {string} + */ + 'track_open'?: UpdatePersonRequestTrackOpenConst; + /** + * The email link click tracking consent of the person. Only accepted if the company has the Email tracking consent setting enabled.
ValueDescription
`no_preference_set`The person has not set a preference
`consent_given`The person has given consent
`consent_declined`The person has declined consent
+ * @type {string} + */ + 'track_click'?: UpdatePersonRequestTrackClickConst; + /** * An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * @type {{ [key: string]: any | undefined; }} */ @@ -112,5 +122,19 @@ export interface UpdatePersonRequest { } as const; export type UpdatePersonRequestMarketingStatusConst = typeof UpdatePersonRequestMarketingStatusConst[keyof typeof UpdatePersonRequestMarketingStatusConst]; + export const UpdatePersonRequestTrackOpenConst = { + no_preference_set: 'no_preference_set', + consent_given: 'consent_given', + consent_declined: 'consent_declined' + } as const; + + export type UpdatePersonRequestTrackOpenConst = typeof UpdatePersonRequestTrackOpenConst[keyof typeof UpdatePersonRequestTrackOpenConst]; + export const UpdatePersonRequestTrackClickConst = { + no_preference_set: 'no_preference_set', + consent_given: 'consent_given', + consent_declined: 'consent_declined' + } as const; + + export type UpdatePersonRequestTrackClickConst = typeof UpdatePersonRequestTrackClickConst[keyof typeof UpdatePersonRequestTrackClickConst];