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