Update auto-generated bindings to latest upstream
[ldk-java] / src / main / java / org / ldk / structs / Result_PaymentSecretAPIErrorZ.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
8
9 public class Result_PaymentSecretAPIErrorZ extends CommonBase {
10         private Result_PaymentSecretAPIErrorZ(Object _dummy, long ptr) { super(ptr); }
11         protected void finalize() throws Throwable {
12                 if (ptr != 0) { bindings.CResult_PaymentSecretAPIErrorZ_free(ptr); } super.finalize();
13         }
14
15         static Result_PaymentSecretAPIErrorZ constr_from_ptr(long ptr) {
16                 if (bindings.LDKCResult_PaymentSecretAPIErrorZ_result_ok(ptr)) {
17                         return new Result_PaymentSecretAPIErrorZ_OK(null, ptr);
18                 } else {
19                         return new Result_PaymentSecretAPIErrorZ_Err(null, ptr);
20                 }
21         }
22         public static final class Result_PaymentSecretAPIErrorZ_OK extends Result_PaymentSecretAPIErrorZ {
23                 public final byte[] res;
24                 private Result_PaymentSecretAPIErrorZ_OK(Object _dummy, long ptr) {
25                         super(_dummy, ptr);
26                         this.res = bindings.LDKCResult_PaymentSecretAPIErrorZ_get_ok(ptr);
27                 }
28         }
29
30         public static final class Result_PaymentSecretAPIErrorZ_Err extends Result_PaymentSecretAPIErrorZ {
31                 public final APIError err;
32                 private Result_PaymentSecretAPIErrorZ_Err(Object _dummy, long ptr) {
33                         super(_dummy, ptr);
34                         long err = bindings.LDKCResult_PaymentSecretAPIErrorZ_get_err(ptr);
35                         APIError err_hu_conv = APIError.constr_from_ptr(err);
36                         err_hu_conv.ptrs_to.add(this);
37                         this.err = err_hu_conv;
38                 }
39         }
40
41         /**
42          * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
43          */
44         public static Result_PaymentSecretAPIErrorZ ok(byte[] o) {
45                 long ret = bindings.CResult_PaymentSecretAPIErrorZ_ok(o);
46                 if (ret < 1024) { return null; }
47                 Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret);
48                 return ret_hu_conv;
49         }
50
51         /**
52          * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
53          */
54         public static Result_PaymentSecretAPIErrorZ err(APIError e) {
55                 long ret = bindings.CResult_PaymentSecretAPIErrorZ_err(e.ptr);
56                 if (ret < 1024) { return null; }
57                 Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret);
58                 return ret_hu_conv;
59         }
60
61         /**
62          * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
63          * but with all dynamically-allocated buffers duplicated in new buffers.
64          */
65         public Result_PaymentSecretAPIErrorZ clone() {
66                 long ret = bindings.CResult_PaymentSecretAPIErrorZ_clone(this.ptr);
67                 if (ret < 1024) { return null; }
68                 Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret);
69                 return ret_hu_conv;
70         }
71
72 }