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