Skip to content

Commit e8e5049

Browse files
author
pipedrive-bot
committed
Build 292 - version-minor
1 parent 582407d commit e8e5049

6 files changed

Lines changed: 97 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ The file format of it is based on [Keep a Changelog](http://keepachangelog.com/e
77
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).
88

99
## [Unreleased]
10+
### Added
11+
- Added `POST /products/{id}/duplicate` endpoint for duplicating an existing product
1012

1113
## [30.3.2] - 2025-11-03
1214
### Fixed

docs/v2.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ ProductsApi | deleteProduct | **DELETE** /products/{id} | Delete a product
8686
ProductsApi | deleteProductFollower | **DELETE** /products/{id}/followers/{follower_id} | Delete a follower from a product
8787
ProductsApi | deleteProductImage | **DELETE** /products/{id}/images | Delete an image of a product
8888
ProductsApi | deleteProductVariation | **DELETE** /products/{id}/variations/{product_variation_id} | Delete a product variation
89+
ProductsApi | duplicateProduct | **POST** /products/{id}/duplicate | Duplicate a product
8990
ProductsApi | getProduct | **GET** /products/{id} | Get one product
9091
ProductsApi | getProductFollowers | **GET** /products/{id}/followers | List followers of a product
9192
ProductsApi | getProductFollowersChangelog | **GET** /products/{id}/followers/changelog | List followers changelog of a product

src/versions/v1/models/add-role-request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ export interface AddRoleRequest {
2929
* The ID of the parent role
3030
* @type {number}
3131
*/
32-
'parent_role_id'?: number;
32+
'parent_role_id'?: number | null;
3333
}
3434

