react-native-nitro-fetch 0.1.7 → 0.2.1

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 (154) hide show
  1. package/android/src/main/java/com/margelo/nitro/nitrofetch/AutoPrefetcher.kt +3 -1
  2. package/android/src/main/java/com/margelo/nitro/nitrofetch/CronetExtensions.kt +31 -0
  3. package/android/src/main/java/com/margelo/nitro/nitrofetch/NitroCronet.kt +89 -0
  4. package/android/src/main/java/com/margelo/nitro/nitrofetch/NitroFetchClient.kt +115 -28
  5. package/android/src/main/java/com/margelo/nitro/nitrofetch/NitroUrlRequest.kt +35 -0
  6. package/android/src/main/java/com/margelo/nitro/nitrofetch/NitroUrlRequestBuilder.kt +181 -0
  7. package/ios/HybridNitroCronet.swift +31 -0
  8. package/ios/HybridUrlRequest.swift +41 -0
  9. package/ios/HybridUrlRequestBuilder.swift +255 -0
  10. package/ios/NitroAutoPrefetcher.swift +3 -1
  11. package/ios/NitroFetchClient.swift +87 -5
  12. package/ios/URLSessionExtensions.swift +36 -0
  13. package/lib/module/NitroCronet.nitro.js +4 -0
  14. package/lib/module/NitroCronet.nitro.js.map +1 -0
  15. package/lib/module/NitroInstances.js +1 -0
  16. package/lib/module/NitroInstances.js.map +1 -1
  17. package/lib/module/fetch.js +179 -9
  18. package/lib/module/fetch.js.map +1 -1
  19. package/lib/typescript/src/NitroCronet.nitro.d.ts +53 -0
  20. package/lib/typescript/src/NitroCronet.nitro.d.ts.map +1 -0
  21. package/lib/typescript/src/NitroFetch.nitro.d.ts +10 -0
  22. package/lib/typescript/src/NitroFetch.nitro.d.ts.map +1 -1
  23. package/lib/typescript/src/NitroInstances.d.ts +3 -1
  24. package/lib/typescript/src/NitroInstances.d.ts.map +1 -1
  25. package/lib/typescript/src/fetch.d.ts +5 -2
  26. package/lib/typescript/src/fetch.d.ts.map +1 -1
  27. package/lib/typescript/src/index.d.ts +1 -1
  28. package/lib/typescript/src/index.d.ts.map +1 -1
  29. package/nitro.json +34 -6
  30. package/nitrogen/generated/android/c++/JFunc_void_UrlResponseInfo.hpp +82 -0
  31. package/nitrogen/generated/android/c++/JFunc_void_UrlResponseInfo_std__shared_ptr_ArrayBuffer__double.hpp +84 -0
  32. package/nitrogen/generated/android/c++/JFunc_void_UrlResponseInfo_std__string.hpp +82 -0
  33. package/nitrogen/generated/android/c++/JFunc_void_std__optional_UrlResponseInfo_.hpp +83 -0
  34. package/nitrogen/generated/android/c++/JFunc_void_std__optional_UrlResponseInfo__RequestException.hpp +85 -0
  35. package/nitrogen/generated/android/c++/JHttpHeader.hpp +61 -0
  36. package/nitrogen/generated/android/c++/JHybridNativeStorageSpec.cpp +23 -16
  37. package/nitrogen/generated/android/c++/JHybridNativeStorageSpec.hpp +20 -21
  38. package/nitrogen/generated/android/c++/JHybridNitroCronetSpec.cpp +57 -0
  39. package/nitrogen/generated/android/c++/JHybridNitroCronetSpec.hpp +63 -0
  40. package/nitrogen/generated/android/c++/JHybridNitroFetchClientSpec.cpp +32 -16
  41. package/nitrogen/generated/android/c++/JHybridNitroFetchClientSpec.hpp +21 -21
  42. package/nitrogen/generated/android/c++/JHybridNitroFetchSpec.cpp +22 -15
  43. package/nitrogen/generated/android/c++/JHybridNitroFetchSpec.hpp +20 -21
  44. package/nitrogen/generated/android/c++/JHybridUrlRequestBuilderSpec.cpp +123 -0
  45. package/nitrogen/generated/android/c++/JHybridUrlRequestBuilderSpec.hpp +73 -0
  46. package/nitrogen/generated/android/c++/JHybridUrlRequestSpec.cpp +69 -0
  47. package/nitrogen/generated/android/c++/JHybridUrlRequestSpec.hpp +67 -0
  48. package/nitrogen/generated/android/c++/JNitroFormDataPart.hpp +74 -0
  49. package/nitrogen/generated/android/c++/JNitroHeader.hpp +7 -3
  50. package/nitrogen/generated/android/c++/JNitroRequest.hpp +39 -6
  51. package/nitrogen/generated/android/c++/JNitroRequestMethod.hpp +9 -10
  52. package/nitrogen/generated/android/c++/JNitroResponse.hpp +9 -4
  53. package/nitrogen/generated/android/c++/JRequestException.hpp +57 -0
  54. package/nitrogen/generated/android/c++/JUrlResponseInfo.hpp +146 -0
  55. package/nitrogen/generated/android/c++/JVariant_ArrayBuffer_String.cpp +26 -0
  56. package/nitrogen/generated/android/c++/JVariant_ArrayBuffer_String.hpp +70 -0
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/Func_void_UrlResponseInfo.kt +80 -0
  58. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/Func_void_UrlResponseInfo_std__shared_ptr_ArrayBuffer__double.kt +80 -0
  59. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/Func_void_UrlResponseInfo_std__string.kt +80 -0
  60. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/Func_void_std__optional_UrlResponseInfo_.kt +80 -0
  61. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/Func_void_std__optional_UrlResponseInfo__RequestException.kt +80 -0
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/HttpHeader.kt +41 -0
  63. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/HybridNativeStorageSpec.kt +18 -16
  64. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/HybridNitroCronetSpec.kt +54 -0
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/HybridNitroFetchClientSpec.kt +23 -16
  66. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/HybridNitroFetchSpec.kt +18 -16
  67. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/HybridUrlRequestBuilderSpec.kt +125 -0
  68. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/HybridUrlRequestSpec.kt +70 -0
  69. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/NitroFormDataPart.kt +50 -0
  70. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/NitroHeader.kt +19 -10
  71. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/NitroRequest.kt +40 -25
  72. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/NitroRequestMethod.kt +3 -1
  73. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/NitroResponse.kt +39 -30
  74. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/RequestException.kt +38 -0
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/UrlResponseInfo.kt +65 -0
  76. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/Variant_ArrayBuffer_String.kt +53 -0
  77. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/nitrofetchOnLoad.kt +1 -1
  78. package/nitrogen/generated/android/nitrofetch+autolinking.cmake +8 -1
  79. package/nitrogen/generated/android/nitrofetch+autolinking.gradle +1 -1
  80. package/nitrogen/generated/android/nitrofetchOnLoad.cpp +85 -33
  81. package/nitrogen/generated/android/nitrofetchOnLoad.hpp +14 -5
  82. package/nitrogen/generated/ios/NitroFetch+autolinking.rb +2 -2
  83. package/nitrogen/generated/ios/NitroFetch-Swift-Cxx-Bridge.cpp +102 -10
  84. package/nitrogen/generated/ios/NitroFetch-Swift-Cxx-Bridge.hpp +359 -24
  85. package/nitrogen/generated/ios/NitroFetch-Swift-Cxx-Umbrella.hpp +32 -1
  86. package/nitrogen/generated/ios/NitroFetchAutolinking.mm +9 -1
  87. package/nitrogen/generated/ios/NitroFetchAutolinking.swift +29 -22
  88. package/nitrogen/generated/ios/c++/HybridNativeStorageSpecSwift.cpp +1 -1
  89. package/nitrogen/generated/ios/c++/HybridNativeStorageSpecSwift.hpp +10 -1
  90. package/nitrogen/generated/ios/c++/HybridNitroCronetSpecSwift.cpp +11 -0
  91. package/nitrogen/generated/ios/c++/HybridNitroCronetSpecSwift.hpp +85 -0
  92. package/nitrogen/generated/ios/c++/HybridNitroFetchClientSpecSwift.cpp +1 -1
  93. package/nitrogen/generated/ios/c++/HybridNitroFetchClientSpecSwift.hpp +22 -4
  94. package/nitrogen/generated/ios/c++/HybridNitroFetchSpecSwift.cpp +1 -1
  95. package/nitrogen/generated/ios/c++/HybridNitroFetchSpecSwift.hpp +10 -1
  96. package/nitrogen/generated/ios/c++/HybridUrlRequestBuilderSpecSwift.cpp +11 -0
  97. package/nitrogen/generated/ios/c++/HybridUrlRequestBuilderSpecSwift.hpp +163 -0
  98. package/nitrogen/generated/ios/c++/HybridUrlRequestSpecSwift.cpp +11 -0
  99. package/nitrogen/generated/ios/c++/HybridUrlRequestSpecSwift.hpp +106 -0
  100. package/nitrogen/generated/ios/swift/Func_void.swift +1 -2
  101. package/nitrogen/generated/ios/swift/Func_void_NitroResponse.swift +1 -2
  102. package/nitrogen/generated/ios/swift/Func_void_UrlResponseInfo.swift +46 -0
  103. package/nitrogen/generated/ios/swift/Func_void_UrlResponseInfo_std__shared_ptr_ArrayBuffer__double.swift +46 -0
  104. package/nitrogen/generated/ios/swift/Func_void_UrlResponseInfo_std__string.swift +46 -0
  105. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -2
  106. package/nitrogen/generated/ios/swift/Func_void_std__optional_UrlResponseInfo_.swift +46 -0
  107. package/nitrogen/generated/ios/swift/Func_void_std__optional_UrlResponseInfo__RequestException.swift +46 -0
  108. package/nitrogen/generated/ios/swift/HttpHeader.swift +34 -0
  109. package/nitrogen/generated/ios/swift/HybridNativeStorageSpec.swift +10 -4
  110. package/nitrogen/generated/ios/swift/HybridNativeStorageSpec_cxx.swift +18 -3
  111. package/nitrogen/generated/ios/swift/HybridNitroCronetSpec.swift +55 -0
  112. package/nitrogen/generated/ios/swift/HybridNitroCronetSpec_cxx.swift +141 -0
  113. package/nitrogen/generated/ios/swift/HybridNitroFetchClientSpec.swift +11 -4
  114. package/nitrogen/generated/ios/swift/HybridNitroFetchClientSpec_cxx.swift +29 -3
  115. package/nitrogen/generated/ios/swift/HybridNitroFetchSpec.swift +10 -4
  116. package/nitrogen/generated/ios/swift/HybridNitroFetchSpec_cxx.swift +18 -3
  117. package/nitrogen/generated/ios/swift/HybridUrlRequestBuilderSpec.swift +65 -0
  118. package/nitrogen/generated/ios/swift/HybridUrlRequestBuilderSpec_cxx.swift +305 -0
  119. package/nitrogen/generated/ios/swift/HybridUrlRequestSpec.swift +59 -0
  120. package/nitrogen/generated/ios/swift/HybridUrlRequestSpec_cxx.swift +182 -0
  121. package/nitrogen/generated/ios/swift/NitroFormDataPart.swift +101 -0
  122. package/nitrogen/generated/ios/swift/NitroHeader.swift +5 -17
  123. package/nitrogen/generated/ios/swift/NitroRequest.swift +111 -121
  124. package/nitrogen/generated/ios/swift/NitroRequestMethod.swift +1 -1
  125. package/nitrogen/generated/ios/swift/NitroResponse.swift +40 -97
  126. package/nitrogen/generated/ios/swift/RequestException.swift +29 -0
  127. package/nitrogen/generated/ios/swift/UrlResponseInfo.swift +118 -0
  128. package/nitrogen/generated/ios/swift/Variant_ArrayBuffer_String.swift +18 -0
  129. package/nitrogen/generated/shared/c++/HttpHeader.hpp +87 -0
  130. package/nitrogen/generated/shared/c++/HybridNativeStorageSpec.cpp +1 -1
  131. package/nitrogen/generated/shared/c++/HybridNativeStorageSpec.hpp +1 -1
  132. package/nitrogen/generated/shared/c++/HybridNitroCronetSpec.cpp +21 -0
  133. package/nitrogen/generated/shared/c++/HybridNitroCronetSpec.hpp +65 -0
  134. package/nitrogen/generated/shared/c++/HybridNitroFetchClientSpec.cpp +2 -1
  135. package/nitrogen/generated/shared/c++/HybridNitroFetchClientSpec.hpp +3 -1
  136. package/nitrogen/generated/shared/c++/HybridNitroFetchSpec.cpp +1 -1
  137. package/nitrogen/generated/shared/c++/HybridNitroFetchSpec.hpp +1 -1
  138. package/nitrogen/generated/shared/c++/HybridUrlRequestBuilderSpec.cpp +31 -0
  139. package/nitrogen/generated/shared/c++/HybridUrlRequestBuilderSpec.hpp +85 -0
  140. package/nitrogen/generated/shared/c++/HybridUrlRequestSpec.cpp +25 -0
  141. package/nitrogen/generated/shared/c++/HybridUrlRequestSpec.hpp +66 -0
  142. package/nitrogen/generated/shared/c++/NitroFormDataPart.hpp +100 -0
  143. package/nitrogen/generated/shared/c++/NitroHeader.hpp +24 -8
  144. package/nitrogen/generated/shared/c++/NitroRequest.hpp +51 -24
  145. package/nitrogen/generated/shared/c++/NitroRequestMethod.hpp +1 -1
  146. package/nitrogen/generated/shared/c++/NitroResponse.hpp +42 -26
  147. package/nitrogen/generated/shared/c++/RequestException.hpp +83 -0
  148. package/nitrogen/generated/shared/c++/UrlResponseInfo.hpp +123 -0
  149. package/package.json +13 -10
  150. package/src/NitroCronet.nitro.ts +72 -0
  151. package/src/NitroFetch.nitro.ts +28 -6
  152. package/src/NitroInstances.ts +4 -0
  153. package/src/fetch.ts +214 -13
  154. package/src/index.tsx +1 -1
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// Func_void_UrlResponseInfo.kt
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
+ package com.margelo.nitro.nitrofetch
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
14
+
15
+
16
+ /**
17
+ * Represents the JavaScript callback `(info: struct) => void`.
18
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
19
+ * or in Kotlin/Java (in which case it is a native callback).
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress("ClassName", "RedundantUnitReturnType")
24
+ fun interface Func_void_UrlResponseInfo: (UrlResponseInfo) -> Unit {
25
+ /**
26
+ * Call the given JS callback.
27
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
28
+ */
29
+ @DoNotStrip
30
+ @Keep
31
+ override fun invoke(info: UrlResponseInfo): Unit
32
+ }
33
+
34
+ /**
35
+ * Represents the JavaScript callback `(info: struct) => void`.
36
+ * This is implemented in C++, via a `std::function<...>`.
37
+ * The callback might be coming from JS.
38
+ */
39
+ @DoNotStrip
40
+ @Keep
41
+ @Suppress(
42
+ "KotlinJniMissingFunction", "unused",
43
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
44
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
45
+ )
46
+ class Func_void_UrlResponseInfo_cxx: Func_void_UrlResponseInfo {
47
+ @DoNotStrip
48
+ @Keep
49
+ private val mHybridData: HybridData
50
+
51
+ @DoNotStrip
52
+ @Keep
53
+ private constructor(hybridData: HybridData) {
54
+ mHybridData = hybridData
55
+ }
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ override fun invoke(info: UrlResponseInfo): Unit
60
+ = invoke_cxx(info)
61
+
62
+ @FastNative
63
+ private external fun invoke_cxx(info: UrlResponseInfo): Unit
64
+ }
65
+
66
+ /**
67
+ * Represents the JavaScript callback `(info: struct) => void`.
68
+ * This is implemented in Java/Kotlin, via a `(UrlResponseInfo) -> Unit`.
69
+ * The callback is always coming from native.
70
+ */
71
+ @DoNotStrip
72
+ @Keep
73
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
74
+ class Func_void_UrlResponseInfo_java(private val function: (UrlResponseInfo) -> Unit): Func_void_UrlResponseInfo {
75
+ @DoNotStrip
76
+ @Keep
77
+ override fun invoke(info: UrlResponseInfo): Unit {
78
+ return this.function(info)
79
+ }
80
+ }
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// Func_void_UrlResponseInfo_std__shared_ptr_ArrayBuffer__double.kt
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
+ package com.margelo.nitro.nitrofetch
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
14
+ import com.margelo.nitro.core.ArrayBuffer
15
+
16
+ /**
17
+ * Represents the JavaScript callback `(info: struct, byteBuffer: array-buffer, bytesRead: number) => void`.
18
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
19
+ * or in Kotlin/Java (in which case it is a native callback).
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress("ClassName", "RedundantUnitReturnType")
24
+ fun interface Func_void_UrlResponseInfo_std__shared_ptr_ArrayBuffer__double: (UrlResponseInfo, ArrayBuffer, Double) -> Unit {
25
+ /**
26
+ * Call the given JS callback.
27
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
28
+ */
29
+ @DoNotStrip
30
+ @Keep
31
+ override fun invoke(info: UrlResponseInfo, byteBuffer: ArrayBuffer, bytesRead: Double): Unit
32
+ }
33
+
34
+ /**
35
+ * Represents the JavaScript callback `(info: struct, byteBuffer: array-buffer, bytesRead: number) => void`.
36
+ * This is implemented in C++, via a `std::function<...>`.
37
+ * The callback might be coming from JS.
38
+ */
39
+ @DoNotStrip
40
+ @Keep
41
+ @Suppress(
42
+ "KotlinJniMissingFunction", "unused",
43
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
44
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
45
+ )
46
+ class Func_void_UrlResponseInfo_std__shared_ptr_ArrayBuffer__double_cxx: Func_void_UrlResponseInfo_std__shared_ptr_ArrayBuffer__double {
47
+ @DoNotStrip
48
+ @Keep
49
+ private val mHybridData: HybridData
50
+
51
+ @DoNotStrip
52
+ @Keep
53
+ private constructor(hybridData: HybridData) {
54
+ mHybridData = hybridData
55
+ }
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ override fun invoke(info: UrlResponseInfo, byteBuffer: ArrayBuffer, bytesRead: Double): Unit
60
+ = invoke_cxx(info,byteBuffer,bytesRead)
61
+
62
+ @FastNative
63
+ private external fun invoke_cxx(info: UrlResponseInfo, byteBuffer: ArrayBuffer, bytesRead: Double): Unit
64
+ }
65
+
66
+ /**
67
+ * Represents the JavaScript callback `(info: struct, byteBuffer: array-buffer, bytesRead: number) => void`.
68
+ * This is implemented in Java/Kotlin, via a `(UrlResponseInfo, ArrayBuffer, Double) -> Unit`.
69
+ * The callback is always coming from native.
70
+ */
71
+ @DoNotStrip
72
+ @Keep
73
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
74
+ class Func_void_UrlResponseInfo_std__shared_ptr_ArrayBuffer__double_java(private val function: (UrlResponseInfo, ArrayBuffer, Double) -> Unit): Func_void_UrlResponseInfo_std__shared_ptr_ArrayBuffer__double {
75
+ @DoNotStrip
76
+ @Keep
77
+ override fun invoke(info: UrlResponseInfo, byteBuffer: ArrayBuffer, bytesRead: Double): Unit {
78
+ return this.function(info, byteBuffer, bytesRead)
79
+ }
80
+ }
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// Func_void_UrlResponseInfo_std__string.kt
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
+ package com.margelo.nitro.nitrofetch
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
14
+
15
+
16
+ /**
17
+ * Represents the JavaScript callback `(info: struct, newLocationUrl: string) => void`.
18
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
19
+ * or in Kotlin/Java (in which case it is a native callback).
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress("ClassName", "RedundantUnitReturnType")
24
+ fun interface Func_void_UrlResponseInfo_std__string: (UrlResponseInfo, String) -> Unit {
25
+ /**
26
+ * Call the given JS callback.
27
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
28
+ */
29
+ @DoNotStrip
30
+ @Keep
31
+ override fun invoke(info: UrlResponseInfo, newLocationUrl: String): Unit
32
+ }
33
+
34
+ /**
35
+ * Represents the JavaScript callback `(info: struct, newLocationUrl: string) => void`.
36
+ * This is implemented in C++, via a `std::function<...>`.
37
+ * The callback might be coming from JS.
38
+ */
39
+ @DoNotStrip
40
+ @Keep
41
+ @Suppress(
42
+ "KotlinJniMissingFunction", "unused",
43
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
44
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
45
+ )
46
+ class Func_void_UrlResponseInfo_std__string_cxx: Func_void_UrlResponseInfo_std__string {
47
+ @DoNotStrip
48
+ @Keep
49
+ private val mHybridData: HybridData
50
+
51
+ @DoNotStrip
52
+ @Keep
53
+ private constructor(hybridData: HybridData) {
54
+ mHybridData = hybridData
55
+ }
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ override fun invoke(info: UrlResponseInfo, newLocationUrl: String): Unit
60
+ = invoke_cxx(info,newLocationUrl)
61
+
62
+ @FastNative
63
+ private external fun invoke_cxx(info: UrlResponseInfo, newLocationUrl: String): Unit
64
+ }
65
+
66
+ /**
67
+ * Represents the JavaScript callback `(info: struct, newLocationUrl: string) => void`.
68
+ * This is implemented in Java/Kotlin, via a `(UrlResponseInfo, String) -> Unit`.
69
+ * The callback is always coming from native.
70
+ */
71
+ @DoNotStrip
72
+ @Keep
73
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
74
+ class Func_void_UrlResponseInfo_std__string_java(private val function: (UrlResponseInfo, String) -> Unit): Func_void_UrlResponseInfo_std__string {
75
+ @DoNotStrip
76
+ @Keep
77
+ override fun invoke(info: UrlResponseInfo, newLocationUrl: String): Unit {
78
+ return this.function(info, newLocationUrl)
79
+ }
80
+ }
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// Func_void_std__optional_UrlResponseInfo_.kt
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
+ package com.margelo.nitro.nitrofetch
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
14
+
15
+
16
+ /**
17
+ * Represents the JavaScript callback `(info: optional) => void`.
18
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
19
+ * or in Kotlin/Java (in which case it is a native callback).
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress("ClassName", "RedundantUnitReturnType")
24
+ fun interface Func_void_std__optional_UrlResponseInfo_: (UrlResponseInfo?) -> Unit {
25
+ /**
26
+ * Call the given JS callback.
27
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
28
+ */
29
+ @DoNotStrip
30
+ @Keep
31
+ override fun invoke(info: UrlResponseInfo?): Unit
32
+ }
33
+
34
+ /**
35
+ * Represents the JavaScript callback `(info: optional) => void`.
36
+ * This is implemented in C++, via a `std::function<...>`.
37
+ * The callback might be coming from JS.
38
+ */
39
+ @DoNotStrip
40
+ @Keep
41
+ @Suppress(
42
+ "KotlinJniMissingFunction", "unused",
43
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
44
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
45
+ )
46
+ class Func_void_std__optional_UrlResponseInfo__cxx: Func_void_std__optional_UrlResponseInfo_ {
47
+ @DoNotStrip
48
+ @Keep
49
+ private val mHybridData: HybridData
50
+
51
+ @DoNotStrip
52
+ @Keep
53
+ private constructor(hybridData: HybridData) {
54
+ mHybridData = hybridData
55
+ }
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ override fun invoke(info: UrlResponseInfo?): Unit
60
+ = invoke_cxx(info)
61
+
62
+ @FastNative
63
+ private external fun invoke_cxx(info: UrlResponseInfo?): Unit
64
+ }
65
+
66
+ /**
67
+ * Represents the JavaScript callback `(info: optional) => void`.
68
+ * This is implemented in Java/Kotlin, via a `(UrlResponseInfo?) -> Unit`.
69
+ * The callback is always coming from native.
70
+ */
71
+ @DoNotStrip
72
+ @Keep
73
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
74
+ class Func_void_std__optional_UrlResponseInfo__java(private val function: (UrlResponseInfo?) -> Unit): Func_void_std__optional_UrlResponseInfo_ {
75
+ @DoNotStrip
76
+ @Keep
77
+ override fun invoke(info: UrlResponseInfo?): Unit {
78
+ return this.function(info)
79
+ }
80
+ }
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// Func_void_std__optional_UrlResponseInfo__RequestException.kt
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
+ package com.margelo.nitro.nitrofetch
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
14
+
15
+
16
+ /**
17
+ * Represents the JavaScript callback `(info: optional, error: struct) => void`.
18
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
19
+ * or in Kotlin/Java (in which case it is a native callback).
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress("ClassName", "RedundantUnitReturnType")
24
+ fun interface Func_void_std__optional_UrlResponseInfo__RequestException: (UrlResponseInfo?, RequestException) -> Unit {
25
+ /**
26
+ * Call the given JS callback.
27
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
28
+ */
29
+ @DoNotStrip
30
+ @Keep
31
+ override fun invoke(info: UrlResponseInfo?, error: RequestException): Unit
32
+ }
33
+
34
+ /**
35
+ * Represents the JavaScript callback `(info: optional, error: struct) => void`.
36
+ * This is implemented in C++, via a `std::function<...>`.
37
+ * The callback might be coming from JS.
38
+ */
39
+ @DoNotStrip
40
+ @Keep
41
+ @Suppress(
42
+ "KotlinJniMissingFunction", "unused",
43
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
44
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
45
+ )
46
+ class Func_void_std__optional_UrlResponseInfo__RequestException_cxx: Func_void_std__optional_UrlResponseInfo__RequestException {
47
+ @DoNotStrip
48
+ @Keep
49
+ private val mHybridData: HybridData
50
+
51
+ @DoNotStrip
52
+ @Keep
53
+ private constructor(hybridData: HybridData) {
54
+ mHybridData = hybridData
55
+ }
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ override fun invoke(info: UrlResponseInfo?, error: RequestException): Unit
60
+ = invoke_cxx(info,error)
61
+
62
+ @FastNative
63
+ private external fun invoke_cxx(info: UrlResponseInfo?, error: RequestException): Unit
64
+ }
65
+
66
+ /**
67
+ * Represents the JavaScript callback `(info: optional, error: struct) => void`.
68
+ * This is implemented in Java/Kotlin, via a `(UrlResponseInfo?, RequestException) -> Unit`.
69
+ * The callback is always coming from native.
70
+ */
71
+ @DoNotStrip
72
+ @Keep
73
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
74
+ class Func_void_std__optional_UrlResponseInfo__RequestException_java(private val function: (UrlResponseInfo?, RequestException) -> Unit): Func_void_std__optional_UrlResponseInfo__RequestException {
75
+ @DoNotStrip
76
+ @Keep
77
+ override fun invoke(info: UrlResponseInfo?, error: RequestException): Unit {
78
+ return this.function(info, error)
79
+ }
80
+ }
@@ -0,0 +1,41 @@
1
+ ///
2
+ /// HttpHeader.kt
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
+ package com.margelo.nitro.nitrofetch
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "HttpHeader".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class HttpHeader(
20
+ @DoNotStrip
21
+ @Keep
22
+ val key: String,
23
+ @DoNotStrip
24
+ @Keep
25
+ val value: String
26
+ ) {
27
+ /* primary constructor */
28
+
29
+ companion object {
30
+ /**
31
+ * Constructor called from C++
32
+ */
33
+ @DoNotStrip
34
+ @Keep
35
+ @Suppress("unused")
36
+ @JvmStatic
37
+ private fun fromCpp(key: String, value: String): HttpHeader {
38
+ return HttpHeader(key, value)
39
+ }
40
+ }
41
+ }
@@ -2,7 +2,7 @@
2
2
  /// HybridNativeStorageSpec.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.nitrofetch
