From cd827834f9ee329c27b82d987f0d1d48a854a954 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 4 Oct 2025 18:36:31 +0200 Subject: namespace importer --- include/importer.hpp | 66 +++++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 32 deletions(-) (limited to 'include/importer.hpp') diff --git a/include/importer.hpp b/include/importer.hpp index 7e23e20..fde297a 100644 --- a/include/importer.hpp +++ b/include/importer.hpp @@ -18,40 +18,42 @@ #include "administration.hpp" -typedef uint32_t i_err; - #define I_ERR_SUCCESS 0 #define I_ERR_FAILED_UPLOAD 1 #define I_ERR_FAILED_QUERY 2 #define I_ERR_FAILED_IMPORT 3 -typedef enum -{ - IMPORT_STARTING, - IMPORT_UPLOADING_FILE, - IMPORT_QUERYING, - IMPORT_WAITING_FOR_RESPONSE, - IMPORT_DONE, -} import_status; - -typedef struct -{ - time_t started_at; - invoice result; - char file_path[MAX_LEN_PATH]; - i_err error; - import_status status; -} import_invoice_request; - -typedef struct -{ - bool (*upload_file)(char* file_path, char* file_id, size_t file_id_len); - bool (*query_with_file)(char* query, size_t query_length, char* file_id, char** response); -} ai_provider_impl; - -extern ai_provider_impl _chatgpt_api_provider; -extern ai_provider_impl _deepseek_api_provider; - -const char* import_error_to_str(i_err error); -const char* import_status_to_str(import_status status); -import_invoice_request* ai_document_to_invoice(char* file_path); \ No newline at end of file +namespace importer { + + typedef uint32_t i_err; + + typedef enum + { + IMPORT_STARTING, + IMPORT_UPLOADING_FILE, + IMPORT_QUERYING, + IMPORT_WAITING_FOR_RESPONSE, + IMPORT_DONE, + } status; + + typedef struct + { + time_t started_at; + invoice result; + char file_path[MAX_LEN_PATH]; + i_err error; + status status; + } invoice_request; + + typedef struct + { + bool (*upload_file)(char* file_path, char* file_id, size_t file_id_len); + bool (*query_with_file)(char* query, size_t query_length, char* file_id, char** response); + } ai_provider_impl; + + const char* error_to_string(i_err error); + const char* status_to_string(status status); + + invoice_request* ai_document_to_invoice(char* file_path); + +} \ No newline at end of file -- cgit v1.2.3-70-g09d2