[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / GossipTimestampFilter.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 [`gossip_timestamp_filter`] message is used by a node to request
11  * gossip relay for messages in the requested time range when the
12  * `gossip_queries` feature has been negotiated.
13  * 
14  * [`gossip_timestamp_filter`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-gossip_timestamp_filter-message
15  */
16 public class GossipTimestampFilter : CommonBase {
17         internal GossipTimestampFilter(object _dummy, long ptr) : base(ptr) { }
18         ~GossipTimestampFilter() {
19                 if (ptr != 0) { bindings.GossipTimestampFilter_free(ptr); }
20         }
21
22         /**
23          * The genesis hash of the blockchain for channel and node information
24          */
25         public byte[] get_chain_hash() {
26                 long ret = bindings.GossipTimestampFilter_get_chain_hash(this.ptr);
27                 GC.KeepAlive(this);
28                 if (ret >= 0 && ret <= 4096) { return null; }
29                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
30                 return ret_conv;
31         }
32
33         /**
34          * The genesis hash of the blockchain for channel and node information
35          */
36         public void set_chain_hash(byte[] val) {
37                 bindings.GossipTimestampFilter_set_chain_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
38                 GC.KeepAlive(this);
39                 GC.KeepAlive(val);
40         }
41
42         /**
43          * The starting unix timestamp
44          */
45         public int get_first_timestamp() {
46                 int ret = bindings.GossipTimestampFilter_get_first_timestamp(this.ptr);
47                 GC.KeepAlive(this);
48                 return ret;
49         }
50
51         /**
52          * The starting unix timestamp
53          */
54         public void set_first_timestamp(int val) {
55                 bindings.GossipTimestampFilter_set_first_timestamp(this.ptr, val);
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(val);
58         }
59
60         /**
61          * The range of information in seconds
62          */
63         public int get_timestamp_range() {
64                 int ret = bindings.GossipTimestampFilter_get_timestamp_range(this.ptr);
65                 GC.KeepAlive(this);
66                 return ret;
67         }
68
69         /**
70          * The range of information in seconds
71          */
72         public void set_timestamp_range(int val) {
73                 bindings.GossipTimestampFilter_set_timestamp_range(this.ptr, val);
74                 GC.KeepAlive(this);
75                 GC.KeepAlive(val);
76         }
77
78         /**
79          * Constructs a new GossipTimestampFilter given each field
80          */
81         public static GossipTimestampFilter of(byte[] chain_hash_arg, int first_timestamp_arg, int timestamp_range_arg) {
82                 long ret = bindings.GossipTimestampFilter_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(chain_hash_arg, 32)), first_timestamp_arg, timestamp_range_arg);
83                 GC.KeepAlive(chain_hash_arg);
84                 GC.KeepAlive(first_timestamp_arg);
85                 GC.KeepAlive(timestamp_range_arg);
86                 if (ret >= 0 && ret <= 4096) { return null; }
87                 org.ldk.structs.GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.GossipTimestampFilter(null, ret); }
88                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
89                 return ret_hu_conv;
90         }
91
92         internal long clone_ptr() {
93                 long ret = bindings.GossipTimestampFilter_clone_ptr(this.ptr);
94                 GC.KeepAlive(this);
95                 return ret;
96         }
97
98         /**
99          * Creates a copy of the GossipTimestampFilter
100          */
101         public GossipTimestampFilter clone() {
102                 long ret = bindings.GossipTimestampFilter_clone(this.ptr);
103                 GC.KeepAlive(this);
104                 if (ret >= 0 && ret <= 4096) { return null; }
105                 org.ldk.structs.GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.GossipTimestampFilter(null, ret); }
106                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
107                 return ret_hu_conv;
108         }
109
110         /**
111          * Checks if two GossipTimestampFilters contain equal inner contents.
112          * This ignores pointers and is_owned flags and looks at the values in fields.
113          * Two objects with NULL inner values will be considered "equal" here.
114          */
115         public bool eq(org.ldk.structs.GossipTimestampFilter b) {
116                 bool ret = bindings.GossipTimestampFilter_eq(this.ptr, b == null ? 0 : b.ptr);
117                 GC.KeepAlive(this);
118                 GC.KeepAlive(b);
119                 if (this != null) { this.ptrs_to.AddLast(b); };
120                 return ret;
121         }
122
123         public override bool Equals(object o) {
124                 if (!(o is GossipTimestampFilter)) return false;
125                 return this.eq((GossipTimestampFilter)o);
126         }
127         /**
128          * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
129          */
130         public byte[] write() {
131                 long ret = bindings.GossipTimestampFilter_write(this.ptr);
132                 GC.KeepAlive(this);
133                 if (ret >= 0 && ret <= 4096) { return null; }
134                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
135                 return ret_conv;
136         }
137
138         /**
139          * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
140          */
141         public static Result_GossipTimestampFilterDecodeErrorZ read(byte[] ser) {
142                 long ret = bindings.GossipTimestampFilter_read(InternalUtils.encodeUint8Array(ser));
143                 GC.KeepAlive(ser);
144                 if (ret >= 0 && ret <= 4096) { return null; }
145                 Result_GossipTimestampFilterDecodeErrorZ ret_hu_conv = Result_GossipTimestampFilterDecodeErrorZ.constr_from_ptr(ret);
146                 return ret_hu_conv;
147         }
148
149 }
150 } } }