export type GetApiApiV2AccountsAddressOrUsernameRelationshipArgs = {address_or_username: string}; export type GetApiApiV2AccountsAddressOrUsernameRelationshipOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, WalletAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get the authenticated account's relationship with a profile * * GET /api/v2/accounts/{address_or_username}/relationship */ export const getApiApiV2AccountsAddressOrUsernameRelationship = async (args: GetApiApiV2AccountsAddressOrUsernameRelationshipArgs, options?: GetApiApiV2AccountsAddressOrUsernameRelationshipOptions) => { 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/accounts/${encodeURIComponent(String(args.address_or_username))}/relationship${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() };