src/versions/v1/models/base-role-request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface BaseRoleRequest {
2424
* The ID of the parent role
2525
* @type {number}
2626
*/
27-
'parent_role_id'?: number;
27+
'parent_role_id'?: number | null;
2828
/**
2929
* The name of the role
3030
* @type {string}

src/versions/v1/models/field.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface Field {
2424
* The ID of the field. Value is `null` in case of subfields.
2525
* @type {number}
2626
*/
27-
'id'?: number;
27+
'id'?: number | null;
2828
/**
2929
* The key of the field. For custom fields this is generated upon creation.
3030
* @type {string}
@@ -54,17 +54,17 @@ export interface Field {
5454
* The update time of the field
5555
* @type {string}
5656
*/
57-
'update_time'?: string;
57+
'update_time'?: string | null;
5858
/**
5959
* The ID of the user who created or most recently updated the field, only applicable for custom fields
6060
* @type {number}
6161
*/
62-
'last_updated_by_user_id'?: number;
62+
'last_updated_by_user_id'?: number | null;
6363
/**
6464
* The ID of the user who created the field
6565
* @type {number}
6666
*/
67-
'created_by_user_id'?: number;
67+
'created_by_user_id'?: number | null;
6868
/**
6969
* The active flag of the field
7070
* @type {boolean}

src/versions/v2/api/products-api.ts

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,47 @@ export const ProductsApiAxiosParamCreator = function (configuration?: Configurat
363363

364364

365365

366+
setSearchParams(localVarUrlObj, localVarQueryParameter);
367+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
368+
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
369+
370+
return {
371+
url: toPathString(localVarUrlObj),
372+
options: localVarRequestOptions,
373+
};
374+
},
375+
/**
376+
* Creates a duplicate of an existing product including all variations, prices, and custom fields.
377+
* @summary Duplicate a product
378+
* @param {number} id The ID of the product
379+
380+
* @throws {RequiredError}
381+
*/
382+
duplicateProduct: async (id: number, ): Promise<RequestArgs> => {
383+
// verify required parameter 'id' is not null or undefined
384+
assertParamExists('duplicateProduct', 'id', id)
385+
const localVarPath = `/products/{id}/duplicate`
386+
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
387+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
388+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
389+
let baseOptions;
390+
if (configuration) {
391+
baseOptions = configuration.baseOptions;
392+
}
393+
394+
const localVarRequestOptions = { method: 'POST', ...baseOptions };
395+
const localVarHeaderParameter = {} as any;
396+
const localVarQueryParameter = {} as any;
397+
398+
// authentication api_key required
399+
await setApiKeyToObject(localVarHeaderParameter, "x-api-token", configuration)
400+
401+
// authentication oauth2 required
402+
// oauth required
403+
await setOAuthToObject(localVarHeaderParameter, "oauth2", ["products:full"], configuration)
404+
405+
406+
366407
setSearchParams(localVarUrlObj, localVarQueryParameter);
367408
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
368409
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, };
@@ -1043,6 +1084,17 @@ export const ProductsApiFp = function(configuration?: Configuration) {
10431084
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteProductVariation(id, product_variation_id, );
10441085
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
10451086
},
1087+
/**
1088+
* Creates a duplicate of an existing product including all variations, prices, and custom fields.
1089+
* @summary Duplicate a product
1090+
* @param {number} id The ID of the product
1091+
1092+
* @throws {RequiredError}
1093+
*/
1094+
async duplicateProduct(id: number, ): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<GetProductResponse>> {
1095+
const localVarAxiosArgs = await localVarAxiosParamCreator.duplicateProduct(id, );
1096+
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1097+
},
10461098
/**
10471099
* Returns data about a specific product.
10481100
* @summary Get one product
@@ -1267,6 +1319,16 @@ export const ProductsApiFactory = function (configuration?: Configuration, baseP
12671319
deleteProductVariation(requestParameters: ProductsApiDeleteProductVariationRequest, ): Promise<DeleteProductVariationResponse> {
12681320
return localVarFp.deleteProductVariation(requestParameters.id, requestParameters.product_variation_id, ).then((request) => request(axios, basePath));
12691321
},
1322+
/**
1323+
* Creates a duplicate of an existing product including all variations, prices, and custom fields.
1324+
* @summary Duplicate a product
1325+
* @param {ProductsApiDuplicateProductRequest} requestParameters Request parameters.
1326+
1327+
* @throws {RequiredError}
1328+
*/
1329+
duplicateProduct(requestParameters: ProductsApiDuplicateProductRequest, ): Promise<GetProductResponse> {
1330+
return localVarFp.duplicateProduct(requestParameters.id, ).then((request) => request(axios, basePath));
1331+
},
12701332
/**
12711333
* Returns data about a specific product.
12721334
* @summary Get one product
@@ -1506,6 +1568,20 @@ export interface ProductsApiDeleteProductVariationRequest {
15061568
readonly product_variation_id: number
15071569
}
15081570

1571+
/**
1572+
* Request parameters for duplicateProduct operation in ProductsApi.
1573+
* @export
1574+
* @interface ProductsApiDuplicateProductRequest
1575+
*/
1576+
export interface ProductsApiDuplicateProductRequest {
1577+
/**
1578+
* The ID of the product
1579+
* @type {number}
1580+
* @memberof ProductsApiDuplicateProduct
1581+
*/
1582+
readonly id: number
1583+
}
1584+
15091585
/**
15101586
* Request parameters for getProduct operation in ProductsApi.
15111587
* @export
@@ -1912,6 +1988,18 @@ export class ProductsApi extends BaseAPI {
19121988
return ProductsApiFp(this.configuration).deleteProductVariation(requestParameters.id, requestParameters.product_variation_id, ).then((request) => request(this.axios, this.basePath));
19131989
}
19141990

1991+
/**
1992+
* Creates a duplicate of an existing product including all variations, prices, and custom fields.
1993+
* @summary Duplicate a product
1994+
* @param {ProductsApiDuplicateProductRequest} requestParameters Request parameters.
1995+
1996+
* @throws {RequiredError}
1997+
* @memberof ProductsApi
1998+
*/
1999+
public duplicateProduct(requestParameters: ProductsApiDuplicateProductRequest, ) {
2000+
return ProductsApiFp(this.configuration).duplicateProduct(requestParameters.id, ).then((request) => request(this.axios, this.basePath));
2001+
}
2002+
19152003
/**
19162004
* Returns data about a specific product.
19172005
* @summary Get one product

0 commit comments

Comments
 (0)