Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / GossipTimestampFilter.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
8
9
10 /**
11  * A gossip_timestamp_filter message is used by a node to request
12  * gossip relay for messages in the requested time range when the
13  * gossip_queries feature has been negotiated.
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class GossipTimestampFilter extends CommonBase {
17         GossipTimestampFilter(Object _dummy, long ptr) { super(ptr); }
18         @Override @SuppressWarnings("deprecation")
19         protected void finalize() throws Throwable {
20                 super.finalize();
21                 if (ptr != 0) { bindings.GossipTimestampFilter_free(ptr); }
22         }
23
24         /**
25          * The genesis hash of the blockchain for channel and node information
26          */
27         public byte[] get_chain_hash() {
28                 byte[] ret = bindings.GossipTimestampFilter_get_chain_hash(this.ptr);
29                 return ret;
30         }
31
32         /**
33          * The genesis hash of the blockchain for channel and node information
34          */
35         public void set_chain_hash(byte[] val) {
36                 bindings.GossipTimestampFilter_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
37         }
38
39         /**
40          * The starting unix timestamp
41          */
42         public int get_first_timestamp() {
43                 int ret = bindings.GossipTimestampFilter_get_first_timestamp(this.ptr);
44                 return ret;
45         }
46
47         /**
48          * The starting unix timestamp
49          */
50         public void set_first_timestamp(int val) {
51                 bindings.GossipTimestampFilter_set_first_timestamp(this.ptr, val);
52         }
53
54         /**
55          * The range of information in seconds
56          */
57         public int get_timestamp_range() {
58                 int ret = bindings.GossipTimestampFilter_get_timestamp_range(this.ptr);
59                 return ret;
60         }
61
62         /**
63          * The range of information in seconds
64          */
65         public void set_timestamp_range(int val) {
66                 bindings.GossipTimestampFilter_set_timestamp_range(this.ptr, val);
67         }
68
69         /**
70          * Constructs a new GossipTimestampFilter given each field
71          */
72         public static GossipTimestampFilter of(byte[] chain_hash_arg, int first_timestamp_arg, int timestamp_range_arg) {
73                 long ret = bindings.GossipTimestampFilter_new(InternalUtils.check_arr_len(chain_hash_arg, 32), first_timestamp_arg, timestamp_range_arg);
74                 if (ret >= 0 && ret <= 4096) { return null; }
75                 GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new GossipTimestampFilter(null, ret); }
76                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
77                 return ret_hu_conv;
78         }
79
80         long clone_ptr() {
81                 long ret = bindings.GossipTimestampFilter_clone_ptr(this.ptr);
82                 return ret;
83         }
84
85         /**
86          * Creates a copy of the GossipTimestampFilter
87          */
88         public GossipTimestampFilter clone() {
89                 long ret = bindings.GossipTimestampFilter_clone(this.ptr);
90                 if (ret >= 0 && ret <= 4096) { return null; }
91                 GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new GossipTimestampFilter(null, ret); }
92                 ret_hu_conv.ptrs_to.add(this);
93                 return ret_hu_conv;
94         }
95
96         /**
97          * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
98          */
99         public byte[] write() {
100                 byte[] ret = bindings.GossipTimestampFilter_write(this.ptr);
101                 return ret;
102         }
103
104         /**
105          * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
106          */
107         public static Result_GossipTimestampFilterDecodeErrorZ read(byte[] ser) {
108                 long ret = bindings.GossipTimestampFilter_read(ser);
109                 if (ret >= 0 && ret <= 4096) { return null; }
110                 Result_GossipTimestampFilterDecodeErrorZ ret_hu_conv = Result_GossipTimestampFilterDecodeErrorZ.constr_from_ptr(ret);
111                 return ret_hu_conv;
112         }
113
114 }