Update auto-updated Java files
[ldk-java] / ts / structs / ErrorAction.ts
1
2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
4
5 export default class ErrorAction extends CommonBase {
6         protected constructor(_dummy: object, ptr: number) { super(ptr); }
7         protected finalize() {
8                 super.finalize();
9                 if (this.ptr != 0) { bindings.ErrorAction_free(this.ptr); }
10         }
11         static constr_from_ptr(ptr: number): ErrorAction {
12                 const raw_val: bindings.LDKErrorAction = bindings.LDKErrorAction_ref_from_ptr(ptr);
13                 if (raw_val instanceof bindings.LDKErrorAction.DisconnectPeer) {
14                         return new DisconnectPeer(this.ptr, raw_val);
15                 }
16                 if (raw_val instanceof bindings.LDKErrorAction.IgnoreError) {
17                         return new IgnoreError(this.ptr, raw_val);
18                 }
19                 if (raw_val instanceof bindings.LDKErrorAction.IgnoreAndLog) {
20                         return new IgnoreAndLog(this.ptr, raw_val);
21                 }
22                 if (raw_val instanceof bindings.LDKErrorAction.IgnoreDuplicateGossip) {
23                         return new IgnoreDuplicateGossip(this.ptr, raw_val);
24                 }
25                 if (raw_val instanceof bindings.LDKErrorAction.SendErrorMessage) {
26                         return new SendErrorMessage(this.ptr, raw_val);
27                 }
28                 throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
29         }
30
31 }
32 export class DisconnectPeer extends ErrorAction {
33         public msg: ErrorMessage;
34         private constructor(ptr: number, obj: bindings.LDKErrorAction.DisconnectPeer) {
35                 super(null, ptr);
36                 const msg: number = obj.msg;
37                 const msg_hu_conv: ErrorMessage = new ErrorMessage(null, msg);
38                         msg_hu_conv.ptrs_to.add(this);
39                 this.msg = msg_hu_conv;
40         }
41 }
42 export class IgnoreError extends ErrorAction {
43         private constructor(ptr: number, obj: bindings.LDKErrorAction.IgnoreError) {
44                 super(null, ptr);
45         }
46 }
47 export class IgnoreAndLog extends ErrorAction {
48         public ignore_and_log: Level;
49         private constructor(ptr: number, obj: bindings.LDKErrorAction.IgnoreAndLog) {
50                 super(null, ptr);
51                 this.ignore_and_log = obj.ignore_and_log;
52         }
53 }
54 export class IgnoreDuplicateGossip extends ErrorAction {
55         private constructor(ptr: number, obj: bindings.LDKErrorAction.IgnoreDuplicateGossip) {
56                 super(null, ptr);
57         }
58 }
59 export class SendErrorMessage extends ErrorAction {
60         public msg: ErrorMessage;
61         private constructor(ptr: number, obj: bindings.LDKErrorAction.SendErrorMessage) {
62                 super(null, ptr);
63                 const msg: number = obj.msg;
64                 const msg_hu_conv: ErrorMessage = new ErrorMessage(null, msg);
65                         msg_hu_conv.ptrs_to.add(this);
66                 this.msg = msg_hu_conv;
67         }
68 }
69         public number clone_ptr() {
70                 number ret = bindings.ErrorAction_clone_ptr(this.ptr);
71                 return ret;
72         }
73
74         public ErrorAction clone() {
75                 number ret = bindings.ErrorAction_clone(this.ptr);
76                 ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret);
77                 ret_hu_conv.ptrs_to.add(this);
78                 return ret_hu_conv;
79         }
80
81         public static ErrorAction constructor_disconnect_peer(ErrorMessage msg) {
82                 number ret = bindings.ErrorAction_disconnect_peer(msg == null ? 0 : msg.ptr & ~1);
83                 ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret);
84                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
85                 return ret_hu_conv;
86         }
87
88         public static ErrorAction constructor_ignore_error() {
89                 number ret = bindings.ErrorAction_ignore_error();
90                 ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret);
91                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
92                 return ret_hu_conv;
93         }
94
95         public static ErrorAction constructor_ignore_and_log(Level a) {
96                 number ret = bindings.ErrorAction_ignore_and_log(a);
97                 ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret);
98                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
99                 return ret_hu_conv;
100         }
101
102         public static ErrorAction constructor_ignore_duplicate_gossip() {
103                 number ret = bindings.ErrorAction_ignore_duplicate_gossip();
104                 ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret);
105                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
106                 return ret_hu_conv;
107         }
108
109         public static ErrorAction constructor_send_error_message(ErrorMessage msg) {
110                 number ret = bindings.ErrorAction_send_error_message(msg == null ? 0 : msg.ptr & ~1);
111                 ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret);
112                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
113                 return ret_hu_conv;
114         }
115
116 }