ProductRepository

@Singleton
class ProductRepository @Inject constructor(    context: Context,     daoSession: <Error class: unknown class>,     rawApi: ProductsAPI,     sentryAnalytics: SentryAnalytics,     localeManager: LocaleManager,     installationService: InstallationService)

API Client for all API callbacks

Constructors

Link copied to clipboard
@Inject
fun ProductRepository(    context: Context,     daoSession: <Error class: unknown class>,     rawApi: ProductsAPI,     sentryAnalytics: SentryAnalytics,     localeManager: LocaleManager,     installationService: InstallationService)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
suspend fun addToHistory(product: Product): <Error class: unknown class>

Add a product to ScanHistory asynchronously

Link copied to clipboard
suspend fun editImage(code: String, imgMap: Map<String, String>): ObjectNode
Link copied to clipboard
suspend fun getEMBCodeSuggestions(term: String): ArrayList<String>
Link copied to clipboard
suspend fun getIncompleteProducts(page: Int): Search
Link copied to clipboard
suspend fun getInfoAddedIncompleteProductsSingle(contributor: String, page: Int): Search
Link copied to clipboard
suspend fun getInfoAddedProducts(contributor: String?, page: Int): Search
Link copied to clipboard
suspend fun getIngredients(product: Product): Result<List<ProductIngredient>>
Link copied to clipboard
suspend fun getPeriodAfterOpeningSuggestions(term: String): ArrayList<String>
Link copied to clipboard
suspend fun getPicturesContributedIncompleteProducts(contributor: String?, page: Int): Search
Link copied to clipboard
suspend fun getPicturesContributedProducts(contributor: String, page: Int): Search
Link copied to clipboard
suspend fun getProductImages(barcode: Barcode): ProductState

Open the product activity if the barcode exist. Also add it in the history if the product exist.

Link copied to clipboard
suspend fun getProductsByAdditive(additive: String, page: Int): Search

call API service to return products using Additives

Link copied to clipboard
suspend fun getProductsByAllergen(allergen: String, page: Int): Search
Link copied to clipboard
suspend fun getProductsByBarcode(codes: List<String>, customHeader: String = ApiFields.UserAgents.SEARCH): List<SearchProduct>
Link copied to clipboard
suspend fun getProductsByBrand(brand: String, page: Int): Search

Search for products using brand name

Link copied to clipboard
suspend fun getProductsByCategory(category: String, page: Int): Search
Link copied to clipboard
suspend fun getProductsByContributor(contributor: String, page: Int): Search
Link copied to clipboard
suspend fun getProductsByCountry(country: String, page: Int): Search
Link copied to clipboard
suspend fun getProductsByLabel(label: String, page: Int): Search
Link copied to clipboard
suspend fun getProductsByManufacturingPlace(manufacturingPlace: String, page: Int): Search
Link copied to clipboard
suspend fun getProductsByOrigin(origin: String, page: Int): Search
Link copied to clipboard
suspend fun getProductsByPackaging(packaging: String, page: Int): Search
Link copied to clipboard
suspend fun getProductsByStates(state: String?, page: Int): Search
Link copied to clipboard
suspend fun getProductsByStore(store: String, page: Int): Search
Link copied to clipboard
suspend fun getProductStateFull(    barcode: String,     fields: String = getAllFields(localeManager.getLanguage()),     userAgent: String = ApiFields.UserAgents.SEARCH): ProductState
suspend fun getProductStateFull(    barcode: Barcode,     fields: String = getAllFields(localeManager.getLanguage()),     userAgent: String = ApiFields.UserAgents.SCAN): ProductState
Link copied to clipboard
suspend fun getToBeCompletedProductsByContributor(contributor: String, page: Int): Search
Link copied to clipboard
suspend fun postImg(image: ProductImage, setAsDefault: Boolean = false): Result<Unit>

Try to upload image. If the upload fails enqueue the image for later uploading.

Link copied to clipboard
suspend fun searchProductsByName(name: String, page: Int): Search
Link copied to clipboard
suspend fun unSelectImage(    code: String,     field: ProductImageField,     language: String): String

Unselect the image.

Link copied to clipboard
suspend fun uploadOfflineProductsImages(): Result<Unit>

Uploads images of the offline saved products.

Properties

Link copied to clipboard
val localeProductNameField: String