1use reqwest;
13
14use crate::apis::ResponseContent;
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum InternalLightningNodeApiConnectToNodeError {
22 Status422(Vec<crate::models::ValidationProblemDetailsInner>),
23 Status400(crate::models::ProblemDetails),
24 Status503(),
25 Status404(),
26 UnknownValue(serde_json::Value),
27}
28
29#[derive(Debug, Clone, Serialize, Deserialize)]
31#[serde(untagged)]
32pub enum InternalLightningNodeApiCreateInvoiceError {
33 Status400(crate::models::ProblemDetails),
34 Status503(),
35 Status404(),
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum InternalLightningNodeApiGetBalanceError {
43 Status503(),
44 Status404(),
45 UnknownValue(serde_json::Value),
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum InternalLightningNodeApiGetChannelsError {
52 Status404(),
53 UnknownValue(serde_json::Value),
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize)]
58#[serde(untagged)]
59pub enum InternalLightningNodeApiGetDepositAddressError {
60 Status503(),
61 Status404(),
62 UnknownValue(serde_json::Value),
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
67#[serde(untagged)]
68pub enum InternalLightningNodeApiGetInfoError {
69 Status503(),
70 Status404(),
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum InternalLightningNodeApiGetInvoiceError {
78 Status503(),
79 Status404(),
80 UnknownValue(serde_json::Value),
81}
82
83#[derive(Debug, Clone, Serialize, Deserialize)]
85#[serde(untagged)]
86pub enum InternalLightningNodeApiGetPaymentError {
87 Status503(),
88 Status404(),
89 UnknownValue(serde_json::Value),
90}
91
92#[derive(Debug, Clone, Serialize, Deserialize)]
94#[serde(untagged)]
95pub enum InternalLightningNodeApiOpenChannelError {
96 Status422(Vec<crate::models::ValidationProblemDetailsInner>),
97 Status400(crate::models::ProblemDetails),
98 Status404(),
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum InternalLightningNodeApiPayInvoiceError {
106 Status422(Vec<crate::models::ValidationProblemDetailsInner>),
107 Status400(crate::models::ProblemDetails),
108 Status503(),
109 Status404(),
110 UnknownValue(serde_json::Value),
111}
112
113
114pub async fn internal_lightning_node_api_connect_to_node(configuration: &configuration::Configuration, crypto_code: &str, connect_to_node_request: crate::models::ConnectToNodeRequest) -> Result<(), Error<InternalLightningNodeApiConnectToNodeError>> {
116 let local_var_configuration = configuration;
117
118 let local_var_client = &local_var_configuration.client;
119
120 let local_var_uri_str = format!("{}/api/v1/server/lightning/{cryptoCode}/connect", local_var_configuration.base_path, cryptoCode=crate::apis::urlencode(crypto_code));
121 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
122
123 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
124 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
125 }
126 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
127 let local_var_key = local_var_apikey.key.clone();
128 let local_var_value = match local_var_apikey.prefix {
129 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
130 None => local_var_key,
131 };
132 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
133 };
134 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
135 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
136 };
137 local_var_req_builder = local_var_req_builder.json(&connect_to_node_request);
138
139 let local_var_req = local_var_req_builder.build()?;
140 let local_var_resp = local_var_client.execute(local_var_req).await?;
141
142 let local_var_status = local_var_resp.status();
143 let local_var_content = local_var_resp.text().await?;
144
145 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
146 Ok(())
147 } else {
148 let local_var_entity: Option<InternalLightningNodeApiConnectToNodeError> = serde_json::from_str(&local_var_content).ok();
149 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
150 Err(Error::ResponseError(local_var_error))
151 }
152}
153
154pub async fn internal_lightning_node_api_create_invoice(configuration: &configuration::Configuration, crypto_code: &str, create_lightning_invoice_request: crate::models::CreateLightningInvoiceRequest) -> Result<crate::models::LightningInvoiceData, Error<InternalLightningNodeApiCreateInvoiceError>> {
156 let local_var_configuration = configuration;
157
158 let local_var_client = &local_var_configuration.client;
159
160 let local_var_uri_str = format!("{}/api/v1/server/lightning/{cryptoCode}/invoices", local_var_configuration.base_path, cryptoCode=crate::apis::urlencode(crypto_code));
161 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
162
163 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
164 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
165 }
166 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
167 let local_var_key = local_var_apikey.key.clone();
168 let local_var_value = match local_var_apikey.prefix {
169 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
170 None => local_var_key,
171 };
172 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
173 };
174 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
175 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
176 };
177 local_var_req_builder = local_var_req_builder.json(&create_lightning_invoice_request);
178
179 let local_var_req = local_var_req_builder.build()?;
180 let local_var_resp = local_var_client.execute(local_var_req).await?;
181
182 let local_var_status = local_var_resp.status();
183 let local_var_content = local_var_resp.text().await?;
184
185 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
186 serde_json::from_str(&local_var_content).map_err(Error::from)
187 } else {
188 let local_var_entity: Option<InternalLightningNodeApiCreateInvoiceError> = serde_json::from_str(&local_var_content).ok();
189 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
190 Err(Error::ResponseError(local_var_error))
191 }
192}
193
194pub async fn internal_lightning_node_api_get_balance(configuration: &configuration::Configuration, crypto_code: &str) -> Result<crate::models::LightningNodeBalanceData, Error<InternalLightningNodeApiGetBalanceError>> {
196 let local_var_configuration = configuration;
197
198 let local_var_client = &local_var_configuration.client;
199
200 let local_var_uri_str = format!("{}/api/v1/server/lightning/{cryptoCode}/balance", local_var_configuration.base_path, cryptoCode=crate::apis::urlencode(crypto_code));
201 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
202
203 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
204 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
205 }
206 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
207 let local_var_key = local_var_apikey.key.clone();
208 let local_var_value = match local_var_apikey.prefix {
209 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
210 None => local_var_key,
211 };
212 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
213 };
214 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
215 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
216 };
217
218 let local_var_req = local_var_req_builder.build()?;
219 let local_var_resp = local_var_client.execute(local_var_req).await?;
220
221 let local_var_status = local_var_resp.status();
222 let local_var_content = local_var_resp.text().await?;
223
224 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
225 serde_json::from_str(&local_var_content).map_err(Error::from)
226 } else {
227 let local_var_entity: Option<InternalLightningNodeApiGetBalanceError> = serde_json::from_str(&local_var_content).ok();
228 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
229 Err(Error::ResponseError(local_var_error))
230 }
231}
232
233pub async fn internal_lightning_node_api_get_channels(configuration: &configuration::Configuration, crypto_code: &str) -> Result<Vec<crate::models::LightningChannelData>, Error<InternalLightningNodeApiGetChannelsError>> {
235 let local_var_configuration = configuration;
236
237 let local_var_client = &local_var_configuration.client;
238
239 let local_var_uri_str = format!("{}/api/v1/server/lightning/{cryptoCode}/channels", local_var_configuration.base_path, cryptoCode=crate::apis::urlencode(crypto_code));
240 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
241
242 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
243 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
244 }
245 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
246 let local_var_key = local_var_apikey.key.clone();
247 let local_var_value = match local_var_apikey.prefix {
248 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
249 None => local_var_key,
250 };
251 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
252 };
253 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
254 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
255 };
256
257 let local_var_req = local_var_req_builder.build()?;
258 let local_var_resp = local_var_client.execute(local_var_req).await?;
259
260 let local_var_status = local_var_resp.status();
261 let local_var_content = local_var_resp.text().await?;
262
263 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
264 serde_json::from_str(&local_var_content).map_err(Error::from)
265 } else {
266 let local_var_entity: Option<InternalLightningNodeApiGetChannelsError> = serde_json::from_str(&local_var_content).ok();
267 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
268 Err(Error::ResponseError(local_var_error))
269 }
270}
271
272pub async fn internal_lightning_node_api_get_deposit_address(configuration: &configuration::Configuration, crypto_code: &str) -> Result<String, Error<InternalLightningNodeApiGetDepositAddressError>> {
274 let local_var_configuration = configuration;
275
276 let local_var_client = &local_var_configuration.client;
277
278 let local_var_uri_str = format!("{}/api/v1/server/lightning/{cryptoCode}/address", local_var_configuration.base_path, cryptoCode=crate::apis::urlencode(crypto_code));
279 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
280
281 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
282 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
283 }
284 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
285 let local_var_key = local_var_apikey.key.clone();
286 let local_var_value = match local_var_apikey.prefix {
287 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
288 None => local_var_key,
289 };
290 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
291 };
292 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
293 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
294 };
295
296 let local_var_req = local_var_req_builder.build()?;
297 let local_var_resp = local_var_client.execute(local_var_req).await?;
298
299 let local_var_status = local_var_resp.status();
300 let local_var_content = local_var_resp.text().await?;
301
302 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
303 serde_json::from_str(&local_var_content).map_err(Error::from)
304 } else {
305 let local_var_entity: Option<InternalLightningNodeApiGetDepositAddressError> = serde_json::from_str(&local_var_content).ok();
306 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
307 Err(Error::ResponseError(local_var_error))
308 }
309}
310
311pub async fn internal_lightning_node_api_get_info(configuration: &configuration::Configuration, crypto_code: &str) -> Result<crate::models::LightningNodeInformationData, Error<InternalLightningNodeApiGetInfoError>> {
313 let local_var_configuration = configuration;
314
315 let local_var_client = &local_var_configuration.client;
316
317 let local_var_uri_str = format!("{}/api/v1/server/lightning/{cryptoCode}/info", local_var_configuration.base_path, cryptoCode=crate::apis::urlencode(crypto_code));
318 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
319
320 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
321 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
322 }
323 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
324 let local_var_key = local_var_apikey.key.clone();
325 let local_var_value = match local_var_apikey.prefix {
326 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
327 None => local_var_key,
328 };
329 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
330 };
331 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
332 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
333 };
334
335 let local_var_req = local_var_req_builder.build()?;
336 let local_var_resp = local_var_client.execute(local_var_req).await?;
337
338 let local_var_status = local_var_resp.status();
339 let local_var_content = local_var_resp.text().await?;
340
341 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
342 serde_json::from_str(&local_var_content).map_err(Error::from)
343 } else {
344 let local_var_entity: Option<InternalLightningNodeApiGetInfoError> = serde_json::from_str(&local_var_content).ok();
345 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
346 Err(Error::ResponseError(local_var_error))
347 }
348}
349
350pub async fn internal_lightning_node_api_get_invoice(configuration: &configuration::Configuration, crypto_code: &str, id: &str) -> Result<crate::models::LightningInvoiceData, Error<InternalLightningNodeApiGetInvoiceError>> {
352 let local_var_configuration = configuration;
353
354 let local_var_client = &local_var_configuration.client;
355
356 let local_var_uri_str = format!("{}/api/v1/server/lightning/{cryptoCode}/invoices/{id}", local_var_configuration.base_path, cryptoCode=crate::apis::urlencode(crypto_code), id=crate::apis::urlencode(id));
357 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
358
359 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
360 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
361 }
362 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
363 let local_var_key = local_var_apikey.key.clone();
364 let local_var_value = match local_var_apikey.prefix {
365 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
366 None => local_var_key,
367 };
368 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
369 };
370 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
371 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
372 };
373
374 let local_var_req = local_var_req_builder.build()?;
375 let local_var_resp = local_var_client.execute(local_var_req).await?;
376
377 let local_var_status = local_var_resp.status();
378 let local_var_content = local_var_resp.text().await?;
379
380 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
381 serde_json::from_str(&local_var_content).map_err(Error::from)
382 } else {
383 let local_var_entity: Option<InternalLightningNodeApiGetInvoiceError> = serde_json::from_str(&local_var_content).ok();
384 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
385 Err(Error::ResponseError(local_var_error))
386 }
387}
388
389pub async fn internal_lightning_node_api_get_payment(configuration: &configuration::Configuration, crypto_code: &str, payment_hash: &str) -> Result<crate::models::LightningPaymentData, Error<InternalLightningNodeApiGetPaymentError>> {
391 let local_var_configuration = configuration;
392
393 let local_var_client = &local_var_configuration.client;
394
395 let local_var_uri_str = format!("{}/api/v1/server/lightning/{cryptoCode}/payments/{paymentHash}", local_var_configuration.base_path, cryptoCode=crate::apis::urlencode(crypto_code), paymentHash=crate::apis::urlencode(payment_hash));
396 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
397
398 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
399 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
400 }
401 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
402 let local_var_key = local_var_apikey.key.clone();
403 let local_var_value = match local_var_apikey.prefix {
404 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
405 None => local_var_key,
406 };
407 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
408 };
409 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
410 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
411 };
412
413 let local_var_req = local_var_req_builder.build()?;
414 let local_var_resp = local_var_client.execute(local_var_req).await?;
415
416 let local_var_status = local_var_resp.status();
417 let local_var_content = local_var_resp.text().await?;
418
419 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
420 serde_json::from_str(&local_var_content).map_err(Error::from)
421 } else {
422 let local_var_entity: Option<InternalLightningNodeApiGetPaymentError> = serde_json::from_str(&local_var_content).ok();
423 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
424 Err(Error::ResponseError(local_var_error))
425 }
426}
427
428pub async fn internal_lightning_node_api_open_channel(configuration: &configuration::Configuration, crypto_code: &str, open_lightning_channel_request: crate::models::OpenLightningChannelRequest) -> Result<(), Error<InternalLightningNodeApiOpenChannelError>> {
430 let local_var_configuration = configuration;
431
432 let local_var_client = &local_var_configuration.client;
433
434 let local_var_uri_str = format!("{}/api/v1/server/lightning/{cryptoCode}/channels", local_var_configuration.base_path, cryptoCode=crate::apis::urlencode(crypto_code));
435 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
436
437 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
438 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
439 }
440 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
441 let local_var_key = local_var_apikey.key.clone();
442 let local_var_value = match local_var_apikey.prefix {
443 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
444 None => local_var_key,
445 };
446 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
447 };
448 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
449 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
450 };
451 local_var_req_builder = local_var_req_builder.json(&open_lightning_channel_request);
452
453 let local_var_req = local_var_req_builder.build()?;
454 let local_var_resp = local_var_client.execute(local_var_req).await?;
455
456 let local_var_status = local_var_resp.status();
457 let local_var_content = local_var_resp.text().await?;
458
459 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
460 Ok(())
461 } else {
462 let local_var_entity: Option<InternalLightningNodeApiOpenChannelError> = serde_json::from_str(&local_var_content).ok();
463 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
464 Err(Error::ResponseError(local_var_error))
465 }
466}
467
468pub async fn internal_lightning_node_api_pay_invoice(configuration: &configuration::Configuration, crypto_code: &str, pay_lightning_invoice_request: crate::models::PayLightningInvoiceRequest) -> Result<crate::models::LightningPaymentData, Error<InternalLightningNodeApiPayInvoiceError>> {
470 let local_var_configuration = configuration;
471
472 let local_var_client = &local_var_configuration.client;
473
474 let local_var_uri_str = format!("{}/api/v1/server/lightning/{cryptoCode}/invoices/pay", local_var_configuration.base_path, cryptoCode=crate::apis::urlencode(crypto_code));
475 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
476
477 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
478 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
479 }
480 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
481 let local_var_key = local_var_apikey.key.clone();
482 let local_var_value = match local_var_apikey.prefix {
483 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
484 None => local_var_key,
485 };
486 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
487 };
488 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
489 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
490 };
491 local_var_req_builder = local_var_req_builder.json(&pay_lightning_invoice_request);
492
493 let local_var_req = local_var_req_builder.build()?;
494 let local_var_resp = local_var_client.execute(local_var_req).await?;
495
496 let local_var_status = local_var_resp.status();
497 let local_var_content = local_var_resp.text().await?;
498
499 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
500 serde_json::from_str(&local_var_content).map_err(Error::from)
501 } else {
502 let local_var_entity: Option<InternalLightningNodeApiPayInvoiceError> = serde_json::from_str(&local_var_content).ok();
503 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
504 Err(Error::ResponseError(local_var_error))
505 }
506}
507