export type ImageMediaRequest = {token: string}; export type VideoMediaRequest = {enable_static_video?: (boolean | null) | undefined, token: string}; export type MediaInputRequest = {image?: (ImageMediaRequest | null) | undefined, video?: (VideoMediaRequest | null) | undefined}; export type AboutSectionRequest = {description: string, id?: (string | null) | undefined, media?: (Array | null) | undefined, title: string}; export type AboutMetadataRequest = {preview_media?: (Array | null) | undefined, sections?: (Array | null) | undefined}; export type HeroMetadataRequest = {desktop_hero_media?: (MediaInputRequest | null) | undefined, mobile_hero_media?: (MediaInputRequest | null) | undefined}; export type LinkRequest = {href: string, label: string}; export type ContentBlockSectionRequest = {collection_slug?: (string | null) | undefined, date?: (string | null) | undefined, description?: (string | null) | undefined, external_link?: (LinkRequest | null) | undefined, id?: (string | null) | undefined, media?: (MediaInputRequest | null) | undefined, module_type: 'default' | 'feature' | 'timeline', title?: (string | null) | undefined, token_id?: (string | null) | undefined}; export type ContentBlockModuleRequest = {description?: (string | null) | undefined, id?: (string | null) | undefined, index: number, sections?: (Array | null) | undefined, title?: (string | null) | undefined}; export type FaqSectionRequest = {answer: string, id?: (string | null) | undefined, question: string}; export type FaqBlockModuleRequest = {description?: (string | null) | undefined, hidden?: (boolean | null) | undefined, index: number, sections?: (Array | null) | undefined, title?: (string | null) | undefined}; export type NarrativeModuleRequest = {background_image?: (ImageMediaRequest | null) | undefined, background_media?: (MediaInputRequest | null) | undefined, description: string, desktop_background_media?: (MediaInputRequest | null) | undefined, horizontal_text_position?: (string | null) | undefined, id?: (string | null) | undefined, index: number, media?: (Array | null) | undefined, mobile_background_media?: (MediaInputRequest | null) | undefined, title: string, variant?: ('text' | 'background' | 'text_and_background' | 'text_and_media' | 'null' | null) | undefined, vertical_text_position?: (string | null) | undefined}; export type TeamSectionRequest = {bio: string, id?: (string | null) | undefined, instagram_url?: (string | null) | undefined, media?: (Array | null) | undefined, name: string, title: string, twitter_url?: (string | null) | undefined, website_url?: (string | null) | undefined}; export type TeamBlockModuleRequest = {description?: (string | null) | undefined, hidden?: (boolean | null) | undefined, index: number, sections?: (Array | null) | undefined, title?: (string | null) | undefined}; export type OverviewModuleRequest = {content_block?: (Array | null) | undefined, faq?: (Array | null) | undefined, narrative?: (Array | null) | undefined, team?: (Array | null) | undefined}; export type OverviewMetadataRequest = {modules: OverviewModuleRequest}; export type UpdateCollectionMetadataRequest = {about?: (AboutMetadataRequest | null) | undefined, hero?: (HeroMetadataRequest | null) | undefined, logo_image_token?: (string | null) | undefined, overview?: (OverviewMetadataRequest | null) | undefined}; export type PatchApiApiV2CollectionsSlugMetadataArgs = {slug: string, body: UpdateCollectionMetadataRequest}; export type PatchApiApiV2CollectionsSlugMetadataOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, WalletAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update collection metadata * * PATCH /api/v2/collections/{slug}/metadata */ export const patchApiApiV2CollectionsSlugMetadata = async (args: PatchApiApiV2CollectionsSlugMetadataArgs, options?: PatchApiApiV2CollectionsSlugMetadataOptions) => { 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/collections/${encodeURIComponent(String(args.slug))}/metadata${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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() };