import { fetch } from 'undici' import { BarcodeAlbumType, LookupType } from '../../types.js' import { AcceptableAlbumTypes, RawError, RawUPCAlbum, UPC } from './constants.js' import { parseAlbum, parseError } from './parse.js' export async function getTrack(tag: string, type: BarcodeAlbumType) { if (!AcceptableAlbumTypes.includes(type)) throw new Error('Cannot use this type with Deezer.') switch (type) { case 'upc': { const data = (await (await fetch(UPC.replace('{upc}', tag))).json()) as any if (data?.id) return parseAlbum(data as RawUPCAlbum) else throw new Error(parseError(data as RawError)) } } } export async function getAlbum(tag: string, type: LookupType) {}