export type CreateApiV1ChainsChainIdNftsCollectionsAddressTokensTokenIdReindexArgs = {chainId: string, address: string, tokenId: string}; export type CreateApiV1ChainsChainIdNftsCollectionsAddressTokensTokenIdReindexOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reindex NFT metadata * * POST /v1/chains/{chainId}/nfts/collections/{address}/tokens/{tokenId}:reindex */ export const createApiV1ChainsChainIdNftsCollectionsAddressTokensTokenIdReindex = async (args: CreateApiV1ChainsChainIdNftsCollectionsAddressTokensTokenIdReindexArgs, options?: CreateApiV1ChainsChainIdNftsCollectionsAddressTokensTokenIdReindexOptions) => { const {baseUrl = "https://data-api.avax.network", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKey !== undefined) headers.set("x-glacier-api-key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/chains/${encodeURIComponent(String(args.chainId))}/nfts/collections/${encodeURIComponent(String(args.address))}/tokens/${encodeURIComponent(String(args.tokenId))}:reindex${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 undefined };