react-native-email-imap-smtp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/EmailImapSmtp.podspec +29 -0
  2. package/LICENSE +20 -0
  3. package/README.md +121 -0
  4. package/android/CMakeLists.txt +24 -0
  5. package/android/build.gradle +117 -0
  6. package/android/src/main/AndroidManifest.xml +3 -0
  7. package/android/src/main/cpp/cpp-adapter.cpp +11 -0
  8. package/android/src/main/java/com/margelo/nitro/emailimapsmtp/EmailImapSmtp.kt +1533 -0
  9. package/android/src/main/java/com/margelo/nitro/emailimapsmtp/EmailImapSmtpPackage.kt +22 -0
  10. package/ios/EmailImapSmtp.swift +5 -0
  11. package/lib/module/EmailImapSmtp.nitro.js +4 -0
  12. package/lib/module/EmailImapSmtp.nitro.js.map +1 -0
  13. package/lib/module/NativeEmailImapSmtp.js +14 -0
  14. package/lib/module/NativeEmailImapSmtp.js.map +1 -0
  15. package/lib/module/index.js +64 -0
  16. package/lib/module/index.js.map +1 -0
  17. package/lib/module/native.js +227 -0
  18. package/lib/module/native.js.map +1 -0
  19. package/lib/module/package.json +1 -0
  20. package/lib/module/types.js +2 -0
  21. package/lib/module/types.js.map +1 -0
  22. package/lib/module/web.js +107 -0
  23. package/lib/module/web.js.map +1 -0
  24. package/lib/module/windows.js +156 -0
  25. package/lib/module/windows.js.map +1 -0
  26. package/lib/typescript/package.json +1 -0
  27. package/lib/typescript/src/EmailImapSmtp.nitro.d.ts +268 -0
  28. package/lib/typescript/src/EmailImapSmtp.nitro.d.ts.map +1 -0
  29. package/lib/typescript/src/NativeEmailImapSmtp.d.ts +36 -0
  30. package/lib/typescript/src/NativeEmailImapSmtp.d.ts.map +1 -0
  31. package/lib/typescript/src/index.d.ts +33 -0
  32. package/lib/typescript/src/index.d.ts.map +1 -0
  33. package/lib/typescript/src/native.d.ts +32 -0
  34. package/lib/typescript/src/native.d.ts.map +1 -0
  35. package/lib/typescript/src/types.d.ts +261 -0
  36. package/lib/typescript/src/types.d.ts.map +1 -0
  37. package/lib/typescript/src/web.d.ts +32 -0
  38. package/lib/typescript/src/web.d.ts.map +1 -0
  39. package/lib/typescript/src/windows.d.ts +32 -0
  40. package/lib/typescript/src/windows.d.ts.map +1 -0
  41. package/nitro.json +23 -0
  42. package/nitrogen/generated/android/c++/JAppendResult.hpp +65 -0
  43. package/nitrogen/generated/android/c++/JAttachmentInfo.hpp +96 -0
  44. package/nitrogen/generated/android/c++/JConnectionConfig.hpp +94 -0
  45. package/nitrogen/generated/android/c++/JConnectionResult.hpp +73 -0
  46. package/nitrogen/generated/android/c++/JDeleteResult.hpp +87 -0
  47. package/nitrogen/generated/android/c++/JEmailAddress.hpp +61 -0
  48. package/nitrogen/generated/android/c++/JEmailBody.hpp +84 -0
  49. package/nitrogen/generated/android/c++/JEmailMessage.hpp +273 -0
  50. package/nitrogen/generated/android/c++/JFetchEmailsOptions.hpp +110 -0
  51. package/nitrogen/generated/android/c++/JFolderInfo.hpp +126 -0
  52. package/nitrogen/generated/android/c++/JFunc_void_IdleNotification.hpp +79 -0
  53. package/nitrogen/generated/android/c++/JHybridEmailImapSmtpSpec.cpp +697 -0
  54. package/nitrogen/generated/android/c++/JHybridEmailImapSmtpSpec.hpp +92 -0
  55. package/nitrogen/generated/android/c++/JIdleNotification.hpp +78 -0
  56. package/nitrogen/generated/android/c++/JImapServerInfo.hpp +84 -0
  57. package/nitrogen/generated/android/c++/JMailboxInfo.hpp +134 -0
  58. package/nitrogen/generated/android/c++/JMailboxListItem.hpp +92 -0
  59. package/nitrogen/generated/android/c++/JQuotaInfo.hpp +78 -0
  60. package/nitrogen/generated/android/c++/JSearchCriteria.hpp +187 -0
  61. package/nitrogen/generated/android/c++/JSearchHeader.hpp +61 -0
  62. package/nitrogen/generated/android/c++/JSendMailOptions.hpp +229 -0
  63. package/nitrogen/generated/android/c++/JSendMailResult.hpp +88 -0
  64. package/nitrogen/generated/android/c++/JSmtpAttachment.hpp +80 -0
  65. package/nitrogen/generated/android/c++/JSmtpConnectionConfig.hpp +98 -0
  66. package/nitrogen/generated/android/c++/JSmtpServerInfo.hpp +102 -0
  67. package/nitrogen/generated/android/c++/JVariant_ImapServerInfo_SmtpServerInfo.cpp +26 -0
  68. package/nitrogen/generated/android/c++/JVariant_ImapServerInfo_SmtpServerInfo.hpp +73 -0
  69. package/nitrogen/generated/android/c++/JVariant_NullType_AttachmentInfo.cpp +26 -0
  70. package/nitrogen/generated/android/c++/JVariant_NullType_AttachmentInfo.hpp +75 -0
  71. package/nitrogen/generated/android/c++/JVariant_NullType_EmailMessage.cpp +26 -0
  72. package/nitrogen/generated/android/c++/JVariant_NullType_EmailMessage.hpp +83 -0
  73. package/nitrogen/generated/android/emailimapsmtp+autolinking.cmake +84 -0
  74. package/nitrogen/generated/android/emailimapsmtp+autolinking.gradle +27 -0
  75. package/nitrogen/generated/android/emailimapsmtpOnLoad.cpp +56 -0
  76. package/nitrogen/generated/android/emailimapsmtpOnLoad.hpp +34 -0
  77. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/AppendResult.kt +61 -0
  78. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/AttachmentInfo.kt +96 -0
  79. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/ConnectionConfig.kt +96 -0
  80. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/ConnectionResult.kt +61 -0
  81. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/DeleteResult.kt +61 -0
  82. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/EmailAddress.kt +56 -0
  83. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/EmailBody.kt +61 -0
  84. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/EmailMessage.kt +156 -0
  85. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/FetchEmailsOptions.kt +116 -0
  86. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/FolderInfo.kt +91 -0
  87. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/Func_void_IdleNotification.kt +80 -0
  88. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/HybridEmailImapSmtpSpec.kt +178 -0
  89. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/IdleNotification.kt +76 -0
  90. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/ImapServerInfo.kt +61 -0
  91. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/MailboxInfo.kt +101 -0
  92. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/MailboxListItem.kt +71 -0
  93. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/QuotaInfo.kt +76 -0
  94. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/SearchCriteria.kt +196 -0
  95. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/SearchHeader.kt +56 -0
  96. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/SendMailOptions.kt +126 -0
  97. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/SendMailResult.kt +86 -0
  98. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/SmtpAttachment.kt +76 -0
  99. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/SmtpConnectionConfig.kt +101 -0
  100. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/SmtpServerInfo.kt +61 -0
  101. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/Variant_ImapServerInfo_SmtpServerInfo.kt +62 -0
  102. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/Variant_NullType_AttachmentInfo.kt +62 -0
  103. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/Variant_NullType_EmailMessage.kt +62 -0
  104. package/nitrogen/generated/android/kotlin/com/margelo/nitro/emailimapsmtp/emailimapsmtpOnLoad.kt +35 -0
  105. package/nitrogen/generated/ios/EmailImapSmtp+autolinking.rb +62 -0
  106. package/nitrogen/generated/ios/EmailImapSmtp-Swift-Cxx-Bridge.cpp +161 -0
  107. package/nitrogen/generated/ios/EmailImapSmtp-Swift-Cxx-Bridge.hpp +1132 -0
  108. package/nitrogen/generated/ios/EmailImapSmtp-Swift-Cxx-Umbrella.hpp +118 -0
  109. package/nitrogen/generated/ios/EmailImapSmtpAutolinking.mm +33 -0
  110. package/nitrogen/generated/ios/EmailImapSmtpAutolinking.swift +26 -0
  111. package/nitrogen/generated/ios/c++/HybridEmailImapSmtpSpecSwift.cpp +11 -0
  112. package/nitrogen/generated/ios/c++/HybridEmailImapSmtpSpecSwift.hpp +390 -0
  113. package/nitrogen/generated/ios/swift/AppendResult.swift +39 -0
  114. package/nitrogen/generated/ios/swift/AttachmentInfo.swift +113 -0
  115. package/nitrogen/generated/ios/swift/ConnectionConfig.swift +87 -0
  116. package/nitrogen/generated/ios/swift/ConnectionResult.swift +84 -0
  117. package/nitrogen/generated/ios/swift/DeleteResult.swift +64 -0
  118. package/nitrogen/generated/ios/swift/EmailAddress.swift +34 -0
  119. package/nitrogen/generated/ios/swift/EmailBody.swift +45 -0
  120. package/nitrogen/generated/ios/swift/EmailMessage.swift +184 -0
  121. package/nitrogen/generated/ios/swift/FetchEmailsOptions.swift +198 -0
  122. package/nitrogen/generated/ios/swift/FolderInfo.swift +81 -0
  123. package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
  124. package/nitrogen/generated/ios/swift/Func_void_AppendResult.swift +46 -0
  125. package/nitrogen/generated/ios/swift/Func_void_ConnectionResult.swift +46 -0
  126. package/nitrogen/generated/ios/swift/Func_void_DeleteResult.swift +46 -0
  127. package/nitrogen/generated/ios/swift/Func_void_IdleNotification.swift +46 -0
  128. package/nitrogen/generated/ios/swift/Func_void_MailboxInfo.swift +46 -0
  129. package/nitrogen/generated/ios/swift/Func_void_QuotaInfo.swift +46 -0
  130. package/nitrogen/generated/ios/swift/Func_void_SendMailResult.swift +46 -0
  131. package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
  132. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  133. package/nitrogen/generated/ios/swift/Func_void_std__variant_nitro__NullType__AttachmentInfo_.swift +58 -0
  134. package/nitrogen/generated/ios/swift/Func_void_std__variant_nitro__NullType__EmailMessage_.swift +58 -0
  135. package/nitrogen/generated/ios/swift/Func_void_std__vector_AttachmentInfo_.swift +46 -0
  136. package/nitrogen/generated/ios/swift/Func_void_std__vector_EmailMessage_.swift +46 -0
  137. package/nitrogen/generated/ios/swift/Func_void_std__vector_FolderInfo_.swift +46 -0
  138. package/nitrogen/generated/ios/swift/Func_void_std__vector_MailboxListItem_.swift +46 -0
  139. package/nitrogen/generated/ios/swift/HybridEmailImapSmtpSpec.swift +84 -0
  140. package/nitrogen/generated/ios/swift/HybridEmailImapSmtpSpec_cxx.swift +759 -0
  141. package/nitrogen/generated/ios/swift/IdleNotification.swift +93 -0
  142. package/nitrogen/generated/ios/swift/ImapServerInfo.swift +45 -0
  143. package/nitrogen/generated/ios/swift/MailboxInfo.swift +91 -0
  144. package/nitrogen/generated/ios/swift/MailboxListItem.swift +55 -0
  145. package/nitrogen/generated/ios/swift/QuotaInfo.swift +80 -0
  146. package/nitrogen/generated/ios/swift/SearchCriteria.swift +485 -0
  147. package/nitrogen/generated/ios/swift/SearchHeader.swift +34 -0
  148. package/nitrogen/generated/ios/swift/SendMailOptions.swift +310 -0
  149. package/nitrogen/generated/ios/swift/SendMailResult.swift +155 -0
  150. package/nitrogen/generated/ios/swift/SmtpAttachment.swift +80 -0
  151. package/nitrogen/generated/ios/swift/SmtpConnectionConfig.swift +105 -0
  152. package/nitrogen/generated/ios/swift/SmtpServerInfo.swift +51 -0
  153. package/nitrogen/generated/ios/swift/Variant_ImapServerInfo_SmtpServerInfo.swift +30 -0
  154. package/nitrogen/generated/ios/swift/Variant_NullType_AttachmentInfo.swift +30 -0
  155. package/nitrogen/generated/ios/swift/Variant_NullType_EmailMessage.swift +30 -0
  156. package/nitrogen/generated/shared/c++/AppendResult.hpp +91 -0
  157. package/nitrogen/generated/shared/c++/AttachmentInfo.hpp +121 -0
  158. package/nitrogen/generated/shared/c++/ConnectionConfig.hpp +120 -0
  159. package/nitrogen/generated/shared/c++/ConnectionResult.hpp +98 -0
  160. package/nitrogen/generated/shared/c++/DeleteResult.hpp +93 -0
  161. package/nitrogen/generated/shared/c++/EmailAddress.hpp +87 -0
  162. package/nitrogen/generated/shared/c++/EmailBody.hpp +92 -0
  163. package/nitrogen/generated/shared/c++/EmailMessage.hpp +177 -0
  164. package/nitrogen/generated/shared/c++/FetchEmailsOptions.hpp +136 -0
  165. package/nitrogen/generated/shared/c++/FolderInfo.hpp +116 -0
  166. package/nitrogen/generated/shared/c++/HybridEmailImapSmtpSpec.cpp +50 -0
  167. package/nitrogen/generated/shared/c++/HybridEmailImapSmtpSpec.hpp +145 -0
  168. package/nitrogen/generated/shared/c++/IdleNotification.hpp +104 -0
  169. package/nitrogen/generated/shared/c++/ImapServerInfo.hpp +92 -0
  170. package/nitrogen/generated/shared/c++/MailboxInfo.hpp +124 -0
  171. package/nitrogen/generated/shared/c++/MailboxListItem.hpp +100 -0
  172. package/nitrogen/generated/shared/c++/QuotaInfo.hpp +104 -0
  173. package/nitrogen/generated/shared/c++/SearchCriteria.hpp +203 -0
  174. package/nitrogen/generated/shared/c++/SearchHeader.hpp +87 -0
  175. package/nitrogen/generated/shared/c++/SendMailOptions.hpp +151 -0
  176. package/nitrogen/generated/shared/c++/SendMailResult.hpp +113 -0
  177. package/nitrogen/generated/shared/c++/SmtpAttachment.hpp +105 -0
  178. package/nitrogen/generated/shared/c++/SmtpConnectionConfig.hpp +124 -0
  179. package/nitrogen/generated/shared/c++/SmtpServerInfo.hpp +92 -0
  180. package/package.json +196 -0
  181. package/react-native.config.js +27 -0
  182. package/src/EmailImapSmtp.nitro.ts +333 -0
  183. package/src/NativeEmailImapSmtp.ts +100 -0
  184. package/src/index.tsx +166 -0
  185. package/src/native.ts +305 -0
  186. package/src/types.ts +328 -0
  187. package/src/web.ts +196 -0
  188. package/src/windows.ts +304 -0
  189. package/windows/EmailImapSmtp.cpp +735 -0
  190. package/windows/EmailImapSmtp.h +137 -0
  191. package/windows/EmailImapSmtpModule.cpp +10 -0
  192. package/windows/EmailImapSmtpModule.h +139 -0
  193. package/windows/EmailImapSmtpPackage.cpp +15 -0
  194. package/windows/EmailImapSmtpPackage.h +13 -0
  195. package/windows/ImapProtocol.cpp +1382 -0
  196. package/windows/ImapProtocol.h +97 -0
  197. package/windows/ProtocolDefs.h +300 -0
  198. package/windows/SmtpProtocol.cpp +334 -0
  199. package/windows/SmtpProtocol.h +36 -0
  200. package/windows/TlsSocket.cpp +818 -0
  201. package/windows/TlsSocket.h +87 -0
