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