[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / UnsignedInvoiceRequest.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  * A semantically valid [`InvoiceRequest`] that hasn't been signed.
11  * 
12  * # Serialization
13  * 
14  * This is serialized as a TLV stream, which includes TLV records from the originating message. As
15  * such, it may include unknown, odd TLV records.
16  */
17 public class UnsignedInvoiceRequest : CommonBase {
18         internal UnsignedInvoiceRequest(object _dummy, long ptr) : base(ptr) { }
19         ~UnsignedInvoiceRequest() {
20                 if (ptr != 0) { bindings.UnsignedInvoiceRequest_free(ptr); }
21         }
22
23         /**
24          * Returns the [`TaggedHash`] of the invoice to sign.
25          */
26         public TaggedHash tagged_hash() {
27                 long ret = bindings.UnsignedInvoiceRequest_tagged_hash(this.ptr);
28                 GC.KeepAlive(this);
29                 if (ret >= 0 && ret <= 4096) { return null; }
30                 org.ldk.structs.TaggedHash ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TaggedHash(null, ret); }
31                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
32                 return ret_hu_conv;
33         }
34
35         /**
36          * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
37          * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
38          * for the selected chain.
39          */
40         public byte[][] chains() {
41                 long ret = bindings.UnsignedInvoiceRequest_chains(this.ptr);
42                 GC.KeepAlive(this);
43                 if (ret >= 0 && ret <= 4096) { return null; }
44                 int ret_conv_8_len = InternalUtils.getArrayLength(ret);
45                 byte[][] ret_conv_8_arr = new byte[ret_conv_8_len][];
46                 for (int i = 0; i < ret_conv_8_len; i++) {
47                         long ret_conv_8 = InternalUtils.getU64ArrayElem(ret, i);
48                         byte[] ret_conv_8_conv = InternalUtils.decodeUint8Array(ret_conv_8);
49                         ret_conv_8_arr[i] = ret_conv_8_conv;
50                 }
51                 bindings.free_buffer(ret);
52                 return ret_conv_8_arr;
53         }
54
55         /**
56          * Opaque bytes set by the originator. Useful for authentication and validating fields since it
57          * is reflected in `invoice_request` messages along with all the other fields from the `offer`.
58          */
59         public Option_CVec_u8ZZ metadata() {
60                 long ret = bindings.UnsignedInvoiceRequest_metadata(this.ptr);
61                 GC.KeepAlive(this);
62                 if (ret >= 0 && ret <= 4096) { return null; }
63                 org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
64                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
65                 return ret_hu_conv;
66         }
67
68         /**
69          * The minimum amount required for a successful payment of a single item.
70          * 
71          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
72          */
73         public Amount amount() {
74                 long ret = bindings.UnsignedInvoiceRequest_amount(this.ptr);
75                 GC.KeepAlive(this);
76                 if (ret >= 0 && ret <= 4096) { return null; }
77                 org.ldk.structs.Amount ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Amount(null, ret); }
78                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
79                 return ret_hu_conv;
80         }
81
82         /**
83          * A complete description of the purpose of the payment. Intended to be displayed to the user
84          * but with the caveat that it has not been verified in any way.
85          */
86         public PrintableString description() {
87                 long ret = bindings.UnsignedInvoiceRequest_description(this.ptr);
88                 GC.KeepAlive(this);
89                 if (ret >= 0 && ret <= 4096) { return null; }
90                 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
91                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
92                 return ret_hu_conv;
93         }
94
95         /**
96          * Features pertaining to the offer.
97          */
98         public OfferFeatures offer_features() {
99                 long ret = bindings.UnsignedInvoiceRequest_offer_features(this.ptr);
100                 GC.KeepAlive(this);
101                 if (ret >= 0 && ret <= 4096) { return null; }
102                 org.ldk.structs.OfferFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OfferFeatures(null, ret); }
103                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
104                 return ret_hu_conv;
105         }
106
107         /**
108          * Duration since the Unix epoch when an invoice should no longer be requested.
109          * 
110          * If `None`, the offer does not expire.
111          */
112         public Option_u64Z absolute_expiry() {
113                 long ret = bindings.UnsignedInvoiceRequest_absolute_expiry(this.ptr);
114                 GC.KeepAlive(this);
115                 if (ret >= 0 && ret <= 4096) { return null; }
116                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
117                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
118                 return ret_hu_conv;
119         }
120
121         /**
122          * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
123          * displayed to the user but with the caveat that it has not been verified in any way.
124          * 
125          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
126          */
127         public PrintableString issuer() {
128                 long ret = bindings.UnsignedInvoiceRequest_issuer(this.ptr);
129                 GC.KeepAlive(this);
130                 if (ret >= 0 && ret <= 4096) { return null; }
131                 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
132                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
133                 return ret_hu_conv;
134         }
135
136         /**
137          * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
138          * recipient privacy by obfuscating its node id.
139          */
140         public BlindedPath[] paths() {
141                 long ret = bindings.UnsignedInvoiceRequest_paths(this.ptr);
142                 GC.KeepAlive(this);
143                 if (ret >= 0 && ret <= 4096) { return null; }
144                 int ret_conv_13_len = InternalUtils.getArrayLength(ret);
145                 BlindedPath[] ret_conv_13_arr = new BlindedPath[ret_conv_13_len];
146                 for (int n = 0; n < ret_conv_13_len; n++) {
147                         long ret_conv_13 = InternalUtils.getU64ArrayElem(ret, n);
148                         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); }
149                         if (ret_conv_13_hu_conv != null) { ret_conv_13_hu_conv.ptrs_to.AddLast(this); };
150                         ret_conv_13_arr[n] = ret_conv_13_hu_conv;
151                 }
152                 bindings.free_buffer(ret);
153                 return ret_conv_13_arr;
154         }
155
156         /**
157          * The quantity of items supported.
158          */
159         public Quantity supported_quantity() {
160                 long ret = bindings.UnsignedInvoiceRequest_supported_quantity(this.ptr);
161                 GC.KeepAlive(this);
162                 if (ret >= 0 && ret <= 4096) { return null; }
163                 org.ldk.structs.Quantity ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Quantity(null, ret); }
164                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
165                 return ret_hu_conv;
166         }
167
168         /**
169          * The public key used by the recipient to sign invoices.
170          */
171         public byte[] signing_pubkey() {
172                 long ret = bindings.UnsignedInvoiceRequest_signing_pubkey(this.ptr);
173                 GC.KeepAlive(this);
174                 if (ret >= 0 && ret <= 4096) { return null; }
175                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
176                 return ret_conv;
177         }
178
179         /**
180          * An unpredictable series of bytes, typically containing information about the derivation of
181          * [`payer_id`].
182          * 
183          * [`payer_id`]: Self::payer_id
184          */
185         public byte[] payer_metadata() {
186                 long ret = bindings.UnsignedInvoiceRequest_payer_metadata(this.ptr);
187                 GC.KeepAlive(this);
188                 if (ret >= 0 && ret <= 4096) { return null; }
189                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
190                 return ret_conv;
191         }
192
193         /**
194          * A chain from [`Offer::chains`] that the offer is valid for.
195          */
196         public byte[] chain() {
197                 long ret = bindings.UnsignedInvoiceRequest_chain(this.ptr);
198                 GC.KeepAlive(this);
199                 if (ret >= 0 && ret <= 4096) { return null; }
200                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
201                 return ret_conv;
202         }
203
204         /**
205          * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
206          * must be greater than or equal to [`Offer::amount`], converted if necessary.
207          * 
208          * [`chain`]: Self::chain
209          */
210         public Option_u64Z amount_msats() {
211                 long ret = bindings.UnsignedInvoiceRequest_amount_msats(this.ptr);
212                 GC.KeepAlive(this);
213                 if (ret >= 0 && ret <= 4096) { return null; }
214                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
215                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
216                 return ret_hu_conv;
217         }
218
219         /**
220          * Features pertaining to requesting an invoice.
221          */
222         public InvoiceRequestFeatures invoice_request_features() {
223                 long ret = bindings.UnsignedInvoiceRequest_invoice_request_features(this.ptr);
224                 GC.KeepAlive(this);
225                 if (ret >= 0 && ret <= 4096) { return null; }
226                 org.ldk.structs.InvoiceRequestFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFeatures(null, ret); }
227                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
228                 return ret_hu_conv;
229         }
230
231         /**
232          * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
233          */
234         public Option_u64Z quantity() {
235                 long ret = bindings.UnsignedInvoiceRequest_quantity(this.ptr);
236                 GC.KeepAlive(this);
237                 if (ret >= 0 && ret <= 4096) { return null; }
238                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
239                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
240                 return ret_hu_conv;
241         }
242
243         /**
244          * A possibly transient pubkey used to sign the invoice request.
245          */
246         public byte[] payer_id() {
247                 long ret = bindings.UnsignedInvoiceRequest_payer_id(this.ptr);
248                 GC.KeepAlive(this);
249                 if (ret >= 0 && ret <= 4096) { return null; }
250                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
251                 return ret_conv;
252         }
253
254         /**
255          * A payer-provided note which will be seen by the recipient and reflected back in the invoice
256          * response.
257          * 
258          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
259          */
260         public PrintableString payer_note() {
261                 long ret = bindings.UnsignedInvoiceRequest_payer_note(this.ptr);
262                 GC.KeepAlive(this);
263                 if (ret >= 0 && ret <= 4096) { return null; }
264                 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
265                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
266                 return ret_hu_conv;
267         }
268
269         /**
270          * Serialize the UnsignedInvoiceRequest object into a byte array which can be read by UnsignedInvoiceRequest_read
271          */
272         public byte[] write() {
273                 long ret = bindings.UnsignedInvoiceRequest_write(this.ptr);
274                 GC.KeepAlive(this);
275                 if (ret >= 0 && ret <= 4096) { return null; }
276                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
277                 return ret_conv;
278         }
279
280 }
281 } } }