mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
chore: add GetCatalogOptions type
!BREAKING_CHANGE
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { CatalogCursor, ProductCreate, ProductUpdate, SocketConfig } from '../Types'
|
import { GetCatalogOptions, ProductCreate, ProductUpdate, SocketConfig } from '../Types'
|
||||||
import { parseCatalogNode, parseCollectionsNode, parseOrderDetailsNode, parseProductNode, toProductNode, uploadingNecessaryImagesOfProduct } from '../Utils/business'
|
import { parseCatalogNode, parseCollectionsNode, parseOrderDetailsNode, parseProductNode, toProductNode, uploadingNecessaryImagesOfProduct } from '../Utils/business'
|
||||||
import { BinaryNode, jidNormalizedUser, S_WHATSAPP_NET } from '../WABinary'
|
import { BinaryNode, jidNormalizedUser, S_WHATSAPP_NET } from '../WABinary'
|
||||||
import { getBinaryNodeChild } from '../WABinary/generic-utils'
|
import { getBinaryNodeChild } from '../WABinary/generic-utils'
|
||||||
@@ -12,11 +12,7 @@ export const makeBusinessSocket = (config: SocketConfig) => {
|
|||||||
waUploadToServer
|
waUploadToServer
|
||||||
} = sock
|
} = sock
|
||||||
|
|
||||||
const getCatalog = async(
|
const getCatalog = async({ jid, limit, cursor }: GetCatalogOptions) => {
|
||||||
jid?: string,
|
|
||||||
limit = 10,
|
|
||||||
cursor?: CatalogCursor
|
|
||||||
) => {
|
|
||||||
jid = jid || authState.creds.me?.id
|
jid = jid || authState.creds.me?.id
|
||||||
jid = jidNormalizedUser(jid!)
|
jid = jidNormalizedUser(jid!)
|
||||||
|
|
||||||
@@ -24,7 +20,7 @@ export const makeBusinessSocket = (config: SocketConfig) => {
|
|||||||
{
|
{
|
||||||
tag: 'limit',
|
tag: 'limit',
|
||||||
attrs: { },
|
attrs: { },
|
||||||
content: Buffer.from(limit.toString())
|
content: Buffer.from((limit || 10).toString())
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
tag: 'width',
|
tag: 'width',
|
||||||
|
|||||||
@@ -73,3 +73,12 @@ export type OrderDetails = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type CatalogCursor = string
|
export type CatalogCursor = string
|
||||||
|
|
||||||
|
export type GetCatalogOptions = {
|
||||||
|
/** cursor to start from */
|
||||||
|
cursor?: CatalogCursor
|
||||||
|
/** number of products to fetch */
|
||||||
|
limit?: number
|
||||||
|
|
||||||
|
jid?: string
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user