@@ -10,7 +10,7 @@ package com.margelo.nitro.nitrofetch
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.jni.HybridData
12
12
  import com.facebook.proguard.annotations.DoNotStrip
13
- import com.margelo.nitro.core.*
13
+ import com.margelo.nitro.core.HybridObject
14
14
 
15
15
  /**
16
16
  * A Kotlin class representing the NativeStorage HybridObject.
@@ -24,18 +24,6 @@ import com.margelo.nitro.core.*
24
24
  "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
25
25
  )
26
26
  abstract class HybridNativeStorageSpec: HybridObject() {
27
- @DoNotStrip
28
- private var mHybridData: HybridData = initHybrid()
29
-
30
- init {
31
- super.updateNative(mHybridData)
32
- }
33
-
34
- override fun updateNative(hybridData: HybridData) {
35
- mHybridData = hybridData
36
- super.updateNative(hybridData)
37
- }
38
-
39
27
  // Properties
40
28
 
41
29
 
@@ -52,9 +40,23 @@ abstract class HybridNativeStorageSpec: HybridObject() {
52
40
  @Keep
53
41
  abstract fun removeString(key: String): Unit
54
42
 
55
- private external fun initHybrid(): HybridData
43
+ // Default implementation of `HybridObject.toString()`
44
+ override fun toString(): String {
45
+ return "[HybridObject NativeStorage]"
46
+ }
47
+
48
+ // C++ backing class
49
+ @DoNotStrip
50
+ @Keep
51
+ protected open class CxxPart(javaPart: HybridNativeStorageSpec): HybridObject.CxxPart(javaPart) {
52
+ // C++ JHybridNativeStorageSpec::CxxPart::initHybrid(...)
53
+ external override fun initHybrid(): HybridData
54
+ }
55
+ override fun createCxxPart(): CxxPart {
56
+ return CxxPart(this)
57
+ }
56
58
 
57
59
  companion object {
58
- private const val TAG = "HybridNativeStorageSpec"
60
+ protected const val TAG = "HybridNativeStorageSpec"
59
61
  }
60
62
  }
@@ -0,0 +1,54 @@
1
+ ///
2
+ /// HybridNitroCronetSpec.kt
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
+ package com.margelo.nitro.nitrofetch
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.HybridObject
14
+
15
+ /**
16
+ * A Kotlin class representing the NitroCronet HybridObject.
17
+ * Implement this abstract class to create Kotlin-based instances of NitroCronet.
18
+ */
19
+ @DoNotStrip
20
+ @Keep
21
+ @Suppress(
22
+ "KotlinJniMissingFunction", "unused",
23
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
24
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
25
+ )
26
+ abstract class HybridNitroCronetSpec: HybridObject() {
27
+ // Properties
28
+
29
+
30
+ // Methods
31
+ @DoNotStrip
32
+ @Keep
33
+ abstract fun newUrlRequestBuilder(url: String): HybridUrlRequestBuilderSpec
34
+
35
+ // Default implementation of `HybridObject.toString()`
36
+ override fun toString(): String {
37
+ return "[HybridObject NitroCronet]"
38
+ }
39
+
40
+ // C++ backing class
41
+ @DoNotStrip
42
+ @Keep
43
+ protected open class CxxPart(javaPart: HybridNitroCronetSpec): HybridObject.CxxPart(javaPart) {
44
+ // C++ JHybridNitroCronetSpec::CxxPart::initHybrid(...)
45
+ external override fun initHybrid(): HybridData
46
+ }
47
+ override fun createCxxPart(): CxxPart {
48
+ return CxxPart(this)
49
+ }
50
+
51
+ companion object {
52
+ protected const val TAG = "HybridNitroCronetSpec"
53
+ }
54
+ }
@@ -2,7 +2,7 @@
2
2
  /// HybridNitroFetchClientSpec.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.nitrofetch
