[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / SendSuccess.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  * Result of successfully [sending an onion message].
10  * 
11  * [sending an onion message]: OnionMessenger::send_onion_message
12  */
13 public class SendSuccess : CommonBase {
14         protected SendSuccess(object _dummy, long ptr) : base(ptr) { }
15         ~SendSuccess() {
16                 if (ptr != 0) { bindings.SendSuccess_free(ptr); }
17         }
18
19         internal static SendSuccess constr_from_ptr(long ptr) {
20                 long raw_ty = bindings.LDKSendSuccess_ty_from_ptr(ptr);
21                 switch (raw_ty) {
22                         case 0: return new SendSuccess_Buffered(ptr);
23                         case 1: return new SendSuccess_BufferedAwaitingConnection(ptr);
24                         default:
25                                 throw new ArgumentException("Impossible enum variant");
26                 }
27         }
28
29         /** A SendSuccess of type Buffered */
30         public class SendSuccess_Buffered : SendSuccess {
31                 internal SendSuccess_Buffered(long ptr) : base(null, ptr) {
32                 }
33         }
34         /** A SendSuccess of type BufferedAwaitingConnection */
35         public class SendSuccess_BufferedAwaitingConnection : SendSuccess {
36                 public byte[] buffered_awaiting_connection;
37                 internal SendSuccess_BufferedAwaitingConnection(long ptr) : base(null, ptr) {
38                         long buffered_awaiting_connection = bindings.LDKSendSuccess_BufferedAwaitingConnection_get_buffered_awaiting_connection(ptr);
39                         byte[] buffered_awaiting_connection_conv = InternalUtils.decodeUint8Array(buffered_awaiting_connection);
40                         this.buffered_awaiting_connection = buffered_awaiting_connection_conv;
41                 }
42         }
43         internal long clone_ptr() {
44                 long ret = bindings.SendSuccess_clone_ptr(this.ptr);
45                 GC.KeepAlive(this);
46                 return ret;
47         }
48
49         /**
50          * Creates a copy of the SendSuccess
51          */
52         public SendSuccess clone() {
53                 long ret = bindings.SendSuccess_clone(this.ptr);
54                 GC.KeepAlive(this);
55                 if (ret >= 0 && ret <= 4096) { return null; }
56                 org.ldk.structs.SendSuccess ret_hu_conv = org.ldk.structs.SendSuccess.constr_from_ptr(ret);
57                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
58                 return ret_hu_conv;
59         }
60
61         /**
62          * Utility method to constructs a new Buffered-variant SendSuccess
63          */
64         public static SendSuccess buffered() {
65                 long ret = bindings.SendSuccess_buffered();
66                 if (ret >= 0 && ret <= 4096) { return null; }
67                 org.ldk.structs.SendSuccess ret_hu_conv = org.ldk.structs.SendSuccess.constr_from_ptr(ret);
68                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
69                 return ret_hu_conv;
70         }
71
72         /**
73          * Utility method to constructs a new BufferedAwaitingConnection-variant SendSuccess
74          */
75         public static SendSuccess buffered_awaiting_connection(byte[] a) {
76                 long ret = bindings.SendSuccess_buffered_awaiting_connection(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(a, 33)));
77                 GC.KeepAlive(a);
78                 if (ret >= 0 && ret <= 4096) { return null; }
79                 org.ldk.structs.SendSuccess ret_hu_conv = org.ldk.structs.SendSuccess.constr_from_ptr(ret);
80                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
81                 return ret_hu_conv;
82         }
83
84         /**
85          * Checks if two SendSuccesss contain equal inner contents.
86          * This ignores pointers and is_owned flags and looks at the values in fields.
87          */
88         public bool eq(org.ldk.structs.SendSuccess b) {
89                 bool ret = bindings.SendSuccess_eq(this.ptr, b == null ? 0 : b.ptr);
90                 GC.KeepAlive(this);
91                 GC.KeepAlive(b);
92                 return ret;
93         }
94
95         public override bool Equals(object o) {
96                 if (!(o is SendSuccess)) return false;
97                 return this.eq((SendSuccess)o);
98         }
99 }
100 } } }