export type ModifyCollectionCreatorFeeRequest = {address: string, basis_points: number}; export type ModifyCollectionRequest = {authorized_editors?: (Array | null) | undefined, banner_image_token?: (string | null) | undefined, buyer_side_creator_fee_basis_points?: (number | null) | undefined, buyer_side_creator_fee_enabled?: (boolean | null) | undefined, buyer_side_creator_fee_recipient?: (string | null) | undefined, category?: (string | null) | undefined, creator_fees?: (Array | null) | undefined, description?: (string | null) | undefined, external_url?: (string | null) | undefined, is_nsfw?: (boolean | null) | undefined, is_rarity_disabled?: (boolean | null) | undefined, is_trait_offers_enabled?: (boolean | null) | undefined, logo_image_token?: (string | null) | undefined, medium_username?: (string | null) | undefined, name?: (string | null) | undefined, slug?: (string | null) | undefined, telegram_url?: (string | null) | undefined}; export type PatchApiApiV2CollectionsSlugArgs = {slug: string, body: ModifyCollectionRequest}; export type PatchApiApiV2CollectionsSlugOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, WalletAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Modify collection metadata * * PATCH /api/v2/collections/{slug} */ export const patchApiApiV2CollectionsSlug = async (args: PatchApiApiV2CollectionsSlugArgs, options?: PatchApiApiV2CollectionsSlugOptions) => { 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))}${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() };