[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / InvoiceRequestWithDerivedPayerIdBuilder.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  * Builds an [`InvoiceRequest`] from an [`Offer`] for the \"offer to be paid\" flow.
11  * 
12  * See [module-level documentation] for usage.
13  * 
14  * [module-level documentation]: self
15  */
16 public class InvoiceRequestWithDerivedPayerIdBuilder : CommonBase {
17         internal InvoiceRequestWithDerivedPayerIdBuilder(object _dummy, long ptr) : base(ptr) { }
18         ~InvoiceRequestWithDerivedPayerIdBuilder() {
19                 if (ptr != 0) { bindings.InvoiceRequestWithDerivedPayerIdBuilder_free(ptr); }
20         }
21
22         /**
23          * Builds a signed [`InvoiceRequest`] after checking for valid semantics.
24          */
25         public Result_InvoiceRequestBolt12SemanticErrorZ build_and_sign() {
26                 long ret = bindings.InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(this.ptr);
27                 GC.KeepAlive(this);
28                 if (ret >= 0 && ret <= 4096) { return null; }
29                 Result_InvoiceRequestBolt12SemanticErrorZ ret_hu_conv = Result_InvoiceRequestBolt12SemanticErrorZ.constr_from_ptr(ret);
30                 if (this != null) { this.ptrs_to.AddLast(this); };
31                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
32                 // an object to pass exclusive ownership to the function being called.
33                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
34                 // at the FFI layer, creating a new object which Rust can claim ownership of
35                 // However, in some cases (eg here), there is no way to clone an object, and thus
36                 // we actually have to pass full ownership to Rust.
37                 // Thus, after this call, this is reset to null and is now a dummy object.
38                 this.ptr = 0;;
39                 return ret_hu_conv;
40         }
41
42         /**
43          * Sets the [`InvoiceRequest::chain`] of the given [`Network`] for paying an invoice. If not
44          * called, [`Network::Bitcoin`] is assumed. Errors if the chain for `network` is not supported
45          * by the offer.
46          * 
47          * Successive calls to this method will override the previous setting.
48          */
49         public Result_NoneBolt12SemanticErrorZ chain(Network network) {
50                 long ret = bindings.InvoiceRequestWithDerivedPayerIdBuilder_chain(this.ptr, network);
51                 GC.KeepAlive(this);
52                 GC.KeepAlive(network);
53                 if (ret >= 0 && ret <= 4096) { return null; }
54                 Result_NoneBolt12SemanticErrorZ ret_hu_conv = Result_NoneBolt12SemanticErrorZ.constr_from_ptr(ret);
55                 if (this != null) { this.ptrs_to.AddLast(this); };
56                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
57                 // an object to pass exclusive ownership to the function being called.
58                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
59                 // at the FFI layer, creating a new object which Rust can claim ownership of
60                 // However, in some cases (eg here), there is no way to clone an object, and thus
61                 // we actually have to pass full ownership to Rust.
62                 // Thus, after this call, this is reset to null and is now a dummy object.
63                 this.ptr = 0;;
64                 return ret_hu_conv;
65         }
66
67         /**
68          * Sets the [`InvoiceRequest::amount_msats`] for paying an invoice. Errors if `amount_msats` is
69          * not at least the expected invoice amount (i.e., [`Offer::amount`] times [`quantity`]).
70          * 
71          * Successive calls to this method will override the previous setting.
72          * 
73          * [`quantity`]: Self::quantity
74          */
75         public Result_NoneBolt12SemanticErrorZ amount_msats(long amount_msats) {
76                 long ret = bindings.InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(this.ptr, amount_msats);
77                 GC.KeepAlive(this);
78                 GC.KeepAlive(amount_msats);
79                 if (ret >= 0 && ret <= 4096) { return null; }
80                 Result_NoneBolt12SemanticErrorZ ret_hu_conv = Result_NoneBolt12SemanticErrorZ.constr_from_ptr(ret);
81                 if (this != null) { this.ptrs_to.AddLast(this); };
82                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
83                 // an object to pass exclusive ownership to the function being called.
84                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
85                 // at the FFI layer, creating a new object which Rust can claim ownership of
86                 // However, in some cases (eg here), there is no way to clone an object, and thus
87                 // we actually have to pass full ownership to Rust.
88                 // Thus, after this call, this is reset to null and is now a dummy object.
89                 this.ptr = 0;;
90                 return ret_hu_conv;
91         }
92
93         /**
94          * Sets [`InvoiceRequest::quantity`] of items. If not set, `1` is assumed. Errors if `quantity`
95          * does not conform to [`Offer::is_valid_quantity`].
96          * 
97          * Successive calls to this method will override the previous setting.
98          */
99         public Result_NoneBolt12SemanticErrorZ quantity(long quantity) {
100                 long ret = bindings.InvoiceRequestWithDerivedPayerIdBuilder_quantity(this.ptr, quantity);
101                 GC.KeepAlive(this);
102                 GC.KeepAlive(quantity);
103                 if (ret >= 0 && ret <= 4096) { return null; }
104                 Result_NoneBolt12SemanticErrorZ ret_hu_conv = Result_NoneBolt12SemanticErrorZ.constr_from_ptr(ret);
105                 if (this != null) { this.ptrs_to.AddLast(this); };
106                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
107                 // an object to pass exclusive ownership to the function being called.
108                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
109                 // at the FFI layer, creating a new object which Rust can claim ownership of
110                 // However, in some cases (eg here), there is no way to clone an object, and thus
111                 // we actually have to pass full ownership to Rust.
112                 // Thus, after this call, this is reset to null and is now a dummy object.
113                 this.ptr = 0;;
114                 return ret_hu_conv;
115         }
116
117         /**
118          * Sets the [`InvoiceRequest::payer_note`].
119          * 
120          * Successive calls to this method will override the previous setting.
121          */
122         public void payer_note(string payer_note) {
123                 bindings.InvoiceRequestWithDerivedPayerIdBuilder_payer_note(this.ptr, InternalUtils.encodeString(payer_note));
124                 GC.KeepAlive(this);
125                 GC.KeepAlive(payer_note);
126                 if (this != null) { this.ptrs_to.AddLast(this); };
127                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
128                 // an object to pass exclusive ownership to the function being called.
129                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
130                 // at the FFI layer, creating a new object which Rust can claim ownership of
131                 // However, in some cases (eg here), there is no way to clone an object, and thus
132                 // we actually have to pass full ownership to Rust.
133                 // Thus, after this call, this is reset to null and is now a dummy object.
134                 this.ptr = 0;;
135         }
136
137 }
138 } } }