Update auto-generated bindings to LDK v0.0.99
[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.SendErrorMessage) {
23                         return new SendErrorMessage(this.ptr, raw_val);
24                 }
25                 throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
26         }
27
28 }
29 export class DisconnectPeer extends ErrorAction {
30         public msg: ErrorMessage;
31         private constructor(ptr: number, obj: bindings.LDKErrorAction.DisconnectPeer) {
32                 super(null, ptr);
33                 const msg: number = obj.msg;
34                 const msg_hu_conv: ErrorMessage = new ErrorMessage(null, msg);
35                         msg_hu_conv.ptrs_to.add(this);
36                 this.msg = msg_hu_conv;
37         }
38 }
39 export class IgnoreError extends ErrorAction {
40         private constructor(ptr: number, obj: bindings.LDKErrorAction.IgnoreError) {
41                 super(null, ptr);
42         }
43 }
44 export class IgnoreAndLog extends ErrorAction {
45         public ignore_and_log: Level;
46         private constructor(ptr: number, obj: bindings.LDKErrorAction.IgnoreAndLog) {
47                 super(null, ptr);
48                 this.ignore_and_log = obj.ignore_and_log;
49         }
50 }
51 export class SendErrorMessage extends ErrorAction {
52         public msg: ErrorMessage;
53         private constructor(ptr: number, obj: bindings.LDKErrorAction.SendErrorMessage) {
54                 super(null, ptr);
55                 const msg: number = obj.msg;
56                 const msg_hu_conv: ErrorMessage = new ErrorMessage(null, msg);
57                         msg_hu_conv.ptrs_to.add(this);
58                 this.msg = msg_hu_conv;
59         }
60 }
61         public ErrorAction clone() {
62                 number ret = bindings.ErrorAction_clone(this.ptr);
63                 ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret);
64                 ret_hu_conv.ptrs_to.add(this);
65                 return ret_hu_conv;
66         }
67
68 }