You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## What's the purpose of this pull request?
To add the Reviews & Ratings API integration through commerce client
## How it works?
Adds 3 new calls to the client:
- client.commerce.rating (retrieves rating information for a specific
product)
- client.commerce.reviews.list (retrieves all reviews for a specific
product)
- client.commerce.reviews.create (creates a new review for a specific
product)
## How to test it?
Creates a `.ts` file on the root folder of the project and adds the
following code:
```typescript
import { getContextFactory, Options } from "./packages/api/src/platforms/vtex";
const apiOptions = {
platform: 'vtex',
account: 'storeframework',
locale: 'en-US',
environment: 'vtexcommercestable',
channel: '{"salesChannel":"1"}',
showSponsored: false,
} as Options
const apiCtx = getContextFactory(apiOptions)
const commerceApiClient = apiCtx({}).clients.commerce
```
After that you can use the `commerceApiClient` to call the new methods.
To run the file locally use the following command:
```bash
npx tsx
```
## References
[JIRA Task: SFS-2092](https://vtex-dev.atlassian.net/browse/SFS-2092)
[Reviews & Ratings API
Doc](https://developers.vtex.com/docs/api-reference/reviews-and-ratings-api#overview)
## Checklist
**PR Description**
- [ ] Added Rating types
- [ ] Added Reviews types
- [ ] Incremented ProductSearchReviewResult
- [ ] Created adapatObject function on `utils`
- [ ] Created camelToSnakeCase function on `utils`
0 commit comments