export type GetApiApiV2OffersCollectionSlugNftsIdentifierArgs = {slug: string, identifier: string, limit?: number | undefined, next?: string | undefined}; export type GetApiApiV2OffersCollectionSlugNftsIdentifierOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get offers by NFT * * GET /api/v2/offers/collection/{slug}/nfts/{identifier} */ export const getApiApiV2OffersCollectionSlugNftsIdentifier = async (args: GetApiApiV2OffersCollectionSlugNftsIdentifierArgs, options?: GetApiApiV2OffersCollectionSlugNftsIdentifierOptions) => { const {baseUrl = "https://api.opensea.io", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.limit != null) query.append("limit", String(args.limit)) if (args.next != null) query.append("next", String(args.next)) if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/offers/collection/${encodeURIComponent(String(args.slug))}/nfts/${encodeURIComponent(String(args.identifier))}${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() };