1use super::configuration;
12use super::ContentType;
13use super::Error;
14use crate::apis::ResponseContent;
15use crate::models;
16use reqwest;
17use serde::de::Error as _;
18use serde::Deserialize;
19use serde::Serialize;
20
21#[derive(Debug, Clone, Serialize, Deserialize)]
23#[serde(untagged)]
24pub enum ArkServiceConfirmRegistrationError {
25 DefaultResponse(models::Status),
26 UnknownValue(serde_json::Value),
27}
28
29#[derive(Debug, Clone, Serialize, Deserialize)]
31#[serde(untagged)]
32pub enum ArkServiceDeleteIntentError {
33 DefaultResponse(models::Status),
34 UnknownValue(serde_json::Value),
35}
36
37#[derive(Debug, Clone, Serialize, Deserialize)]
39#[serde(untagged)]
40pub enum ArkServiceEstimateIntentFeeError {
41 DefaultResponse(models::Status),
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum ArkServiceFinalizeTxError {
49 DefaultResponse(models::Status),
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum ArkServiceGetEventStreamError {
57 DefaultResponse(models::Status),
58 UnknownValue(serde_json::Value),
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum ArkServiceGetInfoError {
65 DefaultResponse(models::Status),
66 UnknownValue(serde_json::Value),
67}
68
69#[derive(Debug, Clone, Serialize, Deserialize)]
71#[serde(untagged)]
72pub enum ArkServiceGetIntentError {
73 DefaultResponse(models::Status),
74 UnknownValue(serde_json::Value),
75}
76
77#[derive(Debug, Clone, Serialize, Deserialize)]
79#[serde(untagged)]
80pub enum ArkServiceGetIntent2Error {
81 DefaultResponse(models::Status),
82 UnknownValue(serde_json::Value),
83}
84
85#[derive(Debug, Clone, Serialize, Deserialize)]
87#[serde(untagged)]
88pub enum ArkServiceGetPendingTxError {
89 DefaultResponse(models::Status),
90 UnknownValue(serde_json::Value),
91}
92
93#[derive(Debug, Clone, Serialize, Deserialize)]
95#[serde(untagged)]
96pub enum ArkServiceGetTransactionsStreamError {
97 DefaultResponse(models::Status),
98 UnknownValue(serde_json::Value),
99}
100
101#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum ArkServiceRegisterIntentError {
105 DefaultResponse(models::Status),
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum ArkServiceSubmitSignedForfeitTxsError {
113 DefaultResponse(models::Status),
114 UnknownValue(serde_json::Value),
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum ArkServiceSubmitTreeNoncesError {
121 DefaultResponse(models::Status),
122 UnknownValue(serde_json::Value),
123}
124
125#[derive(Debug, Clone, Serialize, Deserialize)]
127#[serde(untagged)]
128pub enum ArkServiceSubmitTreeSignaturesError {
129 DefaultResponse(models::Status),
130 UnknownValue(serde_json::Value),
131}
132
133#[derive(Debug, Clone, Serialize, Deserialize)]
135#[serde(untagged)]
136pub enum ArkServiceSubmitTxError {
137 DefaultResponse(models::Status),
138 UnknownValue(serde_json::Value),
139}
140
141#[derive(Debug, Clone, Serialize, Deserialize)]
143#[serde(untagged)]
144pub enum ArkServiceUpdateStreamTopicsError {
145 DefaultResponse(models::Status),
146 UnknownValue(serde_json::Value),
147}
148
149pub async fn ark_service_confirm_registration(
152 configuration: &configuration::Configuration,
153 confirm_registration_request: models::ConfirmRegistrationRequest,
154) -> Result<serde_json::Value, Error<ArkServiceConfirmRegistrationError>> {
155 let p_confirm_registration_request = confirm_registration_request;
157
158 let uri_str = format!("{}/v1/batch/ack", configuration.base_path);
159 let mut req_builder = configuration
160 .client
161 .request(reqwest::Method::POST, &uri_str);
162
163 if let Some(ref user_agent) = configuration.user_agent {
164 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
165 }
166 req_builder = req_builder.json(&p_confirm_registration_request);
167
168 let req = req_builder.build()?;
169 let resp = configuration.client.execute(req).await?;
170
171 let status = resp.status();
172 let content_type = resp
173 .headers()
174 .get("content-type")
175 .and_then(|v| v.to_str().ok())
176 .unwrap_or("application/octet-stream");
177 let content_type = super::ContentType::from(content_type);
178
179 if !status.is_client_error() && !status.is_server_error() {
180 let content = resp.text().await?;
181 match content_type {
182 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
183 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
184 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
185 }
186 } else {
187 let content = resp.text().await?;
188 let entity: Option<ArkServiceConfirmRegistrationError> =
189 serde_json::from_str(&content).ok();
190 Err(Error::ResponseError(ResponseContent {
191 status,
192 content,
193 entity,
194 }))
195 }
196}
197
198pub async fn ark_service_delete_intent(
202 configuration: &configuration::Configuration,
203 delete_intent_request: models::DeleteIntentRequest,
204) -> Result<serde_json::Value, Error<ArkServiceDeleteIntentError>> {
205 let p_delete_intent_request = delete_intent_request;
207
208 let uri_str = format!("{}/v1/batch/deleteIntent", configuration.base_path);
209 let mut req_builder = configuration
210 .client
211 .request(reqwest::Method::POST, &uri_str);
212
213 if let Some(ref user_agent) = configuration.user_agent {
214 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
215 }
216 req_builder = req_builder.json(&p_delete_intent_request);
217
218 let req = req_builder.build()?;
219 let resp = configuration.client.execute(req).await?;
220
221 let status = resp.status();
222 let content_type = resp
223 .headers()
224 .get("content-type")
225 .and_then(|v| v.to_str().ok())
226 .unwrap_or("application/octet-stream");
227 let content_type = super::ContentType::from(content_type);
228
229 if !status.is_client_error() && !status.is_server_error() {
230 let content = resp.text().await?;
231 match content_type {
232 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
233 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
234 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
235 }
236 } else {
237 let content = resp.text().await?;
238 let entity: Option<ArkServiceDeleteIntentError> = serde_json::from_str(&content).ok();
239 Err(Error::ResponseError(ResponseContent {
240 status,
241 content,
242 entity,
243 }))
244 }
245}
246
247pub async fn ark_service_estimate_intent_fee(
251 configuration: &configuration::Configuration,
252 estimate_intent_fee_request: models::EstimateIntentFeeRequest,
253) -> Result<models::EstimateIntentFeeResponse, Error<ArkServiceEstimateIntentFeeError>> {
254 let p_estimate_intent_fee_request = estimate_intent_fee_request;
256
257 let uri_str = format!("{}/v1/batch/estimateFee", configuration.base_path);
258 let mut req_builder = configuration
259 .client
260 .request(reqwest::Method::POST, &uri_str);
261
262 if let Some(ref user_agent) = configuration.user_agent {
263 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
264 }
265 req_builder = req_builder.json(&p_estimate_intent_fee_request);
266
267 let req = req_builder.build()?;
268 let resp = configuration.client.execute(req).await?;
269
270 let status = resp.status();
271 let content_type = resp
272 .headers()
273 .get("content-type")
274 .and_then(|v| v.to_str().ok())
275 .unwrap_or("application/octet-stream");
276 let content_type = super::ContentType::from(content_type);
277
278 if !status.is_client_error() && !status.is_server_error() {
279 let content = resp.text().await?;
280 match content_type {
281 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
282 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EstimateIntentFeeResponse`"))),
283 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::EstimateIntentFeeResponse`")))),
284 }
285 } else {
286 let content = resp.text().await?;
287 let entity: Option<ArkServiceEstimateIntentFeeError> = serde_json::from_str(&content).ok();
288 Err(Error::ResponseError(ResponseContent {
289 status,
290 content,
291 entity,
292 }))
293 }
294}
295
296pub async fn ark_service_finalize_tx(
300 configuration: &configuration::Configuration,
301 finalize_tx_request: models::FinalizeTxRequest,
302) -> Result<serde_json::Value, Error<ArkServiceFinalizeTxError>> {
303 let p_finalize_tx_request = finalize_tx_request;
305
306 let uri_str = format!("{}/v1/tx/finalize", configuration.base_path);
307 let mut req_builder = configuration
308 .client
309 .request(reqwest::Method::POST, &uri_str);
310
311 if let Some(ref user_agent) = configuration.user_agent {
312 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
313 }
314 req_builder = req_builder.json(&p_finalize_tx_request);
315
316 let req = req_builder.build()?;
317 let resp = configuration.client.execute(req).await?;
318
319 let status = resp.status();
320 let content_type = resp
321 .headers()
322 .get("content-type")
323 .and_then(|v| v.to_str().ok())
324 .unwrap_or("application/octet-stream");
325 let content_type = super::ContentType::from(content_type);
326
327 if !status.is_client_error() && !status.is_server_error() {
328 let content = resp.text().await?;
329 match content_type {
330 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
331 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
332 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
333 }
334 } else {
335 let content = resp.text().await?;
336 let entity: Option<ArkServiceFinalizeTxError> = serde_json::from_str(&content).ok();
337 Err(Error::ResponseError(ResponseContent {
338 status,
339 content,
340 entity,
341 }))
342 }
343}
344
345pub async fn ark_service_get_event_stream(
353 configuration: &configuration::Configuration,
354 topics: Option<Vec<String>>,
355) -> Result<models::GetEventStreamResponse, Error<ArkServiceGetEventStreamError>> {
356 let p_topics = topics;
358
359 let uri_str = format!("{}/v1/batch/events", configuration.base_path);
360 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
361
362 if let Some(ref param_value) = p_topics {
363 req_builder = match "csv" {
364 "multi" => req_builder.query(
365 ¶m_value
366 .into_iter()
367 .map(|p| ("topics".to_owned(), p.to_string()))
368 .collect::<Vec<(std::string::String, std::string::String)>>(),
369 ),
370 _ => req_builder.query(&[(
371 "topics",
372 ¶m_value
373 .into_iter()
374 .map(|p| p.to_string())
375 .collect::<Vec<String>>()
376 .join(",")
377 .to_string(),
378 )]),
379 };
380 }
381 if let Some(ref user_agent) = configuration.user_agent {
382 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
383 }
384
385 let req = req_builder.build()?;
386 let resp = configuration.client.execute(req).await?;
387
388 let status = resp.status();
389 let content_type = resp
390 .headers()
391 .get("content-type")
392 .and_then(|v| v.to_str().ok())
393 .unwrap_or("application/octet-stream");
394 let content_type = super::ContentType::from(content_type);
395
396 if !status.is_client_error() && !status.is_server_error() {
397 let content = resp.text().await?;
398 match content_type {
399 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
400 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEventStreamResponse`"))),
401 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetEventStreamResponse`")))),
402 }
403 } else {
404 let content = resp.text().await?;
405 let entity: Option<ArkServiceGetEventStreamError> = serde_json::from_str(&content).ok();
406 Err(Error::ResponseError(ResponseContent {
407 status,
408 content,
409 entity,
410 }))
411 }
412}
413
414pub async fn ark_service_get_info(
416 configuration: &configuration::Configuration,
417) -> Result<models::GetInfoResponse, Error<ArkServiceGetInfoError>> {
418 let uri_str = format!("{}/v1/info", configuration.base_path);
419 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
420
421 if let Some(ref user_agent) = configuration.user_agent {
422 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
423 }
424
425 let req = req_builder.build()?;
426 let resp = configuration.client.execute(req).await?;
427
428 let status = resp.status();
429 let content_type = resp
430 .headers()
431 .get("content-type")
432 .and_then(|v| v.to_str().ok())
433 .unwrap_or("application/octet-stream");
434 let content_type = super::ContentType::from(content_type);
435
436 if !status.is_client_error() && !status.is_server_error() {
437 let content = resp.text().await?;
438 match content_type {
439 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
440 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetInfoResponse`"))),
441 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetInfoResponse`")))),
442 }
443 } else {
444 let content = resp.text().await?;
445 let entity: Option<ArkServiceGetInfoError> = serde_json::from_str(&content).ok();
446 Err(Error::ResponseError(ResponseContent {
447 status,
448 content,
449 entity,
450 }))
451 }
452}
453
454pub async fn ark_service_get_intent(
455 configuration: &configuration::Configuration,
456 txid: Option<&str>,
457 intent_period_proof: Option<&str>,
458 intent_period_message: Option<&str>,
459) -> Result<models::GetIntentResponse, Error<ArkServiceGetIntentError>> {
460 let p_txid = txid;
462 let p_intent_period_proof = intent_period_proof;
463 let p_intent_period_message = intent_period_message;
464
465 let uri_str = format!("{}/v1/intent", configuration.base_path);
466 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
467
468 if let Some(ref param_value) = p_txid {
469 req_builder = req_builder.query(&[("txid", ¶m_value.to_string())]);
470 }
471 if let Some(ref param_value) = p_intent_period_proof {
472 req_builder = req_builder.query(&[("intent.proof", ¶m_value.to_string())]);
473 }
474 if let Some(ref param_value) = p_intent_period_message {
475 req_builder = req_builder.query(&[("intent.message", ¶m_value.to_string())]);
476 }
477 if let Some(ref user_agent) = configuration.user_agent {
478 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
479 }
480
481 let req = req_builder.build()?;
482 let resp = configuration.client.execute(req).await?;
483
484 let status = resp.status();
485 let content_type = resp
486 .headers()
487 .get("content-type")
488 .and_then(|v| v.to_str().ok())
489 .unwrap_or("application/octet-stream");
490 let content_type = super::ContentType::from(content_type);
491
492 if !status.is_client_error() && !status.is_server_error() {
493 let content = resp.text().await?;
494 match content_type {
495 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
496 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetIntentResponse`"))),
497 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetIntentResponse`")))),
498 }
499 } else {
500 let content = resp.text().await?;
501 let entity: Option<ArkServiceGetIntentError> = serde_json::from_str(&content).ok();
502 Err(Error::ResponseError(ResponseContent {
503 status,
504 content,
505 entity,
506 }))
507 }
508}
509
510pub async fn ark_service_get_intent2(
511 configuration: &configuration::Configuration,
512 get_intent_request: models::GetIntentRequest,
513) -> Result<models::GetIntentResponse, Error<ArkServiceGetIntent2Error>> {
514 let p_get_intent_request = get_intent_request;
516
517 let uri_str = format!("{}/v1/intent", configuration.base_path);
518 let mut req_builder = configuration
519 .client
520 .request(reqwest::Method::POST, &uri_str);
521
522 if let Some(ref user_agent) = configuration.user_agent {
523 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
524 }
525 req_builder = req_builder.json(&p_get_intent_request);
526
527 let req = req_builder.build()?;
528 let resp = configuration.client.execute(req).await?;
529
530 let status = resp.status();
531 let content_type = resp
532 .headers()
533 .get("content-type")
534 .and_then(|v| v.to_str().ok())
535 .unwrap_or("application/octet-stream");
536 let content_type = super::ContentType::from(content_type);
537
538 if !status.is_client_error() && !status.is_server_error() {
539 let content = resp.text().await?;
540 match content_type {
541 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
542 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetIntentResponse`"))),
543 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetIntentResponse`")))),
544 }
545 } else {
546 let content = resp.text().await?;
547 let entity: Option<ArkServiceGetIntent2Error> = serde_json::from_str(&content).ok();
548 Err(Error::ResponseError(ResponseContent {
549 status,
550 content,
551 entity,
552 }))
553 }
554}
555
556pub async fn ark_service_get_pending_tx(
559 configuration: &configuration::Configuration,
560 get_pending_tx_request: models::GetPendingTxRequest,
561) -> Result<models::GetPendingTxResponse, Error<ArkServiceGetPendingTxError>> {
562 let p_get_pending_tx_request = get_pending_tx_request;
564
565 let uri_str = format!("{}/v1/tx/pending", configuration.base_path);
566 let mut req_builder = configuration
567 .client
568 .request(reqwest::Method::POST, &uri_str);
569
570 if let Some(ref user_agent) = configuration.user_agent {
571 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
572 }
573 req_builder = req_builder.json(&p_get_pending_tx_request);
574
575 let req = req_builder.build()?;
576 let resp = configuration.client.execute(req).await?;
577
578 let status = resp.status();
579 let content_type = resp
580 .headers()
581 .get("content-type")
582 .and_then(|v| v.to_str().ok())
583 .unwrap_or("application/octet-stream");
584 let content_type = super::ContentType::from(content_type);
585
586 if !status.is_client_error() && !status.is_server_error() {
587 let content = resp.text().await?;
588 match content_type {
589 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
590 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetPendingTxResponse`"))),
591 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetPendingTxResponse`")))),
592 }
593 } else {
594 let content = resp.text().await?;
595 let entity: Option<ArkServiceGetPendingTxError> = serde_json::from_str(&content).ok();
596 Err(Error::ResponseError(ResponseContent {
597 status,
598 content,
599 entity,
600 }))
601 }
602}
603
604pub async fn ark_service_get_transactions_stream(
609 configuration: &configuration::Configuration,
610) -> Result<models::GetTransactionsStreamResponse, Error<ArkServiceGetTransactionsStreamError>> {
611 let uri_str = format!("{}/v1/txs", configuration.base_path);
612 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
613
614 if let Some(ref user_agent) = configuration.user_agent {
615 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
616 }
617
618 let req = req_builder.build()?;
619 let resp = configuration.client.execute(req).await?;
620
621 let status = resp.status();
622 let content_type = resp
623 .headers()
624 .get("content-type")
625 .and_then(|v| v.to_str().ok())
626 .unwrap_or("application/octet-stream");
627 let content_type = super::ContentType::from(content_type);
628
629 if !status.is_client_error() && !status.is_server_error() {
630 let content = resp.text().await?;
631 match content_type {
632 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
633 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetTransactionsStreamResponse`"))),
634 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetTransactionsStreamResponse`")))),
635 }
636 } else {
637 let content = resp.text().await?;
638 let entity: Option<ArkServiceGetTransactionsStreamError> =
639 serde_json::from_str(&content).ok();
640 Err(Error::ResponseError(ResponseContent {
641 status,
642 content,
643 entity,
644 }))
645 }
646}
647
648pub async fn ark_service_register_intent(
652 configuration: &configuration::Configuration,
653 register_intent_request: models::RegisterIntentRequest,
654) -> Result<models::RegisterIntentResponse, Error<ArkServiceRegisterIntentError>> {
655 let p_register_intent_request = register_intent_request;
657
658 let uri_str = format!("{}/v1/batch/registerIntent", configuration.base_path);
659 let mut req_builder = configuration
660 .client
661 .request(reqwest::Method::POST, &uri_str);
662
663 if let Some(ref user_agent) = configuration.user_agent {
664 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
665 }
666 req_builder = req_builder.json(&p_register_intent_request);
667
668 let req = req_builder.build()?;
669 let resp = configuration.client.execute(req).await?;
670
671 let status = resp.status();
672 let content_type = resp
673 .headers()
674 .get("content-type")
675 .and_then(|v| v.to_str().ok())
676 .unwrap_or("application/octet-stream");
677 let content_type = super::ContentType::from(content_type);
678
679 if !status.is_client_error() && !status.is_server_error() {
680 let content = resp.text().await?;
681 match content_type {
682 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
683 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RegisterIntentResponse`"))),
684 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RegisterIntentResponse`")))),
685 }
686 } else {
687 let content = resp.text().await?;
688 let entity: Option<ArkServiceRegisterIntentError> = serde_json::from_str(&content).ok();
689 Err(Error::ResponseError(ResponseContent {
690 status,
691 content,
692 entity,
693 }))
694 }
695}
696
697pub async fn ark_service_submit_signed_forfeit_txs(
701 configuration: &configuration::Configuration,
702 submit_signed_forfeit_txs_request: models::SubmitSignedForfeitTxsRequest,
703) -> Result<serde_json::Value, Error<ArkServiceSubmitSignedForfeitTxsError>> {
704 let p_submit_signed_forfeit_txs_request = submit_signed_forfeit_txs_request;
706
707 let uri_str = format!("{}/v1/batch/submitForfeitTxs", configuration.base_path);
708 let mut req_builder = configuration
709 .client
710 .request(reqwest::Method::POST, &uri_str);
711
712 if let Some(ref user_agent) = configuration.user_agent {
713 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
714 }
715 req_builder = req_builder.json(&p_submit_signed_forfeit_txs_request);
716
717 let req = req_builder.build()?;
718 let resp = configuration.client.execute(req).await?;
719
720 let status = resp.status();
721 let content_type = resp
722 .headers()
723 .get("content-type")
724 .and_then(|v| v.to_str().ok())
725 .unwrap_or("application/octet-stream");
726 let content_type = super::ContentType::from(content_type);
727
728 if !status.is_client_error() && !status.is_server_error() {
729 let content = resp.text().await?;
730 match content_type {
731 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
732 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
733 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
734 }
735 } else {
736 let content = resp.text().await?;
737 let entity: Option<ArkServiceSubmitSignedForfeitTxsError> =
738 serde_json::from_str(&content).ok();
739 Err(Error::ResponseError(ResponseContent {
740 status,
741 content,
742 entity,
743 }))
744 }
745}
746
747pub async fn ark_service_submit_tree_nonces(
752 configuration: &configuration::Configuration,
753 submit_tree_nonces_request: models::SubmitTreeNoncesRequest,
754) -> Result<serde_json::Value, Error<ArkServiceSubmitTreeNoncesError>> {
755 let p_submit_tree_nonces_request = submit_tree_nonces_request;
757
758 let uri_str = format!("{}/v1/batch/tree/submitNonces", configuration.base_path);
759 let mut req_builder = configuration
760 .client
761 .request(reqwest::Method::POST, &uri_str);
762
763 if let Some(ref user_agent) = configuration.user_agent {
764 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
765 }
766 req_builder = req_builder.json(&p_submit_tree_nonces_request);
767
768 let req = req_builder.build()?;
769 let resp = configuration.client.execute(req).await?;
770
771 let status = resp.status();
772 let content_type = resp
773 .headers()
774 .get("content-type")
775 .and_then(|v| v.to_str().ok())
776 .unwrap_or("application/octet-stream");
777 let content_type = super::ContentType::from(content_type);
778
779 if !status.is_client_error() && !status.is_server_error() {
780 let content = resp.text().await?;
781 match content_type {
782 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
783 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
784 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
785 }
786 } else {
787 let content = resp.text().await?;
788 let entity: Option<ArkServiceSubmitTreeNoncesError> = serde_json::from_str(&content).ok();
789 Err(Error::ResponseError(ResponseContent {
790 status,
791 content,
792 entity,
793 }))
794 }
795}
796
797pub async fn ark_service_submit_tree_signatures(
802 configuration: &configuration::Configuration,
803 submit_tree_signatures_request: models::SubmitTreeSignaturesRequest,
804) -> Result<serde_json::Value, Error<ArkServiceSubmitTreeSignaturesError>> {
805 let p_submit_tree_signatures_request = submit_tree_signatures_request;
807
808 let uri_str = format!("{}/v1/batch/tree/submitSignatures", configuration.base_path);
809 let mut req_builder = configuration
810 .client
811 .request(reqwest::Method::POST, &uri_str);
812
813 if let Some(ref user_agent) = configuration.user_agent {
814 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
815 }
816 req_builder = req_builder.json(&p_submit_tree_signatures_request);
817
818 let req = req_builder.build()?;
819 let resp = configuration.client.execute(req).await?;
820
821 let status = resp.status();
822 let content_type = resp
823 .headers()
824 .get("content-type")
825 .and_then(|v| v.to_str().ok())
826 .unwrap_or("application/octet-stream");
827 let content_type = super::ContentType::from(content_type);
828
829 if !status.is_client_error() && !status.is_server_error() {
830 let content = resp.text().await?;
831 match content_type {
832 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
833 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
834 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
835 }
836 } else {
837 let content = resp.text().await?;
838 let entity: Option<ArkServiceSubmitTreeSignaturesError> =
839 serde_json::from_str(&content).ok();
840 Err(Error::ResponseError(ResponseContent {
841 status,
842 content,
843 entity,
844 }))
845 }
846}
847
848pub async fn ark_service_submit_tx(
852 configuration: &configuration::Configuration,
853 submit_tx_request: models::SubmitTxRequest,
854) -> Result<models::SubmitTxResponse, Error<ArkServiceSubmitTxError>> {
855 let p_submit_tx_request = submit_tx_request;
857
858 let uri_str = format!("{}/v1/tx/submit", configuration.base_path);
859 let mut req_builder = configuration
860 .client
861 .request(reqwest::Method::POST, &uri_str);
862
863 if let Some(ref user_agent) = configuration.user_agent {
864 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
865 }
866 req_builder = req_builder.json(&p_submit_tx_request);
867
868 let req = req_builder.build()?;
869 let resp = configuration.client.execute(req).await?;
870
871 let status = resp.status();
872 let content_type = resp
873 .headers()
874 .get("content-type")
875 .and_then(|v| v.to_str().ok())
876 .unwrap_or("application/octet-stream");
877 let content_type = super::ContentType::from(content_type);
878
879 if !status.is_client_error() && !status.is_server_error() {
880 let content = resp.text().await?;
881 match content_type {
882 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
883 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SubmitTxResponse`"))),
884 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SubmitTxResponse`")))),
885 }
886 } else {
887 let content = resp.text().await?;
888 let entity: Option<ArkServiceSubmitTxError> = serde_json::from_str(&content).ok();
889 Err(Error::ResponseError(ResponseContent {
890 status,
891 content,
892 entity,
893 }))
894 }
895}
896
897pub async fn ark_service_update_stream_topics(
901 configuration: &configuration::Configuration,
902 update_stream_topics_request: models::UpdateStreamTopicsRequest,
903) -> Result<models::UpdateStreamTopicsResponse, Error<ArkServiceUpdateStreamTopicsError>> {
904 let p_update_stream_topics_request = update_stream_topics_request;
906
907 let uri_str = format!("{}/v1/batch/updateTopics", configuration.base_path);
908 let mut req_builder = configuration
909 .client
910 .request(reqwest::Method::POST, &uri_str);
911
912 if let Some(ref user_agent) = configuration.user_agent {
913 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
914 }
915 req_builder = req_builder.json(&p_update_stream_topics_request);
916
917 let req = req_builder.build()?;
918 let resp = configuration.client.execute(req).await?;
919
920 let status = resp.status();
921 let content_type = resp
922 .headers()
923 .get("content-type")
924 .and_then(|v| v.to_str().ok())
925 .unwrap_or("application/octet-stream");
926 let content_type = super::ContentType::from(content_type);
927
928 if !status.is_client_error() && !status.is_server_error() {
929 let content = resp.text().await?;
930 match content_type {
931 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
932 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpdateStreamTopicsResponse`"))),
933 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UpdateStreamTopicsResponse`")))),
934 }
935 } else {
936 let content = resp.text().await?;
937 let entity: Option<ArkServiceUpdateStreamTopicsError> = serde_json::from_str(&content).ok();
938 Err(Error::ResponseError(ResponseContent {
939 status,
940 content,
941 entity,
942 }))
943 }
944}