react-native-nitro-fetch 0.1.7 → 0.2.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.
- package/android/src/main/java/com/margelo/nitro/nitrofetch/AutoPrefetcher.kt +3 -1
- package/android/src/main/java/com/margelo/nitro/nitrofetch/CronetExtensions.kt +31 -0
- package/android/src/main/java/com/margelo/nitro/nitrofetch/NitroCronet.kt +89 -0
- package/android/src/main/java/com/margelo/nitro/nitrofetch/NitroFetchClient.kt +115 -28
- package/android/src/main/java/com/margelo/nitro/nitrofetch/NitroUrlRequest.kt +35 -0
- package/android/src/main/java/com/margelo/nitro/nitrofetch/NitroUrlRequestBuilder.kt +181 -0
- package/ios/HybridNitroCronet.swift +31 -0
- package/ios/HybridUrlRequest.swift +41 -0
- package/ios/HybridUrlRequestBuilder.swift +255 -0
- package/ios/NitroAutoPrefetcher.swift +3 -1
- package/ios/NitroFetchClient.swift +87 -5
- package/ios/URLSessionExtensions.swift +36 -0
- package/lib/module/NitroCronet.nitro.js +4 -0
- package/lib/module/NitroCronet.nitro.js.map +1 -0
- package/lib/module/NitroInstances.js +1 -0
- package/lib/module/NitroInstances.js.map +1 -1
- package/lib/module/fetch.js +179 -9
- package/lib/module/fetch.js.map +1 -1
- package/lib/typescript/src/NitroCronet.nitro.d.ts +53 -0
- package/lib/typescript/src/NitroCronet.nitro.d.ts.map +1 -0
- package/lib/typescript/src/NitroFetch.nitro.d.ts +10 -0
- package/lib/typescript/src/NitroFetch.nitro.d.ts.map +1 -1
- package/lib/typescript/src/NitroInstances.d.ts +3 -1
- package/lib/typescript/src/NitroInstances.d.ts.map +1 -1
- package/lib/typescript/src/fetch.d.ts +5 -2
- package/lib/typescript/src/fetch.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitro.json +34 -6
- package/nitrogen/generated/android/c++/JFunc_void_UrlResponseInfo.hpp +82 -0
- package/nitrogen/generated/android/c++/JFunc_void_UrlResponseInfo_std__shared_ptr_ArrayBuffer__double.hpp +84 -0
- package/nitrogen/generated/android/c++/JFunc_void_UrlResponseInfo_std__string.hpp +82 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__optional_UrlResponseInfo_.hpp +83 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__optional_UrlResponseInfo__RequestException.hpp +85 -0
- package/nitrogen/generated/android/c++/JHttpHeader.hpp +61 -0
- package/nitrogen/generated/android/c++/JHybridNativeStorageSpec.cpp +23 -16
- package/nitrogen/generated/android/c++/JHybridNativeStorageSpec.hpp +20 -21
- package/nitrogen/generated/android/c++/JHybridNitroCronetSpec.cpp +57 -0
- package/nitrogen/generated/android/c++/JHybridNitroCronetSpec.hpp +63 -0
- package/nitrogen/generated/android/c++/JHybridNitroFetchClientSpec.cpp +32 -16
- package/nitrogen/generated/android/c++/JHybridNitroFetchClientSpec.hpp +21 -21
- package/nitrogen/generated/android/c++/JHybridNitroFetchSpec.cpp +22 -15
- package/nitrogen/generated/android/c++/JHybridNitroFetchSpec.hpp +20 -21
- package/nitrogen/generated/android/c++/JHybridUrlRequestBuilderSpec.cpp +123 -0
- package/nitrogen/generated/android/c++/JHybridUrlRequestBuilderSpec.hpp +73 -0
- package/nitrogen/generated/android/c++/JHybridUrlRequestSpec.cpp +69 -0
- package/nitrogen/generated/android/c++/JHybridUrlRequestSpec.hpp +67 -0
- package/nitrogen/generated/android/c++/JNitroFormDataPart.hpp +74 -0
- package/nitrogen/generated/android/c++/JNitroHeader.hpp +7 -3
- package/nitrogen/generated/android/c++/JNitroRequest.hpp +39 -6
- package/nitrogen/generated/android/c++/JNitroRequestMethod.hpp +9 -10
- package/nitrogen/generated/android/c++/JNitroResponse.hpp +9 -4
- package/nitrogen/generated/android/c++/JRequestException.hpp +57 -0
- package/nitrogen/generated/android/c++/JUrlResponseInfo.hpp +146 -0
- package/nitrogen/generated/android/c++/JVariant_ArrayBuffer_String.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_ArrayBuffer_String.hpp +70 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/Func_void_UrlResponseInfo.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/Func_void_UrlResponseInfo_std__shared_ptr_ArrayBuffer__double.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/Func_void_UrlResponseInfo_std__string.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/Func_void_std__optional_UrlResponseInfo_.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/Func_void_std__optional_UrlResponseInfo__RequestException.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/HttpHeader.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/HybridNativeStorageSpec.kt +18 -16
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/HybridNitroCronetSpec.kt +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/HybridNitroFetchClientSpec.kt +23 -16
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/HybridNitroFetchSpec.kt +18 -16
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/HybridUrlRequestBuilderSpec.kt +125 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/HybridUrlRequestSpec.kt +70 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/NitroFormDataPart.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/NitroHeader.kt +19 -10
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/NitroRequest.kt +40 -25
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/NitroRequestMethod.kt +3 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/NitroResponse.kt +39 -30
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/RequestException.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/UrlResponseInfo.kt +65 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/Variant_ArrayBuffer_String.kt +53 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrofetch/nitrofetchOnLoad.kt +1 -1
- package/nitrogen/generated/android/nitrofetch+autolinking.cmake +8 -1
- package/nitrogen/generated/android/nitrofetch+autolinking.gradle +1 -1
- package/nitrogen/generated/android/nitrofetchOnLoad.cpp +85 -33
- package/nitrogen/generated/android/nitrofetchOnLoad.hpp +14 -5
- package/nitrogen/generated/ios/NitroFetch+autolinking.rb +2 -2
- package/nitrogen/generated/ios/NitroFetch-Swift-Cxx-Bridge.cpp +102 -10
- package/nitrogen/generated/ios/NitroFetch-Swift-Cxx-Bridge.hpp +359 -24
- package/nitrogen/generated/ios/NitroFetch-Swift-Cxx-Umbrella.hpp +32 -1
- package/nitrogen/generated/ios/NitroFetchAutolinking.mm +9 -1
- package/nitrogen/generated/ios/NitroFetchAutolinking.swift +29 -22
- package/nitrogen/generated/ios/c++/HybridNativeStorageSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridNativeStorageSpecSwift.hpp +10 -1
- package/nitrogen/generated/ios/c++/HybridNitroCronetSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroCronetSpecSwift.hpp +85 -0
- package/nitrogen/generated/ios/c++/HybridNitroFetchClientSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridNitroFetchClientSpecSwift.hpp +22 -4
- package/nitrogen/generated/ios/c++/HybridNitroFetchSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridNitroFetchSpecSwift.hpp +10 -1
- package/nitrogen/generated/ios/c++/HybridUrlRequestBuilderSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridUrlRequestBuilderSpecSwift.hpp +163 -0
- package/nitrogen/generated/ios/c++/HybridUrlRequestSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridUrlRequestSpecSwift.hpp +106 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_NitroResponse.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_UrlResponseInfo.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_UrlResponseInfo_std__shared_ptr_ArrayBuffer__double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_UrlResponseInfo_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_std__optional_UrlResponseInfo_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_UrlResponseInfo__RequestException.swift +46 -0
- package/nitrogen/generated/ios/swift/HttpHeader.swift +34 -0
- package/nitrogen/generated/ios/swift/HybridNativeStorageSpec.swift +10 -4
- package/nitrogen/generated/ios/swift/HybridNativeStorageSpec_cxx.swift +18 -3
- package/nitrogen/generated/ios/swift/HybridNitroCronetSpec.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridNitroCronetSpec_cxx.swift +141 -0
- package/nitrogen/generated/ios/swift/HybridNitroFetchClientSpec.swift +11 -4
- package/nitrogen/generated/ios/swift/HybridNitroFetchClientSpec_cxx.swift +29 -3
- package/nitrogen/generated/ios/swift/HybridNitroFetchSpec.swift +10 -4
- package/nitrogen/generated/ios/swift/HybridNitroFetchSpec_cxx.swift +18 -3
- package/nitrogen/generated/ios/swift/HybridUrlRequestBuilderSpec.swift +65 -0
- package/nitrogen/generated/ios/swift/HybridUrlRequestBuilderSpec_cxx.swift +305 -0
- package/nitrogen/generated/ios/swift/HybridUrlRequestSpec.swift +59 -0
- package/nitrogen/generated/ios/swift/HybridUrlRequestSpec_cxx.swift +182 -0
- package/nitrogen/generated/ios/swift/NitroFormDataPart.swift +101 -0
- package/nitrogen/generated/ios/swift/NitroHeader.swift +5 -17
- package/nitrogen/generated/ios/swift/NitroRequest.swift +111 -121
- package/nitrogen/generated/ios/swift/NitroRequestMethod.swift +1 -1
- package/nitrogen/generated/ios/swift/NitroResponse.swift +40 -97
- package/nitrogen/generated/ios/swift/RequestException.swift +29 -0
- package/nitrogen/generated/ios/swift/UrlResponseInfo.swift +118 -0
- package/nitrogen/generated/ios/swift/Variant_ArrayBuffer_String.swift +18 -0
- package/nitrogen/generated/shared/c++/HttpHeader.hpp +87 -0
- package/nitrogen/generated/shared/c++/HybridNativeStorageSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNativeStorageSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNitroCronetSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridNitroCronetSpec.hpp +65 -0
- package/nitrogen/generated/shared/c++/HybridNitroFetchClientSpec.cpp +2 -1
- package/nitrogen/generated/shared/c++/HybridNitroFetchClientSpec.hpp +3 -1
- package/nitrogen/generated/shared/c++/HybridNitroFetchSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNitroFetchSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUrlRequestBuilderSpec.cpp +31 -0
- package/nitrogen/generated/shared/c++/HybridUrlRequestBuilderSpec.hpp +85 -0
- package/nitrogen/generated/shared/c++/HybridUrlRequestSpec.cpp +25 -0
- package/nitrogen/generated/shared/c++/HybridUrlRequestSpec.hpp +66 -0
- package/nitrogen/generated/shared/c++/NitroFormDataPart.hpp +100 -0
- package/nitrogen/generated/shared/c++/NitroHeader.hpp +24 -8
- package/nitrogen/generated/shared/c++/NitroRequest.hpp +51 -24
- package/nitrogen/generated/shared/c++/NitroRequestMethod.hpp +1 -1
- package/nitrogen/generated/shared/c++/NitroResponse.hpp +42 -26
- package/nitrogen/generated/shared/c++/RequestException.hpp +83 -0
- package/nitrogen/generated/shared/c++/UrlResponseInfo.hpp +123 -0
- package/package.json +10 -10
- package/src/NitroCronet.nitro.ts +72 -0
- package/src/NitroFetch.nitro.ts +28 -6
- package/src/NitroInstances.ts +4 -0
- package/src/fetch.ts +214 -13
- package/src/index.tsx +1 -1
|
@@ -2,19 +2,16 @@
|
|
|
2
2
|
/// NitroFetchAutolinking.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
8
12
|
public final class NitroFetchAutolinking {
|
|
9
13
|
public typealias bridge = margelo.nitro.nitrofetch.bridge.swift
|
|
10
14
|
|
|
11
|
-
/**
|
|
12
|
-
* Creates an instance of a Swift class that implements `HybridNitroFetchSpec`,
|
|
13
|
-
* and wraps it in a Swift class that can directly interop with C++ (`HybridNitroFetchSpec_cxx`)
|
|
14
|
-
*
|
|
15
|
-
* This is generated by Nitrogen and will initialize the class specified
|
|
16
|
-
* in the `"autolinking"` property of `nitro.json` (in this case, `NitroFetch`).
|
|
17
|
-
*/
|
|
18
15
|
public static func createNitroFetch() -> bridge.std__shared_ptr_HybridNitroFetchSpec_ {
|
|
19
16
|
let hybridObject = NitroFetch()
|
|
20
17
|
return { () -> bridge.std__shared_ptr_HybridNitroFetchSpec_ in
|
|
@@ -23,13 +20,10 @@ public final class NitroFetchAutolinking {
|
|
|
23
20
|
}()
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* This is generated by Nitrogen and will initialize the class specified
|
|
31
|
-
* in the `"autolinking"` property of `nitro.json` (in this case, `NitroFetchClient`).
|
|
32
|
-
*/
|
|
23
|
+
public static func isNitroFetchRecyclable() -> Bool {
|
|
24
|
+
return NitroFetch.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
26
|
+
|
|
33
27
|
public static func createNitroFetchClient() -> bridge.std__shared_ptr_HybridNitroFetchClientSpec_ {
|
|
34
28
|
let hybridObject = NitroFetchClient()
|
|
35
29
|
return { () -> bridge.std__shared_ptr_HybridNitroFetchClientSpec_ in
|
|
@@ -38,13 +32,10 @@ public final class NitroFetchAutolinking {
|
|
|
38
32
|
}()
|
|
39
33
|
}
|
|
40
34
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* This is generated by Nitrogen and will initialize the class specified
|
|
46
|
-
* in the `"autolinking"` property of `nitro.json` (in this case, `NativeStorage`).
|
|
47
|
-
*/
|
|
35
|
+
public static func isNitroFetchClientRecyclable() -> Bool {
|
|
36
|
+
return NitroFetchClient.self is any RecyclableView.Type
|
|
37
|
+
}
|
|
38
|
+
|
|
48
39
|
public static func createNativeStorage() -> bridge.std__shared_ptr_HybridNativeStorageSpec_ {
|
|
49
40
|
let hybridObject = NativeStorage()
|
|
50
41
|
return { () -> bridge.std__shared_ptr_HybridNativeStorageSpec_ in
|
|
@@ -52,4 +43,20 @@ public final class NitroFetchAutolinking {
|
|
|
52
43
|
return __cxxWrapped.getCxxPart()
|
|
53
44
|
}()
|
|
54
45
|
}
|
|
46
|
+
|
|
47
|
+
public static func isNativeStorageRecyclable() -> Bool {
|
|
48
|
+
return NativeStorage.self is any RecyclableView.Type
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public static func createNitroCronet() -> bridge.std__shared_ptr_HybridNitroCronetSpec_ {
|
|
52
|
+
let hybridObject = HybridNitroCronet()
|
|
53
|
+
return { () -> bridge.std__shared_ptr_HybridNitroCronetSpec_ in
|
|
54
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
55
|
+
return __cxxWrapped.getCxxPart()
|
|
56
|
+
}()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public static func isNitroCronetRecyclable() -> Bool {
|
|
60
|
+
return HybridNitroCronet.self is any RecyclableView.Type
|
|
61
|
+
}
|
|
55
62
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNativeStorageSpecSwift.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridNativeStorageSpecSwift.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNativeStorageSpecSwift.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -47,9 +47,18 @@ namespace margelo::nitro::nitrofetch {
|
|
|
47
47
|
inline size_t getExternalMemorySize() noexcept override {
|
|
48
48
|
return _swiftPart.getMemorySize();
|
|
49
49
|
}
|
|
50
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
51
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridNativeStorageSpecSwift>(other)) {
|
|
52
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
50
56
|
void dispose() noexcept override {
|
|
51
57
|
_swiftPart.dispose();
|
|
52
58
|
}
|
|
59
|
+
std::string toString() override {
|
|
60
|
+
return _swiftPart.toString();
|
|
61
|
+
}
|
|
53
62
|
|
|
54
63
|
public:
|
|
55
64
|
// Properties
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroCronetSpecSwift.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 "HybridNitroCronetSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitrofetch {
|
|
11
|
+
} // namespace margelo::nitro::nitrofetch
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroCronetSpecSwift.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
|
+
#include "HybridNitroCronetSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridNitroCronetSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace NitroFetch { class HybridNitroCronetSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `HybridUrlRequestBuilderSpec` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nitrofetch { class HybridUrlRequestBuilderSpec; }
|
|
17
|
+
|
|
18
|
+
#include <memory>
|
|
19
|
+
#include "HybridUrlRequestBuilderSpec.hpp"
|
|
20
|
+
#include <string>
|
|
21
|
+
|
|
22
|
+
#include "NitroFetch-Swift-Cxx-Umbrella.hpp"
|
|
23
|
+
|
|
24
|
+
namespace margelo::nitro::nitrofetch {
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The C++ part of HybridNitroCronetSpec_cxx.swift.
|
|
28
|
+
*
|
|
29
|
+
* HybridNitroCronetSpecSwift (C++) accesses HybridNitroCronetSpec_cxx (Swift), and might
|
|
30
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
31
|
+
*
|
|
32
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
33
|
+
* the future, HybridNitroCronetSpec_cxx can directly inherit from the C++ class HybridNitroCronetSpec
|
|
34
|
+
* to simplify the whole structure and memory management.
|
|
35
|
+
*/
|
|
36
|
+
class HybridNitroCronetSpecSwift: public virtual HybridNitroCronetSpec {
|
|
37
|
+
public:
|
|
38
|
+
// Constructor from a Swift instance
|
|
39
|
+
explicit HybridNitroCronetSpecSwift(const NitroFetch::HybridNitroCronetSpec_cxx& swiftPart):
|
|
40
|
+
HybridObject(HybridNitroCronetSpec::TAG),
|
|
41
|
+
_swiftPart(swiftPart) { }
|
|
42
|
+
|
|
43
|
+
public:
|
|
44
|
+
// Get the Swift part
|
|
45
|
+
inline NitroFetch::HybridNitroCronetSpec_cxx& getSwiftPart() noexcept {
|
|
46
|
+
return _swiftPart;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
51
|
+
return _swiftPart.getMemorySize();
|
|
52
|
+
}
|
|
53
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
54
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridNitroCronetSpecSwift>(other)) {
|
|
55
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
void dispose() noexcept override {
|
|
60
|
+
_swiftPart.dispose();
|
|
61
|
+
}
|
|
62
|
+
std::string toString() override {
|
|
63
|
+
return _swiftPart.toString();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public:
|
|
67
|
+
// Properties
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
public:
|
|
71
|
+
// Methods
|
|
72
|
+
inline std::shared_ptr<HybridUrlRequestBuilderSpec> newUrlRequestBuilder(const std::string& url) override {
|
|
73
|
+
auto __result = _swiftPart.newUrlRequestBuilder(url);
|
|
74
|
+
if (__result.hasError()) [[unlikely]] {
|
|
75
|
+
std::rethrow_exception(__result.error());
|
|
76
|
+
}
|
|
77
|
+
auto __value = std::move(__result.value());
|
|
78
|
+
return __value;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private:
|
|
82
|
+
NitroFetch::HybridNitroCronetSpec_cxx _swiftPart;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
} // namespace margelo::nitro::nitrofetch
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNitroFetchClientSpecSwift.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridNitroFetchClientSpecSwift.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNitroFetchClientSpecSwift.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -20,6 +20,8 @@ namespace margelo::nitro::nitrofetch { struct NitroHeader; }
|
|
|
20
20
|
namespace margelo::nitro::nitrofetch { struct NitroRequest; }
|
|
21
21
|
// Forward declaration of `NitroRequestMethod` to properly resolve imports.
|
|
22
22
|
namespace margelo::nitro::nitrofetch { enum class NitroRequestMethod; }
|
|
23
|
+
// Forward declaration of `NitroFormDataPart` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::nitrofetch { struct NitroFormDataPart; }
|
|
23
25
|
|
|
24
26
|
#include "NitroResponse.hpp"
|
|
25
27
|
#include <NitroModules/Promise.hpp>
|
|
@@ -29,6 +31,7 @@ namespace margelo::nitro::nitrofetch { enum class NitroRequestMethod; }
|
|
|
29
31
|
#include <optional>
|
|
30
32
|
#include "NitroRequest.hpp"
|
|
31
33
|
#include "NitroRequestMethod.hpp"
|
|
34
|
+
#include "NitroFormDataPart.hpp"
|
|
32
35
|
|
|
33
36
|
#include "NitroFetch-Swift-Cxx-Umbrella.hpp"
|
|
34
37
|
|
|
@@ -61,9 +64,18 @@ namespace margelo::nitro::nitrofetch {
|
|
|
61
64
|
inline size_t getExternalMemorySize() noexcept override {
|
|
62
65
|
return _swiftPart.getMemorySize();
|
|
63
66
|
}
|
|
67
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
68
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridNitroFetchClientSpecSwift>(other)) {
|
|
69
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
64
73
|
void dispose() noexcept override {
|
|
65
74
|
_swiftPart.dispose();
|
|
66
75
|
}
|
|
76
|
+
std::string toString() override {
|
|
77
|
+
return _swiftPart.toString();
|
|
78
|
+
}
|
|
67
79
|
|
|
68
80
|
public:
|
|
69
81
|
// Properties
|
|
@@ -72,7 +84,7 @@ namespace margelo::nitro::nitrofetch {
|
|
|
72
84
|
public:
|
|
73
85
|
// Methods
|
|
74
86
|
inline std::shared_ptr<Promise<NitroResponse>> request(const NitroRequest& req) override {
|
|
75
|
-
auto __result = _swiftPart.request(req);
|
|
87
|
+
auto __result = _swiftPart.request(std::forward<decltype(req)>(req));
|
|
76
88
|
if (__result.hasError()) [[unlikely]] {
|
|
77
89
|
std::rethrow_exception(__result.error());
|
|
78
90
|
}
|
|
@@ -80,7 +92,7 @@ namespace margelo::nitro::nitrofetch {
|
|
|
80
92
|
return __value;
|
|
81
93
|
}
|
|
82
94
|
inline std::shared_ptr<Promise<void>> prefetch(const NitroRequest& req) override {
|
|
83
|
-
auto __result = _swiftPart.prefetch(req);
|
|
95
|
+
auto __result = _swiftPart.prefetch(std::forward<decltype(req)>(req));
|
|
84
96
|
if (__result.hasError()) [[unlikely]] {
|
|
85
97
|
std::rethrow_exception(__result.error());
|
|
86
98
|
}
|
|
@@ -88,13 +100,19 @@ namespace margelo::nitro::nitrofetch {
|
|
|
88
100
|
return __value;
|
|
89
101
|
}
|
|
90
102
|
inline NitroResponse requestSync(const NitroRequest& req) override {
|
|
91
|
-
auto __result = _swiftPart.requestSync(req);
|
|
103
|
+
auto __result = _swiftPart.requestSync(std::forward<decltype(req)>(req));
|
|
92
104
|
if (__result.hasError()) [[unlikely]] {
|
|
93
105
|
std::rethrow_exception(__result.error());
|
|
94
106
|
}
|
|
95
107
|
auto __value = std::move(__result.value());
|
|
96
108
|
return __value;
|
|
97
109
|
}
|
|
110
|
+
inline void cancelRequest(const std::string& requestId) override {
|
|
111
|
+
auto __result = _swiftPart.cancelRequest(requestId);
|
|
112
|
+
if (__result.hasError()) [[unlikely]] {
|
|
113
|
+
std::rethrow_exception(__result.error());
|
|
114
|
+
}
|
|
115
|
+
}
|
|
98
116
|
|
|
99
117
|
private:
|
|
100
118
|
NitroFetch::HybridNitroFetchClientSpec_cxx _swiftPart;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNitroFetchSpecSwift.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridNitroFetchSpecSwift.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNitroFetchSpecSwift.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -49,9 +49,18 @@ namespace margelo::nitro::nitrofetch {
|
|
|
49
49
|
inline size_t getExternalMemorySize() noexcept override {
|
|
50
50
|
return _swiftPart.getMemorySize();
|
|
51
51
|
}
|
|
52
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
53
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridNitroFetchSpecSwift>(other)) {
|
|
54
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
52
58
|
void dispose() noexcept override {
|
|
53
59
|
_swiftPart.dispose();
|
|
54
60
|
}
|
|
61
|
+
std::string toString() override {
|
|
62
|
+
return _swiftPart.toString();
|
|
63
|
+
}
|
|
55
64
|
|
|
56
65
|
public:
|
|
57
66
|
// Properties
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridUrlRequestBuilderSpecSwift.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 "HybridUrlRequestBuilderSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitrofetch {
|
|
11
|
+
} // namespace margelo::nitro::nitrofetch
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridUrlRequestBuilderSpecSwift.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
|
+
#include "HybridUrlRequestBuilderSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridUrlRequestBuilderSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace NitroFetch { class HybridUrlRequestBuilderSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `ArrayBufferHolder` to properly resolve imports.
|
|
16
|
+
namespace NitroModules { class ArrayBufferHolder; }
|
|
17
|
+
// Forward declaration of `UrlResponseInfo` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nitrofetch { struct UrlResponseInfo; }
|
|
19
|
+
// Forward declaration of `HttpHeader` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::nitrofetch { struct HttpHeader; }
|
|
21
|
+
// Forward declaration of `RequestException` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::nitrofetch { struct RequestException; }
|
|
23
|
+
// Forward declaration of `HybridUrlRequestSpec` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::nitrofetch { class HybridUrlRequestSpec; }
|
|
25
|
+
|
|
26
|
+
#include <string>
|
|
27
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
28
|
+
#include <variant>
|
|
29
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
30
|
+
#include "UrlResponseInfo.hpp"
|
|
31
|
+
#include <functional>
|
|
32
|
+
#include <unordered_map>
|
|
33
|
+
#include "HttpHeader.hpp"
|
|
34
|
+
#include <vector>
|
|
35
|
+
#include <optional>
|
|
36
|
+
#include "RequestException.hpp"
|
|
37
|
+
#include <memory>
|
|
38
|
+
#include "HybridUrlRequestSpec.hpp"
|
|
39
|
+
|
|
40
|
+
#include "NitroFetch-Swift-Cxx-Umbrella.hpp"
|
|
41
|
+
|
|
42
|
+
namespace margelo::nitro::nitrofetch {
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The C++ part of HybridUrlRequestBuilderSpec_cxx.swift.
|
|
46
|
+
*
|
|
47
|
+
* HybridUrlRequestBuilderSpecSwift (C++) accesses HybridUrlRequestBuilderSpec_cxx (Swift), and might
|
|
48
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
49
|
+
*
|
|
50
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
51
|
+
* the future, HybridUrlRequestBuilderSpec_cxx can directly inherit from the C++ class HybridUrlRequestBuilderSpec
|
|
52
|
+
* to simplify the whole structure and memory management.
|
|
53
|
+
*/
|
|
54
|
+
class HybridUrlRequestBuilderSpecSwift: public virtual HybridUrlRequestBuilderSpec {
|
|
55
|
+
public:
|
|
56
|
+
// Constructor from a Swift instance
|
|
57
|
+
explicit HybridUrlRequestBuilderSpecSwift(const NitroFetch::HybridUrlRequestBuilderSpec_cxx& swiftPart):
|
|
58
|
+
HybridObject(HybridUrlRequestBuilderSpec::TAG),
|
|
59
|
+
_swiftPart(swiftPart) { }
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
// Get the Swift part
|
|
63
|
+
inline NitroFetch::HybridUrlRequestBuilderSpec_cxx& getSwiftPart() noexcept {
|
|
64
|
+
return _swiftPart;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public:
|
|
68
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
69
|
+
return _swiftPart.getMemorySize();
|
|
70
|
+
}
|
|
71
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
72
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridUrlRequestBuilderSpecSwift>(other)) {
|
|
73
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
void dispose() noexcept override {
|
|
78
|
+
_swiftPart.dispose();
|
|
79
|
+
}
|
|
80
|
+
std::string toString() override {
|
|
81
|
+
return _swiftPart.toString();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public:
|
|
85
|
+
// Properties
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
public:
|
|
89
|
+
// Methods
|
|
90
|
+
inline void setHttpMethod(const std::string& httpMethod) override {
|
|
91
|
+
auto __result = _swiftPart.setHttpMethod(httpMethod);
|
|
92
|
+
if (__result.hasError()) [[unlikely]] {
|
|
93
|
+
std::rethrow_exception(__result.error());
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
inline void addHeader(const std::string& name, const std::string& value) override {
|
|
97
|
+
auto __result = _swiftPart.addHeader(name, value);
|
|
98
|
+
if (__result.hasError()) [[unlikely]] {
|
|
99
|
+
std::rethrow_exception(__result.error());
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
inline void setUploadBody(const std::variant<std::shared_ptr<ArrayBuffer>, std::string>& body) override {
|
|
103
|
+
auto __result = _swiftPart.setUploadBody(body);
|
|
104
|
+
if (__result.hasError()) [[unlikely]] {
|
|
105
|
+
std::rethrow_exception(__result.error());
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
inline void disableCache() override {
|
|
109
|
+
auto __result = _swiftPart.disableCache();
|
|
110
|
+
if (__result.hasError()) [[unlikely]] {
|
|
111
|
+
std::rethrow_exception(__result.error());
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
inline void onSucceeded(const std::function<void(const UrlResponseInfo& /* info */)>& callback) override {
|
|
115
|
+
auto __result = _swiftPart.onSucceeded(callback);
|
|
116
|
+
if (__result.hasError()) [[unlikely]] {
|
|
117
|
+
std::rethrow_exception(__result.error());
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
inline void onFailed(const std::function<void(const std::optional<UrlResponseInfo>& /* info */, const RequestException& /* error */)>& callback) override {
|
|
121
|
+
auto __result = _swiftPart.onFailed(callback);
|
|
122
|
+
if (__result.hasError()) [[unlikely]] {
|
|
123
|
+
std::rethrow_exception(__result.error());
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
inline void onCanceled(const std::function<void(const std::optional<UrlResponseInfo>& /* info */)>& callback) override {
|
|
127
|
+
auto __result = _swiftPart.onCanceled(callback);
|
|
128
|
+
if (__result.hasError()) [[unlikely]] {
|
|
129
|
+
std::rethrow_exception(__result.error());
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
inline void onRedirectReceived(const std::function<void(const UrlResponseInfo& /* info */, const std::string& /* newLocationUrl */)>& callback) override {
|
|
133
|
+
auto __result = _swiftPart.onRedirectReceived(callback);
|
|
134
|
+
if (__result.hasError()) [[unlikely]] {
|
|
135
|
+
std::rethrow_exception(__result.error());
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
inline void onResponseStarted(const std::function<void(const UrlResponseInfo& /* info */)>& callback) override {
|
|
139
|
+
auto __result = _swiftPart.onResponseStarted(callback);
|
|
140
|
+
if (__result.hasError()) [[unlikely]] {
|
|
141
|
+
std::rethrow_exception(__result.error());
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
inline void onReadCompleted(const std::function<void(const UrlResponseInfo& /* info */, const std::shared_ptr<ArrayBuffer>& /* byteBuffer */, double /* bytesRead */)>& callback) override {
|
|
145
|
+
auto __result = _swiftPart.onReadCompleted(callback);
|
|
146
|
+
if (__result.hasError()) [[unlikely]] {
|
|
147
|
+
std::rethrow_exception(__result.error());
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
inline std::shared_ptr<HybridUrlRequestSpec> build() override {
|
|
151
|
+
auto __result = _swiftPart.build();
|
|
152
|
+
if (__result.hasError()) [[unlikely]] {
|
|
153
|
+
std::rethrow_exception(__result.error());
|
|
154
|
+
}
|
|
155
|
+
auto __value = std::move(__result.value());
|
|
156
|
+
return __value;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
private:
|
|
160
|
+
NitroFetch::HybridUrlRequestBuilderSpec_cxx _swiftPart;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
} // namespace margelo::nitro::nitrofetch
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridUrlRequestSpecSwift.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 "HybridUrlRequestSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitrofetch {
|
|
11
|
+
} // namespace margelo::nitro::nitrofetch
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridUrlRequestSpecSwift.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
|
+
#include "HybridUrlRequestSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridUrlRequestSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace NitroFetch { class HybridUrlRequestSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
#include "NitroFetch-Swift-Cxx-Umbrella.hpp"
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::nitrofetch {
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The C++ part of HybridUrlRequestSpec_cxx.swift.
|
|
25
|
+
*
|
|
26
|
+
* HybridUrlRequestSpecSwift (C++) accesses HybridUrlRequestSpec_cxx (Swift), and might
|
|
27
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
28
|
+
*
|
|
29
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
30
|
+
* the future, HybridUrlRequestSpec_cxx can directly inherit from the C++ class HybridUrlRequestSpec
|
|
31
|
+
* to simplify the whole structure and memory management.
|
|
32
|
+
*/
|
|
33
|
+
class HybridUrlRequestSpecSwift: public virtual HybridUrlRequestSpec {
|
|
34
|
+
public:
|
|
35
|
+
// Constructor from a Swift instance
|
|
36
|
+
explicit HybridUrlRequestSpecSwift(const NitroFetch::HybridUrlRequestSpec_cxx& swiftPart):
|
|
37
|
+
HybridObject(HybridUrlRequestSpec::TAG),
|
|
38
|
+
_swiftPart(swiftPart) { }
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
// Get the Swift part
|
|
42
|
+
inline NitroFetch::HybridUrlRequestSpec_cxx& getSwiftPart() noexcept {
|
|
43
|
+
return _swiftPart;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
48
|
+
return _swiftPart.getMemorySize();
|
|
49
|
+
}
|
|
50
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
51
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridUrlRequestSpecSwift>(other)) {
|
|
52
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
void dispose() noexcept override {
|
|
57
|
+
_swiftPart.dispose();
|
|
58
|
+
}
|
|
59
|
+
std::string toString() override {
|
|
60
|
+
return _swiftPart.toString();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
// Properties
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
public:
|
|
68
|
+
// Methods
|
|
69
|
+
inline void start() override {
|
|
70
|
+
auto __result = _swiftPart.start();
|
|
71
|
+
if (__result.hasError()) [[unlikely]] {
|
|
72
|
+
std::rethrow_exception(__result.error());
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
inline void followRedirect() override {
|
|
76
|
+
auto __result = _swiftPart.followRedirect();
|
|
77
|
+
if (__result.hasError()) [[unlikely]] {
|
|
78
|
+
std::rethrow_exception(__result.error());
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
inline void read() override {
|
|
82
|
+
auto __result = _swiftPart.read();
|
|
83
|
+
if (__result.hasError()) [[unlikely]] {
|
|
84
|
+
std::rethrow_exception(__result.error());
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
inline void cancel() override {
|
|
88
|
+
auto __result = _swiftPart.cancel();
|
|
89
|
+
if (__result.hasError()) [[unlikely]] {
|
|
90
|
+
std::rethrow_exception(__result.error());
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
inline bool isDone() override {
|
|
94
|
+
auto __result = _swiftPart.isDone();
|
|
95
|
+
if (__result.hasError()) [[unlikely]] {
|
|
96
|
+
std::rethrow_exception(__result.error());
|
|
97
|
+
}
|
|
98
|
+
auto __value = std::move(__result.value());
|
|
99
|
+
return __value;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private:
|
|
103
|
+
NitroFetch::HybridUrlRequestSpec_cxx _swiftPart;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
} // namespace margelo::nitro::nitrofetch
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
/// Func_void.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* Wraps a Swift `() -> Void` as a class.
|
|
13
12
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
/// Func_void_NitroResponse.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* Wraps a Swift `(_ value: NitroResponse) -> Void` as a class.
|
|
13
12
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|