export type GetApiApiV2DropsSlugItemsArgs = {slug: string, limit?: number | undefined, next?: string | undefined}; export type GetApiApiV2DropsSlugItemsOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, WalletAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * List drop items * * GET /api/v2/drops/{slug}/items */ export const getApiApiV2DropsSlugItems = async (args: GetApiApiV2DropsSlugItemsArgs, options?: GetApiApiV2DropsSlugItemsOptions) => { const {baseUrl = "https://api.opensea.io", fetch: fetchFn = fetch, ApiKeyAuth, WalletAuth} = 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) if (WalletAuth !== undefined) headers.set('authorization', `Bearer ${WalletAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/drops/${encodeURIComponent(String(args.slug))}/items${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() };