[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / Destination.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 destination of an onion message.
10  */
11 public class Destination : CommonBase {
12         protected Destination(object _dummy, long ptr) : base(ptr) { }
13         ~Destination() {
14                 if (ptr != 0) { bindings.Destination_free(ptr); }
15         }
16
17         internal static Destination constr_from_ptr(long ptr) {
18                 long raw_ty = bindings.LDKDestination_ty_from_ptr(ptr);
19                 switch (raw_ty) {
20                         case 0: return new Destination_Node(ptr);
21                         case 1: return new Destination_BlindedPath(ptr);
22                         default:
23                                 throw new ArgumentException("Impossible enum variant");
24                 }
25         }
26
27         /** A Destination of type Node */
28         public class Destination_Node : Destination {
29                 public byte[] node;
30                 internal Destination_Node(long ptr) : base(null, ptr) {
31                         long node = bindings.LDKDestination_Node_get_node(ptr);
32                         byte[] node_conv = InternalUtils.decodeUint8Array(node);
33                         this.node = node_conv;
34                 }
35         }
36         /** A Destination of type BlindedPath */
37         public class Destination_BlindedPath : Destination {
38                 public BlindedPath blinded_path;
39                 internal Destination_BlindedPath(long ptr) : base(null, ptr) {
40                         long blinded_path = bindings.LDKDestination_BlindedPath_get_blinded_path(ptr);
41                         org.ldk.structs.BlindedPath blinded_path_hu_conv = null; if (blinded_path < 0 || blinded_path > 4096) { blinded_path_hu_conv = new org.ldk.structs.BlindedPath(null, blinded_path); }
42                         if (blinded_path_hu_conv != null) { blinded_path_hu_conv.ptrs_to.AddLast(this); };
43                         this.blinded_path = blinded_path_hu_conv;
44                 }
45         }
46         internal long clone_ptr() {
47                 long ret = bindings.Destination_clone_ptr(this.ptr);
48                 GC.KeepAlive(this);
49                 return ret;
50         }
51
52         /**
53          * Creates a copy of the Destination
54          */
55         public Destination clone() {
56                 long ret = bindings.Destination_clone(this.ptr);
57                 GC.KeepAlive(this);
58                 if (ret >= 0 && ret <= 4096) { return null; }
59                 org.ldk.structs.Destination ret_hu_conv = org.ldk.structs.Destination.constr_from_ptr(ret);
60                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
61                 return ret_hu_conv;
62         }
63
64         /**
65          * Utility method to constructs a new Node-variant Destination
66          */
67         public static Destination node(byte[] a) {
68                 long ret = bindings.Destination_node(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(a, 33)));
69                 GC.KeepAlive(a);
70                 if (ret >= 0 && ret <= 4096) { return null; }
71                 org.ldk.structs.Destination ret_hu_conv = org.ldk.structs.Destination.constr_from_ptr(ret);
72                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
73                 return ret_hu_conv;
74         }
75
76         /**
77          * Utility method to constructs a new BlindedPath-variant Destination
78          */
79         public static Destination blinded_path(org.ldk.structs.BlindedPath a) {
80                 long ret = bindings.Destination_blinded_path(a == null ? 0 : a.ptr);
81                 GC.KeepAlive(a);
82                 if (ret >= 0 && ret <= 4096) { return null; }
83                 org.ldk.structs.Destination ret_hu_conv = org.ldk.structs.Destination.constr_from_ptr(ret);
84                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
85                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(a); };
86                 return ret_hu_conv;
87         }
88
89 }
90 } } }