Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / ChannelInfo.swift
1 import LDKCHeaders
2
3 public class ChannelInfo {
4
5     public internal(set) var cOpaqueStruct: LDKChannelInfo?;
6
7         /* DEFAULT_CONSTRUCTOR_START */
8     public init(features_arg: ChannelFeatures, node_one_arg: [UInt8], one_to_two_arg: DirectionalChannelInfo, node_two_arg: [UInt8], two_to_one_arg: DirectionalChannelInfo, capacity_sats_arg: Option_u64Z, announcement_message_arg: ChannelAnnouncement) {
9         
10         self.cOpaqueStruct = ChannelInfo_new(features_arg.cOpaqueStruct!, Bindings.new_LDKPublicKey(array: node_one_arg), one_to_two_arg.cOpaqueStruct!, Bindings.new_LDKPublicKey(array: node_two_arg), two_to_one_arg.cOpaqueStruct!, capacity_sats_arg.cOpaqueStruct!, announcement_message_arg.cOpaqueStruct!)
11     }
12     /* DEFAULT_CONSTRUCTOR_END */
13
14     public init(pointer: LDKChannelInfo){
15                 self.cOpaqueStruct = pointer
16         }
17
18     /* STRUCT_METHODS_START */
19
20     public func get_features() -> ChannelFeatures {
21         
22         return ChannelFeatures(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelInfo>) in
23 ChannelInfo_get_features(this_ptrPointer)
24 });
25     }
26
27     public func set_features(val: ChannelFeatures) -> Void {
28         
29                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelInfo>.allocate(capacity: 1)
30                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
31                                                 
32         return ChannelInfo_set_features(this_ptrPointer, val.cOpaqueStruct!);
33     }
34
35     public func get_node_one() -> [UInt8] {
36         
37         return Bindings.LDKPublicKey_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelInfo>) in
38 ChannelInfo_get_node_one(this_ptrPointer)
39 });
40     }
41
42     public func set_node_one(val: [UInt8]) -> Void {
43         
44                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelInfo>.allocate(capacity: 1)
45                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
46                                                 
47         return ChannelInfo_set_node_one(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
48     }
49
50     public func get_one_to_two() -> DirectionalChannelInfo {
51         
52         return DirectionalChannelInfo(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelInfo>) in
53 ChannelInfo_get_one_to_two(this_ptrPointer)
54 });
55     }
56
57     public func set_one_to_two(val: DirectionalChannelInfo) -> Void {
58         
59                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelInfo>.allocate(capacity: 1)
60                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
61                                                 
62         return ChannelInfo_set_one_to_two(this_ptrPointer, val.cOpaqueStruct!);
63     }
64
65     public func get_node_two() -> [UInt8] {
66         
67         return Bindings.LDKPublicKey_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelInfo>) in
68 ChannelInfo_get_node_two(this_ptrPointer)
69 });
70     }
71
72     public func set_node_two(val: [UInt8]) -> Void {
73         
74                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelInfo>.allocate(capacity: 1)
75                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
76                                                 
77         return ChannelInfo_set_node_two(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
78     }
79
80     public func get_two_to_one() -> DirectionalChannelInfo {
81         
82         return DirectionalChannelInfo(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelInfo>) in
83 ChannelInfo_get_two_to_one(this_ptrPointer)
84 });
85     }
86
87     public func set_two_to_one(val: DirectionalChannelInfo) -> Void {
88         
89                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelInfo>.allocate(capacity: 1)
90                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
91                                                 
92         return ChannelInfo_set_two_to_one(this_ptrPointer, val.cOpaqueStruct!);
93     }
94
95     public func get_capacity_sats() -> Option_u64Z {
96         
97         return Option_u64Z(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelInfo>) in
98 ChannelInfo_get_capacity_sats(this_ptrPointer)
99 });
100     }
101
102     public func set_capacity_sats(val: Option_u64Z) -> Void {
103         
104                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelInfo>.allocate(capacity: 1)
105                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
106                                                 
107         return ChannelInfo_set_capacity_sats(this_ptrPointer, val.cOpaqueStruct!);
108     }
109
110     public func get_announcement_message() -> ChannelAnnouncement {
111         
112         return ChannelAnnouncement(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelInfo>) in
113 ChannelInfo_get_announcement_message(this_ptrPointer)
114 });
115     }
116
117     public func set_announcement_message(val: ChannelAnnouncement) -> Void {
118         
119                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelInfo>.allocate(capacity: 1)
120                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
121                                                 
122         return ChannelInfo_set_announcement_message(this_ptrPointer, val.cOpaqueStruct!);
123     }
124
125     public func clone(orig: ChannelInfo) -> ChannelInfo {
126         
127         return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKChannelInfo>) in
128 ChannelInfo(pointer: ChannelInfo_clone(origPointer))
129 };
130     }
131
132     public func write(obj: ChannelInfo) -> [UInt8] {
133         
134         return Bindings.LDKCVec_u8Z_to_array(nativeType: withUnsafePointer(to: obj.cOpaqueStruct!) { (objPointer: UnsafePointer<LDKChannelInfo>) in
135 ChannelInfo_write(objPointer)
136 });
137     }
138
139     public func read(ser: [UInt8]) -> Result_ChannelInfoDecodeErrorZ {
140         
141         return Result_ChannelInfoDecodeErrorZ(pointer: ChannelInfo_read(Bindings.new_LDKu8slice(array: ser)));
142     }
143
144                                 
145         deinit {
146                                         if self.cOpaqueStruct?.is_owned == false {
147
148                                         
149                                         
150                 ChannelInfo_free(self.cOpaqueStruct!)
151                                         
152 }
153                                 
154         }
155                         
156     /* STRUCT_METHODS_END */
157
158 }