[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / ReadOnlyNetworkGraph.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 read-only view of [`NetworkGraph`].
11  */
12 public class ReadOnlyNetworkGraph : CommonBase, IDisposable {
13         internal ReadOnlyNetworkGraph(object _dummy, long ptr) : base(ptr) { }
14         public void Dispose() {
15                 if (ptr != 0) { bindings.ReadOnlyNetworkGraph_free(ptr); }
16         }
17
18         /**
19          * Returns information on a channel with the given id.
20          * 
21          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22          */
23         public ChannelInfo channel(long short_channel_id) {
24                 long ret = bindings.ReadOnlyNetworkGraph_channel(this.ptr, short_channel_id);
25                 GC.KeepAlive(this);
26                 GC.KeepAlive(short_channel_id);
27                 if (ret >= 0 && ret <= 4096) { return null; }
28                 org.ldk.structs.ChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelInfo(null, ret); }
29                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
30                 return ret_hu_conv;
31         }
32
33         /**
34          * Returns the list of channels in the graph
35          */
36         public long[] list_channels() {
37                 long ret = bindings.ReadOnlyNetworkGraph_list_channels(this.ptr);
38                 GC.KeepAlive(this);
39                 if (ret >= 0 && ret <= 4096) { return null; }
40                 long[] ret_conv = InternalUtils.decodeUint64Array(ret);
41                 return ret_conv;
42         }
43
44         /**
45          * Returns information on a node with the given id.
46          * 
47          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
48          */
49         public NodeInfo node(org.ldk.structs.NodeId node_id) {
50                 long ret = bindings.ReadOnlyNetworkGraph_node(this.ptr, node_id == null ? 0 : node_id.ptr);
51                 GC.KeepAlive(this);
52                 GC.KeepAlive(node_id);
53                 if (ret >= 0 && ret <= 4096) { return null; }
54                 org.ldk.structs.NodeInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeInfo(null, ret); }
55                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
56                 if (this != null) { this.ptrs_to.AddLast(node_id); };
57                 return ret_hu_conv;
58         }
59
60         /**
61          * Returns the list of nodes in the graph
62          */
63         public NodeId[] list_nodes() {
64                 long ret = bindings.ReadOnlyNetworkGraph_list_nodes(this.ptr);
65                 GC.KeepAlive(this);
66                 if (ret >= 0 && ret <= 4096) { return null; }
67                 int ret_conv_8_len = InternalUtils.getArrayLength(ret);
68                 NodeId[] ret_conv_8_arr = new NodeId[ret_conv_8_len];
69                 for (int i = 0; i < ret_conv_8_len; i++) {
70                         long ret_conv_8 = InternalUtils.getU64ArrayElem(ret, i);
71                         org.ldk.structs.NodeId ret_conv_8_hu_conv = null; if (ret_conv_8 < 0 || ret_conv_8 > 4096) { ret_conv_8_hu_conv = new org.ldk.structs.NodeId(null, ret_conv_8); }
72                         if (ret_conv_8_hu_conv != null) { ret_conv_8_hu_conv.ptrs_to.AddLast(this); };
73                         ret_conv_8_arr[i] = ret_conv_8_hu_conv;
74                 }
75                 bindings.free_buffer(ret);
76                 return ret_conv_8_arr;
77         }
78
79         /**
80          * Get network addresses by node id.
81          * Returns None if the requested node is completely unknown,
82          * or if node announcement for the node was never received.
83          */
84         public Option_CVec_SocketAddressZZ get_addresses(byte[] pubkey) {
85                 long ret = bindings.ReadOnlyNetworkGraph_get_addresses(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(pubkey, 33)));
86                 GC.KeepAlive(this);
87                 GC.KeepAlive(pubkey);
88                 if (ret >= 0 && ret <= 4096) { return null; }
89                 org.ldk.structs.Option_CVec_SocketAddressZZ ret_hu_conv = org.ldk.structs.Option_CVec_SocketAddressZZ.constr_from_ptr(ret);
90                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
91                 return ret_hu_conv;
92         }
93
94 }
95 } } }