6 namespace org { namespace ldk { namespace structs {
10 * An error in response to an [`InvoiceRequest`] or an [`Bolt12Invoice`].
12 * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
13 * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
15 public class InvoiceError : CommonBase {
16 internal InvoiceError(object _dummy, long ptr) : base(ptr) { }
18 if (ptr != 0) { bindings.InvoiceError_free(ptr); }
22 * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error.
24 * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
25 * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
27 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
29 public ErroneousField get_erroneous_field() {
30 long ret = bindings.InvoiceError_get_erroneous_field(this.ptr);
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); };
39 * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error.
41 * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
42 * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
44 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
46 public void set_erroneous_field(org.ldk.structs.ErroneousField val) {
47 bindings.InvoiceError_set_erroneous_field(this.ptr, val == null ? 0 : val.ptr);
50 if (this != null) { this.ptrs_to.AddLast(val); };
54 * An explanation of the error.
56 public UntrustedString get_message() {
57 long ret = bindings.InvoiceError_get_message(this.ptr);
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); };
66 * An explanation of the error.
68 public void set_message(org.ldk.structs.UntrustedString val) {
69 bindings.InvoiceError_set_message(this.ptr, val.ptr);
72 if (this != null) { this.ptrs_to.AddLast(val); };
76 * Constructs a new InvoiceError given each field
78 * Note that erroneous_field_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
80 public static InvoiceError of(org.ldk.structs.ErroneousField erroneous_field_arg, org.ldk.structs.UntrustedString message_arg) {
81 long ret = bindings.InvoiceError_new(erroneous_field_arg == null ? 0 : erroneous_field_arg.ptr, message_arg.ptr);
82 GC.KeepAlive(erroneous_field_arg);
83 GC.KeepAlive(message_arg);
84 if (ret >= 0 && ret <= 4096) { return null; }
85 org.ldk.structs.InvoiceError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceError(null, ret); }
86 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
87 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(erroneous_field_arg); };
88 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(message_arg); };
92 internal long clone_ptr() {
93 long ret = bindings.InvoiceError_clone_ptr(this.ptr);
99 * Creates a copy of the InvoiceError
101 public InvoiceError clone() {
102 long ret = bindings.InvoiceError_clone(this.ptr);
104 if (ret >= 0 && ret <= 4096) { return null; }
105 org.ldk.structs.InvoiceError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceError(null, ret); }
106 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
111 * Creates an [`InvoiceError`] with the given message.
113 public static InvoiceError from_string(string s) {
114 long ret = bindings.InvoiceError_from_string(InternalUtils.encodeString(s));
116 if (ret >= 0 && ret <= 4096) { return null; }
117 org.ldk.structs.InvoiceError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceError(null, ret); }
118 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
123 * Serialize the InvoiceError object into a byte array which can be read by InvoiceError_read
125 public byte[] write() {
126 long ret = bindings.InvoiceError_write(this.ptr);
128 if (ret >= 0 && ret <= 4096) { return null; }
129 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
134 * Read a InvoiceError from a byte array, created by InvoiceError_write
136 public static Result_InvoiceErrorDecodeErrorZ read(byte[] ser) {
137 long ret = bindings.InvoiceError_read(InternalUtils.encodeUint8Array(ser));
139 if (ret >= 0 && ret <= 4096) { return null; }
140 Result_InvoiceErrorDecodeErrorZ ret_hu_conv = Result_InvoiceErrorDecodeErrorZ.constr_from_ptr(ret);