@@ -0,0 +1,87 @@
1
+ ///
2
+ /// EmailAddress.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+
32
+
33
+ #include <string>
34
+
35
+ namespace margelo::nitro::emailimapsmtp {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (EmailAddress).
39
+ */
40
+ struct EmailAddress final {
41
+ public:
42
+ std::string name SWIFT_PRIVATE;
43
+ std::string email SWIFT_PRIVATE;
44
+
45
+ public:
46
+ EmailAddress() = default;
47
+ explicit EmailAddress(std::string name, std::string email): name(name), email(email) {}
48
+
49
+ public:
50
+ friend bool operator==(const EmailAddress& lhs, const EmailAddress& rhs) = default;
51
+ };
52
+
53
+ } // namespace margelo::nitro::emailimapsmtp
54
+
55
+ namespace margelo::nitro {
56
+
57
+ // C++ EmailAddress <> JS EmailAddress (object)
58
+ template <>
59
+ struct JSIConverter<margelo::nitro::emailimapsmtp::EmailAddress> final {
60
+ static inline margelo::nitro::emailimapsmtp::EmailAddress fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
61
+ jsi::Object obj = arg.asObject(runtime);
62
+ return margelo::nitro::emailimapsmtp::EmailAddress(
63
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
64
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "email")))
65
+ );
66
+ }
67
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::emailimapsmtp::EmailAddress& arg) {
68
+ jsi::Object obj(runtime);
69
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::string>::toJSI(runtime, arg.name));
70
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "email"), JSIConverter<std::string>::toJSI(runtime, arg.email));
71
+ return obj;
72
+ }
73
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
74
+ if (!value.isObject()) {
75
+ return false;
76
+ }
77
+ jsi::Object obj = value.getObject(runtime);
78
+ if (!nitro::isPlainObject(runtime, obj)) {
79
+ return false;
80
+ }
81
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false;
82
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "email")))) return false;
83
+ return true;
84
+ }
85
+ };
86
+
87
+ } // namespace margelo::nitro
@@ -0,0 +1,92 @@
1
+ ///
2
+ /// EmailBody.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+
32
+
33
+ #include <string>
34
+ #include <vector>
35
+
36
+ namespace margelo::nitro::emailimapsmtp {
37
+
38
+ /**
39
+ * A struct which can be represented as a JavaScript object (EmailBody).
40
+ */
41
+ struct EmailBody final {
42
+ public:
43
+ std::string text SWIFT_PRIVATE;
44
+ std::string html SWIFT_PRIVATE;
45
+ std::vector<std::string> embeddedAttachments SWIFT_PRIVATE;
46
+
47
+ public:
48
+ EmailBody() = default;
49
+ explicit EmailBody(std::string text, std::string html, std::vector<std::string> embeddedAttachments): text(text), html(html), embeddedAttachments(embeddedAttachments) {}
50
+
51
+ public:
52
+ friend bool operator==(const EmailBody& lhs, const EmailBody& rhs) = default;
53
+ };
54
+
55
+ } // namespace margelo::nitro::emailimapsmtp
56
+
57
+ namespace margelo::nitro {
58
+
59
+ // C++ EmailBody <> JS EmailBody (object)
60
+ template <>
61
+ struct JSIConverter<margelo::nitro::emailimapsmtp::EmailBody> final {
62
+ static inline margelo::nitro::emailimapsmtp::EmailBody fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
63
+ jsi::Object obj = arg.asObject(runtime);
64
+ return margelo::nitro::emailimapsmtp::EmailBody(
65
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text"))),
66
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "html"))),
67
+ JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "embeddedAttachments")))
68
+ );
69
+ }
70
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::emailimapsmtp::EmailBody& arg) {
71
+ jsi::Object obj(runtime);
72
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "text"), JSIConverter<std::string>::toJSI(runtime, arg.text));
73
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "html"), JSIConverter<std::string>::toJSI(runtime, arg.html));
74
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "embeddedAttachments"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.embeddedAttachments));
75
+ return obj;
76
+ }
77
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
78
+ if (!value.isObject()) {
79
+ return false;
80
+ }
81
+ jsi::Object obj = value.getObject(runtime);
82
+ if (!nitro::isPlainObject(runtime, obj)) {
83
+ return false;
84
+ }
85
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text")))) return false;
86
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "html")))) return false;
87
+ if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "embeddedAttachments")))) return false;
88
+ return true;
89
+ }
90
+ };
91
+
92
+ } // namespace margelo::nitro
@@ -0,0 +1,177 @@
1
+ ///
2
+ /// EmailMessage.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+ // Forward declaration of `EmailAddress` to properly resolve imports.
32
+ namespace margelo::nitro::emailimapsmtp { struct EmailAddress; }
33
+ // Forward declaration of `EmailBody` to properly resolve imports.
34
+ namespace margelo::nitro::emailimapsmtp { struct EmailBody; }
35
+ // Forward declaration of `AttachmentInfo` to properly resolve imports.
36
+ namespace margelo::nitro::emailimapsmtp { struct AttachmentInfo; }
37
+
38
+ #include <string>
39
+ #include "EmailAddress.hpp"
40
+ #include <vector>
41
+ #include "EmailBody.hpp"
42
+ #include "AttachmentInfo.hpp"
43
+ #include <unordered_map>
44
+
45
+ namespace margelo::nitro::emailimapsmtp {
46
+
47
+ /**
48
+ * A struct which can be represented as a JavaScript object (EmailMessage).
49
+ */
50
+ struct EmailMessage final {
51
+ public:
52
+ double uid SWIFT_PRIVATE;
53
+ double sequenceNumber SWIFT_PRIVATE;
54
+ std::string subject SWIFT_PRIVATE;
55
+ EmailAddress from SWIFT_PRIVATE;
56
+ std::vector<EmailAddress> to SWIFT_PRIVATE;
57
+ std::vector<EmailAddress> cc SWIFT_PRIVATE;
58
+ std::vector<EmailAddress> bcc SWIFT_PRIVATE;
59
+ std::vector<EmailAddress> replyTo SWIFT_PRIVATE;
60
+ std::string date SWIFT_PRIVATE;
61
+ std::string receivedDate SWIFT_PRIVATE;
62
+ EmailBody body SWIFT_PRIVATE;
63
+ std::vector<AttachmentInfo> attachments SWIFT_PRIVATE;
64
+ std::vector<std::string> flags SWIFT_PRIVATE;
65
+ std::unordered_map<std::string, std::string> headers SWIFT_PRIVATE;
66
+ double size SWIFT_PRIVATE;
67
+ std::string messageId SWIFT_PRIVATE;
68
+ std::string inReplyTo SWIFT_PRIVATE;
69
+ std::string references SWIFT_PRIVATE;
70
+ std::string priority SWIFT_PRIVATE;
71
+ bool isEncrypted SWIFT_PRIVATE;
72
+ std::string mimeType SWIFT_PRIVATE;
73
+ std::string charset SWIFT_PRIVATE;
74
+
75
+ public:
76
+ EmailMessage() = default;
77
+ explicit EmailMessage(double uid, double sequenceNumber, std::string subject, EmailAddress from, std::vector<EmailAddress> to, std::vector<EmailAddress> cc, std::vector<EmailAddress> bcc, std::vector<EmailAddress> replyTo, std::string date, std::string receivedDate, EmailBody body, std::vector<AttachmentInfo> attachments, std::vector<std::string> flags, std::unordered_map<std::string, std::string> headers, double size, std::string messageId, std::string inReplyTo, std::string references, std::string priority, bool isEncrypted, std::string mimeType, std::string charset): uid(uid), sequenceNumber(sequenceNumber), subject(subject), from(from), to(to), cc(cc), bcc(bcc), replyTo(replyTo), date(date), receivedDate(receivedDate), body(body), attachments(attachments), flags(flags), headers(headers), size(size), messageId(messageId), inReplyTo(inReplyTo), references(references), priority(priority), isEncrypted(isEncrypted), mimeType(mimeType), charset(charset) {}
78
+
79
+ public:
80
+ friend bool operator==(const EmailMessage& lhs, const EmailMessage& rhs) = default;
81
+ };
82
+
83
+ } // namespace margelo::nitro::emailimapsmtp
84
+
85
+ namespace margelo::nitro {
86
+
87
+ // C++ EmailMessage <> JS EmailMessage (object)
88
+ template <>
89
+ struct JSIConverter<margelo::nitro::emailimapsmtp::EmailMessage> final {
90
+ static inline margelo::nitro::emailimapsmtp::EmailMessage fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
91
+ jsi::Object obj = arg.asObject(runtime);
92
+ return margelo::nitro::emailimapsmtp::EmailMessage(
93
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uid"))),
94
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sequenceNumber"))),
95
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subject"))),
96
+ JSIConverter<margelo::nitro::emailimapsmtp::EmailAddress>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "from"))),
97
+ JSIConverter<std::vector<margelo::nitro::emailimapsmtp::EmailAddress>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "to"))),
98
+ JSIConverter<std::vector<margelo::nitro::emailimapsmtp::EmailAddress>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cc"))),
99
+ JSIConverter<std::vector<margelo::nitro::emailimapsmtp::EmailAddress>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bcc"))),
100
+ JSIConverter<std::vector<margelo::nitro::emailimapsmtp::EmailAddress>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "replyTo"))),
101
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "date"))),
102
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "receivedDate"))),
103
+ JSIConverter<margelo::nitro::emailimapsmtp::EmailBody>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "body"))),
104
+ JSIConverter<std::vector<margelo::nitro::emailimapsmtp::AttachmentInfo>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "attachments"))),
105
+ JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "flags"))),
106
+ JSIConverter<std::unordered_map<std::string, std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "headers"))),
107
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "size"))),
108
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "messageId"))),
109
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "inReplyTo"))),
110
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "references"))),
111
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "priority"))),
112
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isEncrypted"))),
113
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mimeType"))),
114
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "charset")))
115
+ );
116
+ }
117
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::emailimapsmtp::EmailMessage& arg) {
118
+ jsi::Object obj(runtime);
119
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "uid"), JSIConverter<double>::toJSI(runtime, arg.uid));
120
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "sequenceNumber"), JSIConverter<double>::toJSI(runtime, arg.sequenceNumber));
121
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "subject"), JSIConverter<std::string>::toJSI(runtime, arg.subject));
122
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "from"), JSIConverter<margelo::nitro::emailimapsmtp::EmailAddress>::toJSI(runtime, arg.from));
123
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "to"), JSIConverter<std::vector<margelo::nitro::emailimapsmtp::EmailAddress>>::toJSI(runtime, arg.to));
124
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "cc"), JSIConverter<std::vector<margelo::nitro::emailimapsmtp::EmailAddress>>::toJSI(runtime, arg.cc));
125
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "bcc"), JSIConverter<std::vector<margelo::nitro::emailimapsmtp::EmailAddress>>::toJSI(runtime, arg.bcc));
126
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "replyTo"), JSIConverter<std::vector<margelo::nitro::emailimapsmtp::EmailAddress>>::toJSI(runtime, arg.replyTo));
127
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "date"), JSIConverter<std::string>::toJSI(runtime, arg.date));
128
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "receivedDate"), JSIConverter<std::string>::toJSI(runtime, arg.receivedDate));
129
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "body"), JSIConverter<margelo::nitro::emailimapsmtp::EmailBody>::toJSI(runtime, arg.body));
130
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "attachments"), JSIConverter<std::vector<margelo::nitro::emailimapsmtp::AttachmentInfo>>::toJSI(runtime, arg.attachments));
131
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "flags"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.flags));
132
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "headers"), JSIConverter<std::unordered_map<std::string, std::string>>::toJSI(runtime, arg.headers));
133
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "size"), JSIConverter<double>::toJSI(runtime, arg.size));
134
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "messageId"), JSIConverter<std::string>::toJSI(runtime, arg.messageId));
135
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "inReplyTo"), JSIConverter<std::string>::toJSI(runtime, arg.inReplyTo));
136
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "references"), JSIConverter<std::string>::toJSI(runtime, arg.references));
137
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "priority"), JSIConverter<std::string>::toJSI(runtime, arg.priority));
138
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "isEncrypted"), JSIConverter<bool>::toJSI(runtime, arg.isEncrypted));
139
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "mimeType"), JSIConverter<std::string>::toJSI(runtime, arg.mimeType));
140
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "charset"), JSIConverter<std::string>::toJSI(runtime, arg.charset));
141
+ return obj;
142
+ }
143
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
144
+ if (!value.isObject()) {
145
+ return false;
146
+ }
147
+ jsi::Object obj = value.getObject(runtime);
148
+ if (!nitro::isPlainObject(runtime, obj)) {
149
+ return false;
150
+ }
151
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uid")))) return false;
152
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sequenceNumber")))) return false;
153
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subject")))) return false;
154
+ if (!JSIConverter<margelo::nitro::emailimapsmtp::EmailAddress>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "from")))) return false;
155
+ if (!JSIConverter<std::vector<margelo::nitro::emailimapsmtp::EmailAddress>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "to")))) return false;
156
+ if (!JSIConverter<std::vector<margelo::nitro::emailimapsmtp::EmailAddress>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cc")))) return false;
157
+ if (!JSIConverter<std::vector<margelo::nitro::emailimapsmtp::EmailAddress>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bcc")))) return false;
158
+ if (!JSIConverter<std::vector<margelo::nitro::emailimapsmtp::EmailAddress>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "replyTo")))) return false;
159
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "date")))) return false;
160
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "receivedDate")))) return false;
161
+ if (!JSIConverter<margelo::nitro::emailimapsmtp::EmailBody>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "body")))) return false;
162
+ if (!JSIConverter<std::vector<margelo::nitro::emailimapsmtp::AttachmentInfo>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "attachments")))) return false;
163
+ if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "flags")))) return false;
164
+ if (!JSIConverter<std::unordered_map<std::string, std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "headers")))) return false;
165
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "size")))) return false;
166
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "messageId")))) return false;
167
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "inReplyTo")))) return false;
168
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "references")))) return false;
169
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "priority")))) return false;
170
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isEncrypted")))) return false;
171
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mimeType")))) return false;
172
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "charset")))) return false;
173
+ return true;
174
+ }
175
+ };
176
+
177
+ } // namespace margelo::nitro
@@ -0,0 +1,136 @@
1
+ ///
2
+ /// FetchEmailsOptions.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+
32
+
33
+ #include <optional>
34
+ #include <string>
35
+
36
+ namespace margelo::nitro::emailimapsmtp {
37
+
38
+ /**
39
+ * A struct which can be represented as a JavaScript object (FetchEmailsOptions).
40
+ */
41
+ struct FetchEmailsOptions final {
42
+ public:
43
+ std::optional<double> from SWIFT_PRIVATE;
44
+ std::optional<double> to SWIFT_PRIVATE;
45
+ std::optional<std::string> rangeType SWIFT_PRIVATE;
46
+ std::optional<double> page SWIFT_PRIVATE;
47
+ std::optional<double> pageSize SWIFT_PRIVATE;
48
+ std::optional<std::string> since SWIFT_PRIVATE;
49
+ std::optional<std::string> before SWIFT_PRIVATE;
50
+ std::optional<std::string> mailbox SWIFT_PRIVATE;
51
+ bool fetchBody SWIFT_PRIVATE;
52
+ bool fetchAttachments SWIFT_PRIVATE;
53
+ bool fetchFlags SWIFT_PRIVATE;
54
+ bool fetchHeaders SWIFT_PRIVATE;
55
+ bool fetchFullContent SWIFT_PRIVATE;
56
+ double maxBodySize SWIFT_PRIVATE;
57
+
58
+ public:
59
+ FetchEmailsOptions() = default;
60
+ explicit FetchEmailsOptions(std::optional<double> from, std::optional<double> to, std::optional<std::string> rangeType, std::optional<double> page, std::optional<double> pageSize, std::optional<std::string> since, std::optional<std::string> before, std::optional<std::string> mailbox, bool fetchBody, bool fetchAttachments, bool fetchFlags, bool fetchHeaders, bool fetchFullContent, double maxBodySize): from(from), to(to), rangeType(rangeType), page(page), pageSize(pageSize), since(since), before(before), mailbox(mailbox), fetchBody(fetchBody), fetchAttachments(fetchAttachments), fetchFlags(fetchFlags), fetchHeaders(fetchHeaders), fetchFullContent(fetchFullContent), maxBodySize(maxBodySize) {}
61
+
62
+ public:
63
+ friend bool operator==(const FetchEmailsOptions& lhs, const FetchEmailsOptions& rhs) = default;
64
+ };
65
+
66
+ } // namespace margelo::nitro::emailimapsmtp
67
+
68
+ namespace margelo::nitro {
69
+
70
+ // C++ FetchEmailsOptions <> JS FetchEmailsOptions (object)
71
+ template <>
72
+ struct JSIConverter<margelo::nitro::emailimapsmtp::FetchEmailsOptions> final {
73
+ static inline margelo::nitro::emailimapsmtp::FetchEmailsOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
74
+ jsi::Object obj = arg.asObject(runtime);
75
+ return margelo::nitro::emailimapsmtp::FetchEmailsOptions(
76
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "from"))),
77
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "to"))),
78
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rangeType"))),
79
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "page"))),
80
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pageSize"))),
81
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "since"))),
82
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "before"))),
83
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mailbox"))),
84
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fetchBody"))),
85
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fetchAttachments"))),
86
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fetchFlags"))),
87
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fetchHeaders"))),
88
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fetchFullContent"))),
89
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxBodySize")))
90
+ );
91
+ }
92
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::emailimapsmtp::FetchEmailsOptions& arg) {
93
+ jsi::Object obj(runtime);
94
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "from"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.from));
95
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "to"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.to));
96
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "rangeType"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.rangeType));
97
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "page"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.page));
98
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "pageSize"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.pageSize));
99
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "since"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.since));
100
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "before"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.before));
101
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "mailbox"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.mailbox));
102
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "fetchBody"), JSIConverter<bool>::toJSI(runtime, arg.fetchBody));
103
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "fetchAttachments"), JSIConverter<bool>::toJSI(runtime, arg.fetchAttachments));
104
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "fetchFlags"), JSIConverter<bool>::toJSI(runtime, arg.fetchFlags));
105
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "fetchHeaders"), JSIConverter<bool>::toJSI(runtime, arg.fetchHeaders));
106
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "fetchFullContent"), JSIConverter<bool>::toJSI(runtime, arg.fetchFullContent));
107
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "maxBodySize"), JSIConverter<double>::toJSI(runtime, arg.maxBodySize));
108
+ return obj;
109
+ }
110
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
111
+ if (!value.isObject()) {
112
+ return false;
113
+ }
114
+ jsi::Object obj = value.getObject(runtime);
115
+ if (!nitro::isPlainObject(runtime, obj)) {
116
+ return false;
117
+ }
118
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "from")))) return false;
119
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "to")))) return false;
120
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rangeType")))) return false;
121
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "page")))) return false;
122
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pageSize")))) return false;
123
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "since")))) return false;
124
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "before")))) return false;
125
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mailbox")))) return false;
126
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fetchBody")))) return false;
127
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fetchAttachments")))) return false;
128
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fetchFlags")))) return false;
129
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fetchHeaders")))) return false;
130
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fetchFullContent")))) return false;
131
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxBodySize")))) return false;
132
+ return true;
133
+ }
134
+ };
135
+
136
+ } // namespace margelo::nitro
@@ -0,0 +1,116 @@
1
+ ///
2
+ /// FolderInfo.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+
32
+
33
+ #include <string>
34
+ #include <vector>
35
+
36
+ namespace margelo::nitro::emailimapsmtp {
37
+
38
+ /**
39
+ * A struct which can be represented as a JavaScript object (FolderInfo).
40
+ */
41
+ struct FolderInfo final {
42
+ public:
43
+ std::string name SWIFT_PRIVATE;
44
+ std::string path SWIFT_PRIVATE;
45
+ std::string delimiter SWIFT_PRIVATE;
46
+ std::string parent SWIFT_PRIVATE;
47
+ std::vector<std::string> children SWIFT_PRIVATE;
48
+ std::vector<std::string> flags SWIFT_PRIVATE;
49
+ bool subscribed SWIFT_PRIVATE;
50
+ double messageCount SWIFT_PRIVATE;
51
+ double unseenCount SWIFT_PRIVATE;
52
+
53
+ public:
54
+ FolderInfo() = default;
55
+ explicit FolderInfo(std::string name, std::string path, std::string delimiter, std::string parent, std::vector<std::string> children, std::vector<std::string> flags, bool subscribed, double messageCount, double unseenCount): name(name), path(path), delimiter(delimiter), parent(parent), children(children), flags(flags), subscribed(subscribed), messageCount(messageCount), unseenCount(unseenCount) {}
56
+
57
+ public:
58
+ friend bool operator==(const FolderInfo& lhs, const FolderInfo& rhs) = default;
59
+ };
60
+
61
+ } // namespace margelo::nitro::emailimapsmtp
62
+
63
+ namespace margelo::nitro {
64
+
65
+ // C++ FolderInfo <> JS FolderInfo (object)
66
+ template <>
67
+ struct JSIConverter<margelo::nitro::emailimapsmtp::FolderInfo> final {
68
+ static inline margelo::nitro::emailimapsmtp::FolderInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
69
+ jsi::Object obj = arg.asObject(runtime);
70
+ return margelo::nitro::emailimapsmtp::FolderInfo(
71
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
72
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "path"))),
73
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "delimiter"))),
74
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "parent"))),
75
+ JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "children"))),
76
+ JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "flags"))),
77
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subscribed"))),
78
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "messageCount"))),
79
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unseenCount")))
80
+ );
81
+ }
82
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::emailimapsmtp::FolderInfo& arg) {
83
+ jsi::Object obj(runtime);
84
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::string>::toJSI(runtime, arg.name));
85
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "path"), JSIConverter<std::string>::toJSI(runtime, arg.path));
86
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "delimiter"), JSIConverter<std::string>::toJSI(runtime, arg.delimiter));
87
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "parent"), JSIConverter<std::string>::toJSI(runtime, arg.parent));
88
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "children"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.children));
89
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "flags"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.flags));
90
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "subscribed"), JSIConverter<bool>::toJSI(runtime, arg.subscribed));
91
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "messageCount"), JSIConverter<double>::toJSI(runtime, arg.messageCount));
92
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "unseenCount"), JSIConverter<double>::toJSI(runtime, arg.unseenCount));
93
+ return obj;
94
+ }
95
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
96
+ if (!value.isObject()) {
97
+ return false;
98
+ }
99
+ jsi::Object obj = value.getObject(runtime);
100
+ if (!nitro::isPlainObject(runtime, obj)) {
101
+ return false;
102
+ }
103
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false;
104
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "path")))) return false;
105
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "delimiter")))) return false;
106
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "parent")))) return false;
107
+ if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "children")))) return false;
108
+ if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "flags")))) return false;
109
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subscribed")))) return false;
110
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "messageCount")))) return false;
111
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unseenCount")))) return false;
112
+ return true;
113
+ }
114
+ };
115
+
116
+ } // namespace margelo::nitro