[TS] Update tests for LDK 0.0.121 API
[ldk-java] / c_sharp / src / org / ldk / structs / Result_NoneSendErrorZ.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 public class Result_NoneSendErrorZ : CommonBase {
9         Result_NoneSendErrorZ(object _dummy, long ptr) : base(ptr) { }
10         ~Result_NoneSendErrorZ() {
11                 if (ptr != 0) { bindings.CResult_NoneSendErrorZ_free(ptr); }
12         }
13
14         internal static Result_NoneSendErrorZ constr_from_ptr(long ptr) {
15                 if (bindings.CResult_NoneSendErrorZ_is_ok(ptr)) {
16                         return new Result_NoneSendErrorZ_OK(null, ptr);
17                 } else {
18                         return new Result_NoneSendErrorZ_Err(null, ptr);
19                 }
20         }
21         public class Result_NoneSendErrorZ_OK : Result_NoneSendErrorZ {
22                 internal Result_NoneSendErrorZ_OK(object _dummy, long ptr) : base(_dummy, ptr) {
23                 }
24         }
25
26         public class Result_NoneSendErrorZ_Err : Result_NoneSendErrorZ {
27                 public readonly SendError err;
28                 internal Result_NoneSendErrorZ_Err(object _dummy, long ptr) : base(_dummy, ptr) {
29                         long err = bindings.CResult_NoneSendErrorZ_get_err(ptr);
30                         org.ldk.structs.SendError err_hu_conv = org.ldk.structs.SendError.constr_from_ptr(err);
31                         if (err_hu_conv != null) { err_hu_conv.ptrs_to.AddLast(this); };
32                         this.err = err_hu_conv;
33                 }
34         }
35
36         /**
37          * Creates a new CResult_NoneSendErrorZ in the success state.
38          */
39         public static Result_NoneSendErrorZ ok() {
40                 long ret = bindings.CResult_NoneSendErrorZ_ok();
41                 if (ret >= 0 && ret <= 4096) { return null; }
42                 Result_NoneSendErrorZ ret_hu_conv = Result_NoneSendErrorZ.constr_from_ptr(ret);
43                 return ret_hu_conv;
44         }
45
46         /**
47          * Creates a new CResult_NoneSendErrorZ in the error state.
48          */
49         public static Result_NoneSendErrorZ err(org.ldk.structs.SendError e) {
50                 long ret = bindings.CResult_NoneSendErrorZ_err(e.ptr);
51                 GC.KeepAlive(e);
52                 if (ret >= 0 && ret <= 4096) { return null; }
53                 Result_NoneSendErrorZ ret_hu_conv = Result_NoneSendErrorZ.constr_from_ptr(ret);
54                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(e); };
55                 return ret_hu_conv;
56         }
57
58         /**
59          * Checks if the given object is currently in the success state
60          */
61         public bool is_ok() {
62                 bool ret = bindings.CResult_NoneSendErrorZ_is_ok(this.ptr);
63                 GC.KeepAlive(this);
64                 return ret;
65         }
66
67 }
68 } } }