[C#] Check in initial auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / ParseError.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8 /**
9  * Errors that indicate what is wrong with the invoice. They have some granularity for debug
10  * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
11  */
12 public class ParseError : CommonBase {
13         protected ParseError(object _dummy, long ptr) : base(ptr) { }
14         ~ParseError() {
15                 if (ptr != 0) { bindings.ParseError_free(ptr); }
16         }
17
18         internal static ParseError constr_from_ptr(long ptr) {
19                 long raw_ty = bindings.LDKParseError_ty_from_ptr(ptr);
20                 switch (raw_ty) {
21                         case 0: return new ParseError_Bech32Error(ptr);
22                         case 1: return new ParseError_ParseAmountError(ptr);
23                         case 2: return new ParseError_MalformedSignature(ptr);
24                         case 3: return new ParseError_BadPrefix(ptr);
25                         case 4: return new ParseError_UnknownCurrency(ptr);
26                         case 5: return new ParseError_UnknownSiPrefix(ptr);
27                         case 6: return new ParseError_MalformedHRP(ptr);
28                         case 7: return new ParseError_TooShortDataPart(ptr);
29                         case 8: return new ParseError_UnexpectedEndOfTaggedFields(ptr);
30                         case 9: return new ParseError_DescriptionDecodeError(ptr);
31                         case 10: return new ParseError_PaddingError(ptr);
32                         case 11: return new ParseError_IntegerOverflowError(ptr);
33                         case 12: return new ParseError_InvalidSegWitProgramLength(ptr);
34                         case 13: return new ParseError_InvalidPubKeyHashLength(ptr);
35                         case 14: return new ParseError_InvalidScriptHashLength(ptr);
36                         case 15: return new ParseError_InvalidRecoveryId(ptr);
37                         case 16: return new ParseError_InvalidSliceLength(ptr);
38                         case 17: return new ParseError_Skip(ptr);
39                         default:
40                                 throw new ArgumentException("Impossible enum variant");
41                 }
42         }
43
44         /** A ParseError of type Bech32Error */
45         public class ParseError_Bech32Error : ParseError {
46                 public Bech32Error bech32_error;
47                 internal ParseError_Bech32Error(long ptr) : base(null, ptr) {
48                         long bech32_error = bindings.LDKParseError_Bech32Error_get_bech32_error(ptr);
49                         org.ldk.structs.Bech32Error bech32_error_hu_conv = org.ldk.structs.Bech32Error.constr_from_ptr(bech32_error);
50                         if (bech32_error_hu_conv != null) { bech32_error_hu_conv.ptrs_to.AddLast(this); };
51                         this.bech32_error = bech32_error_hu_conv;
52                 }
53         }
54         /** A ParseError of type ParseAmountError */
55         public class ParseError_ParseAmountError : ParseError {
56                 public UnqualifiedError parse_amount_error;
57                 internal ParseError_ParseAmountError(long ptr) : base(null, ptr) {
58                         int parse_amount_error = bindings.LDKParseError_ParseAmountError_get_parse_amount_error(ptr);
59                         UnqualifiedError parse_amount_error_conv = new UnqualifiedError(parse_amount_error);
60                         this.parse_amount_error = parse_amount_error_conv;
61                 }
62         }
63         /** A ParseError of type MalformedSignature */
64         public class ParseError_MalformedSignature : ParseError {
65                 public Secp256k1Error malformed_signature;
66                 internal ParseError_MalformedSignature(long ptr) : base(null, ptr) {
67                         this.malformed_signature = bindings.LDKParseError_MalformedSignature_get_malformed_signature(ptr);
68                 }
69         }
70         /** A ParseError of type BadPrefix */
71         public class ParseError_BadPrefix : ParseError {
72                 internal ParseError_BadPrefix(long ptr) : base(null, ptr) {
73                 }
74         }
75         /** A ParseError of type UnknownCurrency */
76         public class ParseError_UnknownCurrency : ParseError {
77                 internal ParseError_UnknownCurrency(long ptr) : base(null, ptr) {
78                 }
79         }
80         /** A ParseError of type UnknownSiPrefix */
81         public class ParseError_UnknownSiPrefix : ParseError {
82                 internal ParseError_UnknownSiPrefix(long ptr) : base(null, ptr) {
83                 }
84         }
85         /** A ParseError of type MalformedHRP */
86         public class ParseError_MalformedHRP : ParseError {
87                 internal ParseError_MalformedHRP(long ptr) : base(null, ptr) {
88                 }
89         }
90         /** A ParseError of type TooShortDataPart */
91         public class ParseError_TooShortDataPart : ParseError {
92                 internal ParseError_TooShortDataPart(long ptr) : base(null, ptr) {
93                 }
94         }
95         /** A ParseError of type UnexpectedEndOfTaggedFields */
96         public class ParseError_UnexpectedEndOfTaggedFields : ParseError {
97                 internal ParseError_UnexpectedEndOfTaggedFields(long ptr) : base(null, ptr) {
98                 }
99         }
100         /** A ParseError of type DescriptionDecodeError */
101         public class ParseError_DescriptionDecodeError : ParseError {
102                 public UnqualifiedError description_decode_error;
103                 internal ParseError_DescriptionDecodeError(long ptr) : base(null, ptr) {
104                         int description_decode_error = bindings.LDKParseError_DescriptionDecodeError_get_description_decode_error(ptr);
105                         UnqualifiedError description_decode_error_conv = new UnqualifiedError(description_decode_error);
106                         this.description_decode_error = description_decode_error_conv;
107                 }
108         }
109         /** A ParseError of type PaddingError */
110         public class ParseError_PaddingError : ParseError {
111                 internal ParseError_PaddingError(long ptr) : base(null, ptr) {
112                 }
113         }
114         /** A ParseError of type IntegerOverflowError */
115         public class ParseError_IntegerOverflowError : ParseError {
116                 internal ParseError_IntegerOverflowError(long ptr) : base(null, ptr) {
117                 }
118         }
119         /** A ParseError of type InvalidSegWitProgramLength */
120         public class ParseError_InvalidSegWitProgramLength : ParseError {
121                 internal ParseError_InvalidSegWitProgramLength(long ptr) : base(null, ptr) {
122                 }
123         }
124         /** A ParseError of type InvalidPubKeyHashLength */
125         public class ParseError_InvalidPubKeyHashLength : ParseError {
126                 internal ParseError_InvalidPubKeyHashLength(long ptr) : base(null, ptr) {
127                 }
128         }
129         /** A ParseError of type InvalidScriptHashLength */
130         public class ParseError_InvalidScriptHashLength : ParseError {
131                 internal ParseError_InvalidScriptHashLength(long ptr) : base(null, ptr) {
132                 }
133         }
134         /** A ParseError of type InvalidRecoveryId */
135         public class ParseError_InvalidRecoveryId : ParseError {
136                 internal ParseError_InvalidRecoveryId(long ptr) : base(null, ptr) {
137                 }
138         }
139         /** A ParseError of type InvalidSliceLength */
140         public class ParseError_InvalidSliceLength : ParseError {
141                 public string invalid_slice_length;
142                 internal ParseError_InvalidSliceLength(long ptr) : base(null, ptr) {
143                         this.invalid_slice_length = bindings.LDKParseError_InvalidSliceLength_get_invalid_slice_length(ptr);
144                 }
145         }
146         /** A ParseError of type Skip */
147         public class ParseError_Skip : ParseError {
148                 internal ParseError_Skip(long ptr) : base(null, ptr) {
149                 }
150         }
151         internal long clone_ptr() {
152                 long ret = bindings.ParseError_clone_ptr(this.ptr);
153                 GC.KeepAlive(this);
154                 return ret;
155         }
156
157         /**
158          * Creates a copy of the ParseError
159          */
160         public ParseError clone() {
161                 long ret = bindings.ParseError_clone(this.ptr);
162                 GC.KeepAlive(this);
163                 if (ret >= 0 && ret <= 4096) { return null; }
164                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
165                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
166                 return ret_hu_conv;
167         }
168
169         /**
170          * Utility method to constructs a new Bech32Error-variant ParseError
171          */
172         public static ParseError bech32_error(org.ldk.structs.Bech32Error a) {
173                 long ret = bindings.ParseError_bech32_error(a.ptr);
174                 GC.KeepAlive(a);
175                 if (ret >= 0 && ret <= 4096) { return null; }
176                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
177                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
178                 return ret_hu_conv;
179         }
180
181         /**
182          * Utility method to constructs a new ParseAmountError-variant ParseError
183          */
184         public static ParseError parse_amount_error(org.ldk.util.UnqualifiedError a) {
185                 long ret = bindings.ParseError_parse_amount_error(0);
186                 GC.KeepAlive(a);
187                 if (ret >= 0 && ret <= 4096) { return null; }
188                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
189                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
190                 return ret_hu_conv;
191         }
192
193         /**
194          * Utility method to constructs a new MalformedSignature-variant ParseError
195          */
196         public static ParseError malformed_signature(Secp256k1Error a) {
197                 long ret = bindings.ParseError_malformed_signature(a);
198                 GC.KeepAlive(a);
199                 if (ret >= 0 && ret <= 4096) { return null; }
200                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
201                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
202                 return ret_hu_conv;
203         }
204
205         /**
206          * Utility method to constructs a new BadPrefix-variant ParseError
207          */
208         public static ParseError bad_prefix() {
209                 long ret = bindings.ParseError_bad_prefix();
210                 if (ret >= 0 && ret <= 4096) { return null; }
211                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
212                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
213                 return ret_hu_conv;
214         }
215
216         /**
217          * Utility method to constructs a new UnknownCurrency-variant ParseError
218          */
219         public static ParseError unknown_currency() {
220                 long ret = bindings.ParseError_unknown_currency();
221                 if (ret >= 0 && ret <= 4096) { return null; }
222                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
223                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
224                 return ret_hu_conv;
225         }
226
227         /**
228          * Utility method to constructs a new UnknownSiPrefix-variant ParseError
229          */
230         public static ParseError unknown_si_prefix() {
231                 long ret = bindings.ParseError_unknown_si_prefix();
232                 if (ret >= 0 && ret <= 4096) { return null; }
233                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
234                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
235                 return ret_hu_conv;
236         }
237
238         /**
239          * Utility method to constructs a new MalformedHRP-variant ParseError
240          */
241         public static ParseError malformed_hrp() {
242                 long ret = bindings.ParseError_malformed_hrp();
243                 if (ret >= 0 && ret <= 4096) { return null; }
244                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
245                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
246                 return ret_hu_conv;
247         }
248
249         /**
250          * Utility method to constructs a new TooShortDataPart-variant ParseError
251          */
252         public static ParseError too_short_data_part() {
253                 long ret = bindings.ParseError_too_short_data_part();
254                 if (ret >= 0 && ret <= 4096) { return null; }
255                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
256                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
257                 return ret_hu_conv;
258         }
259
260         /**
261          * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant ParseError
262          */
263         public static ParseError unexpected_end_of_tagged_fields() {
264                 long ret = bindings.ParseError_unexpected_end_of_tagged_fields();
265                 if (ret >= 0 && ret <= 4096) { return null; }
266                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
267                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
268                 return ret_hu_conv;
269         }
270
271         /**
272          * Utility method to constructs a new DescriptionDecodeError-variant ParseError
273          */
274         public static ParseError description_decode_error(org.ldk.util.UnqualifiedError a) {
275                 long ret = bindings.ParseError_description_decode_error(0);
276                 GC.KeepAlive(a);
277                 if (ret >= 0 && ret <= 4096) { return null; }
278                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
279                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
280                 return ret_hu_conv;
281         }
282
283         /**
284          * Utility method to constructs a new PaddingError-variant ParseError
285          */
286         public static ParseError padding_error() {
287                 long ret = bindings.ParseError_padding_error();
288                 if (ret >= 0 && ret <= 4096) { return null; }
289                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
290                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
291                 return ret_hu_conv;
292         }
293
294         /**
295          * Utility method to constructs a new IntegerOverflowError-variant ParseError
296          */
297         public static ParseError integer_overflow_error() {
298                 long ret = bindings.ParseError_integer_overflow_error();
299                 if (ret >= 0 && ret <= 4096) { return null; }
300                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
301                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
302                 return ret_hu_conv;
303         }
304
305         /**
306          * Utility method to constructs a new InvalidSegWitProgramLength-variant ParseError
307          */
308         public static ParseError invalid_seg_wit_program_length() {
309                 long ret = bindings.ParseError_invalid_seg_wit_program_length();
310                 if (ret >= 0 && ret <= 4096) { return null; }
311                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
312                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
313                 return ret_hu_conv;
314         }
315
316         /**
317          * Utility method to constructs a new InvalidPubKeyHashLength-variant ParseError
318          */
319         public static ParseError invalid_pub_key_hash_length() {
320                 long ret = bindings.ParseError_invalid_pub_key_hash_length();
321                 if (ret >= 0 && ret <= 4096) { return null; }
322                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
323                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
324                 return ret_hu_conv;
325         }
326
327         /**
328          * Utility method to constructs a new InvalidScriptHashLength-variant ParseError
329          */
330         public static ParseError invalid_script_hash_length() {
331                 long ret = bindings.ParseError_invalid_script_hash_length();
332                 if (ret >= 0 && ret <= 4096) { return null; }
333                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
334                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
335                 return ret_hu_conv;
336         }
337
338         /**
339          * Utility method to constructs a new InvalidRecoveryId-variant ParseError
340          */
341         public static ParseError invalid_recovery_id() {
342                 long ret = bindings.ParseError_invalid_recovery_id();
343                 if (ret >= 0 && ret <= 4096) { return null; }
344                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
345                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
346                 return ret_hu_conv;
347         }
348
349         /**
350          * Utility method to constructs a new InvalidSliceLength-variant ParseError
351          */
352         public static ParseError invalid_slice_length(string a) {
353                 long ret = bindings.ParseError_invalid_slice_length(a);
354                 GC.KeepAlive(a);
355                 if (ret >= 0 && ret <= 4096) { return null; }
356                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
357                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
358                 return ret_hu_conv;
359         }
360
361         /**
362          * Utility method to constructs a new Skip-variant ParseError
363          */
364         public static ParseError skip() {
365                 long ret = bindings.ParseError_skip();
366                 if (ret >= 0 && ret <= 4096) { return null; }
367                 org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
368                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
369                 return ret_hu_conv;
370         }
371
372         /**
373          * Checks if two ParseErrors contain equal inner contents.
374          * This ignores pointers and is_owned flags and looks at the values in fields.
375          */
376         public bool eq(org.ldk.structs.ParseError b) {
377                 bool ret = bindings.ParseError_eq(this.ptr, b == null ? 0 : b.ptr);
378                 GC.KeepAlive(this);
379                 GC.KeepAlive(b);
380                 return ret;
381         }
382
383         public override bool Equals(object o) {
384                 if (!(o is ParseError)) return false;
385                 return this.eq((ParseError)o);
386         }
387         /**
388          * Get the string representation of a ParseError object
389          */
390         public string to_str() {
391                 string ret = bindings.ParseError_to_str(this.ptr);
392                 GC.KeepAlive(this);
393                 return ret;
394         }
395
396 }
397 } } }