@@ -10,7 +10,8 @@ package com.margelo.nitro.nitrofetch
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.jni.HybridData
12
12
  import com.facebook.proguard.annotations.DoNotStrip
13
- import com.margelo.nitro.core.*
13
+ import com.margelo.nitro.core.Promise
14
+ import com.margelo.nitro.core.HybridObject
14
15
 
15
16
  /**
16
17
  * A Kotlin class representing the NitroFetchClient HybridObject.
@@ -24,18 +25,6 @@ import com.margelo.nitro.core.*
24
25
  "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
25
26
  )
26
27
  abstract class HybridNitroFetchClientSpec: HybridObject() {
27
- @DoNotStrip
28
- private var mHybridData: HybridData = initHybrid()
29
-
30
- init {
31
- super.updateNative(mHybridData)
32
- }
33
-
34
- override fun updateNative(hybridData: HybridData) {
35
- mHybridData = hybridData
36
- super.updateNative(hybridData)
37
- }
38
-
39
28
  // Properties
40
29
 
41
30
 
@@ -51,10 +40,28 @@ abstract class HybridNitroFetchClientSpec: HybridObject() {
51
40
  @DoNotStrip
52
41
  @Keep
53
42
  abstract fun requestSync(req: NitroRequest): NitroResponse
43
+
44
+ @DoNotStrip
45
+ @Keep
46
+ abstract fun cancelRequest(requestId: String): Unit
47
+
48
+ // Default implementation of `HybridObject.toString()`
49
+ override fun toString(): String {
50
+ return "[HybridObject NitroFetchClient]"
51
+ }
54
52
 
55
- private external fun initHybrid(): HybridData
53
+ // C++ backing class
54
+ @DoNotStrip
55
+ @Keep
56
+ protected open class CxxPart(javaPart: HybridNitroFetchClientSpec): HybridObject.CxxPart(javaPart) {
57
+ // C++ JHybridNitroFetchClientSpec::CxxPart::initHybrid(...)
58
+ external override fun initHybrid(): HybridData
59
+ }
60
+ override fun createCxxPart(): CxxPart {
61
+ return CxxPart(this)
62
+ }
56
63
 
57
64
  companion object {
58
- private const val TAG = "HybridNitroFetchClientSpec"
65
+ protected const val TAG = "HybridNitroFetchClientSpec"
59
66
  }
60
67
  }
@@ -2,7 +2,7 @@
2
2
  /// HybridNitroFetchSpec.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.nitrofetch
@@ -10,7 +10,7 @@ package com.margelo.nitro.nitrofetch
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.jni.HybridData
12
12
  import com.facebook.proguard.annotations.DoNotStrip
13
- import com.margelo.nitro.core.*
13
+ import com.margelo.nitro.core.HybridObject
14
14
 
15
15
  /**
16
16
  * A Kotlin class representing the NitroFetch HybridObject.
@@ -24,18 +24,6 @@ import com.margelo.nitro.core.*
24
24
  "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
25
25
  )
26
26
  abstract class HybridNitroFetchSpec: HybridObject() {
27
- @DoNotStrip
28
- private var mHybridData: HybridData = initHybrid()
29
-
30
- init {
31
- super.updateNative(mHybridData)
32
- }
33
-
34
- override fun updateNative(hybridData: HybridData) {
35
- mHybridData = hybridData
36
- super.updateNative(hybridData)
37
- }
38
-
39
27
  // Properties
40
28
 
41
29
 
@@ -44,9 +32,23 @@ abstract class HybridNitroFetchSpec: HybridObject() {
44
32
  @Keep
45
33
  abstract fun createClient(): HybridNitroFetchClientSpec
46
34
 
47
- private external fun initHybrid(): HybridData
35
+ // Default implementation of `HybridObject.toString()`
36
+ override fun toString(): String {
37
+ return "[HybridObject NitroFetch]"
38
+ }
39
+
40
+ // C++ backing class
41
+ @DoNotStrip
42
+ @Keep
43
+ protected open class CxxPart(javaPart: HybridNitroFetchSpec): HybridObject.CxxPart(javaPart) {
44
+ // C++ JHybridNitroFetchSpec::CxxPart::initHybrid(...)
45
+ external override fun initHybrid(): HybridData
46
+ }
47
+ override fun createCxxPart(): CxxPart {
48
+ return CxxPart(this)
49
+ }
48
50
 
49
51
  companion object {
50
- private const val TAG = "HybridNitroFetchSpec"
52
+ protected const val TAG = "HybridNitroFetchSpec"
51
53
  }
52
54
  }