[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / InvoiceError.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 /**
10  * An error in response to an [`InvoiceRequest`] or an [`Bolt12Invoice`].
11  * 
12  * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
13  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
14  */
15 public class InvoiceError : CommonBase {
16         internal InvoiceError(object _dummy, long ptr) : base(ptr) { }
17         ~InvoiceError() {
18                 if (ptr != 0) { bindings.InvoiceError_free(ptr); }
19         }
20
21         /**
22          * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error.
23          * 
24          * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
25          * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
26          * 
27          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28          */
29         public ErroneousField get_erroneous_field() {
30                 long ret = bindings.InvoiceError_get_erroneous_field(this.ptr);
31                 GC.KeepAlive(this);
32                 if (ret >= 0 && ret <= 4096) { return null; }
33                 org.ldk.structs.ErroneousField ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ErroneousField(null, ret); }
34                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
35                 return ret_hu_conv;
36         }
37
38         /**
39          * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error.
40          * 
41          * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
42          * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
43          * 
44          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
45          */
46         public void set_erroneous_field(org.ldk.structs.ErroneousField val) {
47                 bindings.InvoiceError_set_erroneous_field(this.ptr, val == null ? 0 : val.ptr);
48                 GC.KeepAlive(this);
49                 GC.KeepAlive(val);
50                 if (this != null) { this.ptrs_to.AddLast(val); };
51         }
52
53         /**
54          * An explanation of the error.
55          */
56         public UntrustedString get_message() {
57                 long ret = bindings.InvoiceError_get_message(this.ptr);
58                 GC.KeepAlive(this);
59                 if (ret >= 0 && ret <= 4096) { return null; }
60                 org.ldk.structs.UntrustedString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UntrustedString(null, ret); }
61                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
62                 return ret_hu_conv;
63         }
64
65         /**
66          * An explanation of the error.
67          */
68         public void set_message(org.ldk.structs.UntrustedString val) {
69                 bindings.InvoiceError_set_message(this.ptr, val == null ? 0 : val.ptr);
70                 GC.KeepAlive(this);
71                 GC.KeepAlive(val);
72                 if (this != null) { this.ptrs_to.AddLast(val); };
73         }
74
75         /**
76          * Constructs a new InvoiceError given each field
77          */
78         public static InvoiceError of(org.ldk.structs.ErroneousField erroneous_field_arg, org.ldk.structs.UntrustedString message_arg) {
79                 long ret = bindings.InvoiceError_new(erroneous_field_arg == null ? 0 : erroneous_field_arg.ptr, message_arg == null ? 0 : message_arg.ptr);
80                 GC.KeepAlive(erroneous_field_arg);
81                 GC.KeepAlive(message_arg);
82                 if (ret >= 0 && ret <= 4096) { return null; }
83                 org.ldk.structs.InvoiceError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceError(null, ret); }
84                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
85                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(erroneous_field_arg); };
86                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(message_arg); };
87                 return ret_hu_conv;
88         }
89
90         internal long clone_ptr() {
91                 long ret = bindings.InvoiceError_clone_ptr(this.ptr);
92                 GC.KeepAlive(this);
93                 return ret;
94         }
95
96         /**
97          * Creates a copy of the InvoiceError
98          */
99         public InvoiceError clone() {
100                 long ret = bindings.InvoiceError_clone(this.ptr);
101                 GC.KeepAlive(this);
102                 if (ret >= 0 && ret <= 4096) { return null; }
103                 org.ldk.structs.InvoiceError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceError(null, ret); }
104                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
105                 return ret_hu_conv;
106         }
107
108         /**
109          * Serialize the InvoiceError object into a byte array which can be read by InvoiceError_read
110          */
111         public byte[] write() {
112                 byte[] ret = bindings.InvoiceError_write(this.ptr);
113                 GC.KeepAlive(this);
114                 return ret;
115         }
116
117         /**
118          * Read a InvoiceError from a byte array, created by InvoiceError_write
119          */
120         public static Result_InvoiceErrorDecodeErrorZ read(byte[] ser) {
121                 long ret = bindings.InvoiceError_read(ser);
122                 GC.KeepAlive(ser);
123                 if (ret >= 0 && ret <= 4096) { return null; }
124                 Result_InvoiceErrorDecodeErrorZ ret_hu_conv = Result_InvoiceErrorDecodeErrorZ.constr_from_ptr(ret);
125                 return ret_hu_conv;
126         }
127
128 }
129 } } }