import type { ApolloQueryResult } from "@apollo/client/core"; import type { CustomHeaders, CustomQuery, GetProductSearchParams, RelatedProductsQuery } from "@vue-storefront/magento-types"; import type { Context } from "../../types/context"; /** * Get related products * * @example * Simple usage without filters, sorting or pagination: * ```ts * import { sdk } from '~/sdk.config.ts'; * * // Fetch list of products filtered by the SKU * // Only the parent product is affected by filters * const products = await sdk.magento.relatedProduct({ * pageSize: 1, * filter: { * sku: { * eq: PRODUCT_SKU * } * } * }); * ``` * * @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 products = await sdk.magento.relatedProduct({ * pageSize: 20, * currentPage: 1, * filter: { * sku: { * eq: PRODUCT_SKU * } * } * }); * ``` * * @example * Creating a custom GraphQL query getting related products. * * ```ts * module.exports = { * integrations: { * magento: { * customQueries: { * 'related-product-custom-query': ({ variables, metadata }) => ({ * variables, * query: ` * query relatedProduct( * $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 related products. * * ```ts * import { sdk } from '~/sdk.config.ts'; * const customQuery = { * relatedProduct: 'related-product-custom-query', * metadata: { * fields: 'items { related_products { uid __typename } }' * } * }; * * const result = await sdk.magento.relatedProduct({ * filter: { * sku: { * eq: 'some-sku' // optional SKU filter * } * } * }, customQuery); * * // Result will contain only the fields specified in the custom query. * ``` */ export declare function relatedProducts(context: Context, searchParams?: GetProductSearchParams, customQuery?: CustomQuery, customHeaders?: CustomHeaders): Promise>; //# sourceMappingURL=index.d.ts.map