[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / IntroductionNode.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  * The unblinded node in a [`BlindedPath`].
10  */
11 public class IntroductionNode : CommonBase {
12         protected IntroductionNode(object _dummy, long ptr) : base(ptr) { }
13         ~IntroductionNode() {
14                 if (ptr != 0) { bindings.IntroductionNode_free(ptr); }
15         }
16
17         internal static IntroductionNode constr_from_ptr(long ptr) {
18                 long raw_ty = bindings.LDKIntroductionNode_ty_from_ptr(ptr);
19                 switch (raw_ty) {
20                         case 0: return new IntroductionNode_NodeId(ptr);
21                         case 1: return new IntroductionNode_DirectedShortChannelId(ptr);
22                         default:
23                                 throw new ArgumentException("Impossible enum variant");
24                 }
25         }
26
27         /** A IntroductionNode of type NodeId */
28         public class IntroductionNode_NodeId : IntroductionNode {
29                 public byte[] node_id;
30                 internal IntroductionNode_NodeId(long ptr) : base(null, ptr) {
31                         long node_id = bindings.LDKIntroductionNode_NodeId_get_node_id(ptr);
32                         byte[] node_id_conv = InternalUtils.decodeUint8Array(node_id);
33                         this.node_id = node_id_conv;
34                 }
35         }
36         /** A IntroductionNode of type DirectedShortChannelId */
37         public class IntroductionNode_DirectedShortChannelId : IntroductionNode {
38                 public Direction _0;
39                 public long _1;
40                 internal IntroductionNode_DirectedShortChannelId(long ptr) : base(null, ptr) {
41                         this._0 = bindings.LDKIntroductionNode_DirectedShortChannelId_get__0(ptr);
42                         this._1 = bindings.LDKIntroductionNode_DirectedShortChannelId_get__1(ptr);
43                 }
44         }
45         internal long clone_ptr() {
46                 long ret = bindings.IntroductionNode_clone_ptr(this.ptr);
47                 GC.KeepAlive(this);
48                 return ret;
49         }
50
51         /**
52          * Creates a copy of the IntroductionNode
53          */
54         public IntroductionNode clone() {
55                 long ret = bindings.IntroductionNode_clone(this.ptr);
56                 GC.KeepAlive(this);
57                 if (ret >= 0 && ret <= 4096) { return null; }
58                 org.ldk.structs.IntroductionNode ret_hu_conv = org.ldk.structs.IntroductionNode.constr_from_ptr(ret);
59                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
60                 return ret_hu_conv;
61         }
62
63         /**
64          * Utility method to constructs a new NodeId-variant IntroductionNode
65          */
66         public static IntroductionNode node_id(byte[] a) {
67                 long ret = bindings.IntroductionNode_node_id(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(a, 33)));
68                 GC.KeepAlive(a);
69                 if (ret >= 0 && ret <= 4096) { return null; }
70                 org.ldk.structs.IntroductionNode ret_hu_conv = org.ldk.structs.IntroductionNode.constr_from_ptr(ret);
71                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
72                 return ret_hu_conv;
73         }
74
75         /**
76          * Utility method to constructs a new DirectedShortChannelId-variant IntroductionNode
77          */
78         public static IntroductionNode directed_short_channel_id(Direction a, long b) {
79                 long ret = bindings.IntroductionNode_directed_short_channel_id(a, b);
80                 GC.KeepAlive(a);
81                 GC.KeepAlive(b);
82                 if (ret >= 0 && ret <= 4096) { return null; }
83                 org.ldk.structs.IntroductionNode ret_hu_conv = org.ldk.structs.IntroductionNode.constr_from_ptr(ret);
84                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
85                 return ret_hu_conv;
86         }
87
88         /**
89          * Generates a non-cryptographic 64-bit hash of the IntroductionNode.
90          */
91         public long hash() {
92                 long ret = bindings.IntroductionNode_hash(this.ptr);
93                 GC.KeepAlive(this);
94                 return ret;
95         }
96
97         public override int GetHashCode() {
98                 return (int)this.hash();
99         }
100         /**
101          * Checks if two IntroductionNodes contain equal inner contents.
102          * This ignores pointers and is_owned flags and looks at the values in fields.
103          */
104         public bool eq(org.ldk.structs.IntroductionNode b) {
105                 bool ret = bindings.IntroductionNode_eq(this.ptr, b.ptr);
106                 GC.KeepAlive(this);
107                 GC.KeepAlive(b);
108                 return ret;
109         }
110
111         public override bool Equals(object o) {
112                 if (!(o is IntroductionNode)) return false;
113                 return this.eq((IntroductionNode)o);
114         }
115 }
116 } } }