@@ -10,6 +10,133 @@ public class APIError {
10
10
11
11
/* OPTION_METHODS_START */
12
12
13
+ public enum APIErrorValueType {
14
+ case APIMisuseError, FeeRateTooHigh, RouteError, ChannelUnavailable
15
+ }
16
+
17
+ public func getValueType( ) -> APIErrorValueType ? {
18
+ switch self . cOpaqueStruct? . tag {
19
+
20
+ case LDKAPIError_APIMisuseError:
21
+ return . APIMisuseError
22
+ case LDKAPIError_FeeRateTooHigh:
23
+ return . FeeRateTooHigh
24
+ case LDKAPIError_RouteError:
25
+ return . RouteError
26
+ case LDKAPIError_ChannelUnavailable:
27
+ return . ChannelUnavailable
28
+ default :
29
+ return nil
30
+ }
31
+ }
32
+
33
+
34
+ public func getValueAsAPIMisuseError( ) -> APIMisuseError ? {
35
+ if self . cOpaqueStruct? . tag != LDKAPIError_APIMisuseError {
36
+ return nil
37
+ }
38
+ return APIMisuseError ( pointer: self . cOpaqueStruct!. api_misuse_error)
39
+ }
40
+
41
+ public func getValueAsFeeRateTooHigh( ) -> FeeRateTooHigh ? {
42
+ if self . cOpaqueStruct? . tag != LDKAPIError_FeeRateTooHigh {
43
+ return nil
44
+ }
45
+ return FeeRateTooHigh ( pointer: self . cOpaqueStruct!. fee_rate_too_high)
46
+ }
47
+
48
+ public func getValueAsRouteError( ) -> RouteError ? {
49
+ if self . cOpaqueStruct? . tag != LDKAPIError_RouteError {
50
+ return nil
51
+ }
52
+ return RouteError ( pointer: self . cOpaqueStruct!. route_error)
53
+ }
54
+
55
+ public func getValueAsChannelUnavailable( ) -> ChannelUnavailable ? {
56
+ if self . cOpaqueStruct? . tag != LDKAPIError_ChannelUnavailable {
57
+ return nil
58
+ }
59
+ return ChannelUnavailable ( pointer: self . cOpaqueStruct!. channel_unavailable)
60
+ }
61
+
62
+
13
63
/* OPTION_METHODS_END */
14
64
65
+
66
+
67
+ public class APIMisuseError {
68
+
69
+
70
+ var cOpaqueStruct : LDKAPIError_LDKAPIMisuseError_Body ? ;
71
+ fileprivate init ( pointer: LDKAPIError_LDKAPIMisuseError_Body ) {
72
+ self . cOpaqueStruct = pointer
73
+ }
74
+
75
+
76
+
77
+ public func getErr( ) -> String {
78
+ return Bindings . LDKStr_to_string ( nativeType: self . cOpaqueStruct!. err)
79
+ }
80
+
81
+
82
+ }
83
+
84
+
85
+ public class FeeRateTooHigh {
86
+
87
+
88
+ var cOpaqueStruct : LDKAPIError_LDKFeeRateTooHigh_Body ? ;
89
+ fileprivate init ( pointer: LDKAPIError_LDKFeeRateTooHigh_Body ) {
90
+ self . cOpaqueStruct = pointer
91
+ }
92
+
93
+
94
+
95
+ public func getErr( ) -> String {
96
+ return Bindings . LDKStr_to_string ( nativeType: self . cOpaqueStruct!. err)
97
+ }
98
+
99
+ public func getFeerate( ) -> UInt32 {
100
+ return self . cOpaqueStruct!. feerate
101
+ }
102
+
103
+
104
+ }
105
+
106
+
107
+ public class RouteError {
108
+
109
+
110
+ var cOpaqueStruct : LDKAPIError_LDKRouteError_Body ? ;
111
+ fileprivate init ( pointer: LDKAPIError_LDKRouteError_Body ) {
112
+ self . cOpaqueStruct = pointer
113
+ }
114
+
115
+
116
+
117
+ public func getErr( ) -> String {
118
+ return Bindings . LDKStr_to_string ( nativeType: self . cOpaqueStruct!. err)
119
+ }
120
+
121
+
122
+ }
123
+
124
+
125
+ public class ChannelUnavailable {
126
+
127
+
128
+ var cOpaqueStruct : LDKAPIError_LDKChannelUnavailable_Body ? ;
129
+ fileprivate init ( pointer: LDKAPIError_LDKChannelUnavailable_Body ) {
130
+ self . cOpaqueStruct = pointer
131
+ }
132
+
133
+
134
+
135
+ public func getErr( ) -> String {
136
+ return Bindings . LDKStr_to_string ( nativeType: self . cOpaqueStruct!. err)
137
+ }
138
+
139
+
140
+ }
141
+
15
142
}
0 commit comments