[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / Refund.cs
diff --git a/c_sharp/src/org/ldk/structs/Refund.cs b/c_sharp/src/org/ldk/structs/Refund.cs
new file mode 100644 (file)
index 0000000..8ae3f58
--- /dev/null
@@ -0,0 +1,215 @@
+using org.ldk.impl;
+using org.ldk.enums;
+using org.ldk.util;
+using System;
+
+namespace org { namespace ldk { namespace structs {
+
+
+/**
+ * A `Refund` is a request to send an [`Bolt12Invoice`] without a preceding [`Offer`].
+ * 
+ * Typically, after an invoice is paid, the recipient may publish a refund allowing the sender to
+ * recoup their funds. A refund may be used more generally as an \"offer for money\", such as with a
+ * bitcoin ATM.
+ * 
+ * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
+ * [`Offer`]: crate::offers::offer::Offer
+ */
+public class Refund : CommonBase {
+       internal Refund(object _dummy, long ptr) : base(ptr) { }
+       ~Refund() {
+               if (ptr != 0) { bindings.Refund_free(ptr); }
+       }
+
+       internal long clone_ptr() {
+               long ret = bindings.Refund_clone_ptr(this.ptr);
+               GC.KeepAlive(this);
+               return ret;
+       }
+
+       /**
+        * Creates a copy of the Refund
+        */
+       public Refund clone() {
+               long ret = bindings.Refund_clone(this.ptr);
+               GC.KeepAlive(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.Refund ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Refund(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * A complete description of the purpose of the refund. Intended to be displayed to the user
+        * but with the caveat that it has not been verified in any way.
+        */
+       public PrintableString description() {
+               long ret = bindings.Refund_description(this.ptr);
+               GC.KeepAlive(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * Duration since the Unix epoch when an invoice should no longer be sent.
+        * 
+        * If `None`, the refund does not expire.
+        */
+       public Option_DurationZ absolute_expiry() {
+               long ret = bindings.Refund_absolute_expiry(this.ptr);
+               GC.KeepAlive(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.Option_DurationZ ret_hu_conv = org.ldk.structs.Option_DurationZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * Whether the refund has expired.
+        */
+       public bool is_expired() {
+               bool ret = bindings.Refund_is_expired(this.ptr);
+               GC.KeepAlive(this);
+               return ret;
+       }
+
+       /**
+        * The issuer of the refund, possibly beginning with `user@domain` or `domain`. Intended to be
+        * displayed to the user but with the caveat that it has not been verified in any way.
+        * 
+        * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+        */
+       public PrintableString issuer() {
+               long ret = bindings.Refund_issuer(this.ptr);
+               GC.KeepAlive(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * Paths to the sender originating from publicly reachable nodes. Blinded paths provide sender
+        * privacy by obfuscating its node id.
+        */
+       public BlindedPath[] paths() {
+               long[] ret = bindings.Refund_paths(this.ptr);
+               GC.KeepAlive(this);
+               int ret_conv_13_len = ret.Length;
+               BlindedPath[] ret_conv_13_arr = new BlindedPath[ret_conv_13_len];
+               for (int n = 0; n < ret_conv_13_len; n++) {
+                       long ret_conv_13 = ret[n];
+                       org.ldk.structs.BlindedPath ret_conv_13_hu_conv = null; if (ret_conv_13 < 0 || ret_conv_13 > 4096) { ret_conv_13_hu_conv = new org.ldk.structs.BlindedPath(null, ret_conv_13); }
+                       if (ret_conv_13_hu_conv != null) { ret_conv_13_hu_conv.ptrs_to.AddLast(this); };
+                       ret_conv_13_arr[n] = ret_conv_13_hu_conv;
+               }
+               return ret_conv_13_arr;
+       }
+
+       /**
+        * An unpredictable series of bytes, typically containing information about the derivation of
+        * [`payer_id`].
+        * 
+        * [`payer_id`]: Self::payer_id
+        */
+       public byte[] metadata() {
+               byte[] ret = bindings.Refund_metadata(this.ptr);
+               GC.KeepAlive(this);
+               return ret;
+       }
+
+       /**
+        * A chain that the refund is valid for.
+        */
+       public byte[] chain() {
+               byte[] ret = bindings.Refund_chain(this.ptr);
+               GC.KeepAlive(this);
+               return ret;
+       }
+
+       /**
+        * The amount to refund in msats (i.e., the minimum lightning-payable unit for [`chain`]).
+        * 
+        * [`chain`]: Self::chain
+        */
+       public long amount_msats() {
+               long ret = bindings.Refund_amount_msats(this.ptr);
+               GC.KeepAlive(this);
+               return ret;
+       }
+
+       /**
+        * Features pertaining to requesting an invoice.
+        */
+       public InvoiceRequestFeatures features() {
+               long ret = bindings.Refund_features(this.ptr);
+               GC.KeepAlive(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.InvoiceRequestFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFeatures(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * The quantity of an item that refund is for.
+        */
+       public Option_u64Z quantity() {
+               long ret = bindings.Refund_quantity(this.ptr);
+               GC.KeepAlive(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * A public node id to send to in the case where there are no [`paths`]. Otherwise, a possibly
+        * transient pubkey.
+        * 
+        * [`paths`]: Self::paths
+        */
+       public byte[] payer_id() {
+               byte[] ret = bindings.Refund_payer_id(this.ptr);
+               GC.KeepAlive(this);
+               return ret;
+       }
+
+       /**
+        * Payer provided note to include in the invoice.
+        * 
+        * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+        */
+       public PrintableString payer_note() {
+               long ret = bindings.Refund_payer_note(this.ptr);
+               GC.KeepAlive(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * Serialize the Refund object into a byte array which can be read by Refund_read
+        */
+       public byte[] write() {
+               byte[] ret = bindings.Refund_write(this.ptr);
+               GC.KeepAlive(this);
+               return ret;
+       }
+
+       /**
+        * Read a Refund object from a string
+        */
+       public static Result_RefundBolt12ParseErrorZ from_str(string s) {
+               long ret = bindings.Refund_from_str(s);
+               GC.KeepAlive(s);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_RefundBolt12ParseErrorZ ret_hu_conv = Result_RefundBolt12ParseErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+}
+} } }