export type CreateApiApiV2CollectionsSlugRefreshArgs = {slug: string}; export type CreateApiApiV2CollectionsSlugRefreshOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, WalletAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Refresh collection metadata * * POST /api/v2/collections/{slug}/refresh */ export const createApiApiV2CollectionsSlugRefresh = async (args: CreateApiApiV2CollectionsSlugRefreshArgs, options?: CreateApiApiV2CollectionsSlugRefreshOptions) => { const {baseUrl = "https://api.opensea.io", fetch: fetchFn = fetch, ApiKeyAuth, WalletAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) if (WalletAuth !== undefined) headers.set('authorization', `Bearer ${WalletAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/collections/${encodeURIComponent(String(args.slug))}/refresh${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };