[Java] Update auto-generated bindings to 0.0.115
[ldk-java] / src / main / java / org / ldk / structs / InvoiceRequest.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * An `InvoiceRequest` is a request for an [`Invoice`] formulated from an [`Offer`].
13  * 
14  * An offer may provide choices such as quantity, amount, chain, features, etc. An invoice request
15  * specifies these such that its recipient can send an invoice for payment.
16  * 
17  * [`Invoice`]: crate::offers::invoice::Invoice
18  * [`Offer`]: crate::offers::offer::Offer
19  */
20 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
21 public class InvoiceRequest extends CommonBase {
22         InvoiceRequest(Object _dummy, long ptr) { super(ptr); }
23         @Override @SuppressWarnings("deprecation")
24         protected void finalize() throws Throwable {
25                 super.finalize();
26                 if (ptr != 0) { bindings.InvoiceRequest_free(ptr); }
27         }
28
29         long clone_ptr() {
30                 long ret = bindings.InvoiceRequest_clone_ptr(this.ptr);
31                 Reference.reachabilityFence(this);
32                 return ret;
33         }
34
35         /**
36          * Creates a copy of the InvoiceRequest
37          */
38         public InvoiceRequest clone() {
39                 long ret = bindings.InvoiceRequest_clone(this.ptr);
40                 Reference.reachabilityFence(this);
41                 if (ret >= 0 && ret <= 4096) { return null; }
42                 org.ldk.structs.InvoiceRequest ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequest(null, ret); }
43                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
44                 return ret_hu_conv;
45         }
46
47         /**
48          * An unpredictable series of bytes, typically containing information about the derivation of
49          * [`payer_id`].
50          * 
51          * [`payer_id`]: Self::payer_id
52          */
53         public byte[] metadata() {
54                 byte[] ret = bindings.InvoiceRequest_metadata(this.ptr);
55                 Reference.reachabilityFence(this);
56                 return ret;
57         }
58
59         /**
60          * A chain from [`Offer::chains`] that the offer is valid for.
61          */
62         public byte[] chain() {
63                 byte[] ret = bindings.InvoiceRequest_chain(this.ptr);
64                 Reference.reachabilityFence(this);
65                 return ret;
66         }
67
68         /**
69          * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
70          * must be greater than or equal to [`Offer::amount`], converted if necessary.
71          * 
72          * [`chain`]: Self::chain
73          */
74         public Option_u64Z amount_msats() {
75                 long ret = bindings.InvoiceRequest_amount_msats(this.ptr);
76                 Reference.reachabilityFence(this);
77                 if (ret >= 0 && ret <= 4096) { return null; }
78                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
79                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
80                 return ret_hu_conv;
81         }
82
83         /**
84          * Features pertaining to requesting an invoice.
85          */
86         public InvoiceRequestFeatures features() {
87                 long ret = bindings.InvoiceRequest_features(this.ptr);
88                 Reference.reachabilityFence(this);
89                 if (ret >= 0 && ret <= 4096) { return null; }
90                 org.ldk.structs.InvoiceRequestFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFeatures(null, ret); }
91                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
92                 return ret_hu_conv;
93         }
94
95         /**
96          * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
97          */
98         public Option_u64Z quantity() {
99                 long ret = bindings.InvoiceRequest_quantity(this.ptr);
100                 Reference.reachabilityFence(this);
101                 if (ret >= 0 && ret <= 4096) { return null; }
102                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
103                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
104                 return ret_hu_conv;
105         }
106
107         /**
108          * A possibly transient pubkey used to sign the invoice request.
109          */
110         public byte[] payer_id() {
111                 byte[] ret = bindings.InvoiceRequest_payer_id(this.ptr);
112                 Reference.reachabilityFence(this);
113                 return ret;
114         }
115
116         /**
117          * A payer-provided note which will be seen by the recipient and reflected back in the invoice
118          * response.
119          * 
120          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
121          */
122         @Nullable
123         public PrintableString payer_note() {
124                 long ret = bindings.InvoiceRequest_payer_note(this.ptr);
125                 Reference.reachabilityFence(this);
126                 if (ret >= 0 && ret <= 4096) { return null; }
127                 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
128                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
129                 return ret_hu_conv;
130         }
131
132         /**
133          * Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read
134          */
135         public byte[] write() {
136                 byte[] ret = bindings.InvoiceRequest_write(this.ptr);
137                 Reference.reachabilityFence(this);
138                 return ret;
139         }
140
141 }