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