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,50 @@
1
+ ///
2
+ /// HybridEmailImapSmtpSpec.cpp
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
+ #include "HybridEmailImapSmtpSpec.hpp"
9
+
10
+ namespace margelo::nitro::emailimapsmtp {
11
+
12
+ void HybridEmailImapSmtpSpec::loadHybridMethods() {
13
+ // load base methods/properties
14
+ HybridObject::loadHybridMethods();
15
+ // load custom methods/properties
16
+ registerHybrids(this, [](Prototype& prototype) {
17
+ prototype.registerHybridMethod("imapConnect", &HybridEmailImapSmtpSpec::imapConnect);
18
+ prototype.registerHybridMethod("imapDisconnect", &HybridEmailImapSmtpSpec::imapDisconnect);
19
+ prototype.registerHybridMethod("imapListMailboxes", &HybridEmailImapSmtpSpec::imapListMailboxes);
20
+ prototype.registerHybridMethod("imapSelectMailbox", &HybridEmailImapSmtpSpec::imapSelectMailbox);
21
+ prototype.registerHybridMethod("imapRefreshMailbox", &HybridEmailImapSmtpSpec::imapRefreshMailbox);
22
+ prototype.registerHybridMethod("imapFetchFolders", &HybridEmailImapSmtpSpec::imapFetchFolders);
23
+ prototype.registerHybridMethod("imapCreateFolder", &HybridEmailImapSmtpSpec::imapCreateFolder);
24
+ prototype.registerHybridMethod("imapDeleteFolder", &HybridEmailImapSmtpSpec::imapDeleteFolder);
25
+ prototype.registerHybridMethod("imapRenameFolder", &HybridEmailImapSmtpSpec::imapRenameFolder);
26
+ prototype.registerHybridMethod("imapSubscribeFolder", &HybridEmailImapSmtpSpec::imapSubscribeFolder);
27
+ prototype.registerHybridMethod("imapUnsubscribeFolder", &HybridEmailImapSmtpSpec::imapUnsubscribeFolder);
28
+ prototype.registerHybridMethod("imapFetchEmails", &HybridEmailImapSmtpSpec::imapFetchEmails);
29
+ prototype.registerHybridMethod("imapFetchEmailByUID", &HybridEmailImapSmtpSpec::imapFetchEmailByUID);
30
+ prototype.registerHybridMethod("imapSearchEmails", &HybridEmailImapSmtpSpec::imapSearchEmails);
31
+ prototype.registerHybridMethod("imapMarkAsRead", &HybridEmailImapSmtpSpec::imapMarkAsRead);
32
+ prototype.registerHybridMethod("imapMarkAsFlagged", &HybridEmailImapSmtpSpec::imapMarkAsFlagged);
33
+ prototype.registerHybridMethod("imapMoveEmails", &HybridEmailImapSmtpSpec::imapMoveEmails);
34
+ prototype.registerHybridMethod("imapCopyEmails", &HybridEmailImapSmtpSpec::imapCopyEmails);
35
+ prototype.registerHybridMethod("imapDeleteEmails", &HybridEmailImapSmtpSpec::imapDeleteEmails);
36
+ prototype.registerHybridMethod("imapExpunge", &HybridEmailImapSmtpSpec::imapExpunge);
37
+ prototype.registerHybridMethod("imapFetchAttachments", &HybridEmailImapSmtpSpec::imapFetchAttachments);
38
+ prototype.registerHybridMethod("imapFetchAllAttachments", &HybridEmailImapSmtpSpec::imapFetchAllAttachments);
39
+ prototype.registerHybridMethod("imapIdle", &HybridEmailImapSmtpSpec::imapIdle);
40
+ prototype.registerHybridMethod("imapStopIdle", &HybridEmailImapSmtpSpec::imapStopIdle);
41
+ prototype.registerHybridMethod("imapGetQuota", &HybridEmailImapSmtpSpec::imapGetQuota);
42
+ prototype.registerHybridMethod("imapAppendMessage", &HybridEmailImapSmtpSpec::imapAppendMessage);
43
+ prototype.registerHybridMethod("smtpConnect", &HybridEmailImapSmtpSpec::smtpConnect);
44
+ prototype.registerHybridMethod("smtpDisconnect", &HybridEmailImapSmtpSpec::smtpDisconnect);
45
+ prototype.registerHybridMethod("smtpSendMail", &HybridEmailImapSmtpSpec::smtpSendMail);
46
+ prototype.registerHybridMethod("smtpVerifyConnection", &HybridEmailImapSmtpSpec::smtpVerifyConnection);
47
+ });
48
+ }
49
+
50
+ } // namespace margelo::nitro::emailimapsmtp
@@ -0,0 +1,145 @@
1
+ ///
2
+ /// HybridEmailImapSmtpSpec.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/HybridObject.hpp>)
11
+ #include <NitroModules/HybridObject.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+
16
+ // Forward declaration of `ConnectionResult` to properly resolve imports.
17
+ namespace margelo::nitro::emailimapsmtp { struct ConnectionResult; }
18
+ // Forward declaration of `ConnectionConfig` to properly resolve imports.
19
+ namespace margelo::nitro::emailimapsmtp { struct ConnectionConfig; }
20
+ // Forward declaration of `MailboxListItem` to properly resolve imports.
21
+ namespace margelo::nitro::emailimapsmtp { struct MailboxListItem; }
22
+ // Forward declaration of `MailboxInfo` to properly resolve imports.
23
+ namespace margelo::nitro::emailimapsmtp { struct MailboxInfo; }
24
+ // Forward declaration of `FolderInfo` to properly resolve imports.
25
+ namespace margelo::nitro::emailimapsmtp { struct FolderInfo; }
26
+ // Forward declaration of `EmailMessage` to properly resolve imports.
27
+ namespace margelo::nitro::emailimapsmtp { struct EmailMessage; }
28
+ // Forward declaration of `FetchEmailsOptions` to properly resolve imports.
29
+ namespace margelo::nitro::emailimapsmtp { struct FetchEmailsOptions; }
30
+ // Forward declaration of `SearchCriteria` to properly resolve imports.
31
+ namespace margelo::nitro::emailimapsmtp { struct SearchCriteria; }
32
+ // Forward declaration of `DeleteResult` to properly resolve imports.
33
+ namespace margelo::nitro::emailimapsmtp { struct DeleteResult; }
34
+ // Forward declaration of `AttachmentInfo` to properly resolve imports.
35
+ namespace margelo::nitro::emailimapsmtp { struct AttachmentInfo; }
36
+ // Forward declaration of `IdleNotification` to properly resolve imports.
37
+ namespace margelo::nitro::emailimapsmtp { struct IdleNotification; }
38
+ // Forward declaration of `QuotaInfo` to properly resolve imports.
39
+ namespace margelo::nitro::emailimapsmtp { struct QuotaInfo; }
40
+ // Forward declaration of `AppendResult` to properly resolve imports.
41
+ namespace margelo::nitro::emailimapsmtp { struct AppendResult; }
42
+ // Forward declaration of `SmtpConnectionConfig` to properly resolve imports.
43
+ namespace margelo::nitro::emailimapsmtp { struct SmtpConnectionConfig; }
44
+ // Forward declaration of `SendMailResult` to properly resolve imports.
45
+ namespace margelo::nitro::emailimapsmtp { struct SendMailResult; }
46
+ // Forward declaration of `SendMailOptions` to properly resolve imports.
47
+ namespace margelo::nitro::emailimapsmtp { struct SendMailOptions; }
48
+
49
+ #include "ConnectionResult.hpp"
50
+ #include <NitroModules/Promise.hpp>
51
+ #include "ConnectionConfig.hpp"
52
+ #include "MailboxListItem.hpp"
53
+ #include <vector>
54
+ #include "MailboxInfo.hpp"
55
+ #include <string>
56
+ #include "FolderInfo.hpp"
57
+ #include "EmailMessage.hpp"
58
+ #include "FetchEmailsOptions.hpp"
59
+ #include <NitroModules/Null.hpp>
60
+ #include <variant>
61
+ #include "SearchCriteria.hpp"
62
+ #include "DeleteResult.hpp"
63
+ #include "AttachmentInfo.hpp"
64
+ #include "IdleNotification.hpp"
65
+ #include <functional>
66
+ #include "QuotaInfo.hpp"
67
+ #include <optional>
68
+ #include "AppendResult.hpp"
69
+ #include <NitroModules/ArrayBuffer.hpp>
70
+ #include "SmtpConnectionConfig.hpp"
71
+ #include "SendMailResult.hpp"
72
+ #include "SendMailOptions.hpp"
73
+
74
+ namespace margelo::nitro::emailimapsmtp {
75
+
76
+ using namespace margelo::nitro;
77
+
78
+ /**
79
+ * An abstract base class for `EmailImapSmtp`
80
+ * Inherit this class to create instances of `HybridEmailImapSmtpSpec` in C++.
81
+ * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
82
+ * @example
83
+ * ```cpp
84
+ * class HybridEmailImapSmtp: public HybridEmailImapSmtpSpec {
85
+ * public:
86
+ * HybridEmailImapSmtp(...): HybridObject(TAG) { ... }
87
+ * // ...
88
+ * };
89
+ * ```
90
+ */
91
+ class HybridEmailImapSmtpSpec: public virtual HybridObject {
92
+ public:
93
+ // Constructor
94
+ explicit HybridEmailImapSmtpSpec(): HybridObject(TAG) { }
95
+
96
+ // Destructor
97
+ ~HybridEmailImapSmtpSpec() override = default;
98
+
99
+ public:
100
+ // Properties
101
+
102
+
103
+ public:
104
+ // Methods
105
+ virtual std::shared_ptr<Promise<ConnectionResult>> imapConnect(const ConnectionConfig& config) = 0;
106
+ virtual std::shared_ptr<Promise<void>> imapDisconnect() = 0;
107
+ virtual std::shared_ptr<Promise<std::vector<MailboxListItem>>> imapListMailboxes() = 0;
108
+ virtual std::shared_ptr<Promise<MailboxInfo>> imapSelectMailbox(const std::string& mailbox, bool readOnly) = 0;
109
+ virtual std::shared_ptr<Promise<MailboxInfo>> imapRefreshMailbox() = 0;
110
+ virtual std::shared_ptr<Promise<std::vector<FolderInfo>>> imapFetchFolders() = 0;
111
+ virtual std::shared_ptr<Promise<void>> imapCreateFolder(const std::string& folderName) = 0;
112
+ virtual std::shared_ptr<Promise<void>> imapDeleteFolder(const std::string& folderName) = 0;
113
+ virtual std::shared_ptr<Promise<void>> imapRenameFolder(const std::string& oldName, const std::string& newName) = 0;
114
+ virtual std::shared_ptr<Promise<void>> imapSubscribeFolder(const std::string& folderName) = 0;
115
+ virtual std::shared_ptr<Promise<void>> imapUnsubscribeFolder(const std::string& folderName) = 0;
116
+ virtual std::shared_ptr<Promise<std::vector<EmailMessage>>> imapFetchEmails(const FetchEmailsOptions& options) = 0;
117
+ virtual std::shared_ptr<Promise<std::variant<nitro::NullType, EmailMessage>>> imapFetchEmailByUID(double uid) = 0;
118
+ virtual std::shared_ptr<Promise<std::vector<EmailMessage>>> imapSearchEmails(const SearchCriteria& criteria) = 0;
119
+ virtual std::shared_ptr<Promise<void>> imapMarkAsRead(const std::vector<double>& uids, bool silent) = 0;
120
+ virtual std::shared_ptr<Promise<void>> imapMarkAsFlagged(const std::vector<double>& uids, bool flagged) = 0;
121
+ virtual std::shared_ptr<Promise<void>> imapMoveEmails(const std::vector<double>& uids, const std::string& destinationMailbox) = 0;
122
+ virtual std::shared_ptr<Promise<void>> imapCopyEmails(const std::vector<double>& uids, const std::string& destinationMailbox) = 0;
123
+ virtual std::shared_ptr<Promise<DeleteResult>> imapDeleteEmails(const std::vector<double>& uids) = 0;
124
+ virtual std::shared_ptr<Promise<void>> imapExpunge() = 0;
125
+ virtual std::shared_ptr<Promise<std::variant<nitro::NullType, AttachmentInfo>>> imapFetchAttachments(double uid, const std::string& partId) = 0;
126
+ virtual std::shared_ptr<Promise<std::vector<AttachmentInfo>>> imapFetchAllAttachments(double uid) = 0;
127
+ virtual std::shared_ptr<Promise<void>> imapIdle(const std::function<void(const IdleNotification& /* notification */)>& callback) = 0;
128
+ virtual std::shared_ptr<Promise<void>> imapStopIdle() = 0;
129
+ virtual std::shared_ptr<Promise<QuotaInfo>> imapGetQuota(const std::optional<std::string>& root) = 0;
130
+ virtual std::shared_ptr<Promise<AppendResult>> imapAppendMessage(const std::string& mailbox, const std::shared_ptr<ArrayBuffer>& rawMimeData, const std::optional<std::vector<std::string>>& flags) = 0;
131
+ virtual std::shared_ptr<Promise<ConnectionResult>> smtpConnect(const SmtpConnectionConfig& config) = 0;
132
+ virtual std::shared_ptr<Promise<void>> smtpDisconnect() = 0;
133
+ virtual std::shared_ptr<Promise<SendMailResult>> smtpSendMail(const SendMailOptions& options) = 0;
134
+ virtual std::shared_ptr<Promise<bool>> smtpVerifyConnection() = 0;
135
+
136
+ protected:
137
+ // Hybrid Setup
138
+ void loadHybridMethods() override;
139
+
140
+ protected:
141
+ // Tag for logging
142
+ static constexpr auto TAG = "EmailImapSmtp";
143
+ };
144
+
145
+ } // namespace margelo::nitro::emailimapsmtp
@@ -0,0 +1,104 @@
1
+ ///
2
+ /// IdleNotification.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 <optional>
35
+
36
+ namespace margelo::nitro::emailimapsmtp {
37
+
38
+ /**
39
+ * A struct which can be represented as a JavaScript object (IdleNotification).
40
+ */
41
+ struct IdleNotification final {
42
+ public:
43
+ std::string type SWIFT_PRIVATE;
44
+ std::string mailbox SWIFT_PRIVATE;
45
+ std::optional<double> uid SWIFT_PRIVATE;
46
+ std::optional<std::string> flag SWIFT_PRIVATE;
47
+ std::optional<double> messageCount SWIFT_PRIVATE;
48
+ double timestamp SWIFT_PRIVATE;
49
+
50
+ public:
51
+ IdleNotification() = default;
52
+ explicit IdleNotification(std::string type, std::string mailbox, std::optional<double> uid, std::optional<std::string> flag, std::optional<double> messageCount, double timestamp): type(type), mailbox(mailbox), uid(uid), flag(flag), messageCount(messageCount), timestamp(timestamp) {}
53
+
54
+ public:
55
+ friend bool operator==(const IdleNotification& lhs, const IdleNotification& rhs) = default;
56
+ };
57
+
58
+ } // namespace margelo::nitro::emailimapsmtp
59
+
60
+ namespace margelo::nitro {
61
+
62
+ // C++ IdleNotification <> JS IdleNotification (object)
63
+ template <>
64
+ struct JSIConverter<margelo::nitro::emailimapsmtp::IdleNotification> final {
65
+ static inline margelo::nitro::emailimapsmtp::IdleNotification fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
66
+ jsi::Object obj = arg.asObject(runtime);
67
+ return margelo::nitro::emailimapsmtp::IdleNotification(
68
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
69
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mailbox"))),
70
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uid"))),
71
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "flag"))),
72
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "messageCount"))),
73
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp")))
74
+ );
75
+ }
76
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::emailimapsmtp::IdleNotification& arg) {
77
+ jsi::Object obj(runtime);
78
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<std::string>::toJSI(runtime, arg.type));
79
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "mailbox"), JSIConverter<std::string>::toJSI(runtime, arg.mailbox));
80
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "uid"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.uid));
81
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "flag"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.flag));
82
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "messageCount"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.messageCount));
83
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestamp"), JSIConverter<double>::toJSI(runtime, arg.timestamp));
84
+ return obj;
85
+ }
86
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
87
+ if (!value.isObject()) {
88
+ return false;
89
+ }
90
+ jsi::Object obj = value.getObject(runtime);
91
+ if (!nitro::isPlainObject(runtime, obj)) {
92
+ return false;
93
+ }
94
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
95
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mailbox")))) return false;
96
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uid")))) return false;
97
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "flag")))) return false;
98
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "messageCount")))) return false;
99
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp")))) return false;
100
+ return true;
101
+ }
102
+ };
103
+
104
+ } // namespace margelo::nitro
@@ -0,0 +1,92 @@
1
+ ///
2
+ /// ImapServerInfo.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 (ImapServerInfo).
40
+ */
41
+ struct ImapServerInfo final {
42
+ public:
43
+ std::string serverName SWIFT_PRIVATE;
44
+ std::vector<std::string> capabilities SWIFT_PRIVATE;
45
+ bool isCompressed SWIFT_PRIVATE;
46
+
47
+ public:
48
+ ImapServerInfo() = default;
49
+ explicit ImapServerInfo(std::string serverName, std::vector<std::string> capabilities, bool isCompressed): serverName(serverName), capabilities(capabilities), isCompressed(isCompressed) {}
50
+
51
+ public:
52
+ friend bool operator==(const ImapServerInfo& lhs, const ImapServerInfo& rhs) = default;
53
+ };
54
+
55
+ } // namespace margelo::nitro::emailimapsmtp
56
+
57
+ namespace margelo::nitro {
58
+
59
+ // C++ ImapServerInfo <> JS ImapServerInfo (object)
60
+ template <>
61
+ struct JSIConverter<margelo::nitro::emailimapsmtp::ImapServerInfo> final {
62
+ static inline margelo::nitro::emailimapsmtp::ImapServerInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
63
+ jsi::Object obj = arg.asObject(runtime);
64
+ return margelo::nitro::emailimapsmtp::ImapServerInfo(
65
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "serverName"))),
66
+ JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "capabilities"))),
67
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isCompressed")))
68
+ );
69
+ }
70
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::emailimapsmtp::ImapServerInfo& arg) {
71
+ jsi::Object obj(runtime);
72
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "serverName"), JSIConverter<std::string>::toJSI(runtime, arg.serverName));
73
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "capabilities"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.capabilities));
74
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "isCompressed"), JSIConverter<bool>::toJSI(runtime, arg.isCompressed));
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, "serverName")))) return false;
86
+ if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "capabilities")))) return false;
87
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isCompressed")))) return false;
88
+ return true;
89
+ }
90
+ };
91
+
92
+ } // namespace margelo::nitro
@@ -0,0 +1,124 @@
1
+ ///
2
+ /// MailboxInfo.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 (MailboxInfo).
40
+ */
41
+ struct MailboxInfo final {
42
+ public:
43
+ std::string name SWIFT_PRIVATE;
44
+ std::string path SWIFT_PRIVATE;
45
+ double uidNext SWIFT_PRIVATE;
46
+ double uidValidity SWIFT_PRIVATE;
47
+ double messageCount SWIFT_PRIVATE;
48
+ double recentCount SWIFT_PRIVATE;
49
+ double unseenCount SWIFT_PRIVATE;
50
+ double firstUnseenUid SWIFT_PRIVATE;
51
+ double highestModSeq SWIFT_PRIVATE;
52
+ std::vector<std::string> flags SWIFT_PRIVATE;
53
+ std::vector<std::string> permanentFlags SWIFT_PRIVATE;
54
+
55
+ public:
56
+ MailboxInfo() = default;
57
+ explicit MailboxInfo(std::string name, std::string path, double uidNext, double uidValidity, double messageCount, double recentCount, double unseenCount, double firstUnseenUid, double highestModSeq, std::vector<std::string> flags, std::vector<std::string> permanentFlags): name(name), path(path), uidNext(uidNext), uidValidity(uidValidity), messageCount(messageCount), recentCount(recentCount), unseenCount(unseenCount), firstUnseenUid(firstUnseenUid), highestModSeq(highestModSeq), flags(flags), permanentFlags(permanentFlags) {}
58
+
59
+ public:
60
+ friend bool operator==(const MailboxInfo& lhs, const MailboxInfo& rhs) = default;
61
+ };
62
+
63
+ } // namespace margelo::nitro::emailimapsmtp
64
+
65
+ namespace margelo::nitro {
66
+
67
+ // C++ MailboxInfo <> JS MailboxInfo (object)
68
+ template <>
69
+ struct JSIConverter<margelo::nitro::emailimapsmtp::MailboxInfo> final {
70
+ static inline margelo::nitro::emailimapsmtp::MailboxInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
71
+ jsi::Object obj = arg.asObject(runtime);
72
+ return margelo::nitro::emailimapsmtp::MailboxInfo(
73
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
74
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "path"))),
75
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uidNext"))),
76
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uidValidity"))),
77
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "messageCount"))),
78
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "recentCount"))),
79
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unseenCount"))),
80
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "firstUnseenUid"))),
81
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "highestModSeq"))),
82
+ JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "flags"))),
83
+ JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "permanentFlags")))
84
+ );
85
+ }
86
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::emailimapsmtp::MailboxInfo& arg) {
87
+ jsi::Object obj(runtime);
88
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::string>::toJSI(runtime, arg.name));
89
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "path"), JSIConverter<std::string>::toJSI(runtime, arg.path));
90
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "uidNext"), JSIConverter<double>::toJSI(runtime, arg.uidNext));
91
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "uidValidity"), JSIConverter<double>::toJSI(runtime, arg.uidValidity));
92
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "messageCount"), JSIConverter<double>::toJSI(runtime, arg.messageCount));
93
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "recentCount"), JSIConverter<double>::toJSI(runtime, arg.recentCount));
94
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "unseenCount"), JSIConverter<double>::toJSI(runtime, arg.unseenCount));
95
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "firstUnseenUid"), JSIConverter<double>::toJSI(runtime, arg.firstUnseenUid));
96
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "highestModSeq"), JSIConverter<double>::toJSI(runtime, arg.highestModSeq));
97
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "flags"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.flags));
98
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "permanentFlags"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.permanentFlags));
99
+ return obj;
100
+ }
101
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
102
+ if (!value.isObject()) {
103
+ return false;
104
+ }
105
+ jsi::Object obj = value.getObject(runtime);
106
+ if (!nitro::isPlainObject(runtime, obj)) {
107
+ return false;
108
+ }
109
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false;
110
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "path")))) return false;
111
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uidNext")))) return false;
112
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uidValidity")))) return false;
113
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "messageCount")))) return false;
114
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "recentCount")))) return false;
115
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unseenCount")))) return false;
116
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "firstUnseenUid")))) return false;
117
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "highestModSeq")))) return false;
118
+ if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "flags")))) return false;
119
+ if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "permanentFlags")))) return false;
120
+ return true;
121
+ }
122
+ };
123
+
124
+ } // namespace margelo::nitro
@@ -0,0 +1,100 @@
1
+ ///
2
+ /// MailboxListItem.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 (MailboxListItem).
40
+ */
41
+ struct MailboxListItem final {
42
+ public:
43
+ std::string name SWIFT_PRIVATE;
44
+ std::string path SWIFT_PRIVATE;
45
+ std::string delimiter SWIFT_PRIVATE;
46
+ std::vector<std::string> flags SWIFT_PRIVATE;
47
+ bool subscribed SWIFT_PRIVATE;
48
+
49
+ public:
50
+ MailboxListItem() = default;
51
+ explicit MailboxListItem(std::string name, std::string path, std::string delimiter, std::vector<std::string> flags, bool subscribed): name(name), path(path), delimiter(delimiter), flags(flags), subscribed(subscribed) {}
52
+
53
+ public:
54
+ friend bool operator==(const MailboxListItem& lhs, const MailboxListItem& rhs) = default;
55
+ };
56
+
57
+ } // namespace margelo::nitro::emailimapsmtp
58
+
59
+ namespace margelo::nitro {
60
+
61
+ // C++ MailboxListItem <> JS MailboxListItem (object)
62
+ template <>
63
+ struct JSIConverter<margelo::nitro::emailimapsmtp::MailboxListItem> final {
64
+ static inline margelo::nitro::emailimapsmtp::MailboxListItem fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
65
+ jsi::Object obj = arg.asObject(runtime);
66
+ return margelo::nitro::emailimapsmtp::MailboxListItem(
67
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
68
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "path"))),
69
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "delimiter"))),
70
+ JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "flags"))),
71
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subscribed")))
72
+ );
73
+ }
74
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::emailimapsmtp::MailboxListItem& arg) {
75
+ jsi::Object obj(runtime);
76
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::string>::toJSI(runtime, arg.name));
77
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "path"), JSIConverter<std::string>::toJSI(runtime, arg.path));
78
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "delimiter"), JSIConverter<std::string>::toJSI(runtime, arg.delimiter));
79
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "flags"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.flags));
80
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "subscribed"), JSIConverter<bool>::toJSI(runtime, arg.subscribed));
81
+ return obj;
82
+ }
83
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
84
+ if (!value.isObject()) {
85
+ return false;
86
+ }
87
+ jsi::Object obj = value.getObject(runtime);
88
+ if (!nitro::isPlainObject(runtime, obj)) {
89
+ return false;
90
+ }
91
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false;
92
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "path")))) return false;
93
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "delimiter")))) return false;
94
+ if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "flags")))) return false;
95
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subscribed")))) return false;
96
+ return true;
97
+ }
98
+ };
99
+
100
+ } // namespace margelo::nitro