import { Additive, Allergen, Brand, Category, Country, Ingredient, Label, Language, Nutrient, Packaging, State, Store, TaxoNode, Taxonomy } from "./taxonomy/types.js"; import { FetchFn, RawImage, SelectedImage } from "./types.js"; import { Robotoff } from "./robotoff.js"; import { NutriPatrol } from "./nutripatrol.js"; import { components } from "./schemas/server/v2.js"; import { components as components$1 } from "./schemas/server/v3.js"; import { PackagingComponent, PackagingTaxonomyTag, Product, ProductDataSection, ProductDataType, ProductImageUploadParams, ProductOpenerApiV3, ProductQuery, ProductState, ResponseStatus, TaxonomySuggestionsQuery } from "./off-v3.js"; import { AttributeGroups, Product as Product$1, ProductAttribute, ProductAttributeGroup, ProductOpenerApiV2, SearchQuery, SearchResult, getProductIngredientsInLang, getProductNameInLang } from "./off-v2.js"; import { BackendType } from "./consts.js"; import { FacetResponse, FacetSortOption, FacetValueResponse } from "./facets.js"; import * as _$openapi_fetch0 from "openapi-fetch"; //#region src/off.d.ts type OpenFoodFactsOptions = { type?: BackendType; country?: string; language?: string; host?: string; accessToken?: string; onAccessTokenExpired?: () => string | Promise; }; /** Wrapper of OFF API */ declare class OpenFoodFacts { private readonly fetch; private readonly baseUrl; private readonly backendType?; private readonly customUserAgent; private accessToken?; private readonly defaultOptions; /** The V2 ProductOpener API class. Do not use directly unless you know what you're doing. */ readonly apiv2: ProductOpenerApiV2; /** The V3 ProductOpener API class. Do not use directly unless you know what you're doing. */ readonly apiv3: ProductOpenerApiV3; /** The Robotoff API class. */ readonly robotoff: Robotoff; /** The NutriPatrol API class. */ readonly nutriPatrol: NutriPatrol; /** * Create OFF object * @param fetch - Fetch implementation to use * @param options - Options for the OFF Object */ constructor(fetch: FetchFn, options?: OpenFoodFactsOptions); /** * Validates constructor options for mutual exclusivity */ private validateOptions; /** * Creates the base URL based on options */ private createBaseUrl; /** * Creates the User-Agent string based on backend type */ private createUserAgent; /** * Validates access token format and expiration */ private validateAccessToken; /** * Creates a fetch wrapper with User-Agent and optional token handling */ private createFetchWrapper; /** * Creates a fetch wrapper that adds User-Agent header */ private createUserAgentFetch; /** * Creates a fetch wrapper that handles token refresh and authorization */ private createTokenAwareFetch; /** * Refreshes the access token using the provided callback */ private refreshAccessToken; /** * Checks if a JWT access token is expired. Returns false only if the token is * well-formed, has a valid exp claim, and is not expired. Otherwise returns * true. */ private isTokenExpired; getBrand(brandId: string): Promise; getLanguage(languageId: string): Promise; /** * Returns a single category taxonomy entry by id * @param categoryId - The id of the category (e.g., "en:beverages") */ getCategory(categoryId: string): Promise; /** * Returns a single label taxonomy entry by id * @param labelId - The id of the label (e.g., "en:organic") */ getLabel(labelId: string): Promise