[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / Bolt11ParseError.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 Bolt11ParseError : CommonBase {
13         protected Bolt11ParseError(object _dummy, long ptr) : base(ptr) { }
14         ~Bolt11ParseError() {
15                 if (ptr != 0) { bindings.Bolt11ParseError_free(ptr); }
16         }
17
18         internal static Bolt11ParseError constr_from_ptr(long ptr) {
19                 long raw_ty = bindings.LDKBolt11ParseError_ty_from_ptr(ptr);
20                 switch (raw_ty) {
21                         case 0: return new Bolt11ParseError_Bech32Error(ptr);
22                         case 1: return new Bolt11ParseError_ParseAmountError(ptr);
23                         case 2: return new Bolt11ParseError_MalformedSignature(ptr);
24                         case 3: return new Bolt11ParseError_BadPrefix(ptr);
25                         case 4: return new Bolt11ParseError_UnknownCurrency(ptr);
26                         case 5: return new Bolt11ParseError_UnknownSiPrefix(ptr);
27                         case 6: return new Bolt11ParseError_MalformedHRP(ptr);
28                         case 7: return new Bolt11ParseError_TooShortDataPart(ptr);
29                         case 8: return new Bolt11ParseError_UnexpectedEndOfTaggedFields(ptr);
30                         case 9: return new Bolt11ParseError_DescriptionDecodeError(ptr);
31                         case 10: return new Bolt11ParseError_PaddingError(ptr);
32                         case 11: return new Bolt11ParseError_IntegerOverflowError(ptr);
33                         case 12: return new Bolt11ParseError_InvalidSegWitProgramLength(ptr);
34                         case 13: return new Bolt11ParseError_InvalidPubKeyHashLength(ptr);
35                         case 14: return new Bolt11ParseError_InvalidScriptHashLength(ptr);
36                         case 15: return new Bolt11ParseError_InvalidRecoveryId(ptr);
37                         case 16: return new Bolt11ParseError_InvalidSliceLength(ptr);
38                         case 17: return new Bolt11ParseError_Skip(ptr);
39                         default:
40                                 throw new ArgumentException("Impossible enum variant");
41                 }
42         }
43
44         /** A Bolt11ParseError of type Bech32Error */
45         public class Bolt11ParseError_Bech32Error : Bolt11ParseError {
46                 public Bech32Error bech32_error;
47                 internal Bolt11ParseError_Bech32Error(long ptr) : base(null, ptr) {
48                         long bech32_error = bindings.LDKBolt11ParseError_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 Bolt11ParseError of type ParseAmountError */
55         public class Bolt11ParseError_ParseAmountError : Bolt11ParseError {
56                 public UnqualifiedError parse_amount_error;
57                 internal Bolt11ParseError_ParseAmountError(long ptr) : base(null, ptr) {
58                         int parse_amount_error = bindings.LDKBolt11ParseError_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 Bolt11ParseError of type MalformedSignature */
64         public class Bolt11ParseError_MalformedSignature : Bolt11ParseError {
65                 public Secp256k1Error malformed_signature;
66                 internal Bolt11ParseError_MalformedSignature(long ptr) : base(null, ptr) {
67                         this.malformed_signature = bindings.LDKBolt11ParseError_MalformedSignature_get_malformed_signature(ptr);
68                 }
69         }
70         /** A Bolt11ParseError of type BadPrefix */
71         public class Bolt11ParseError_BadPrefix : Bolt11ParseError {
72                 internal Bolt11ParseError_BadPrefix(long ptr) : base(null, ptr) {
73                 }
74         }
75         /** A Bolt11ParseError of type UnknownCurrency */
76         public class Bolt11ParseError_UnknownCurrency : Bolt11ParseError {
77                 internal Bolt11ParseError_UnknownCurrency(long ptr) : base(null, ptr) {
78                 }
79         }
80         /** A Bolt11ParseError of type UnknownSiPrefix */
81         public class Bolt11ParseError_UnknownSiPrefix : Bolt11ParseError {
82                 internal Bolt11ParseError_UnknownSiPrefix(long ptr) : base(null, ptr) {
83                 }
84         }
85         /** A Bolt11ParseError of type MalformedHRP */
86         public class Bolt11ParseError_MalformedHRP : Bolt11ParseError {
87                 internal Bolt11ParseError_MalformedHRP(long ptr) : base(null, ptr) {
88                 }
89         }
90         /** A Bolt11ParseError of type TooShortDataPart */
91         public class Bolt11ParseError_TooShortDataPart : Bolt11ParseError {
92                 internal Bolt11ParseError_TooShortDataPart(long ptr) : base(null, ptr) {
93                 }
94         }
95         /** A Bolt11ParseError of type UnexpectedEndOfTaggedFields */
96         public class Bolt11ParseError_UnexpectedEndOfTaggedFields : Bolt11ParseError {
97                 internal Bolt11ParseError_UnexpectedEndOfTaggedFields(long ptr) : base(null, ptr) {
98                 }
99         }
100         /** A Bolt11ParseError of type DescriptionDecodeError */
101         public class Bolt11ParseError_DescriptionDecodeError : Bolt11ParseError {
102                 public UnqualifiedError description_decode_error;
103                 internal Bolt11ParseError_DescriptionDecodeError(long ptr) : base(null, ptr) {
104                         int description_decode_error = bindings.LDKBolt11ParseError_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 Bolt11ParseError of type PaddingError */
110         public class Bolt11ParseError_PaddingError : Bolt11ParseError {
111                 internal Bolt11ParseError_PaddingError(long ptr) : base(null, ptr) {
112                 }
113         }
114         /** A Bolt11ParseError of type IntegerOverflowError */
115         public class Bolt11ParseError_IntegerOverflowError : Bolt11ParseError {
116                 internal Bolt11ParseError_IntegerOverflowError(long ptr) : base(null, ptr) {
117                 }
118         }
119         /** A Bolt11ParseError of type InvalidSegWitProgramLength */
120         public class Bolt11ParseError_InvalidSegWitProgramLength : Bolt11ParseError {
121                 internal Bolt11ParseError_InvalidSegWitProgramLength(long ptr) : base(null, ptr) {
122                 }
123         }
124         /** A Bolt11ParseError of type InvalidPubKeyHashLength */
125         public class Bolt11ParseError_InvalidPubKeyHashLength : Bolt11ParseError {
126                 internal Bolt11ParseError_InvalidPubKeyHashLength(long ptr) : base(null, ptr) {
127                 }
128         }
129         /** A Bolt11ParseError of type InvalidScriptHashLength */
130         public class Bolt11ParseError_InvalidScriptHashLength : Bolt11ParseError {
131                 internal Bolt11ParseError_InvalidScriptHashLength(long ptr) : base(null, ptr) {
132                 }
133         }
134         /** A Bolt11ParseError of type InvalidRecoveryId */
135         public class Bolt11ParseError_InvalidRecoveryId : Bolt11ParseError {
136                 internal Bolt11ParseError_InvalidRecoveryId(long ptr) : base(null, ptr) {
137                 }
138         }
139         /** A Bolt11ParseError of type InvalidSliceLength */
140         public class Bolt11ParseError_InvalidSliceLength : Bolt11ParseError {
141                 public string invalid_slice_length;
142                 internal Bolt11ParseError_InvalidSliceLength(long ptr) : base(null, ptr) {
143                         long invalid_slice_length = bindings.LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length(ptr);
144                         string invalid_slice_length_conv = InternalUtils.decodeString(invalid_slice_length);
145                         this.invalid_slice_length = invalid_slice_length_conv;
146                 }
147         }
148         /** A Bolt11ParseError of type Skip */
149         public class Bolt11ParseError_Skip : Bolt11ParseError {
150                 internal Bolt11ParseError_Skip(long ptr) : base(null, ptr) {
151                 }
152         }
153         internal long clone_ptr() {
154                 long ret = bindings.Bolt11ParseError_clone_ptr(this.ptr);
155                 GC.KeepAlive(this);
156                 return ret;
157         }
158
159         /**
160          * Creates a copy of the Bolt11ParseError
161          */
162         public Bolt11ParseError clone() {
163                 long ret = bindings.Bolt11ParseError_clone(this.ptr);
164                 GC.KeepAlive(this);
165                 if (ret >= 0 && ret <= 4096) { return null; }
166                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
167                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
168                 return ret_hu_conv;
169         }
170
171         /**
172          * Utility method to constructs a new Bech32Error-variant Bolt11ParseError
173          */
174         public static Bolt11ParseError bech32_error(org.ldk.structs.Bech32Error a) {
175                 long ret = bindings.Bolt11ParseError_bech32_error(a.ptr);
176                 GC.KeepAlive(a);
177                 if (ret >= 0 && ret <= 4096) { return null; }
178                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
179                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
180                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(a); };
181                 return ret_hu_conv;
182         }
183
184         /**
185          * Utility method to constructs a new ParseAmountError-variant Bolt11ParseError
186          */
187         public static Bolt11ParseError parse_amount_error(org.ldk.util.UnqualifiedError a) {
188                 long ret = bindings.Bolt11ParseError_parse_amount_error(0);
189                 GC.KeepAlive(a);
190                 if (ret >= 0 && ret <= 4096) { return null; }
191                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
192                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
193                 return ret_hu_conv;
194         }
195
196         /**
197          * Utility method to constructs a new MalformedSignature-variant Bolt11ParseError
198          */
199         public static Bolt11ParseError malformed_signature(Secp256k1Error a) {
200                 long ret = bindings.Bolt11ParseError_malformed_signature(a);
201                 GC.KeepAlive(a);
202                 if (ret >= 0 && ret <= 4096) { return null; }
203                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
204                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
205                 return ret_hu_conv;
206         }
207
208         /**
209          * Utility method to constructs a new BadPrefix-variant Bolt11ParseError
210          */
211         public static Bolt11ParseError bad_prefix() {
212                 long ret = bindings.Bolt11ParseError_bad_prefix();
213                 if (ret >= 0 && ret <= 4096) { return null; }
214                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
215                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
216                 return ret_hu_conv;
217         }
218
219         /**
220          * Utility method to constructs a new UnknownCurrency-variant Bolt11ParseError
221          */
222         public static Bolt11ParseError unknown_currency() {
223                 long ret = bindings.Bolt11ParseError_unknown_currency();
224                 if (ret >= 0 && ret <= 4096) { return null; }
225                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
226                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
227                 return ret_hu_conv;
228         }
229
230         /**
231          * Utility method to constructs a new UnknownSiPrefix-variant Bolt11ParseError
232          */
233         public static Bolt11ParseError unknown_si_prefix() {
234                 long ret = bindings.Bolt11ParseError_unknown_si_prefix();
235                 if (ret >= 0 && ret <= 4096) { return null; }
236                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
237                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
238                 return ret_hu_conv;
239         }
240
241         /**
242          * Utility method to constructs a new MalformedHRP-variant Bolt11ParseError
243          */
244         public static Bolt11ParseError malformed_hrp() {
245                 long ret = bindings.Bolt11ParseError_malformed_hrp();
246                 if (ret >= 0 && ret <= 4096) { return null; }
247                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
248                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
249                 return ret_hu_conv;
250         }
251
252         /**
253          * Utility method to constructs a new TooShortDataPart-variant Bolt11ParseError
254          */
255         public static Bolt11ParseError too_short_data_part() {
256                 long ret = bindings.Bolt11ParseError_too_short_data_part();
257                 if (ret >= 0 && ret <= 4096) { return null; }
258                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
259                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
260                 return ret_hu_conv;
261         }
262
263         /**
264          * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant Bolt11ParseError
265          */
266         public static Bolt11ParseError unexpected_end_of_tagged_fields() {
267                 long ret = bindings.Bolt11ParseError_unexpected_end_of_tagged_fields();
268                 if (ret >= 0 && ret <= 4096) { return null; }
269                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
270                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
271                 return ret_hu_conv;
272         }
273
274         /**
275          * Utility method to constructs a new DescriptionDecodeError-variant Bolt11ParseError
276          */
277         public static Bolt11ParseError description_decode_error(org.ldk.util.UnqualifiedError a) {
278                 long ret = bindings.Bolt11ParseError_description_decode_error(0);
279                 GC.KeepAlive(a);
280                 if (ret >= 0 && ret <= 4096) { return null; }
281                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
282                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
283                 return ret_hu_conv;
284         }
285
286         /**
287          * Utility method to constructs a new PaddingError-variant Bolt11ParseError
288          */
289         public static Bolt11ParseError padding_error() {
290                 long ret = bindings.Bolt11ParseError_padding_error();
291                 if (ret >= 0 && ret <= 4096) { return null; }
292                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
293                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
294                 return ret_hu_conv;
295         }
296
297         /**
298          * Utility method to constructs a new IntegerOverflowError-variant Bolt11ParseError
299          */
300         public static Bolt11ParseError integer_overflow_error() {
301                 long ret = bindings.Bolt11ParseError_integer_overflow_error();
302                 if (ret >= 0 && ret <= 4096) { return null; }
303                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
304                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
305                 return ret_hu_conv;
306         }
307
308         /**
309          * Utility method to constructs a new InvalidSegWitProgramLength-variant Bolt11ParseError
310          */
311         public static Bolt11ParseError invalid_seg_wit_program_length() {
312                 long ret = bindings.Bolt11ParseError_invalid_seg_wit_program_length();
313                 if (ret >= 0 && ret <= 4096) { return null; }
314                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
315                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
316                 return ret_hu_conv;
317         }
318
319         /**
320          * Utility method to constructs a new InvalidPubKeyHashLength-variant Bolt11ParseError
321          */
322         public static Bolt11ParseError invalid_pub_key_hash_length() {
323                 long ret = bindings.Bolt11ParseError_invalid_pub_key_hash_length();
324                 if (ret >= 0 && ret <= 4096) { return null; }
325                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
326                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
327                 return ret_hu_conv;
328         }
329
330         /**
331          * Utility method to constructs a new InvalidScriptHashLength-variant Bolt11ParseError
332          */
333         public static Bolt11ParseError invalid_script_hash_length() {
334                 long ret = bindings.Bolt11ParseError_invalid_script_hash_length();
335                 if (ret >= 0 && ret <= 4096) { return null; }
336                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
337                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
338                 return ret_hu_conv;
339         }
340
341         /**
342          * Utility method to constructs a new InvalidRecoveryId-variant Bolt11ParseError
343          */
344         public static Bolt11ParseError invalid_recovery_id() {
345                 long ret = bindings.Bolt11ParseError_invalid_recovery_id();
346                 if (ret >= 0 && ret <= 4096) { return null; }
347                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
348                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
349                 return ret_hu_conv;
350         }
351
352         /**
353          * Utility method to constructs a new InvalidSliceLength-variant Bolt11ParseError
354          */
355         public static Bolt11ParseError invalid_slice_length(string a) {
356                 long ret = bindings.Bolt11ParseError_invalid_slice_length(InternalUtils.encodeString(a));
357                 GC.KeepAlive(a);
358                 if (ret >= 0 && ret <= 4096) { return null; }
359                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
360                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
361                 return ret_hu_conv;
362         }
363
364         /**
365          * Utility method to constructs a new Skip-variant Bolt11ParseError
366          */
367         public static Bolt11ParseError skip() {
368                 long ret = bindings.Bolt11ParseError_skip();
369                 if (ret >= 0 && ret <= 4096) { return null; }
370                 org.ldk.structs.Bolt11ParseError ret_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(ret);
371                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
372                 return ret_hu_conv;
373         }
374
375         /**
376          * Checks if two Bolt11ParseErrors contain equal inner contents.
377          * This ignores pointers and is_owned flags and looks at the values in fields.
378          */
379         public bool eq(org.ldk.structs.Bolt11ParseError b) {
380                 bool ret = bindings.Bolt11ParseError_eq(this.ptr, b == null ? 0 : b.ptr);
381                 GC.KeepAlive(this);
382                 GC.KeepAlive(b);
383                 return ret;
384         }
385
386         public override bool Equals(object o) {
387                 if (!(o is Bolt11ParseError)) return false;
388                 return this.eq((Bolt11ParseError)o);
389         }
390         /**
391          * Get the string representation of a Bolt11ParseError object
392          */
393         public string to_str() {
394                 long ret = bindings.Bolt11ParseError_to_str(this.ptr);
395                 GC.KeepAlive(this);
396                 if (ret >= 0 && ret <= 4096) { return null; }
397                 string ret_conv = InternalUtils.decodeString(ret);
398                 return ret_conv;
399         }
400
401 }
402 } } }