Skip to content

Commit

Permalink
fix: add createProduct method
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorDePaula committed Jan 30, 2023
1 parent 8a984bd commit a5ac010
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/api/layers/catalog.layer.ts
Expand Up @@ -25,6 +25,64 @@ export class CatalogLayer extends HostLayer {
super(page, session, options);
}

/**
* Create a product on catalog
* @param name Product name
* @param image Product image
* @param description Product description
* @param price Product price
* @param isHidden Product visibility
* @param url Product url
* @param retailerId Product own ID system
* @param currency Product currency
* @example
* ```javascript
* client.createtProduct(
* 'Product name',
* 'image in base64',
* 'product description',
* '89.90',
* true,
* 'https://wppconnect.io',
* 'AKA001',
* );
* ```
*/
public async createProduct(
name: string,
image: string,
description: string,
price: number,
isHidden: boolean,
url: string,
retailerId: string,
currency: string
) {
return evaluateAndReturn(
this.page,
({
name,
image,
description,
price,
isHidden,
url,
retailerId,
currency,
}) =>
WPP.catalog.createProduct({
name,
image,
description,
price,
isHidden,
url,
retailerId,
currency,
}),
{ name, image, description, price, isHidden, url, retailerId, currency }
);
}
/**
* Querys all products
* @param id Buisness profile id ('00000@c.us')
Expand Down

0 comments on commit a5ac010

Please sign in to comment.