[C#] Check in initial auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / OnionMessageContents.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 contents of an onion message. In the context of offers, this would be the invoice, invoice
10  * request, or invoice error.
11  */
12 public class OnionMessageContents : CommonBase {
13         protected OnionMessageContents(object _dummy, long ptr) : base(ptr) { }
14         ~OnionMessageContents() {
15                 if (ptr != 0) { bindings.OnionMessageContents_free(ptr); }
16         }
17
18         internal static OnionMessageContents constr_from_ptr(long ptr) {
19                 long raw_ty = bindings.LDKOnionMessageContents_ty_from_ptr(ptr);
20                 switch (raw_ty) {
21                         case 0: return new OnionMessageContents_Custom(ptr);
22                         default:
23                                 throw new ArgumentException("Impossible enum variant");
24                 }
25         }
26
27         /** A OnionMessageContents of type Custom */
28         public class OnionMessageContents_Custom : OnionMessageContents {
29                 public CustomOnionMessageContents custom;
30                 internal OnionMessageContents_Custom(long ptr) : base(null, ptr) {
31                         long custom = bindings.LDKOnionMessageContents_Custom_get_custom(ptr);
32                         CustomOnionMessageContents ret_hu_conv = new CustomOnionMessageContents(null, custom);
33                         if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
34                         this.custom = ret_hu_conv;
35                 }
36         }
37         internal long clone_ptr() {
38                 long ret = bindings.OnionMessageContents_clone_ptr(this.ptr);
39                 GC.KeepAlive(this);
40                 return ret;
41         }
42
43         /**
44          * Creates a copy of the OnionMessageContents
45          */
46         public OnionMessageContents clone() {
47                 long ret = bindings.OnionMessageContents_clone(this.ptr);
48                 GC.KeepAlive(this);
49                 if (ret >= 0 && ret <= 4096) { return null; }
50                 org.ldk.structs.OnionMessageContents ret_hu_conv = org.ldk.structs.OnionMessageContents.constr_from_ptr(ret);
51                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
52                 return ret_hu_conv;
53         }
54
55         /**
56          * Utility method to constructs a new Custom-variant OnionMessageContents
57          */
58         public static OnionMessageContents custom(org.ldk.structs.CustomOnionMessageContents a) {
59                 long ret = bindings.OnionMessageContents_custom(a == null ? 0 : a.ptr);
60                 GC.KeepAlive(a);
61                 if (ret >= 0 && ret <= 4096) { return null; }
62                 org.ldk.structs.OnionMessageContents ret_hu_conv = org.ldk.structs.OnionMessageContents.constr_from_ptr(ret);
63                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
64                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(a); };
65                 return ret_hu_conv;
66         }
67
68 }
69 } } }