]> git.bitcoin.ninja Git - ldk-java/blob - c_sharp/src/org/ldk/structs/InvoiceRequestFields.cs
Update CI references to LDK 0.0.124 drop stale memchr pins
[ldk-java] / c_sharp / src / org / ldk / structs / InvoiceRequestFields.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  * Fields sent in an [`InvoiceRequest`] message to include in [`PaymentContext::Bolt12Offer`].
11  * 
12  * [`PaymentContext::Bolt12Offer`]: crate::blinded_path::payment::PaymentContext::Bolt12Offer
13  */
14 public class InvoiceRequestFields : CommonBase {
15         internal InvoiceRequestFields(object _dummy, long ptr) : base(ptr) { }
16         ~InvoiceRequestFields() {
17                 if (ptr != 0) { bindings.InvoiceRequestFields_free(ptr); }
18         }
19
20         /**
21          * A possibly transient pubkey used to sign the invoice request.
22          */
23         public byte[] get_payer_id() {
24                 long ret = bindings.InvoiceRequestFields_get_payer_id(this.ptr);
25                 GC.KeepAlive(this);
26                 if (ret >= 0 && ret <= 4096) { return null; }
27                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
28                 return ret_conv;
29         }
30
31         /**
32          * A possibly transient pubkey used to sign the invoice request.
33          */
34         public void set_payer_id(byte[] val) {
35                 bindings.InvoiceRequestFields_set_payer_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
36                 GC.KeepAlive(this);
37                 GC.KeepAlive(val);
38         }
39
40         /**
41          * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
42          */
43         public Option_u64Z get_quantity() {
44                 long ret = bindings.InvoiceRequestFields_get_quantity(this.ptr);
45                 GC.KeepAlive(this);
46                 if (ret >= 0 && ret <= 4096) { return null; }
47                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
48                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
49                 return ret_hu_conv;
50         }
51
52         /**
53          * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
54          */
55         public void set_quantity(org.ldk.structs.Option_u64Z val) {
56                 bindings.InvoiceRequestFields_set_quantity(this.ptr, val.ptr);
57                 GC.KeepAlive(this);
58                 GC.KeepAlive(val);
59         }
60
61         /**
62          * A payer-provided note which will be seen by the recipient and reflected back in the invoice
63          * response. Truncated to [`PAYER_NOTE_LIMIT`] characters.
64          * 
65          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
66          */
67         public UntrustedString get_payer_note_truncated() {
68                 long ret = bindings.InvoiceRequestFields_get_payer_note_truncated(this.ptr);
69                 GC.KeepAlive(this);
70                 if (ret >= 0 && ret <= 4096) { return null; }
71                 org.ldk.structs.UntrustedString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UntrustedString(null, ret); }
72                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
73                 return ret_hu_conv;
74         }
75
76         /**
77          * A payer-provided note which will be seen by the recipient and reflected back in the invoice
78          * response. Truncated to [`PAYER_NOTE_LIMIT`] characters.
79          * 
80          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
81          */
82         public void set_payer_note_truncated(org.ldk.structs.UntrustedString val) {
83                 bindings.InvoiceRequestFields_set_payer_note_truncated(this.ptr, val == null ? 0 : val.ptr);
84                 GC.KeepAlive(this);
85                 GC.KeepAlive(val);
86         }
87
88         /**
89          * Constructs a new InvoiceRequestFields given each field
90          * 
91          * Note that payer_note_truncated_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
92          */
93         public static InvoiceRequestFields of(byte[] payer_id_arg, org.ldk.structs.Option_u64Z quantity_arg, org.ldk.structs.UntrustedString payer_note_truncated_arg) {
94                 long ret = bindings.InvoiceRequestFields_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payer_id_arg, 33)), quantity_arg.ptr, payer_note_truncated_arg == null ? 0 : payer_note_truncated_arg.ptr);
95                 GC.KeepAlive(payer_id_arg);
96                 GC.KeepAlive(quantity_arg);
97                 GC.KeepAlive(payer_note_truncated_arg);
98                 if (ret >= 0 && ret <= 4096) { return null; }
99                 org.ldk.structs.InvoiceRequestFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFields(null, ret); }
100                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
101                 return ret_hu_conv;
102         }
103
104         internal long clone_ptr() {
105                 long ret = bindings.InvoiceRequestFields_clone_ptr(this.ptr);
106                 GC.KeepAlive(this);
107                 return ret;
108         }
109
110         /**
111          * Creates a copy of the InvoiceRequestFields
112          */
113         public InvoiceRequestFields clone() {
114                 long ret = bindings.InvoiceRequestFields_clone(this.ptr);
115                 GC.KeepAlive(this);
116                 if (ret >= 0 && ret <= 4096) { return null; }
117                 org.ldk.structs.InvoiceRequestFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFields(null, ret); }
118                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
119                 return ret_hu_conv;
120         }
121
122         /**
123          * Checks if two InvoiceRequestFieldss contain equal inner contents.
124          * This ignores pointers and is_owned flags and looks at the values in fields.
125          * Two objects with NULL inner values will be considered "equal" here.
126          */
127         public bool eq(org.ldk.structs.InvoiceRequestFields b) {
128                 bool ret = bindings.InvoiceRequestFields_eq(this.ptr, b.ptr);
129                 GC.KeepAlive(this);
130                 GC.KeepAlive(b);
131                 if (this != null) { this.ptrs_to.AddLast(b); };
132                 return ret;
133         }
134
135         public override bool Equals(object o) {
136                 if (!(o is InvoiceRequestFields)) return false;
137                 return this.eq((InvoiceRequestFields)o);
138         }
139         /**
140          * Serialize the InvoiceRequestFields object into a byte array which can be read by InvoiceRequestFields_read
141          */
142         public byte[] write() {
143                 long ret = bindings.InvoiceRequestFields_write(this.ptr);
144                 GC.KeepAlive(this);
145                 if (ret >= 0 && ret <= 4096) { return null; }
146                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
147                 return ret_conv;
148         }
149
150         /**
151          * Read a InvoiceRequestFields from a byte array, created by InvoiceRequestFields_write
152          */
153         public static Result_InvoiceRequestFieldsDecodeErrorZ read(byte[] ser) {
154                 long ret = bindings.InvoiceRequestFields_read(InternalUtils.encodeUint8Array(ser));
155                 GC.KeepAlive(ser);
156                 if (ret >= 0 && ret <= 4096) { return null; }
157                 Result_InvoiceRequestFieldsDecodeErrorZ ret_hu_conv = Result_InvoiceRequestFieldsDecodeErrorZ.constr_from_ptr(ret);
158                 return ret_hu_conv;
159         }
160
161 }
162 } } }