import { ApolloQueryResult } from "@apollo/client/core"; import { CustomHeaders, CustomQuery, GetProductSearchParams, ProductsListQuery } from "@vue-storefront/magento-types"; import { Context } from "../../types/context"; /** * Get products * * @example * Simple usage without filters, sorting or pagination: * ```ts * import { sdk } from '~/sdk.config.ts'; * * // fetch list of products with default parameters * const details = await sdk.magento.products({}); * ``` * * @example * Usage with filters, sorting and pagination: * * ```ts * import { sdk } from '~/sdk.config.ts'; * * // make a request to fetch list of products with custom parameters * const details = await sdk.magento.products({ * pageSize: 20, * currentPage: 1, * filter: { * sku: { * eq: PRODUCT_SKU * } * } * }); * ``` * * @example * Creating a custom GraphQL query for fetching products. * * ```ts * module.exports = { * integrations: { * magento: { * customQueries: { * 'products-custom-query': ({ variables, metadata }) => ({ * variables, * query: ` * query productsList( * $search: String = "", * $filter: ProductAttributeFilterInput, * $pageSize: Int = 10, * $currentPage: Int = 1, * $sort: ProductAttributeSortInput * ) { * products(search: $search, filter: $filter, sort: $sort, pageSize: $pageSize, currentPage: $currentPage) { * ${metadata.fields} * } * } * ` * }), * }, * } * } * }; * ``` * * @example * Using a custom GraphQL query to fetch products list. * * ```ts * import { sdk } from '~/sdk.config.ts'; * const customQuery = { * products: 'products-custom-query', * metadata: { * fields: 'items { sku name }' * } * }; * * const products = await sdk.magento.products({ * filter: { * sku: { * eq: 'some-sku' // optional SKU filter * } * } * }, customQuery); * * // Products will contain only the fields specified in the custom query. * ``` */ export declare function products(context: Context, searchParams?: GetProductSearchParams, customQuery?: CustomQuery, customHeaders?: CustomHeaders): Promise>; //# sourceMappingURL=index.d.ts.map