]> git.bitcoin.ninja Git - ldk-java/blob - c_sharp/src/org/ldk/structs/Record.cs
Update CI references to LDK 0.0.124 drop stale memchr pins
[ldk-java] / c_sharp / src / org / ldk / structs / Record.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  * A Record, unit of logging output with Metadata to enable filtering
11  * Module_path, file, line to inform on log's source
12  */
13 public class Record : CommonBase {
14         internal Record(object _dummy, long ptr) : base(ptr) { }
15         ~Record() {
16                 if (ptr != 0) { bindings.Record_free(ptr); }
17         }
18
19         /**
20          * The verbosity level of the message.
21          */
22         public Level get_level() {
23                 Level ret = bindings.Record_get_level(this.ptr);
24                 GC.KeepAlive(this);
25                 return ret;
26         }
27
28         /**
29          * The verbosity level of the message.
30          */
31         public void set_level(Level val) {
32                 bindings.Record_set_level(this.ptr, val);
33                 GC.KeepAlive(this);
34                 GC.KeepAlive(val);
35         }
36
37         /**
38          * The node id of the peer pertaining to the logged record.
39          * 
40          * Note that in some cases a [`Self::channel_id`] may be filled in but this may still be
41          * `None`, depending on if the peer information is readily available in LDK when the log is
42          * generated.
43          * 
44          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
45          */
46         public byte[] get_peer_id() {
47                 long ret = bindings.Record_get_peer_id(this.ptr);
48                 GC.KeepAlive(this);
49                 if (ret >= 0 && ret <= 4096) { return null; }
50                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
51                 return ret_conv;
52         }
53
54         /**
55          * The node id of the peer pertaining to the logged record.
56          * 
57          * Note that in some cases a [`Self::channel_id`] may be filled in but this may still be
58          * `None`, depending on if the peer information is readily available in LDK when the log is
59          * generated.
60          * 
61          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
62          */
63         public void set_peer_id(byte[] val) {
64                 bindings.Record_set_peer_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
65                 GC.KeepAlive(this);
66                 GC.KeepAlive(val);
67         }
68
69         /**
70          * The channel id of the channel pertaining to the logged record. May be a temporary id before
71          * the channel has been funded.
72          * 
73          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
74          */
75         public ChannelId get_channel_id() {
76                 long ret = bindings.Record_get_channel_id(this.ptr);
77                 GC.KeepAlive(this);
78                 if (ret >= 0 && ret <= 4096) { return null; }
79                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
80                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
81                 return ret_hu_conv;
82         }
83
84         /**
85          * The channel id of the channel pertaining to the logged record. May be a temporary id before
86          * the channel has been funded.
87          * 
88          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
89          */
90         public void set_channel_id(org.ldk.structs.ChannelId val) {
91                 bindings.Record_set_channel_id(this.ptr, val == null ? 0 : val.ptr);
92                 GC.KeepAlive(this);
93                 GC.KeepAlive(val);
94         }
95
96         /**
97          * The message body.
98          */
99         public string get_args() {
100                 long ret = bindings.Record_get_args(this.ptr);
101                 GC.KeepAlive(this);
102                 if (ret >= 0 && ret <= 4096) { return null; }
103                 string ret_conv = InternalUtils.decodeString(ret);
104                 return ret_conv;
105         }
106
107         /**
108          * The message body.
109          */
110         public void set_args(string val) {
111                 bindings.Record_set_args(this.ptr, InternalUtils.encodeString(val));
112                 GC.KeepAlive(this);
113                 GC.KeepAlive(val);
114         }
115
116         /**
117          * The module path of the message.
118          */
119         public string get_module_path() {
120                 long ret = bindings.Record_get_module_path(this.ptr);
121                 GC.KeepAlive(this);
122                 if (ret >= 0 && ret <= 4096) { return null; }
123                 string ret_conv = InternalUtils.decodeString(ret);
124                 return ret_conv;
125         }
126
127         /**
128          * The module path of the message.
129          */
130         public void set_module_path(string val) {
131                 bindings.Record_set_module_path(this.ptr, InternalUtils.encodeString(val));
132                 GC.KeepAlive(this);
133                 GC.KeepAlive(val);
134         }
135
136         /**
137          * The source file containing the message.
138          */
139         public string get_file() {
140                 long ret = bindings.Record_get_file(this.ptr);
141                 GC.KeepAlive(this);
142                 if (ret >= 0 && ret <= 4096) { return null; }
143                 string ret_conv = InternalUtils.decodeString(ret);
144                 return ret_conv;
145         }
146
147         /**
148          * The source file containing the message.
149          */
150         public void set_file(string val) {
151                 bindings.Record_set_file(this.ptr, InternalUtils.encodeString(val));
152                 GC.KeepAlive(this);
153                 GC.KeepAlive(val);
154         }
155
156         /**
157          * The line containing the message.
158          */
159         public int get_line() {
160                 int ret = bindings.Record_get_line(this.ptr);
161                 GC.KeepAlive(this);
162                 return ret;
163         }
164
165         /**
166          * The line containing the message.
167          */
168         public void set_line(int val) {
169                 bindings.Record_set_line(this.ptr, val);
170                 GC.KeepAlive(this);
171                 GC.KeepAlive(val);
172         }
173
174         /**
175          * The payment hash.
176          * 
177          * Note that this is only filled in for logs pertaining to a specific payment, and will be
178          * `None` for logs which are not directly related to a payment.
179          */
180         public Option_ThirtyTwoBytesZ get_payment_hash() {
181                 long ret = bindings.Record_get_payment_hash(this.ptr);
182                 GC.KeepAlive(this);
183                 if (ret >= 0 && ret <= 4096) { return null; }
184                 org.ldk.structs.Option_ThirtyTwoBytesZ ret_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(ret);
185                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
186                 return ret_hu_conv;
187         }
188
189         /**
190          * The payment hash.
191          * 
192          * Note that this is only filled in for logs pertaining to a specific payment, and will be
193          * `None` for logs which are not directly related to a payment.
194          */
195         public void set_payment_hash(org.ldk.structs.Option_ThirtyTwoBytesZ val) {
196                 bindings.Record_set_payment_hash(this.ptr, val.ptr);
197                 GC.KeepAlive(this);
198                 GC.KeepAlive(val);
199         }
200
201         /**
202          * Constructs a new Record given each field
203          * 
204          * Note that peer_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
205          * Note that channel_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
206          */
207         public static Record of(Level level_arg, byte[] peer_id_arg, org.ldk.structs.ChannelId channel_id_arg, string args_arg, string module_path_arg, string file_arg, int line_arg, org.ldk.structs.Option_ThirtyTwoBytesZ payment_hash_arg) {
208                 long ret = bindings.Record_new(level_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(peer_id_arg, 33)), channel_id_arg == null ? 0 : channel_id_arg.ptr, InternalUtils.encodeString(args_arg), InternalUtils.encodeString(module_path_arg), InternalUtils.encodeString(file_arg), line_arg, payment_hash_arg.ptr);
209                 GC.KeepAlive(level_arg);
210                 GC.KeepAlive(peer_id_arg);
211                 GC.KeepAlive(channel_id_arg);
212                 GC.KeepAlive(args_arg);
213                 GC.KeepAlive(module_path_arg);
214                 GC.KeepAlive(file_arg);
215                 GC.KeepAlive(line_arg);
216                 GC.KeepAlive(payment_hash_arg);
217                 if (ret >= 0 && ret <= 4096) { return null; }
218                 org.ldk.structs.Record ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Record(null, ret); }
219                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
220                 return ret_hu_conv;
221         }
222
223         internal long clone_ptr() {
224                 long ret = bindings.Record_clone_ptr(this.ptr);
225                 GC.KeepAlive(this);
226                 return ret;
227         }
228
229         /**
230          * Creates a copy of the Record
231          */
232         public Record clone() {
233                 long ret = bindings.Record_clone(this.ptr);
234                 GC.KeepAlive(this);
235                 if (ret >= 0 && ret <= 4096) { return null; }
236                 org.ldk.structs.Record ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Record(null, ret); }
237                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
238                 return ret_hu_conv;
239         }
240
241 }
242 } } }