[C#] Check in initial auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / Result__u832APIErrorZ.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__u832APIErrorZ : CommonBase {
9         Result__u832APIErrorZ(object _dummy, long ptr) : base(ptr) { }
10         ~Result__u832APIErrorZ() {
11                 if (ptr != 0) { bindings.CResult__u832APIErrorZ_free(ptr); }
12         }
13
14         internal static Result__u832APIErrorZ constr_from_ptr(long ptr) {
15                 if (bindings.CResult__u832APIErrorZ_is_ok(ptr)) {
16                         return new Result__u832APIErrorZ_OK(null, ptr);
17                 } else {
18                         return new Result__u832APIErrorZ_Err(null, ptr);
19                 }
20         }
21         public class Result__u832APIErrorZ_OK : Result__u832APIErrorZ {
22                 public readonly byte[] res;
23                 internal Result__u832APIErrorZ_OK(object _dummy, long ptr) : base(_dummy, ptr) {
24                         this.res = bindings.CResult__u832APIErrorZ_get_ok(ptr);
25                 }
26         }
27
28         public class Result__u832APIErrorZ_Err : Result__u832APIErrorZ {
29                 public readonly APIError err;
30                 internal Result__u832APIErrorZ_Err(object _dummy, long ptr) : base(_dummy, ptr) {
31                         long err = bindings.CResult__u832APIErrorZ_get_err(ptr);
32                         org.ldk.structs.APIError err_hu_conv = org.ldk.structs.APIError.constr_from_ptr(err);
33                         if (err_hu_conv != null) { err_hu_conv.ptrs_to.AddLast(this); };
34                         this.err = err_hu_conv;
35                 }
36         }
37
38         /**
39          * Creates a new CResult__u832APIErrorZ in the success state.
40          */
41         public static Result__u832APIErrorZ ok(byte[] o) {
42                 long ret = bindings.CResult__u832APIErrorZ_ok(InternalUtils.check_arr_len(o, 32));
43                 GC.KeepAlive(o);
44                 if (ret >= 0 && ret <= 4096) { return null; }
45                 Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret);
46                 return ret_hu_conv;
47         }
48
49         /**
50          * Creates a new CResult__u832APIErrorZ in the error state.
51          */
52         public static Result__u832APIErrorZ err(org.ldk.structs.APIError e) {
53                 long ret = bindings.CResult__u832APIErrorZ_err(e.ptr);
54                 GC.KeepAlive(e);
55                 if (ret >= 0 && ret <= 4096) { return null; }
56                 Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret);
57                 return ret_hu_conv;
58         }
59
60         /**
61          * Checks if the given object is currently in the success state
62          */
63         public bool is_ok() {
64                 bool ret = bindings.CResult__u832APIErrorZ_is_ok(this.ptr);
65                 GC.KeepAlive(this);
66                 return ret;
67         }
68
69         internal long clone_ptr() {
70                 long ret = bindings.CResult__u832APIErrorZ_clone_ptr(this.ptr);
71                 GC.KeepAlive(this);
72                 return ret;
73         }
74
75         /**
76          * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
77          * but with all dynamically-allocated buffers duplicated in new buffers.
78          */
79         public Result__u832APIErrorZ clone() {
80                 long ret = bindings.CResult__u832APIErrorZ_clone(this.ptr);
81                 GC.KeepAlive(this);
82                 if (ret >= 0 && ret <= 4096) { return null; }
83                 Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret);
84                 return ret_hu_conv;
85         }
86
87 }
88 } } }