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