feat: add product API for legacy connections

This commit is contained in:
Adhiraj Singh
2022-02-24 17:58:37 +05:30
parent 0567384af9
commit d21a39c302
4 changed files with 195 additions and 1 deletions

39
src/Types/Product.ts Normal file
View File

@@ -0,0 +1,39 @@
export type CatalogResult = {
data: {
paging: { cursors: { before: string, after: string } },
data: any[]
}
}
export type ProductCreateResult = {
data: { product: any }
}
export type ProductAvailability = 'in stock'
export type ProductBase = {
name: string
retailerId?: string
url?: string
description: string
price: number
currency: string
isHidden?: boolean
}
export type ProductCreate = ProductBase & {
/** ISO country code for product origin. Set to undefined for no country */
originCountryCode: string | undefined
imageUrls: string[]
}
export type ProductUpdate = Omit<ProductCreate, 'originCountryCode'>
export type Product = ProductBase & {
id: string
imageUrls: { [_: string]: string }
reviewStatus: { [_: string]: string }
availability: ProductAvailability
}

View File

@@ -7,6 +7,7 @@ export * from './Message'
export * from './Legacy'
export * from './Socket'
export * from './Events'
export * from './Product'
import type NodeCache from 'node-cache'
import { proto } from '../../WAProto'