I'm trying to add digital product capability. The examples in the docs for src/lib/data/index.ts use medusaRequest but I can't find it anywhere.
The full example is as follows:
import {
ProductMedia,
} from "types/product-media"
import { Variant } from "../../types/medusa"
// ... rest of the functions
export async function getProductMediaPreviewByVariant(
variant: Variant
): Promise<ProductMedia> {
const {
product_medias,
} = await medusaRequest(
"GET",
`/product-media`,
{
query: {
variant_ids: variant.id,
},
}
)
.then((res) => res.body)
.catch((err) => {
throw err
})
return product_medias[0]
}
I'm guessing API has changed, so what's the current way to do this?