[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / LightningError.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  * An Err type for failure to process messages.
11  */
12 public class LightningError : CommonBase {
13         internal LightningError(object _dummy, long ptr) : base(ptr) { }
14         ~LightningError() {
15                 if (ptr != 0) { bindings.LightningError_free(ptr); }
16         }
17
18         /**
19          * A human-readable message describing the error
20          */
21         public string get_err() {
22                 long ret = bindings.LightningError_get_err(this.ptr);
23                 GC.KeepAlive(this);
24                 if (ret >= 0 && ret <= 4096) { return null; }
25                 string ret_conv = InternalUtils.decodeString(ret);
26                 return ret_conv;
27         }
28
29         /**
30          * A human-readable message describing the error
31          */
32         public void set_err(string val) {
33                 bindings.LightningError_set_err(this.ptr, InternalUtils.encodeString(val));
34                 GC.KeepAlive(this);
35                 GC.KeepAlive(val);
36         }
37
38         /**
39          * The action which should be taken against the offending peer.
40          */
41         public ErrorAction get_action() {
42                 long ret = bindings.LightningError_get_action(this.ptr);
43                 GC.KeepAlive(this);
44                 if (ret >= 0 && ret <= 4096) { return null; }
45                 org.ldk.structs.ErrorAction ret_hu_conv = org.ldk.structs.ErrorAction.constr_from_ptr(ret);
46                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
47                 return ret_hu_conv;
48         }
49
50         /**
51          * The action which should be taken against the offending peer.
52          */
53         public void set_action(org.ldk.structs.ErrorAction val) {
54                 bindings.LightningError_set_action(this.ptr, val.ptr);
55                 GC.KeepAlive(this);
56                 GC.KeepAlive(val);
57                 if (this != null) { this.ptrs_to.AddLast(val); };
58         }
59
60         /**
61          * Constructs a new LightningError given each field
62          */
63         public static LightningError of(string err_arg, org.ldk.structs.ErrorAction action_arg) {
64                 long ret = bindings.LightningError_new(InternalUtils.encodeString(err_arg), action_arg.ptr);
65                 GC.KeepAlive(err_arg);
66                 GC.KeepAlive(action_arg);
67                 if (ret >= 0 && ret <= 4096) { return null; }
68                 org.ldk.structs.LightningError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.LightningError(null, ret); }
69                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
70                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(action_arg); };
71                 return ret_hu_conv;
72         }
73
74         internal long clone_ptr() {
75                 long ret = bindings.LightningError_clone_ptr(this.ptr);
76                 GC.KeepAlive(this);
77                 return ret;
78         }
79
80         /**
81          * Creates a copy of the LightningError
82          */
83         public LightningError clone() {
84                 long ret = bindings.LightningError_clone(this.ptr);
85                 GC.KeepAlive(this);
86                 if (ret >= 0 && ret <= 4096) { return null; }
87                 org.ldk.structs.LightningError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.LightningError(null, ret); }
88                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
89                 return ret_hu_conv;
90         }
91
92 }
93 } } }