export type GetApiApiV2NftsGroupGroupFacetsArgs = {group: string, facet_types?: Array | undefined, collection_slugs?: Array | undefined, franchise?: Array | undefined, grader?: Array | undefined, grade?: Array | undefined, subject?: Array | undefined, year?: Array | undefined, set?: Array | undefined, language?: Array | undefined, edition?: Array | undefined, product_type?: Array | undefined}; export type GetApiApiV2NftsGroupGroupFacetsOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get filter facets for a collection group * * GET /api/v2/nfts/group/{group}/facets */ export const getApiApiV2NftsGroupGroupFacets = async (args: GetApiApiV2NftsGroupGroupFacetsArgs, options?: GetApiApiV2NftsGroupGroupFacetsOptions) => { const {baseUrl = "https://api.opensea.io", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") for (const item of args.facet_types ?? []) query.append("facet_types", String(item)) for (const item of args.collection_slugs ?? []) query.append("collection_slugs", String(item)) for (const item of args.franchise ?? []) query.append("franchise", String(item)) for (const item of args.grader ?? []) query.append("grader", String(item)) for (const item of args.grade ?? []) query.append("grade", String(item)) for (const item of args.subject ?? []) query.append("subject", String(item)) for (const item of args.year ?? []) query.append("year", String(item)) for (const item of args.set ?? []) query.append("set", String(item)) for (const item of args.language ?? []) query.append("language", String(item)) for (const item of args.edition ?? []) query.append("edition", String(item)) for (const item of args.product_type ?? []) query.append("product_type", String(item)) if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/nfts/group/${encodeURIComponent(String(args.group))}/facets${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };