[C#] Run tests against release library in determinism CI run
[ldk-java] / c_sharp / src / org / ldk / structs / Bolt12OfferContext.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * The context of a payment made for an invoice requested from a BOLT 12 [`Offer`].
11  * 
12  * [`Offer`]: crate::offers::offer::Offer
13  */
14 public class Bolt12OfferContext : CommonBase {
15         internal Bolt12OfferContext(object _dummy, long ptr) : base(ptr) { }
16         ~Bolt12OfferContext() {
17                 if (ptr != 0) { bindings.Bolt12OfferContext_free(ptr); }
18         }
19
20         /**
21          * The identifier of the [`Offer`].
22          * 
23          * [`Offer`]: crate::offers::offer::Offer
24          */
25         public OfferId get_offer_id() {
26                 long ret = bindings.Bolt12OfferContext_get_offer_id(this.ptr);
27                 GC.KeepAlive(this);
28                 if (ret >= 0 && ret <= 4096) { return null; }
29                 org.ldk.structs.OfferId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OfferId(null, ret); }
30                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
31                 return ret_hu_conv;
32         }
33
34         /**
35          * The identifier of the [`Offer`].
36          * 
37          * [`Offer`]: crate::offers::offer::Offer
38          */
39         public void set_offer_id(org.ldk.structs.OfferId val) {
40                 bindings.Bolt12OfferContext_set_offer_id(this.ptr, val.ptr);
41                 GC.KeepAlive(this);
42                 GC.KeepAlive(val);
43                 if (this != null) { this.ptrs_to.AddLast(val); };
44         }
45
46         /**
47          * Fields from an [`InvoiceRequest`] sent for a [`Bolt12Invoice`].
48          * 
49          * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
50          * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
51          */
52         public InvoiceRequestFields get_invoice_request() {
53                 long ret = bindings.Bolt12OfferContext_get_invoice_request(this.ptr);
54                 GC.KeepAlive(this);
55                 if (ret >= 0 && ret <= 4096) { return null; }
56                 org.ldk.structs.InvoiceRequestFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFields(null, ret); }
57                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
58                 return ret_hu_conv;
59         }
60
61         /**
62          * Fields from an [`InvoiceRequest`] sent for a [`Bolt12Invoice`].
63          * 
64          * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
65          * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
66          */
67         public void set_invoice_request(org.ldk.structs.InvoiceRequestFields val) {
68                 bindings.Bolt12OfferContext_set_invoice_request(this.ptr, val.ptr);
69                 GC.KeepAlive(this);
70                 GC.KeepAlive(val);
71                 if (this != null) { this.ptrs_to.AddLast(val); };
72         }
73
74         /**
75          * Constructs a new Bolt12OfferContext given each field
76          */
77         public static Bolt12OfferContext of(org.ldk.structs.OfferId offer_id_arg, org.ldk.structs.InvoiceRequestFields invoice_request_arg) {
78                 long ret = bindings.Bolt12OfferContext_new(offer_id_arg.ptr, invoice_request_arg.ptr);
79                 GC.KeepAlive(offer_id_arg);
80                 GC.KeepAlive(invoice_request_arg);
81                 if (ret >= 0 && ret <= 4096) { return null; }
82                 org.ldk.structs.Bolt12OfferContext ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt12OfferContext(null, ret); }
83                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
84                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(offer_id_arg); };
85                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(invoice_request_arg); };
86                 return ret_hu_conv;
87         }
88
89         internal long clone_ptr() {
90                 long ret = bindings.Bolt12OfferContext_clone_ptr(this.ptr);
91                 GC.KeepAlive(this);
92                 return ret;
93         }
94
95         /**
96          * Creates a copy of the Bolt12OfferContext
97          */
98         public Bolt12OfferContext clone() {
99                 long ret = bindings.Bolt12OfferContext_clone(this.ptr);
100                 GC.KeepAlive(this);
101                 if (ret >= 0 && ret <= 4096) { return null; }
102                 org.ldk.structs.Bolt12OfferContext ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt12OfferContext(null, ret); }
103                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
104                 return ret_hu_conv;
105         }
106
107         /**
108          * Checks if two Bolt12OfferContexts contain equal inner contents.
109          * This ignores pointers and is_owned flags and looks at the values in fields.
110          * Two objects with NULL inner values will be considered "equal" here.
111          */
112         public bool eq(org.ldk.structs.Bolt12OfferContext b) {
113                 bool ret = bindings.Bolt12OfferContext_eq(this.ptr, b.ptr);
114                 GC.KeepAlive(this);
115                 GC.KeepAlive(b);
116                 if (this != null) { this.ptrs_to.AddLast(b); };
117                 return ret;
118         }
119
120         public override bool Equals(object o) {
121                 if (!(o is Bolt12OfferContext)) return false;
122                 return this.eq((Bolt12OfferContext)o);
123         }
124         /**
125          * Serialize the Bolt12OfferContext object into a byte array which can be read by Bolt12OfferContext_read
126          */
127         public byte[] write() {
128                 long ret = bindings.Bolt12OfferContext_write(this.ptr);
129                 GC.KeepAlive(this);
130                 if (ret >= 0 && ret <= 4096) { return null; }
131                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
132                 return ret_conv;
133         }
134
135         /**
136          * Read a Bolt12OfferContext from a byte array, created by Bolt12OfferContext_write
137          */
138         public static Result_Bolt12OfferContextDecodeErrorZ read(byte[] ser) {
139                 long ret = bindings.Bolt12OfferContext_read(InternalUtils.encodeUint8Array(ser));
140                 GC.KeepAlive(ser);
141                 if (ret >= 0 && ret <= 4096) { return null; }
142                 Result_Bolt12OfferContextDecodeErrorZ ret_hu_conv = Result_Bolt12OfferContextDecodeErrorZ.constr_from_ptr(ret);
143                 return ret_hu_conv;
144         }
145
146 }
147 } } }