[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[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                 if (this != null) { this.ptrs_to.AddLast(val); };
95         }
96
97         /**
98          * The message body.
99          */
100         public string get_args() {
101                 long ret = bindings.Record_get_args(this.ptr);
102                 GC.KeepAlive(this);
103                 if (ret >= 0 && ret <= 4096) { return null; }
104                 string ret_conv = InternalUtils.decodeString(ret);
105                 return ret_conv;
106         }
107
108         /**
109          * The message body.
110          */
111         public void set_args(string val) {
112                 bindings.Record_set_args(this.ptr, InternalUtils.encodeString(val));
113                 GC.KeepAlive(this);
114                 GC.KeepAlive(val);
115         }
116
117         /**
118          * The module path of the message.
119          */
120         public string get_module_path() {
121                 long ret = bindings.Record_get_module_path(this.ptr);
122                 GC.KeepAlive(this);
123                 if (ret >= 0 && ret <= 4096) { return null; }
124                 string ret_conv = InternalUtils.decodeString(ret);
125                 return ret_conv;
126         }
127
128         /**
129          * The module path of the message.
130          */
131         public void set_module_path(string val) {
132                 bindings.Record_set_module_path(this.ptr, InternalUtils.encodeString(val));
133                 GC.KeepAlive(this);
134                 GC.KeepAlive(val);
135         }
136
137         /**
138          * The source file containing the message.
139          */
140         public string get_file() {
141                 long ret = bindings.Record_get_file(this.ptr);
142                 GC.KeepAlive(this);
143                 if (ret >= 0 && ret <= 4096) { return null; }
144                 string ret_conv = InternalUtils.decodeString(ret);
145                 return ret_conv;
146         }
147
148         /**
149          * The source file containing the message.
150          */
151         public void set_file(string val) {
152                 bindings.Record_set_file(this.ptr, InternalUtils.encodeString(val));
153                 GC.KeepAlive(this);
154                 GC.KeepAlive(val);
155         }
156
157         /**
158          * The line containing the message.
159          */
160         public int get_line() {
161                 int ret = bindings.Record_get_line(this.ptr);
162                 GC.KeepAlive(this);
163                 return ret;
164         }
165
166         /**
167          * The line containing the message.
168          */
169         public void set_line(int val) {
170                 bindings.Record_set_line(this.ptr, val);
171                 GC.KeepAlive(this);
172                 GC.KeepAlive(val);
173         }
174
175         /**
176          * Constructs a new Record given each field
177          * 
178          * Note that peer_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
179          * Note that channel_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
180          */
181         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) {
182                 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);
183                 GC.KeepAlive(level_arg);
184                 GC.KeepAlive(peer_id_arg);
185                 GC.KeepAlive(channel_id_arg);
186                 GC.KeepAlive(args_arg);
187                 GC.KeepAlive(module_path_arg);
188                 GC.KeepAlive(file_arg);
189                 GC.KeepAlive(line_arg);
190                 if (ret >= 0 && ret <= 4096) { return null; }
191                 org.ldk.structs.Record ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Record(null, ret); }
192                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
193                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id_arg); };
194                 return ret_hu_conv;
195         }
196
197         internal long clone_ptr() {
198                 long ret = bindings.Record_clone_ptr(this.ptr);
199                 GC.KeepAlive(this);
200                 return ret;
201         }
202
203         /**
204          * Creates a copy of the Record
205          */
206         public Record clone() {
207                 long ret = bindings.Record_clone(this.ptr);
208                 GC.KeepAlive(this);
209                 if (ret >= 0 && ret <= 4096) { return null; }
210                 org.ldk.structs.Record ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Record(null, ret); }
211                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
212                 return ret_hu_conv;
213         }
214
215 }
216 } } }