lookup_inventory_products.h (2255B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2025 Taler Systems SA 4 5 TALER is free software; you can redistribute it and/or modify it under the 6 terms of the GNU General Public License as published by the Free Software 7 Foundation; either version 3, or (at your option) any later version. 8 9 TALER is distributed in the hope that it will be useful, but WITHOUT ANY 10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License along with 14 TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 /** 17 * @file src/include/merchant-database/lookup_inventory_products.h 18 * @brief Lookup inventory product details for templates 19 * @author Bohdan Potuzhnyi 20 */ 21 #ifndef MERCHANT_DATABASE_LOOKUP_INVENTORY_PRODUCTS_H 22 #define MERCHANT_DATABASE_LOOKUP_INVENTORY_PRODUCTS_H 23 24 #include "merchantdb_lib.h" 25 26 27 struct TALER_MERCHANTDB_PostgresContext; 28 /* Callback typedefs */ 29 /** 30 * Typically called by `lookup_inventory_products`. 31 * 32 * @param cls a `json_t *` JSON array to build 33 * @param product_id ID of the product 34 * @param pd inventory product details 35 * @param num_categories length of @a categories array 36 * @param categories array of categories the 37 * product is in 38 */ 39 typedef void 40 (*TALER_MERCHANTDB_InventoryProductCallback)( 41 void *cls, 42 const char *product_id, 43 const struct TALER_MERCHANTDB_InventoryProductDetails *pd, 44 size_t num_categories, 45 const uint64_t *categories); 46 47 /** 48 * Lookup inventory details for all products of an instance. 49 * 50 * @param pg database context 51 * @param instance_id instance to lookup products for 52 * @param cb function to call on all products found 53 * @param cb_cls closure for @a cb 54 * @return database result code 55 */ 56 enum GNUNET_DB_QueryStatus 57 TALER_MERCHANTDB_lookup_inventory_products (struct TALER_MERCHANTDB_PostgresContext *pg, 58 const char *instance_id, 59 TALER_MERCHANTDB_InventoryProductCallback cb, 60 void *cb_cls); 61 62 #endif /* MERCHANT_DATABASE_LOOKUP_INVENTORY_PRODUCTS_H */