[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / ForwardTlvs.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  * Data to construct a [`BlindedHop`] for forwarding a payment.
11  */
12 public class ForwardTlvs : CommonBase {
13         internal ForwardTlvs(object _dummy, long ptr) : base(ptr) { }
14         ~ForwardTlvs() {
15                 if (ptr != 0) { bindings.ForwardTlvs_free(ptr); }
16         }
17
18         /**
19          * The short channel id this payment should be forwarded out over.
20          */
21         public long get_short_channel_id() {
22                 long ret = bindings.ForwardTlvs_get_short_channel_id(this.ptr);
23                 GC.KeepAlive(this);
24                 return ret;
25         }
26
27         /**
28          * The short channel id this payment should be forwarded out over.
29          */
30         public void set_short_channel_id(long val) {
31                 bindings.ForwardTlvs_set_short_channel_id(this.ptr, val);
32                 GC.KeepAlive(this);
33                 GC.KeepAlive(val);
34         }
35
36         /**
37          * Payment parameters for relaying over [`Self::short_channel_id`].
38          */
39         public PaymentRelay get_payment_relay() {
40                 long ret = bindings.ForwardTlvs_get_payment_relay(this.ptr);
41                 GC.KeepAlive(this);
42                 if (ret >= 0 && ret <= 4096) { return null; }
43                 org.ldk.structs.PaymentRelay ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentRelay(null, ret); }
44                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
45                 return ret_hu_conv;
46         }
47
48         /**
49          * Payment parameters for relaying over [`Self::short_channel_id`].
50          */
51         public void set_payment_relay(org.ldk.structs.PaymentRelay val) {
52                 bindings.ForwardTlvs_set_payment_relay(this.ptr, val == null ? 0 : val.ptr);
53                 GC.KeepAlive(this);
54                 GC.KeepAlive(val);
55                 if (this != null) { this.ptrs_to.AddLast(val); };
56         }
57
58         /**
59          * Payment constraints for relaying over [`Self::short_channel_id`].
60          */
61         public PaymentConstraints get_payment_constraints() {
62                 long ret = bindings.ForwardTlvs_get_payment_constraints(this.ptr);
63                 GC.KeepAlive(this);
64                 if (ret >= 0 && ret <= 4096) { return null; }
65                 org.ldk.structs.PaymentConstraints ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentConstraints(null, ret); }
66                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
67                 return ret_hu_conv;
68         }
69
70         /**
71          * Payment constraints for relaying over [`Self::short_channel_id`].
72          */
73         public void set_payment_constraints(org.ldk.structs.PaymentConstraints val) {
74                 bindings.ForwardTlvs_set_payment_constraints(this.ptr, val == null ? 0 : val.ptr);
75                 GC.KeepAlive(this);
76                 GC.KeepAlive(val);
77                 if (this != null) { this.ptrs_to.AddLast(val); };
78         }
79
80         /**
81          * Supported and required features when relaying a payment onion containing this object's
82          * corresponding [`BlindedHop::encrypted_payload`].
83          * 
84          * [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload
85          */
86         public BlindedHopFeatures get_features() {
87                 long ret = bindings.ForwardTlvs_get_features(this.ptr);
88                 GC.KeepAlive(this);
89                 if (ret >= 0 && ret <= 4096) { return null; }
90                 org.ldk.structs.BlindedHopFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedHopFeatures(null, ret); }
91                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
92                 return ret_hu_conv;
93         }
94
95         /**
96          * Supported and required features when relaying a payment onion containing this object's
97          * corresponding [`BlindedHop::encrypted_payload`].
98          * 
99          * [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload
100          */
101         public void set_features(org.ldk.structs.BlindedHopFeatures val) {
102                 bindings.ForwardTlvs_set_features(this.ptr, val == null ? 0 : val.ptr);
103                 GC.KeepAlive(this);
104                 GC.KeepAlive(val);
105                 if (this != null) { this.ptrs_to.AddLast(val); };
106         }
107
108         /**
109          * Constructs a new ForwardTlvs given each field
110          */
111         public static ForwardTlvs of(long short_channel_id_arg, org.ldk.structs.PaymentRelay payment_relay_arg, org.ldk.structs.PaymentConstraints payment_constraints_arg, org.ldk.structs.BlindedHopFeatures features_arg) {
112                 long ret = bindings.ForwardTlvs_new(short_channel_id_arg, payment_relay_arg == null ? 0 : payment_relay_arg.ptr, payment_constraints_arg == null ? 0 : payment_constraints_arg.ptr, features_arg == null ? 0 : features_arg.ptr);
113                 GC.KeepAlive(short_channel_id_arg);
114                 GC.KeepAlive(payment_relay_arg);
115                 GC.KeepAlive(payment_constraints_arg);
116                 GC.KeepAlive(features_arg);
117                 if (ret >= 0 && ret <= 4096) { return null; }
118                 org.ldk.structs.ForwardTlvs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ForwardTlvs(null, ret); }
119                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
120                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(payment_relay_arg); };
121                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(payment_constraints_arg); };
122                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(features_arg); };
123                 return ret_hu_conv;
124         }
125
126         internal long clone_ptr() {
127                 long ret = bindings.ForwardTlvs_clone_ptr(this.ptr);
128                 GC.KeepAlive(this);
129                 return ret;
130         }
131
132         /**
133          * Creates a copy of the ForwardTlvs
134          */
135         public ForwardTlvs clone() {
136                 long ret = bindings.ForwardTlvs_clone(this.ptr);
137                 GC.KeepAlive(this);
138                 if (ret >= 0 && ret <= 4096) { return null; }
139                 org.ldk.structs.ForwardTlvs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ForwardTlvs(null, ret); }
140                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
141                 return ret_hu_conv;
142         }
143
144         /**
145          * Serialize the ForwardTlvs object into a byte array which can be read by ForwardTlvs_read
146          */
147         public byte[] write() {
148                 long ret = bindings.ForwardTlvs_write(this.ptr);
149                 GC.KeepAlive(this);
150                 if (ret >= 0 && ret <= 4096) { return null; }
151                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
152                 return ret_conv;
153         }
154
155 }
156 } } }