export type SavePrerevealDropItemRequest = {description?: string | undefined, media_token: string, media_type?: string | undefined, name: string, unreveal?: boolean | undefined}; export type CreateApiApiV2DropsSlugPrerevealItemArgs = {slug: string, body: SavePrerevealDropItemRequest}; export type CreateApiApiV2DropsSlugPrerevealItemOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, WalletAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Save prereveal drop item * * POST /api/v2/drops/{slug}/prereveal-item */ export const createApiApiV2DropsSlugPrerevealItem = async (args: CreateApiApiV2DropsSlugPrerevealItemArgs, options?: CreateApiApiV2DropsSlugPrerevealItemOptions) => { const {baseUrl = "https://api.opensea.io", fetch: fetchFn = fetch, ApiKeyAuth, WalletAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") 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/drops/${encodeURIComponent(String(args.slug))}/prereveal-item${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };