summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/config.hpp2
-rw-r--r--include/countries.hpp2
-rw-r--r--include/exporter.hpp55
-rw-r--r--include/importer.hpp3
4 files changed, 58 insertions, 4 deletions
diff --git a/include/config.hpp b/include/config.hpp
index 05659e8..ff36364 100644
--- a/include/config.hpp
+++ b/include/config.hpp
@@ -39,4 +39,4 @@ namespace config {
static const ImU32 COLOR_ERROR = IM_COL32(235, 64, 52, 255);
static const ImU32 COLOR_DEFAULT = IM_COL32(235, 255, 255, 255);
}
-} \ No newline at end of file
+}
diff --git a/include/countries.hpp b/include/countries.hpp
index 7a15a32..1595b85 100644
--- a/include/countries.hpp
+++ b/include/countries.hpp
@@ -49,4 +49,4 @@ namespace country {
float calculate_tax_report_final(char* country_code, tax_report* report);
time_t get_invoice_date_to_use_for_tax_report(char* country_code, invoice* inv);
u32 get_available_tax_rates(const char* country_code, tax_rate* buffer, u32 buffer_size);
-} \ No newline at end of file
+}
diff --git a/include/exporter.hpp b/include/exporter.hpp
new file mode 100644
index 0000000..00eaf32
--- /dev/null
+++ b/include/exporter.hpp
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2025 Aldrik Ramaekers <aldrik.ramaekers@gmail.com>
+*
+* Permission to use, copy, modify, and/or distribute this software for any
+* purpose with or without fee is hereby granted, provided that the above
+* copyright notice and this permission notice appear in all copies.
+*
+* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#pragma once
+
+#include "administration.hpp"
+
+#define E_ERR_SUCCESS 0
+#define E_ERR_FAILED_REQUEST 1
+#define E_ERR_UNIMPLEMENTED 2
+
+typedef uint32_t e_err;
+
+namespace exporter {
+
+ typedef enum
+ {
+ EXPORT_STARTING,
+ EXPORT_WAITING_FOR_RESPONSE,
+ EXPORT_DONE,
+ } status;
+
+ typedef struct
+ {
+ time_t started_at;
+ e_err error;
+ status status;
+ char* sender;
+ char* recipient;
+ const char* subject;
+ const char* text;
+ } export_request;
+
+ typedef struct
+ {
+ char* provider_name;
+ bool (*send_email)(char* sender, char* recipient, const char* subject, const char* text);
+ } email_provider_impl;
+
+ email_provider_impl get_email_provider_implementation(email_provider provider);
+ exporter::export_request* send_email(char* sender, char* recipient, const char* subject, const char* text);
+} \ No newline at end of file
diff --git a/include/importer.hpp b/include/importer.hpp
index 8db70ef..2360d29 100644
--- a/include/importer.hpp
+++ b/include/importer.hpp
@@ -73,14 +73,13 @@ namespace importer {
typedef struct
{
char* provider_name;
- bool (*send_email)(char* sender, char* recipients, u32 recipients_count, const char* subject, const char* text);
+ bool (*send_email)(char* sender, char* recipient, const char* subject, const char* text);
} email_provider_impl;
const char* error_to_string(i_err error);
const char* status_to_string(status status);
ai_provider_impl get_ai_provider_implementation(ai_provider provider);
- email_provider_impl get_email_provider_implementation(email_provider provider);
invoice_request* ai_document_to_invoice(char* file_path);
model_list_request* ai_get_available_models(ai_provider service);