Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / RawInvoice.swift
1 import LDKCHeaders
2
3 public class RawInvoice {
4
5     public internal(set) var cOpaqueStruct: LDKRawInvoice?;
6
7         
8
9     public init(pointer: LDKRawInvoice){
10                 self.cOpaqueStruct = pointer
11         }
12
13     /* STRUCT_METHODS_START */
14
15     public func get_data() -> RawDataPart {
16         
17         return RawDataPart(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKRawInvoice>) in
18 RawInvoice_get_data(this_ptrPointer)
19 });
20     }
21
22     public func set_data(val: RawDataPart) -> Void {
23         
24                                                         let this_ptrPointer = UnsafeMutablePointer<LDKRawInvoice>.allocate(capacity: 1)
25                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
26                                                 
27         return RawInvoice_set_data(this_ptrPointer, val.cOpaqueStruct!);
28     }
29
30     public func eq(a: RawInvoice, b: RawInvoice) -> Bool {
31         
32         return withUnsafePointer(to: a.cOpaqueStruct!) { (aPointer: UnsafePointer<LDKRawInvoice>) in
33 withUnsafePointer(to: b.cOpaqueStruct!) { (bPointer: UnsafePointer<LDKRawInvoice>) in
34 RawInvoice_eq(aPointer, bPointer)
35 }
36 };
37     }
38
39     public func clone(orig: RawInvoice) -> RawInvoice {
40         
41         return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKRawInvoice>) in
42 RawInvoice(pointer: RawInvoice_clone(origPointer))
43 };
44     }
45
46     public func hash() -> [UInt8] {
47         
48         return Bindings.LDKThirtyTwoBytes_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKRawInvoice>) in
49 RawInvoice_hash(this_argPointer)
50 });
51     }
52
53     public func payment_hash() -> Sha256 {
54         
55         return Sha256(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKRawInvoice>) in
56 RawInvoice_payment_hash(this_argPointer)
57 });
58     }
59
60     public func description() -> Description {
61         
62         return Description(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKRawInvoice>) in
63 RawInvoice_description(this_argPointer)
64 });
65     }
66
67     public func payee_pub_key() -> PayeePubKey {
68         
69         return PayeePubKey(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKRawInvoice>) in
70 RawInvoice_payee_pub_key(this_argPointer)
71 });
72     }
73
74     public func description_hash() -> Sha256 {
75         
76         return Sha256(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKRawInvoice>) in
77 RawInvoice_description_hash(this_argPointer)
78 });
79     }
80
81     public func expiry_time() -> ExpiryTime {
82         
83         return ExpiryTime(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKRawInvoice>) in
84 RawInvoice_expiry_time(this_argPointer)
85 });
86     }
87
88     public func min_final_cltv_expiry() -> MinFinalCltvExpiry {
89         
90         return MinFinalCltvExpiry(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKRawInvoice>) in
91 RawInvoice_min_final_cltv_expiry(this_argPointer)
92 });
93     }
94
95     public func payment_secret() -> [UInt8] {
96         
97         return Bindings.LDKThirtyTwoBytes_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKRawInvoice>) in
98 RawInvoice_payment_secret(this_argPointer)
99 });
100     }
101
102     public func features() -> InvoiceFeatures {
103         
104         return InvoiceFeatures(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKRawInvoice>) in
105 RawInvoice_features(this_argPointer)
106 });
107     }
108
109     public func private_routes() -> [LDKPrivateRoute] {
110         
111         return Bindings.LDKCVec_PrivateRouteZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKRawInvoice>) in
112 RawInvoice_private_routes(this_argPointer)
113 });
114     }
115
116     public func amount_pico_btc() -> Option_u64Z {
117         
118         return Option_u64Z(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKRawInvoice>) in
119 RawInvoice_amount_pico_btc(this_argPointer)
120 });
121     }
122
123     public func currency() -> LDKCurrency {
124         
125         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKRawInvoice>) in
126 RawInvoice_currency(this_argPointer)
127 };
128     }
129
130                                 
131         deinit {
132                                         if self.cOpaqueStruct?.is_owned == false {
133
134                                         
135                                         
136                 RawInvoice_free(self.cOpaqueStruct!)
137                                         
138 }
139                                 
140         }
141                         
142     /* STRUCT_METHODS_END */
143
144 }