1#![allow(clippy::format_in_format_args)]
7#![allow(clippy::let_unit_value)]
8use super::types::*;
9use thiserror::Error;
10pub mod openapi_to_rust_problem {
13 #[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
14 pub struct ProblemDetails {
15 #[serde(rename = "type")]
16 pub type_uri: String,
17 pub title: String,
18 pub status: u16,
19 pub code: String,
20 #[serde(default)]
21 pub errors: Vec<InvalidParameter>,
22 #[serde(default, skip_serializing_if = "Option::is_none")]
23 pub detail: Option<String>,
24 #[serde(default, skip_serializing_if = "Option::is_none")]
25 pub instance: Option<String>,
26 }
27 #[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
28 pub struct InvalidParameter {
29 pub code: String,
30 pub location: String,
31 pub message: String,
32 }
33}
34#[derive(Error, Debug)]
42pub enum HttpError {
43 #[error("Network error: {0}")]
45 Network(#[from] reqwest::Error),
46 #[error("Middleware error: {0}")]
48 Middleware(#[from] reqwest_middleware::Error),
49 #[error("Failed to serialize request: {0}")]
51 Serialization(String),
52 #[error("Authentication error: {0}")]
54 Auth(String),
55 #[error("Request timeout")]
57 Timeout,
58 #[error("Response body exceeded configured limit of {limit} bytes")]
60 ResponseTooLarge { limit: usize },
61 #[error("Configuration error: {0}")]
63 Config(String),
64 #[error("{0}")]
66 Other(String),
67}
68impl HttpError {
69 pub fn serialization_error(error: impl std::fmt::Display) -> Self {
71 Self::Serialization(error.to_string())
72 }
73 pub fn is_retryable(&self) -> bool {
75 matches!(self, Self::Network(_) | Self::Middleware(_) | Self::Timeout)
76 }
77}
78#[derive(Debug, Clone)]
90pub struct ApiError<E> {
91 pub status: u16,
92 pub headers: reqwest::header::HeaderMap,
93 pub body: String,
94 pub raw_body: Vec<u8>,
96 pub typed: Option<E>,
97 pub parse_error: Option<String>,
98}
99const API_ERROR_BODY_DISPLAY_LIMIT: usize = 500;
100const API_ERROR_BODY_TRUNCATION_MARKER: &str = "... [truncated]";
101fn display_api_error_body(body: &str) -> std::borrow::Cow<'_, str> {
102 let Some((end, _)) = body.char_indices().nth(API_ERROR_BODY_DISPLAY_LIMIT) else {
103 return std::borrow::Cow::Borrowed(body);
104 };
105 let mut displayed = String::with_capacity(end + API_ERROR_BODY_TRUNCATION_MARKER.len());
106 displayed.push_str(&body[..end]);
107 displayed.push_str(API_ERROR_BODY_TRUNCATION_MARKER);
108 std::borrow::Cow::Owned(displayed)
109}
110impl<E> ApiError<E> {
111 pub fn is_client_error(&self) -> bool {
112 (400..500).contains(&self.status)
113 }
114 pub fn is_server_error(&self) -> bool {
115 (500..600).contains(&self.status)
116 }
117 pub fn is_retryable(&self) -> bool {
120 matches!(self.status, 429 | 500 | 502 | 503 | 504)
121 }
122 pub fn problem_details(&self) -> Option<openapi_to_rust_problem::ProblemDetails> {
134 let content_type = self
135 .headers
136 .get(reqwest::header::CONTENT_TYPE)?
137 .to_str()
138 .ok()?;
139 let media_type = content_type.split(';').next()?.trim();
140 if !media_type.eq_ignore_ascii_case("application/problem+json") {
141 return None;
142 }
143 serde_json::from_str(&self.body).ok()
144 }
145}
146impl<E: std::fmt::Debug> std::fmt::Display for ApiError<E> {
147 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
148 write!(
149 f,
150 "API error {}: {}",
151 self.status,
152 display_api_error_body(&self.body)
153 )?;
154 if let Some(typed) = &self.typed {
155 write!(f, "; typed: {typed:?}")?;
156 }
157 if let Some(parse_error) = &self.parse_error {
158 write!(f, "; parse error: {parse_error}")?;
159 }
160 Ok(())
161 }
162}
163impl<E: std::fmt::Debug> std::error::Error for ApiError<E> {}
164#[derive(Debug, Error)]
172pub enum ApiOpError<E: std::fmt::Debug> {
173 #[error(transparent)]
174 Transport(#[from] HttpError),
175 #[error(transparent)]
176 Api(ApiError<E>),
177}
178impl<E: std::fmt::Debug> ApiOpError<E> {
179 pub fn api(&self) -> Option<&ApiError<E>> {
181 match self {
182 Self::Api(e) => Some(e),
183 Self::Transport(_) => None,
184 }
185 }
186 pub fn is_api_error(&self) -> bool {
189 matches!(self, Self::Api(_))
190 }
191}
192impl<E: std::fmt::Debug> From<reqwest::Error> for ApiOpError<E> {
193 fn from(e: reqwest::Error) -> Self {
194 Self::Transport(HttpError::Network(e))
195 }
196}
197impl<E: std::fmt::Debug> From<reqwest_middleware::Error> for ApiOpError<E> {
198 fn from(e: reqwest_middleware::Error) -> Self {
199 Self::Transport(HttpError::Middleware(e))
200 }
201}
202pub type HttpResult<T> = Result<T, HttpError>;
206use reqwest_middleware::{ClientBuilder, ClientWithMiddleware};
207use std::collections::BTreeMap;
208pub const DEFAULT_MAX_RESPONSE_BODY_BYTES: usize = 8 * 1024 * 1024;
210#[derive(Clone)]
212pub struct HttpClient {
213 base_url: String,
214 api_key: Option<String>,
215 http_client: ClientWithMiddleware,
216 custom_headers: BTreeMap<String, String>,
217 max_response_body_bytes: usize,
218}
219async fn __read_bounded_response_body(
220 mut response: reqwest::Response,
221 limit: usize,
222) -> Result<Vec<u8>, HttpError> {
223 let mut body = Vec::new();
224 while let Some(chunk) = response.chunk().await.map_err(HttpError::Network)? {
225 let next_len = body.len().checked_add(chunk.len());
226 if next_len.is_none_or(|next_len| next_len > limit) {
227 return Err(HttpError::ResponseTooLarge { limit });
228 }
229 body.extend_from_slice(&chunk);
230 }
231 Ok(body)
232}
233impl HttpClient {
234 pub fn new() -> Self {
236 Self::with_config(true)
237 }
238 pub fn with_config(enable_tracing: bool) -> Self {
240 let reqwest_client = reqwest::Client::new();
241 let mut client_builder = ClientBuilder::new(reqwest_client);
242 if enable_tracing {
243 use reqwest_tracing::TracingMiddleware;
244 client_builder = client_builder.with(TracingMiddleware::default());
245 }
246 let http_client = client_builder.build();
247 Self {
248 base_url: "https://api.jup.ag".to_string(),
249 api_key: None,
250 http_client,
251 custom_headers: BTreeMap::new(),
252 max_response_body_bytes: 8388608usize,
253 }
254 }
255 pub fn with_base_url(mut self, base_url: impl Into<String>) -> Self {
257 self.base_url = base_url.into();
258 self
259 }
260 pub fn with_api_key(mut self, api_key: impl Into<String>) -> Self {
262 self.api_key = Some(api_key.into());
263 self
264 }
265 pub fn with_max_response_body_bytes(mut self, limit: usize) -> Self {
267 self.max_response_body_bytes = limit;
268 self
269 }
270 pub fn with_header(mut self, name: impl Into<String>, value: impl Into<String>) -> Self {
272 self.custom_headers.insert(name.into(), value.into());
273 self
274 }
275 pub fn with_headers(mut self, headers: BTreeMap<String, String>) -> Self {
277 self.custom_headers.extend(headers);
278 self
279 }
280}
281impl Default for HttpClient {
282 fn default() -> Self {
283 Self::new()
284 }
285}
286fn __pct_encode_path_segment(s: &str) -> String {
287 let mut out = String::with_capacity(s.len());
288 for &b in s.as_bytes() {
289 match b {
290 b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'.' | b'_' | b'~' => {
291 out.push(b as char);
292 }
293 _ => {
294 out.push('%');
295 out.push_str(&format!("{:02X}", b));
296 }
297 }
298 }
299 out
300}
301#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
303pub enum GetBuildMode {
304 #[serde(rename = "fast")]
305 Fast,
306}
307impl GetBuildMode {
308 pub fn as_str(&self) -> &'static str {
309 match self {
310 Self::Fast => "fast",
311 }
312 }
313}
314impl std::fmt::Display for GetBuildMode {
315 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
316 f.write_str(self.as_str())
317 }
318}
319impl AsRef<str> for GetBuildMode {
320 fn as_ref(&self) -> &str {
321 self.as_str()
322 }
323}
324#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
326pub enum GetOrderBroadcastFeeType {
327 #[serde(rename = "maxCap")]
328 MaxCap,
329 #[serde(rename = "exactFee")]
330 ExactFee,
331}
332impl GetOrderBroadcastFeeType {
333 pub fn as_str(&self) -> &'static str {
334 match self {
335 Self::MaxCap => "maxCap",
336 Self::ExactFee => "exactFee",
337 }
338 }
339}
340impl std::fmt::Display for GetOrderBroadcastFeeType {
341 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
342 f.write_str(self.as_str())
343 }
344}
345impl AsRef<str> for GetOrderBroadcastFeeType {
346 fn as_ref(&self) -> &str {
347 self.as_str()
348 }
349}
350#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
352pub enum GetOrderSwapMode {
353 #[serde(rename = "ExactIn")]
354 ExactIn,
355}
356impl GetOrderSwapMode {
357 pub fn as_str(&self) -> &'static str {
358 match self {
359 Self::ExactIn => "ExactIn",
360 }
361 }
362}
363impl std::fmt::Display for GetOrderSwapMode {
364 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
365 f.write_str(self.as_str())
366 }
367}
368impl AsRef<str> for GetOrderSwapMode {
369 fn as_ref(&self) -> &str {
370 self.as_str()
371 }
372}
373#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
375pub enum GetPredictionV1EventsCategory {
376 #[serde(rename = "all")]
377 All,
378 #[serde(rename = "crypto")]
379 Crypto,
380 #[serde(rename = "sports")]
381 Sports,
382 #[serde(rename = "politics")]
383 Politics,
384 #[serde(rename = "esports")]
385 Esports,
386 #[serde(rename = "culture")]
387 Culture,
388 #[serde(rename = "economics")]
389 Economics,
390 #[serde(rename = "tech")]
391 Tech,
392}
393impl GetPredictionV1EventsCategory {
394 pub fn as_str(&self) -> &'static str {
395 match self {
396 Self::All => "all",
397 Self::Crypto => "crypto",
398 Self::Sports => "sports",
399 Self::Politics => "politics",
400 Self::Esports => "esports",
401 Self::Culture => "culture",
402 Self::Economics => "economics",
403 Self::Tech => "tech",
404 }
405 }
406}
407impl std::fmt::Display for GetPredictionV1EventsCategory {
408 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
409 f.write_str(self.as_str())
410 }
411}
412impl AsRef<str> for GetPredictionV1EventsCategory {
413 fn as_ref(&self) -> &str {
414 self.as_str()
415 }
416}
417#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
419pub enum GetPredictionV1EventsFilter {
420 #[serde(rename = "new")]
421 New,
422 #[serde(rename = "live")]
423 Live,
424 #[serde(rename = "trending")]
425 Trending,
426 #[serde(rename = "upcoming")]
427 Upcoming,
428}
429impl GetPredictionV1EventsFilter {
430 pub fn as_str(&self) -> &'static str {
431 match self {
432 Self::New => "new",
433 Self::Live => "live",
434 Self::Trending => "trending",
435 Self::Upcoming => "upcoming",
436 }
437 }
438}
439impl std::fmt::Display for GetPredictionV1EventsFilter {
440 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
441 f.write_str(self.as_str())
442 }
443}
444impl AsRef<str> for GetPredictionV1EventsFilter {
445 fn as_ref(&self) -> &str {
446 self.as_str()
447 }
448}
449#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
451pub enum GetPredictionV1EventsProvider {
452 #[serde(rename = "kalshi")]
453 Kalshi,
454 #[serde(rename = "polymarket")]
455 Polymarket,
456 #[serde(rename = "bisonfi")]
457 Bisonfi,
458}
459impl GetPredictionV1EventsProvider {
460 pub fn as_str(&self) -> &'static str {
461 match self {
462 Self::Kalshi => "kalshi",
463 Self::Polymarket => "polymarket",
464 Self::Bisonfi => "bisonfi",
465 }
466 }
467}
468impl std::fmt::Display for GetPredictionV1EventsProvider {
469 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
470 f.write_str(self.as_str())
471 }
472}
473impl AsRef<str> for GetPredictionV1EventsProvider {
474 fn as_ref(&self) -> &str {
475 self.as_str()
476 }
477}
478#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
480pub enum GetPredictionV1EventsSearchProvider {
481 #[serde(rename = "kalshi")]
482 Kalshi,
483 #[serde(rename = "polymarket")]
484 Polymarket,
485 #[serde(rename = "bisonfi")]
486 Bisonfi,
487}
488impl GetPredictionV1EventsSearchProvider {
489 pub fn as_str(&self) -> &'static str {
490 match self {
491 Self::Kalshi => "kalshi",
492 Self::Polymarket => "polymarket",
493 Self::Bisonfi => "bisonfi",
494 }
495 }
496}
497impl std::fmt::Display for GetPredictionV1EventsSearchProvider {
498 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
499 f.write_str(self.as_str())
500 }
501}
502impl AsRef<str> for GetPredictionV1EventsSearchProvider {
503 fn as_ref(&self) -> &str {
504 self.as_str()
505 }
506}
507#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
509pub enum GetPredictionV1EventsSortBy {
510 #[serde(rename = "volume")]
511 Volume,
512 #[serde(rename = "beginAt")]
513 BeginAt,
514}
515impl GetPredictionV1EventsSortBy {
516 pub fn as_str(&self) -> &'static str {
517 match self {
518 Self::Volume => "volume",
519 Self::BeginAt => "beginAt",
520 }
521 }
522}
523impl std::fmt::Display for GetPredictionV1EventsSortBy {
524 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
525 f.write_str(self.as_str())
526 }
527}
528impl AsRef<str> for GetPredictionV1EventsSortBy {
529 fn as_ref(&self) -> &str {
530 self.as_str()
531 }
532}
533#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
535pub enum GetPredictionV1EventsSortDirection {
536 #[serde(rename = "asc")]
537 Asc,
538 #[serde(rename = "desc")]
539 Desc,
540}
541impl GetPredictionV1EventsSortDirection {
542 pub fn as_str(&self) -> &'static str {
543 match self {
544 Self::Asc => "asc",
545 Self::Desc => "desc",
546 }
547 }
548}
549impl std::fmt::Display for GetPredictionV1EventsSortDirection {
550 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
551 f.write_str(self.as_str())
552 }
553}
554impl AsRef<str> for GetPredictionV1EventsSortDirection {
555 fn as_ref(&self) -> &str {
556 self.as_str()
557 }
558}
559#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
561pub enum GetPredictionV1EventsSuggestedPubkeyProvider {
562 #[serde(rename = "kalshi")]
563 Kalshi,
564 #[serde(rename = "polymarket")]
565 Polymarket,
566 #[serde(rename = "bisonfi")]
567 Bisonfi,
568}
569impl GetPredictionV1EventsSuggestedPubkeyProvider {
570 pub fn as_str(&self) -> &'static str {
571 match self {
572 Self::Kalshi => "kalshi",
573 Self::Polymarket => "polymarket",
574 Self::Bisonfi => "bisonfi",
575 }
576 }
577}
578impl std::fmt::Display for GetPredictionV1EventsSuggestedPubkeyProvider {
579 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
580 f.write_str(self.as_str())
581 }
582}
583impl AsRef<str> for GetPredictionV1EventsSuggestedPubkeyProvider {
584 fn as_ref(&self) -> &str {
585 self.as_str()
586 }
587}
588#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
590pub enum GetPredictionV1LeaderboardsMetric {
591 #[serde(rename = "pnl")]
592 Pnl,
593 #[serde(rename = "volume")]
594 Volume,
595 #[serde(rename = "win_rate")]
596 WinRate,
597}
598impl GetPredictionV1LeaderboardsMetric {
599 pub fn as_str(&self) -> &'static str {
600 match self {
601 Self::Pnl => "pnl",
602 Self::Volume => "volume",
603 Self::WinRate => "win_rate",
604 }
605 }
606}
607impl std::fmt::Display for GetPredictionV1LeaderboardsMetric {
608 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
609 f.write_str(self.as_str())
610 }
611}
612impl AsRef<str> for GetPredictionV1LeaderboardsMetric {
613 fn as_ref(&self) -> &str {
614 self.as_str()
615 }
616}
617#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
619pub enum GetPredictionV1LeaderboardsPeriod {
620 #[serde(rename = "all_time")]
621 AllTime,
622 #[serde(rename = "weekly")]
623 Weekly,
624 #[serde(rename = "monthly")]
625 Monthly,
626}
627impl GetPredictionV1LeaderboardsPeriod {
628 pub fn as_str(&self) -> &'static str {
629 match self {
630 Self::AllTime => "all_time",
631 Self::Weekly => "weekly",
632 Self::Monthly => "monthly",
633 }
634 }
635}
636impl std::fmt::Display for GetPredictionV1LeaderboardsPeriod {
637 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
638 f.write_str(self.as_str())
639 }
640}
641impl AsRef<str> for GetPredictionV1LeaderboardsPeriod {
642 fn as_ref(&self) -> &str {
643 self.as_str()
644 }
645}
646#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
648pub enum GetPredictionV1PositionsIsYes {
649 #[serde(rename = "true")]
650 TrueValue,
651 #[serde(rename = "false")]
652 FalseValue,
653}
654impl GetPredictionV1PositionsIsYes {
655 pub fn as_str(&self) -> &'static str {
656 match self {
657 Self::TrueValue => "true",
658 Self::FalseValue => "false",
659 }
660 }
661}
662impl std::fmt::Display for GetPredictionV1PositionsIsYes {
663 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
664 f.write_str(self.as_str())
665 }
666}
667impl AsRef<str> for GetPredictionV1PositionsIsYes {
668 fn as_ref(&self) -> &str {
669 self.as_str()
670 }
671}
672#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
674pub enum GetPredictionV1ProfilesOwnerPubkeyPnlHistoryInterval {
675 #[serde(rename = "24h")]
676 Variant24h,
677 #[serde(rename = "1w")]
678 Variant1w,
679 #[serde(rename = "1m")]
680 Variant1m,
681}
682impl GetPredictionV1ProfilesOwnerPubkeyPnlHistoryInterval {
683 pub fn as_str(&self) -> &'static str {
684 match self {
685 Self::Variant24h => "24h",
686 Self::Variant1w => "1w",
687 Self::Variant1m => "1m",
688 }
689 }
690}
691impl std::fmt::Display for GetPredictionV1ProfilesOwnerPubkeyPnlHistoryInterval {
692 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
693 f.write_str(self.as_str())
694 }
695}
696impl AsRef<str> for GetPredictionV1ProfilesOwnerPubkeyPnlHistoryInterval {
697 fn as_ref(&self) -> &str {
698 self.as_str()
699 }
700}
701#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
703pub enum GetTokensV2CategoryIntervalCategory {
704 #[serde(rename = "toporganicscore")]
705 Toporganicscore,
706 #[serde(rename = "toptraded")]
707 Toptraded,
708 #[serde(rename = "toptrending")]
709 Toptrending,
710}
711impl GetTokensV2CategoryIntervalCategory {
712 pub fn as_str(&self) -> &'static str {
713 match self {
714 Self::Toporganicscore => "toporganicscore",
715 Self::Toptraded => "toptraded",
716 Self::Toptrending => "toptrending",
717 }
718 }
719}
720impl std::fmt::Display for GetTokensV2CategoryIntervalCategory {
721 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
722 f.write_str(self.as_str())
723 }
724}
725impl AsRef<str> for GetTokensV2CategoryIntervalCategory {
726 fn as_ref(&self) -> &str {
727 self.as_str()
728 }
729}
730#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
732pub enum GetTokensV2CategoryIntervalInterval {
733 #[serde(rename = "5m")]
734 Variant5m,
735 #[serde(rename = "1h")]
736 Variant1h,
737 #[serde(rename = "6h")]
738 Variant6h,
739 #[serde(rename = "24h")]
740 Variant24h,
741}
742impl GetTokensV2CategoryIntervalInterval {
743 pub fn as_str(&self) -> &'static str {
744 match self {
745 Self::Variant5m => "5m",
746 Self::Variant1h => "1h",
747 Self::Variant6h => "6h",
748 Self::Variant24h => "24h",
749 }
750 }
751}
752impl std::fmt::Display for GetTokensV2CategoryIntervalInterval {
753 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
754 f.write_str(self.as_str())
755 }
756}
757impl AsRef<str> for GetTokensV2CategoryIntervalInterval {
758 fn as_ref(&self) -> &str {
759 self.as_str()
760 }
761}
762#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
764pub enum GetTokensV2TagQuery {
765 #[serde(rename = "lst")]
766 Lst,
767 #[serde(rename = "verified")]
768 Verified,
769 #[serde(rename = "stocks")]
770 Stocks,
771}
772impl GetTokensV2TagQuery {
773 pub fn as_str(&self) -> &'static str {
774 match self {
775 Self::Lst => "lst",
776 Self::Verified => "verified",
777 Self::Stocks => "stocks",
778 }
779 }
780}
781impl std::fmt::Display for GetTokensV2TagQuery {
782 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
783 f.write_str(self.as_str())
784 }
785}
786impl AsRef<str> for GetTokensV2TagQuery {
787 fn as_ref(&self) -> &str {
788 self.as_str()
789 }
790}
791#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
793pub enum GetTriggerV1GetTriggerOrdersIncludeFailedTx {
794 #[serde(rename = "true")]
795 TrueValue,
796 #[serde(rename = "false")]
797 FalseValue,
798}
799impl GetTriggerV1GetTriggerOrdersIncludeFailedTx {
800 pub fn as_str(&self) -> &'static str {
801 match self {
802 Self::TrueValue => "true",
803 Self::FalseValue => "false",
804 }
805 }
806}
807impl std::fmt::Display for GetTriggerV1GetTriggerOrdersIncludeFailedTx {
808 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
809 f.write_str(self.as_str())
810 }
811}
812impl AsRef<str> for GetTriggerV1GetTriggerOrdersIncludeFailedTx {
813 fn as_ref(&self) -> &str {
814 self.as_str()
815 }
816}
817#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
819pub enum GetTriggerV1GetTriggerOrdersOrderStatus {
820 #[serde(rename = "active")]
821 Active,
822 #[serde(rename = "history")]
823 History,
824}
825impl GetTriggerV1GetTriggerOrdersOrderStatus {
826 pub fn as_str(&self) -> &'static str {
827 match self {
828 Self::Active => "active",
829 Self::History => "history",
830 }
831 }
832}
833impl std::fmt::Display for GetTriggerV1GetTriggerOrdersOrderStatus {
834 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
835 f.write_str(self.as_str())
836 }
837}
838impl AsRef<str> for GetTriggerV1GetTriggerOrdersOrderStatus {
839 fn as_ref(&self) -> &str {
840 self.as_str()
841 }
842}
843#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
845pub enum GetTriggerV2OrdersHistoryDcaDir {
846 #[serde(rename = "asc")]
847 Asc,
848 #[serde(rename = "desc")]
849 Desc,
850}
851impl GetTriggerV2OrdersHistoryDcaDir {
852 pub fn as_str(&self) -> &'static str {
853 match self {
854 Self::Asc => "asc",
855 Self::Desc => "desc",
856 }
857 }
858}
859impl std::fmt::Display for GetTriggerV2OrdersHistoryDcaDir {
860 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
861 f.write_str(self.as_str())
862 }
863}
864impl AsRef<str> for GetTriggerV2OrdersHistoryDcaDir {
865 fn as_ref(&self) -> &str {
866 self.as_str()
867 }
868}
869#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
871pub enum GetTriggerV2OrdersHistoryDcaSort {
872 #[serde(rename = "updated_at")]
873 UpdatedAt,
874 #[serde(rename = "created_at")]
875 CreatedAt,
876 #[serde(rename = "next_fill_at")]
877 NextFillAt,
878}
879impl GetTriggerV2OrdersHistoryDcaSort {
880 pub fn as_str(&self) -> &'static str {
881 match self {
882 Self::UpdatedAt => "updated_at",
883 Self::CreatedAt => "created_at",
884 Self::NextFillAt => "next_fill_at",
885 }
886 }
887}
888impl std::fmt::Display for GetTriggerV2OrdersHistoryDcaSort {
889 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
890 f.write_str(self.as_str())
891 }
892}
893impl AsRef<str> for GetTriggerV2OrdersHistoryDcaSort {
894 fn as_ref(&self) -> &str {
895 self.as_str()
896 }
897}
898#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
900pub enum GetTriggerV2OrdersHistoryDcaState {
901 #[serde(rename = "active")]
902 Active,
903 #[serde(rename = "past")]
904 Past,
905}
906impl GetTriggerV2OrdersHistoryDcaState {
907 pub fn as_str(&self) -> &'static str {
908 match self {
909 Self::Active => "active",
910 Self::Past => "past",
911 }
912 }
913}
914impl std::fmt::Display for GetTriggerV2OrdersHistoryDcaState {
915 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
916 f.write_str(self.as_str())
917 }
918}
919impl AsRef<str> for GetTriggerV2OrdersHistoryDcaState {
920 fn as_ref(&self) -> &str {
921 self.as_str()
922 }
923}
924#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
926pub enum GetTriggerV2OrdersHistoryDir {
927 #[serde(rename = "asc")]
928 Asc,
929 #[serde(rename = "desc")]
930 Desc,
931}
932impl GetTriggerV2OrdersHistoryDir {
933 pub fn as_str(&self) -> &'static str {
934 match self {
935 Self::Asc => "asc",
936 Self::Desc => "desc",
937 }
938 }
939}
940impl std::fmt::Display for GetTriggerV2OrdersHistoryDir {
941 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
942 f.write_str(self.as_str())
943 }
944}
945impl AsRef<str> for GetTriggerV2OrdersHistoryDir {
946 fn as_ref(&self) -> &str {
947 self.as_str()
948 }
949}
950#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
952pub enum GetTriggerV2OrdersHistorySort {
953 #[serde(rename = "updated_at")]
954 UpdatedAt,
955 #[serde(rename = "created_at")]
956 CreatedAt,
957 #[serde(rename = "expires_at")]
958 ExpiresAt,
959}
960impl GetTriggerV2OrdersHistorySort {
961 pub fn as_str(&self) -> &'static str {
962 match self {
963 Self::UpdatedAt => "updated_at",
964 Self::CreatedAt => "created_at",
965 Self::ExpiresAt => "expires_at",
966 }
967 }
968}
969impl std::fmt::Display for GetTriggerV2OrdersHistorySort {
970 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
971 f.write_str(self.as_str())
972 }
973}
974impl AsRef<str> for GetTriggerV2OrdersHistorySort {
975 fn as_ref(&self) -> &str {
976 self.as_str()
977 }
978}
979#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
981pub enum GetTriggerV2OrdersHistoryState {
982 #[serde(rename = "active")]
983 Active,
984 #[serde(rename = "past")]
985 Past,
986}
987impl GetTriggerV2OrdersHistoryState {
988 pub fn as_str(&self) -> &'static str {
989 match self {
990 Self::Active => "active",
991 Self::Past => "past",
992 }
993 }
994}
995impl std::fmt::Display for GetTriggerV2OrdersHistoryState {
996 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
997 f.write_str(self.as_str())
998 }
999}
1000impl AsRef<str> for GetTriggerV2OrdersHistoryState {
1001 fn as_ref(&self) -> &str {
1002 self.as_str()
1003 }
1004}
1005#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
1007pub enum GetUltraV1OrderExcludeRouters {
1008 #[serde(rename = "metis")]
1009 Metis,
1010 #[serde(rename = "jupiterz")]
1011 Jupiterz,
1012 #[serde(rename = "dflow")]
1013 Dflow,
1014 #[serde(rename = "okx")]
1015 Okx,
1016}
1017impl GetUltraV1OrderExcludeRouters {
1018 pub fn as_str(&self) -> &'static str {
1019 match self {
1020 Self::Metis => "metis",
1021 Self::Jupiterz => "jupiterz",
1022 Self::Dflow => "dflow",
1023 Self::Okx => "okx",
1024 }
1025 }
1026}
1027impl std::fmt::Display for GetUltraV1OrderExcludeRouters {
1028 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1029 f.write_str(self.as_str())
1030 }
1031}
1032impl AsRef<str> for GetUltraV1OrderExcludeRouters {
1033 fn as_ref(&self) -> &str {
1034 self.as_str()
1035 }
1036}
1037#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
1039pub enum QuoteGetInstructionVersion {
1040 #[serde(rename = "V1")]
1041 V1,
1042 #[serde(rename = "V2")]
1043 V2,
1044}
1045impl QuoteGetInstructionVersion {
1046 pub fn as_str(&self) -> &'static str {
1047 match self {
1048 Self::V1 => "V1",
1049 Self::V2 => "V2",
1050 }
1051 }
1052}
1053impl std::fmt::Display for QuoteGetInstructionVersion {
1054 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1055 f.write_str(self.as_str())
1056 }
1057}
1058impl AsRef<str> for QuoteGetInstructionVersion {
1059 fn as_ref(&self) -> &str {
1060 self.as_str()
1061 }
1062}
1063#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
1065pub enum QuoteGetSwapMode {
1066 #[serde(rename = "ExactIn")]
1067 ExactIn,
1068 #[serde(rename = "ExactOut")]
1069 ExactOut,
1070}
1071impl QuoteGetSwapMode {
1072 pub fn as_str(&self) -> &'static str {
1073 match self {
1074 Self::ExactIn => "ExactIn",
1075 Self::ExactOut => "ExactOut",
1076 }
1077 }
1078}
1079impl std::fmt::Display for QuoteGetSwapMode {
1080 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1081 f.write_str(self.as_str())
1082 }
1083}
1084impl AsRef<str> for QuoteGetSwapMode {
1085 fn as_ref(&self) -> &str {
1086 self.as_str()
1087 }
1088}
1089#[derive(Debug, Clone)]
1091pub enum GetBuildApiError {
1092 Status400(GetBuildResponse400),
1093}
1094#[derive(Debug, Clone)]
1096pub enum GetOrderApiError {
1097 Status400(GetOrderResponse400),
1098}
1099#[derive(Debug, Clone)]
1101pub enum PostExecuteApiError {
1102 Status400(PostExecuteResponse400),
1103 Status500(PostExecuteResponse500),
1104}
1105#[derive(Debug, Clone)]
1107pub enum DeletePredictionV1PositionsApiError {
1108 Status400(PredictionErrorResponse),
1109}
1110#[derive(Debug, Clone)]
1112pub enum DeletePredictionV1PositionsPositionPubkeyApiError {
1113 Status400(PredictionErrorResponse),
1114 Status404(PredictionErrorResponse),
1115}
1116#[derive(Debug, Clone)]
1118pub enum GetPredictionV1EventsEventIdApiError {
1119 Status404(PredictionErrorResponse),
1120}
1121#[derive(Debug, Clone)]
1123pub enum GetPredictionV1EventsEventIdMarketsMarketIdApiError {
1124 Status404(PredictionErrorResponse),
1125}
1126#[derive(Debug, Clone)]
1128pub enum GetPredictionV1ForecastApiError {
1129 Status400(PredictionErrorResponse),
1130 Status502(PredictionErrorResponse),
1131}
1132#[derive(Debug, Clone)]
1134pub enum GetPredictionV1MarketsMarketIdApiError {
1135 Status404(PredictionErrorResponse),
1136}
1137#[derive(Debug, Clone)]
1139pub enum GetPredictionV1OrderbookMarketIdApiError {
1140 Status502(PredictionErrorResponse),
1141}
1142#[derive(Debug, Clone)]
1144pub enum GetPredictionV1OrdersApiError {
1145 Status400(PredictionErrorResponse),
1146}
1147#[derive(Debug, Clone)]
1149pub enum GetPredictionV1OrdersOrderPubkeyApiError {
1150 Status400(PredictionErrorResponse),
1151 Status404(PredictionErrorResponse),
1152}
1153#[derive(Debug, Clone)]
1155pub enum GetPredictionV1OrdersStatusOrderPubkeyApiError {
1156 Status400(PredictionErrorResponse),
1157 Status404(PredictionErrorResponse),
1158}
1159#[derive(Debug, Clone)]
1161pub enum GetPredictionV1PositionsApiError {
1162 Status400(PredictionErrorResponse),
1163}
1164#[derive(Debug, Clone)]
1166pub enum GetPredictionV1PositionsPositionPubkeyApiError {
1167 Status400(PredictionErrorResponse),
1168 Status404(PredictionErrorResponse),
1169}
1170#[derive(Debug, Clone)]
1172pub enum GetPredictionV1ProfilesOwnerPubkeyApiError {
1173 Status404(GetPredictionV1ProfilesOwnerPubkeyResponse404),
1174}
1175#[derive(Debug, Clone)]
1177pub enum GetPredictionV1VaultInfoApiError {
1178 Status404(GetPredictionV1VaultInfoResponse404),
1179}
1180#[derive(Debug, Clone)]
1182pub enum GetSendV1InviteHistoryApiError {
1183 Status400(GetSendV1InviteHistoryResponse400),
1184 Status500(GetSendV1InviteHistoryResponse500),
1185}
1186#[derive(Debug, Clone)]
1188pub enum GetSendV1PendingInvitesApiError {
1189 Status400(GetSendV1PendingInvitesResponse400),
1190 Status500(GetSendV1PendingInvitesResponse500),
1191}
1192#[derive(Debug, Clone)]
1194pub enum GetStudioV1DbcPoolAddressesMintApiError {
1195 Status400(GetStudioV1DbcPoolAddressesMintResponse400),
1196 Status404(GetStudioV1DbcPoolAddressesMintResponse404),
1197 Status500(GetStudioV1DbcPoolAddressesMintResponse500),
1198}
1199#[derive(Debug, Clone)]
1201pub enum GetTokensV2CategoryIntervalApiError {
1202 Status400(GetTokensV2CategoryIntervalResponse400),
1203 Status500(GetTokensV2CategoryIntervalResponse500),
1204}
1205#[derive(Debug, Clone)]
1207pub enum GetTokensV2RecentApiError {
1208 Status400(GetTokensV2RecentResponse400),
1209 Status500(GetTokensV2RecentResponse500),
1210}
1211#[derive(Debug, Clone)]
1213pub enum GetTokensV2SearchApiError {
1214 Status400(GetTokensV2SearchResponse400),
1215 Status500(GetTokensV2SearchResponse500),
1216}
1217#[derive(Debug, Clone)]
1219pub enum GetTokensV2TagApiError {
1220 Status400(GetTokensV2TagResponse400),
1221 Status500(GetTokensV2TagResponse500),
1222}
1223#[derive(Debug, Clone)]
1225pub enum GetTokensV2VerifyExpressCheckEligibilityApiError {
1226 Status400(TokensV2VerificationErrorResponse),
1227 Status500(TokensV2VerificationErrorResponse),
1228}
1229#[derive(Debug, Clone)]
1231pub enum GetTokensV2VerifyExpressCraftTxnApiError {
1232 Status400(TokensV2VerificationErrorResponse),
1233 Status500(TokensV2VerificationErrorResponse),
1234}
1235#[derive(Debug, Clone)]
1237pub enum GetTriggerV2VaultRegisterApiError {
1238 Status409(TriggerV2ErrorResponse),
1239}
1240#[derive(Debug, Clone)]
1242pub enum GetUltraV1BalancesAddressApiError {
1243 Status400(GetUltraV1BalancesAddressResponse400),
1244 Status500(GetUltraV1BalancesAddressResponse500),
1245}
1246#[derive(Debug, Clone)]
1248pub enum GetUltraV1OrderApiError {
1249 Status400(GetUltraV1OrderResponse400),
1250 Status500(GetUltraV1OrderResponse500),
1251}
1252#[derive(Debug, Clone)]
1254pub enum GetUltraV1SearchApiError {
1255 Status400(GetUltraV1SearchResponse400),
1256 Status500(GetUltraV1SearchResponse500),
1257}
1258#[derive(Debug, Clone)]
1260pub enum GetUltraV1ShieldApiError {
1261 Status400(GetUltraV1ShieldResponse400),
1262 Status500(GetUltraV1ShieldResponse500),
1263}
1264#[derive(Debug, Clone)]
1266pub enum PostPredictionV1ExecuteApiError {
1267 Status400(PredictionErrorResponse),
1268}
1269#[derive(Debug, Clone)]
1271pub enum PostPredictionV1OrdersApiError {
1272 Status400(PredictionErrorResponse),
1273}
1274#[derive(Debug, Clone)]
1276pub enum PostPredictionV1PositionsPositionPubkeyClaimApiError {
1277 Status400(PredictionErrorResponse),
1278 Status404(PredictionErrorResponse),
1279}
1280#[derive(Debug, Clone)]
1282pub enum PostSendV1CraftClawbackApiError {
1283 Status400(PostSendV1CraftClawbackResponse400),
1284 Status500(PostSendV1CraftClawbackResponse500),
1285}
1286#[derive(Debug, Clone)]
1288pub enum PostSendV1CraftSendApiError {
1289 Status400(PostSendV1CraftSendResponse400),
1290 Status500(PostSendV1CraftSendResponse500),
1291}
1292#[derive(Debug, Clone)]
1294pub enum PostStudioV1DbcFeeApiError {
1295 Status400(PostStudioV1DbcFeeResponse400),
1296}
1297#[derive(Debug, Clone)]
1299pub enum PostStudioV1DbcFeeCreateTxApiError {
1300 Status400(PostStudioV1DbcFeeCreateTxResponse400),
1301 Status403(PostStudioV1DbcFeeCreateTxResponse403),
1302 Status404(PostStudioV1DbcFeeCreateTxResponse404),
1303}
1304#[derive(Debug, Clone)]
1306pub enum PostStudioV1DbcPoolCreateTxApiError {
1307 Status400(PostStudioV1DbcPoolCreateTxResponse400),
1308 Status500(PostStudioV1DbcPoolCreateTxResponse500),
1309}
1310#[derive(Debug, Clone)]
1312pub enum PostStudioV1DbcPoolSubmitApiError {
1313 Status400(PostStudioV1DbcPoolSubmitResponse400),
1314}
1315#[derive(Debug, Clone)]
1317pub enum PostTokensV2VerifyExpressExecuteApiError {
1318 Status400(TokensV2VerificationErrorResponse),
1319 Status409(TokensV2VerificationErrorResponse),
1320 Status500(TokensV2VerificationErrorResponse),
1321}
1322#[derive(Debug, Clone)]
1324pub enum PostTriggerV1CancelOrderApiError {
1325 Status400(PostTriggerV1CancelOrderResponse400),
1326 Status500(PostTriggerV1CancelOrderResponse500),
1327}
1328#[derive(Debug, Clone)]
1330pub enum PostTriggerV1CancelOrdersApiError {
1331 Status400(PostTriggerV1CancelOrdersResponse400),
1332 Status500(PostTriggerV1CancelOrdersResponse500),
1333}
1334#[derive(Debug, Clone)]
1336pub enum PostTriggerV1CreateOrderApiError {
1337 Status400(PostTriggerV1CreateOrderResponse400),
1338 Status500(PostTriggerV1CreateOrderResponse500),
1339}
1340#[derive(Debug, Clone)]
1342pub enum PostTriggerV1ExecuteApiError {
1343 Status400(PostTriggerV1ExecuteResponse400),
1344 Status500(PostTriggerV1ExecuteResponse500),
1345}
1346#[derive(Debug, Clone)]
1348pub enum PostTriggerV2AuthChallengeApiError {
1349 Status400(TriggerV2ErrorResponse),
1350}
1351#[derive(Debug, Clone)]
1353pub enum PostTriggerV2AuthVerifyApiError {
1354 Status400(TriggerV2ErrorResponse),
1355 Status401(TriggerV2ErrorResponse),
1356}
1357#[derive(Debug, Clone)]
1359pub enum PostTriggerV2DepositCraftApiError {
1360 Status400(TriggerV2ErrorResponse),
1361}
1362#[derive(Debug, Clone)]
1364pub enum PostTriggerV2OrdersDcaApiError {
1365 Status400(TriggerV2ErrorResponse),
1366}
1367#[derive(Debug, Clone)]
1369pub enum PostTriggerV2OrdersPriceApiError {
1370 Status400(TriggerV2ErrorResponse),
1371}
1372#[derive(Debug, Clone)]
1374pub enum PostUltraV1ExecuteApiError {
1375 Status400(PostUltraV1ExecuteResponse400),
1376 Status500(PostUltraV1ExecuteResponse500),
1377}
1378#[doc = concat!("Additive request builder for `", "GetBuild", "`.")]
1379#[must_use]
1380pub struct GetBuildBuilder<'a> {
1381 client: &'a HttpClient,
1382 input_mint: String,
1383 output_mint: String,
1384 amount: String,
1385 taker: String,
1386 slippage_bps: Option<String>,
1387 mode: Option<GetBuildMode>,
1388 dexes: Option<String>,
1389 exclude_dexes: Option<String>,
1390 platform_fee_bps: Option<i64>,
1391 fee_account: Option<String>,
1392 max_accounts: Option<i64>,
1393 payer: Option<String>,
1394 wrap_and_unwrap_sol: Option<bool>,
1395 destination_token_account: Option<String>,
1396 native_destination_account: Option<String>,
1397 blockhash_slots_to_expiry: Option<i64>,
1398 tip_amount: Option<String>,
1399 compute_unit_price_percentile: Option<String>,
1400 for_jito_bundle: Option<bool>,
1401}
1402impl<'a> GetBuildBuilder<'a> {
1403 #[doc = concat!("Set the optional `", "slippageBps", "` operation parameter.")]
1404 #[must_use]
1405 pub fn slippage_bps(mut self, slippage_bps: impl Into<String>) -> Self {
1406 self.slippage_bps = Some(slippage_bps.into());
1407 self
1408 }
1409 #[doc = concat!("Set the optional `", "mode", "` operation parameter.")]
1410 #[must_use]
1411 pub fn mode(mut self, mode: GetBuildMode) -> Self {
1412 self.mode = Some(mode);
1413 self
1414 }
1415 #[doc = concat!("Set the optional `", "dexes", "` operation parameter.")]
1416 #[must_use]
1417 pub fn dexes(mut self, dexes: impl Into<String>) -> Self {
1418 self.dexes = Some(dexes.into());
1419 self
1420 }
1421 #[doc = concat!("Set the optional `", "excludeDexes", "` operation parameter.")]
1422 #[must_use]
1423 pub fn exclude_dexes(mut self, exclude_dexes: impl Into<String>) -> Self {
1424 self.exclude_dexes = Some(exclude_dexes.into());
1425 self
1426 }
1427 #[doc = concat!("Set the optional `", "platformFeeBps", "` operation parameter.")]
1428 #[must_use]
1429 pub fn platform_fee_bps(mut self, platform_fee_bps: i64) -> Self {
1430 self.platform_fee_bps = Some(platform_fee_bps);
1431 self
1432 }
1433 #[doc = concat!("Set the optional `", "feeAccount", "` operation parameter.")]
1434 #[must_use]
1435 pub fn fee_account(mut self, fee_account: impl Into<String>) -> Self {
1436 self.fee_account = Some(fee_account.into());
1437 self
1438 }
1439 #[doc = concat!("Set the optional `", "maxAccounts", "` operation parameter.")]
1440 #[must_use]
1441 pub fn max_accounts(mut self, max_accounts: i64) -> Self {
1442 self.max_accounts = Some(max_accounts);
1443 self
1444 }
1445 #[doc = concat!("Set the optional `", "payer", "` operation parameter.")]
1446 #[must_use]
1447 pub fn payer(mut self, payer: impl Into<String>) -> Self {
1448 self.payer = Some(payer.into());
1449 self
1450 }
1451 #[doc = concat!("Set the optional `", "wrapAndUnwrapSol", "` operation parameter.")]
1452 #[must_use]
1453 pub fn wrap_and_unwrap_sol(mut self, wrap_and_unwrap_sol: bool) -> Self {
1454 self.wrap_and_unwrap_sol = Some(wrap_and_unwrap_sol);
1455 self
1456 }
1457 #[doc = concat!(
1458 "Set the optional `", "destinationTokenAccount", "` operation parameter."
1459 )]
1460 #[must_use]
1461 pub fn destination_token_account(
1462 mut self,
1463 destination_token_account: impl Into<String>,
1464 ) -> Self {
1465 self.destination_token_account = Some(destination_token_account.into());
1466 self
1467 }
1468 #[doc = concat!(
1469 "Set the optional `", "nativeDestinationAccount", "` operation parameter."
1470 )]
1471 #[must_use]
1472 pub fn native_destination_account(
1473 mut self,
1474 native_destination_account: impl Into<String>,
1475 ) -> Self {
1476 self.native_destination_account = Some(native_destination_account.into());
1477 self
1478 }
1479 #[doc = concat!(
1480 "Set the optional `", "blockhashSlotsToExpiry", "` operation parameter."
1481 )]
1482 #[must_use]
1483 pub fn blockhash_slots_to_expiry(mut self, blockhash_slots_to_expiry: i64) -> Self {
1484 self.blockhash_slots_to_expiry = Some(blockhash_slots_to_expiry);
1485 self
1486 }
1487 #[doc = concat!("Set the optional `", "tipAmount", "` operation parameter.")]
1488 #[must_use]
1489 pub fn tip_amount(mut self, tip_amount: impl Into<String>) -> Self {
1490 self.tip_amount = Some(tip_amount.into());
1491 self
1492 }
1493 #[doc = concat!(
1494 "Set the optional `", "computeUnitPricePercentile", "` operation parameter."
1495 )]
1496 #[must_use]
1497 pub fn compute_unit_price_percentile(
1498 mut self,
1499 compute_unit_price_percentile: impl Into<String>,
1500 ) -> Self {
1501 self.compute_unit_price_percentile = Some(compute_unit_price_percentile.into());
1502 self
1503 }
1504 #[doc = concat!("Set the optional `", "forJitoBundle", "` operation parameter.")]
1505 #[must_use]
1506 pub fn for_jito_bundle(mut self, for_jito_bundle: bool) -> Self {
1507 self.for_jito_bundle = Some(for_jito_bundle);
1508 self
1509 }
1510 pub async fn send(self) -> Result<GetBuildResponse, ApiOpError<GetBuildApiError>> {
1512 self.client
1513 .get_build(
1514 self.input_mint,
1515 self.output_mint,
1516 self.amount,
1517 self.taker,
1518 self.slippage_bps,
1519 self.mode,
1520 self.dexes,
1521 self.exclude_dexes,
1522 self.platform_fee_bps,
1523 self.fee_account,
1524 self.max_accounts,
1525 self.payer,
1526 self.wrap_and_unwrap_sol,
1527 self.destination_token_account,
1528 self.native_destination_account,
1529 self.blockhash_slots_to_expiry,
1530 self.tip_amount,
1531 self.compute_unit_price_percentile,
1532 self.for_jito_bundle,
1533 )
1534 .await
1535 }
1536}
1537#[doc = concat!("Additive request builder for `", "GetOrder", "`.")]
1538#[must_use]
1539pub struct GetOrderBuilder<'a> {
1540 client: &'a HttpClient,
1541 input_mint: String,
1542 output_mint: String,
1543 amount: String,
1544 taker: Option<String>,
1545 receiver: Option<String>,
1546 swap_mode: Option<GetOrderSwapMode>,
1547 slippage_bps: Option<i64>,
1548 referral_account: Option<String>,
1549 referral_fee: Option<f64>,
1550 payer: Option<String>,
1551 priority_fee_lamports: Option<f64>,
1552 jito_tip_lamports: Option<f64>,
1553 broadcast_fee_type: Option<GetOrderBroadcastFeeType>,
1554 exclude_routers: Option<String>,
1555 exclude_dexes: Option<String>,
1556}
1557impl<'a> GetOrderBuilder<'a> {
1558 #[doc = concat!("Set the optional `", "taker", "` operation parameter.")]
1559 #[must_use]
1560 pub fn taker(mut self, taker: impl Into<String>) -> Self {
1561 self.taker = Some(taker.into());
1562 self
1563 }
1564 #[doc = concat!("Set the optional `", "receiver", "` operation parameter.")]
1565 #[must_use]
1566 pub fn receiver(mut self, receiver: impl Into<String>) -> Self {
1567 self.receiver = Some(receiver.into());
1568 self
1569 }
1570 #[doc = concat!("Set the optional `", "swapMode", "` operation parameter.")]
1571 #[must_use]
1572 pub fn swap_mode(mut self, swap_mode: GetOrderSwapMode) -> Self {
1573 self.swap_mode = Some(swap_mode);
1574 self
1575 }
1576 #[doc = concat!("Set the optional `", "slippageBps", "` operation parameter.")]
1577 #[must_use]
1578 pub fn slippage_bps(mut self, slippage_bps: i64) -> Self {
1579 self.slippage_bps = Some(slippage_bps);
1580 self
1581 }
1582 #[doc = concat!("Set the optional `", "referralAccount", "` operation parameter.")]
1583 #[must_use]
1584 pub fn referral_account(mut self, referral_account: impl Into<String>) -> Self {
1585 self.referral_account = Some(referral_account.into());
1586 self
1587 }
1588 #[doc = concat!("Set the optional `", "referralFee", "` operation parameter.")]
1589 #[must_use]
1590 pub fn referral_fee(mut self, referral_fee: f64) -> Self {
1591 self.referral_fee = Some(referral_fee);
1592 self
1593 }
1594 #[doc = concat!("Set the optional `", "payer", "` operation parameter.")]
1595 #[must_use]
1596 pub fn payer(mut self, payer: impl Into<String>) -> Self {
1597 self.payer = Some(payer.into());
1598 self
1599 }
1600 #[doc = concat!(
1601 "Set the optional `", "priorityFeeLamports", "` operation parameter."
1602 )]
1603 #[must_use]
1604 pub fn priority_fee_lamports(mut self, priority_fee_lamports: f64) -> Self {
1605 self.priority_fee_lamports = Some(priority_fee_lamports);
1606 self
1607 }
1608 #[doc = concat!("Set the optional `", "jitoTipLamports", "` operation parameter.")]
1609 #[must_use]
1610 pub fn jito_tip_lamports(mut self, jito_tip_lamports: f64) -> Self {
1611 self.jito_tip_lamports = Some(jito_tip_lamports);
1612 self
1613 }
1614 #[doc = concat!("Set the optional `", "broadcastFeeType", "` operation parameter.")]
1615 #[must_use]
1616 pub fn broadcast_fee_type(mut self, broadcast_fee_type: GetOrderBroadcastFeeType) -> Self {
1617 self.broadcast_fee_type = Some(broadcast_fee_type);
1618 self
1619 }
1620 #[doc = concat!("Set the optional `", "excludeRouters", "` operation parameter.")]
1621 #[must_use]
1622 pub fn exclude_routers(mut self, exclude_routers: impl Into<String>) -> Self {
1623 self.exclude_routers = Some(exclude_routers.into());
1624 self
1625 }
1626 #[doc = concat!("Set the optional `", "excludeDexes", "` operation parameter.")]
1627 #[must_use]
1628 pub fn exclude_dexes(mut self, exclude_dexes: impl Into<String>) -> Self {
1629 self.exclude_dexes = Some(exclude_dexes.into());
1630 self
1631 }
1632 pub async fn send(self) -> Result<GetOrderResponse, ApiOpError<GetOrderApiError>> {
1634 self.client
1635 .get_order(
1636 self.input_mint,
1637 self.output_mint,
1638 self.amount,
1639 self.taker,
1640 self.receiver,
1641 self.swap_mode,
1642 self.slippage_bps,
1643 self.referral_account,
1644 self.referral_fee,
1645 self.payer,
1646 self.priority_fee_lamports,
1647 self.jito_tip_lamports,
1648 self.broadcast_fee_type,
1649 self.exclude_routers,
1650 self.exclude_dexes,
1651 )
1652 .await
1653 }
1654}
1655#[doc = concat!("Additive request builder for `", "PostExecute", "`.")]
1656#[must_use]
1657pub struct PostExecuteBuilder<'a> {
1658 client: &'a HttpClient,
1659 request: PostExecuteRequest,
1660}
1661impl<'a> PostExecuteBuilder<'a> {
1662 #[must_use]
1664 pub fn request(mut self, request: PostExecuteRequest) -> Self {
1665 self.request = request;
1666 self
1667 }
1668 #[doc = concat!(
1669 "Set the optional request-body field `", "lastValidBlockHeight", "`."
1670 )]
1671 #[must_use]
1672 pub fn last_valid_block_height(mut self, last_valid_block_height: String) -> Self {
1673 self.request.last_valid_block_height = Some(last_valid_block_height);
1674 self
1675 }
1676 pub async fn send(self) -> Result<PostExecuteResponse, ApiOpError<PostExecuteApiError>> {
1678 self.client.post_execute(self.request).await
1679 }
1680}
1681#[doc = concat!("Additive request builder for `", "QuoteGet", "`.")]
1682#[must_use]
1683pub struct QuoteGetBuilder<'a> {
1684 client: &'a HttpClient,
1685 input_mint: String,
1686 output_mint: String,
1687 amount: u64,
1688 slippage_bps: Option<i64>,
1689 swap_mode: Option<QuoteGetSwapMode>,
1690 dexes: Option<Vec<String>>,
1691 exclude_dexes: Option<Vec<String>>,
1692 restrict_intermediate_tokens: Option<bool>,
1693 only_direct_routes: Option<bool>,
1694 as_legacy_transaction: Option<bool>,
1695 platform_fee_bps: Option<i64>,
1696 max_accounts: Option<u64>,
1697 instruction_version: Option<QuoteGetInstructionVersion>,
1698 dynamic_slippage: Option<bool>,
1699 for_jito_bundle: Option<bool>,
1700}
1701impl<'a> QuoteGetBuilder<'a> {
1702 #[doc = concat!("Set the optional `", "slippageBps", "` operation parameter.")]
1703 #[must_use]
1704 pub fn slippage_bps(mut self, slippage_bps: i64) -> Self {
1705 self.slippage_bps = Some(slippage_bps);
1706 self
1707 }
1708 #[doc = concat!("Set the optional `", "swapMode", "` operation parameter.")]
1709 #[must_use]
1710 pub fn swap_mode(mut self, swap_mode: QuoteGetSwapMode) -> Self {
1711 self.swap_mode = Some(swap_mode);
1712 self
1713 }
1714 #[doc = concat!("Set the optional `", "dexes", "` operation parameter.")]
1715 #[must_use]
1716 pub fn dexes(mut self, dexes: Vec<String>) -> Self {
1717 self.dexes = Some(dexes);
1718 self
1719 }
1720 #[doc = concat!("Set the optional `", "excludeDexes", "` operation parameter.")]
1721 #[must_use]
1722 pub fn exclude_dexes(mut self, exclude_dexes: Vec<String>) -> Self {
1723 self.exclude_dexes = Some(exclude_dexes);
1724 self
1725 }
1726 #[doc = concat!(
1727 "Set the optional `", "restrictIntermediateTokens", "` operation parameter."
1728 )]
1729 #[must_use]
1730 pub fn restrict_intermediate_tokens(mut self, restrict_intermediate_tokens: bool) -> Self {
1731 self.restrict_intermediate_tokens = Some(restrict_intermediate_tokens);
1732 self
1733 }
1734 #[doc = concat!("Set the optional `", "onlyDirectRoutes", "` operation parameter.")]
1735 #[must_use]
1736 pub fn only_direct_routes(mut self, only_direct_routes: bool) -> Self {
1737 self.only_direct_routes = Some(only_direct_routes);
1738 self
1739 }
1740 #[doc = concat!(
1741 "Set the optional `", "asLegacyTransaction", "` operation parameter."
1742 )]
1743 #[must_use]
1744 pub fn as_legacy_transaction(mut self, as_legacy_transaction: bool) -> Self {
1745 self.as_legacy_transaction = Some(as_legacy_transaction);
1746 self
1747 }
1748 #[doc = concat!("Set the optional `", "platformFeeBps", "` operation parameter.")]
1749 #[must_use]
1750 pub fn platform_fee_bps(mut self, platform_fee_bps: i64) -> Self {
1751 self.platform_fee_bps = Some(platform_fee_bps);
1752 self
1753 }
1754 #[doc = concat!("Set the optional `", "maxAccounts", "` operation parameter.")]
1755 #[must_use]
1756 pub fn max_accounts(mut self, max_accounts: u64) -> Self {
1757 self.max_accounts = Some(max_accounts);
1758 self
1759 }
1760 #[doc = concat!(
1761 "Set the optional `", "instructionVersion", "` operation parameter."
1762 )]
1763 #[must_use]
1764 pub fn instruction_version(mut self, instruction_version: QuoteGetInstructionVersion) -> Self {
1765 self.instruction_version = Some(instruction_version);
1766 self
1767 }
1768 #[doc = concat!("Set the optional `", "dynamicSlippage", "` operation parameter.")]
1769 #[must_use]
1770 pub fn dynamic_slippage(mut self, dynamic_slippage: bool) -> Self {
1771 self.dynamic_slippage = Some(dynamic_slippage);
1772 self
1773 }
1774 #[doc = concat!("Set the optional `", "forJitoBundle", "` operation parameter.")]
1775 #[must_use]
1776 pub fn for_jito_bundle(mut self, for_jito_bundle: bool) -> Self {
1777 self.for_jito_bundle = Some(for_jito_bundle);
1778 self
1779 }
1780 pub async fn send(self) -> Result<SwapV1QuoteResponse, ApiOpError<serde_json::Value>> {
1782 self.client
1783 .quote_get(
1784 self.input_mint,
1785 self.output_mint,
1786 self.amount,
1787 self.slippage_bps,
1788 self.swap_mode,
1789 self.dexes,
1790 self.exclude_dexes,
1791 self.restrict_intermediate_tokens,
1792 self.only_direct_routes,
1793 self.as_legacy_transaction,
1794 self.platform_fee_bps,
1795 self.max_accounts,
1796 self.instruction_version,
1797 self.dynamic_slippage,
1798 self.for_jito_bundle,
1799 )
1800 .await
1801 }
1802}
1803#[doc = concat!("Additive request builder for `", "SwapInstructionsPost", "`.")]
1804#[must_use]
1805pub struct SwapInstructionsPostBuilder<'a> {
1806 client: &'a HttpClient,
1807 request: SwapV1SwapRequest,
1808}
1809impl<'a> SwapInstructionsPostBuilder<'a> {
1810 #[must_use]
1812 pub fn request(mut self, request: SwapV1SwapRequest) -> Self {
1813 self.request = request;
1814 self
1815 }
1816 #[doc = concat!(
1817 "Set the optional request-body field `", "asLegacyTransaction", "`."
1818 )]
1819 #[must_use]
1820 pub fn as_legacy_transaction(mut self, as_legacy_transaction: bool) -> Self {
1821 self.request.as_legacy_transaction = Some(as_legacy_transaction);
1822 self
1823 }
1824 #[doc = concat!(
1825 "Set the optional request-body field `", "blockhashSlotsToExpiry", "`."
1826 )]
1827 #[must_use]
1828 pub fn blockhash_slots_to_expiry(mut self, blockhash_slots_to_expiry: i64) -> Self {
1829 self.request.blockhash_slots_to_expiry = Some(blockhash_slots_to_expiry);
1830 self
1831 }
1832 #[doc = concat!(
1833 "Set the optional request-body field `", "computeUnitPriceMicroLamports", "`."
1834 )]
1835 #[must_use]
1836 pub fn compute_unit_price_micro_lamports(
1837 mut self,
1838 compute_unit_price_micro_lamports: u64,
1839 ) -> Self {
1840 self.request.compute_unit_price_micro_lamports = Some(compute_unit_price_micro_lamports);
1841 self
1842 }
1843 #[doc = concat!(
1844 "Set the optional request-body field `", "destinationTokenAccount", "`."
1845 )]
1846 #[must_use]
1847 pub fn destination_token_account(mut self, destination_token_account: String) -> Self {
1848 self.request.destination_token_account = Some(destination_token_account);
1849 self
1850 }
1851 #[doc = concat!(
1852 "Set the optional request-body field `", "dynamicComputeUnitLimit", "`."
1853 )]
1854 #[must_use]
1855 pub fn dynamic_compute_unit_limit(mut self, dynamic_compute_unit_limit: bool) -> Self {
1856 self.request.dynamic_compute_unit_limit = Some(dynamic_compute_unit_limit);
1857 self
1858 }
1859 #[doc = concat!("Set the optional request-body field `", "dynamicSlippage", "`.")]
1860 #[must_use]
1861 pub fn dynamic_slippage(mut self, dynamic_slippage: bool) -> Self {
1862 self.request.dynamic_slippage = Some(dynamic_slippage);
1863 self
1864 }
1865 #[doc = concat!("Set the optional request-body field `", "feeAccount", "`.")]
1866 #[must_use]
1867 pub fn fee_account(mut self, fee_account: String) -> Self {
1868 self.request.fee_account = Some(fee_account);
1869 self
1870 }
1871 #[doc = concat!(
1872 "Set the optional request-body field `", "nativeDestinationAccount", "`."
1873 )]
1874 #[must_use]
1875 pub fn native_destination_account(mut self, native_destination_account: String) -> Self {
1876 self.request.native_destination_account = Some(native_destination_account);
1877 self
1878 }
1879 #[doc = concat!("Set the optional request-body field `", "payer", "`.")]
1880 #[must_use]
1881 pub fn payer(mut self, payer: String) -> Self {
1882 self.request.payer = Some(payer);
1883 self
1884 }
1885 #[doc = concat!(
1886 "Set the optional request-body field `", "prioritizationFeeLamports", "`."
1887 )]
1888 #[must_use]
1889 pub fn prioritization_fee_lamports(
1890 mut self,
1891 prioritization_fee_lamports: SwapV1SwapRequestPrioritizationFeeLamports,
1892 ) -> Self {
1893 self.request.prioritization_fee_lamports = Some(prioritization_fee_lamports);
1894 self
1895 }
1896 #[doc = concat!(
1897 "Set the optional request-body field `", "skipUserAccountsRpcCalls", "`."
1898 )]
1899 #[must_use]
1900 pub fn skip_user_accounts_rpc_calls(mut self, skip_user_accounts_rpc_calls: bool) -> Self {
1901 self.request.skip_user_accounts_rpc_calls = Some(skip_user_accounts_rpc_calls);
1902 self
1903 }
1904 #[doc = concat!("Set the optional request-body field `", "trackingAccount", "`.")]
1905 #[must_use]
1906 pub fn tracking_account(mut self, tracking_account: String) -> Self {
1907 self.request.tracking_account = Some(tracking_account);
1908 self
1909 }
1910 #[doc = concat!("Set the optional request-body field `", "useSharedAccounts", "`.")]
1911 #[must_use]
1912 pub fn use_shared_accounts(mut self, use_shared_accounts: bool) -> Self {
1913 self.request.use_shared_accounts = Some(use_shared_accounts);
1914 self
1915 }
1916 #[doc = concat!("Set the optional request-body field `", "wrapAndUnwrapSol", "`.")]
1917 #[must_use]
1918 pub fn wrap_and_unwrap_sol(mut self, wrap_and_unwrap_sol: bool) -> Self {
1919 self.request.wrap_and_unwrap_sol = Some(wrap_and_unwrap_sol);
1920 self
1921 }
1922 pub async fn send(
1924 self,
1925 ) -> Result<SwapV1SwapInstructionsResponse, ApiOpError<serde_json::Value>> {
1926 self.client.swap_instructions_post(self.request).await
1927 }
1928}
1929#[doc = concat!("Additive request builder for `", "SwapPost", "`.")]
1930#[must_use]
1931pub struct SwapPostBuilder<'a> {
1932 client: &'a HttpClient,
1933 request: SwapV1SwapRequest,
1934}
1935impl<'a> SwapPostBuilder<'a> {
1936 #[must_use]
1938 pub fn request(mut self, request: SwapV1SwapRequest) -> Self {
1939 self.request = request;
1940 self
1941 }
1942 #[doc = concat!(
1943 "Set the optional request-body field `", "asLegacyTransaction", "`."
1944 )]
1945 #[must_use]
1946 pub fn as_legacy_transaction(mut self, as_legacy_transaction: bool) -> Self {
1947 self.request.as_legacy_transaction = Some(as_legacy_transaction);
1948 self
1949 }
1950 #[doc = concat!(
1951 "Set the optional request-body field `", "blockhashSlotsToExpiry", "`."
1952 )]
1953 #[must_use]
1954 pub fn blockhash_slots_to_expiry(mut self, blockhash_slots_to_expiry: i64) -> Self {
1955 self.request.blockhash_slots_to_expiry = Some(blockhash_slots_to_expiry);
1956 self
1957 }
1958 #[doc = concat!(
1959 "Set the optional request-body field `", "computeUnitPriceMicroLamports", "`."
1960 )]
1961 #[must_use]
1962 pub fn compute_unit_price_micro_lamports(
1963 mut self,
1964 compute_unit_price_micro_lamports: u64,
1965 ) -> Self {
1966 self.request.compute_unit_price_micro_lamports = Some(compute_unit_price_micro_lamports);
1967 self
1968 }
1969 #[doc = concat!(
1970 "Set the optional request-body field `", "destinationTokenAccount", "`."
1971 )]
1972 #[must_use]
1973 pub fn destination_token_account(mut self, destination_token_account: String) -> Self {
1974 self.request.destination_token_account = Some(destination_token_account);
1975 self
1976 }
1977 #[doc = concat!(
1978 "Set the optional request-body field `", "dynamicComputeUnitLimit", "`."
1979 )]
1980 #[must_use]
1981 pub fn dynamic_compute_unit_limit(mut self, dynamic_compute_unit_limit: bool) -> Self {
1982 self.request.dynamic_compute_unit_limit = Some(dynamic_compute_unit_limit);
1983 self
1984 }
1985 #[doc = concat!("Set the optional request-body field `", "dynamicSlippage", "`.")]
1986 #[must_use]
1987 pub fn dynamic_slippage(mut self, dynamic_slippage: bool) -> Self {
1988 self.request.dynamic_slippage = Some(dynamic_slippage);
1989 self
1990 }
1991 #[doc = concat!("Set the optional request-body field `", "feeAccount", "`.")]
1992 #[must_use]
1993 pub fn fee_account(mut self, fee_account: String) -> Self {
1994 self.request.fee_account = Some(fee_account);
1995 self
1996 }
1997 #[doc = concat!(
1998 "Set the optional request-body field `", "nativeDestinationAccount", "`."
1999 )]
2000 #[must_use]
2001 pub fn native_destination_account(mut self, native_destination_account: String) -> Self {
2002 self.request.native_destination_account = Some(native_destination_account);
2003 self
2004 }
2005 #[doc = concat!("Set the optional request-body field `", "payer", "`.")]
2006 #[must_use]
2007 pub fn payer(mut self, payer: String) -> Self {
2008 self.request.payer = Some(payer);
2009 self
2010 }
2011 #[doc = concat!(
2012 "Set the optional request-body field `", "prioritizationFeeLamports", "`."
2013 )]
2014 #[must_use]
2015 pub fn prioritization_fee_lamports(
2016 mut self,
2017 prioritization_fee_lamports: SwapV1SwapRequestPrioritizationFeeLamports,
2018 ) -> Self {
2019 self.request.prioritization_fee_lamports = Some(prioritization_fee_lamports);
2020 self
2021 }
2022 #[doc = concat!(
2023 "Set the optional request-body field `", "skipUserAccountsRpcCalls", "`."
2024 )]
2025 #[must_use]
2026 pub fn skip_user_accounts_rpc_calls(mut self, skip_user_accounts_rpc_calls: bool) -> Self {
2027 self.request.skip_user_accounts_rpc_calls = Some(skip_user_accounts_rpc_calls);
2028 self
2029 }
2030 #[doc = concat!("Set the optional request-body field `", "trackingAccount", "`.")]
2031 #[must_use]
2032 pub fn tracking_account(mut self, tracking_account: String) -> Self {
2033 self.request.tracking_account = Some(tracking_account);
2034 self
2035 }
2036 #[doc = concat!("Set the optional request-body field `", "useSharedAccounts", "`.")]
2037 #[must_use]
2038 pub fn use_shared_accounts(mut self, use_shared_accounts: bool) -> Self {
2039 self.request.use_shared_accounts = Some(use_shared_accounts);
2040 self
2041 }
2042 #[doc = concat!("Set the optional request-body field `", "wrapAndUnwrapSol", "`.")]
2043 #[must_use]
2044 pub fn wrap_and_unwrap_sol(mut self, wrap_and_unwrap_sol: bool) -> Self {
2045 self.request.wrap_and_unwrap_sol = Some(wrap_and_unwrap_sol);
2046 self
2047 }
2048 pub async fn send(self) -> Result<SwapV1SwapResponse, ApiOpError<serde_json::Value>> {
2050 self.client.swap_post(self.request).await
2051 }
2052}
2053#[doc = concat!(
2054 "Additive request builder for `", "buildBorrowOperateInstructions", "`."
2055)]
2056#[must_use]
2057pub struct BuildBorrowOperateInstructionsBuilder<'a> {
2058 client: &'a HttpClient,
2059 market: Option<LendBorrowMarket>,
2060 request: LendBorrowOperatePayload,
2061}
2062impl<'a> BuildBorrowOperateInstructionsBuilder<'a> {
2063 #[doc = concat!("Set the optional `", "market", "` operation parameter.")]
2064 #[must_use]
2065 pub fn market(mut self, market: LendBorrowMarket) -> Self {
2066 self.market = Some(market);
2067 self
2068 }
2069 #[must_use]
2071 pub fn request(mut self, request: LendBorrowOperatePayload) -> Self {
2072 self.request = request;
2073 self
2074 }
2075 #[doc = concat!("Set the optional request-body field `", "positionOwner", "`.")]
2076 #[must_use]
2077 pub fn position_owner(mut self, position_owner: String) -> Self {
2078 self.request.position_owner = Some(position_owner);
2079 self
2080 }
2081 pub async fn send(
2083 self,
2084 ) -> Result<LendBorrowOperateInstructionsResponse, ApiOpError<serde_json::Value>> {
2085 self.client
2086 .build_borrow_operate_instructions(self.market, self.request)
2087 .await
2088 }
2089}
2090#[doc = concat!("Additive request builder for `", "buildBorrowOperateTransaction", "`.")]
2091#[must_use]
2092pub struct BuildBorrowOperateTransactionBuilder<'a> {
2093 client: &'a HttpClient,
2094 market: Option<LendBorrowMarket>,
2095 request: LendBorrowOperatePayload,
2096}
2097impl<'a> BuildBorrowOperateTransactionBuilder<'a> {
2098 #[doc = concat!("Set the optional `", "market", "` operation parameter.")]
2099 #[must_use]
2100 pub fn market(mut self, market: LendBorrowMarket) -> Self {
2101 self.market = Some(market);
2102 self
2103 }
2104 #[must_use]
2106 pub fn request(mut self, request: LendBorrowOperatePayload) -> Self {
2107 self.request = request;
2108 self
2109 }
2110 #[doc = concat!("Set the optional request-body field `", "positionOwner", "`.")]
2111 #[must_use]
2112 pub fn position_owner(mut self, position_owner: String) -> Self {
2113 self.request.position_owner = Some(position_owner);
2114 self
2115 }
2116 pub async fn send(
2118 self,
2119 ) -> Result<LendBorrowOperateTransactionResponse, ApiOpError<serde_json::Value>> {
2120 self.client
2121 .build_borrow_operate_transaction(self.market, self.request)
2122 .await
2123 }
2124}
2125#[doc = concat!("Additive request builder for `", "deletePredictionV1Positions", "`.")]
2126#[must_use]
2127pub struct DeletePredictionV1PositionsBuilder<'a> {
2128 client: &'a HttpClient,
2129 request: PredictionCloseAllPositionsRequest,
2130}
2131impl<'a> DeletePredictionV1PositionsBuilder<'a> {
2132 #[must_use]
2134 pub fn request(mut self, request: PredictionCloseAllPositionsRequest) -> Self {
2135 self.request = request;
2136 self
2137 }
2138 #[doc = concat!("Set the optional request-body field `", "ownerPubkey", "`.")]
2139 #[must_use]
2140 pub fn owner_pubkey(mut self, owner_pubkey: String) -> Self {
2141 self.request.owner_pubkey = Some(owner_pubkey);
2142 self
2143 }
2144 pub async fn send(
2146 self,
2147 ) -> Result<DeletePredictionV1PositionsResponse, ApiOpError<DeletePredictionV1PositionsApiError>>
2148 {
2149 self.client
2150 .delete_prediction_v1_positions(self.request)
2151 .await
2152 }
2153}
2154#[doc = concat!(
2155 "Additive request builder for `", "deletePredictionV1PositionsPositionPubkey", "`."
2156)]
2157#[must_use]
2158pub struct DeletePredictionV1PositionsPositionPubkeyBuilder<'a> {
2159 client: &'a HttpClient,
2160 position_pubkey: String,
2161 request: PredictionClosePositionRequest,
2162}
2163impl<'a> DeletePredictionV1PositionsPositionPubkeyBuilder<'a> {
2164 #[must_use]
2166 pub fn request(mut self, request: PredictionClosePositionRequest) -> Self {
2167 self.request = request;
2168 self
2169 }
2170 #[doc = concat!("Set the optional request-body field `", "ownerPubkey", "`.")]
2171 #[must_use]
2172 pub fn owner_pubkey(mut self, owner_pubkey: String) -> Self {
2173 self.request.owner_pubkey = Some(owner_pubkey);
2174 self
2175 }
2176 pub async fn send(
2178 self,
2179 ) -> Result<
2180 PredictionCreateOrderResponse,
2181 ApiOpError<DeletePredictionV1PositionsPositionPubkeyApiError>,
2182 > {
2183 self.client
2184 .delete_prediction_v1_positions_position_pubkey(self.position_pubkey, self.request)
2185 .await
2186 }
2187}
2188#[doc = concat!(
2189 "Additive request builder for `", "getPortfolioV1PositionsAddress", "`."
2190)]
2191#[must_use]
2192pub struct GetPortfolioV1PositionsAddressBuilder<'a> {
2193 client: &'a HttpClient,
2194 address: String,
2195 platforms: Option<String>,
2196}
2197impl<'a> GetPortfolioV1PositionsAddressBuilder<'a> {
2198 #[doc = concat!("Set the optional `", "platforms", "` operation parameter.")]
2199 #[must_use]
2200 pub fn platforms(mut self, platforms: impl Into<String>) -> Self {
2201 self.platforms = Some(platforms.into());
2202 self
2203 }
2204 pub async fn send(
2206 self,
2207 ) -> Result<GetPortfolioV1PositionsAddressResponse, ApiOpError<serde_json::Value>> {
2208 self.client
2209 .get_portfolio_v1_positions_address(self.address, self.platforms)
2210 .await
2211 }
2212}
2213#[doc = concat!("Additive request builder for `", "getPredictionV1Events", "`.")]
2214#[must_use]
2215pub struct GetPredictionV1EventsBuilder<'a> {
2216 client: &'a HttpClient,
2217 provider: Option<GetPredictionV1EventsProvider>,
2218 include_markets: Option<bool>,
2219 include_all_markets: Option<bool>,
2220 start: Option<i64>,
2221 end: Option<i64>,
2222 category: Option<GetPredictionV1EventsCategory>,
2223 subcategory: Option<String>,
2224 sort_by: Option<GetPredictionV1EventsSortBy>,
2225 sort_direction: Option<GetPredictionV1EventsSortDirection>,
2226 filter: Option<GetPredictionV1EventsFilter>,
2227 tags: Option<String>,
2228}
2229impl<'a> GetPredictionV1EventsBuilder<'a> {
2230 #[doc = concat!("Set the optional `", "provider", "` operation parameter.")]
2231 #[must_use]
2232 pub fn provider(mut self, provider: GetPredictionV1EventsProvider) -> Self {
2233 self.provider = Some(provider);
2234 self
2235 }
2236 #[doc = concat!("Set the optional `", "includeMarkets", "` operation parameter.")]
2237 #[must_use]
2238 pub fn include_markets(mut self, include_markets: bool) -> Self {
2239 self.include_markets = Some(include_markets);
2240 self
2241 }
2242 #[doc = concat!("Set the optional `", "includeAllMarkets", "` operation parameter.")]
2243 #[must_use]
2244 pub fn include_all_markets(mut self, include_all_markets: bool) -> Self {
2245 self.include_all_markets = Some(include_all_markets);
2246 self
2247 }
2248 #[doc = concat!("Set the optional `", "start", "` operation parameter.")]
2249 #[must_use]
2250 pub fn start(mut self, start: i64) -> Self {
2251 self.start = Some(start);
2252 self
2253 }
2254 #[doc = concat!("Set the optional `", "end", "` operation parameter.")]
2255 #[must_use]
2256 pub fn end(mut self, end: i64) -> Self {
2257 self.end = Some(end);
2258 self
2259 }
2260 #[doc = concat!("Set the optional `", "category", "` operation parameter.")]
2261 #[must_use]
2262 pub fn category(mut self, category: GetPredictionV1EventsCategory) -> Self {
2263 self.category = Some(category);
2264 self
2265 }
2266 #[doc = concat!("Set the optional `", "subcategory", "` operation parameter.")]
2267 #[must_use]
2268 pub fn subcategory(mut self, subcategory: impl Into<String>) -> Self {
2269 self.subcategory = Some(subcategory.into());
2270 self
2271 }
2272 #[doc = concat!("Set the optional `", "sortBy", "` operation parameter.")]
2273 #[must_use]
2274 pub fn sort_by(mut self, sort_by: GetPredictionV1EventsSortBy) -> Self {
2275 self.sort_by = Some(sort_by);
2276 self
2277 }
2278 #[doc = concat!("Set the optional `", "sortDirection", "` operation parameter.")]
2279 #[must_use]
2280 pub fn sort_direction(mut self, sort_direction: GetPredictionV1EventsSortDirection) -> Self {
2281 self.sort_direction = Some(sort_direction);
2282 self
2283 }
2284 #[doc = concat!("Set the optional `", "filter", "` operation parameter.")]
2285 #[must_use]
2286 pub fn filter(mut self, filter: GetPredictionV1EventsFilter) -> Self {
2287 self.filter = Some(filter);
2288 self
2289 }
2290 #[doc = concat!("Set the optional `", "tags", "` operation parameter.")]
2291 #[must_use]
2292 pub fn tags(mut self, tags: impl Into<String>) -> Self {
2293 self.tags = Some(tags.into());
2294 self
2295 }
2296 pub async fn send(
2298 self,
2299 ) -> Result<GetPredictionV1EventsResponse, ApiOpError<serde_json::Value>> {
2300 self.client
2301 .get_prediction_v1_events(
2302 self.provider,
2303 self.include_markets,
2304 self.include_all_markets,
2305 self.start,
2306 self.end,
2307 self.category,
2308 self.subcategory,
2309 self.sort_by,
2310 self.sort_direction,
2311 self.filter,
2312 self.tags,
2313 )
2314 .await
2315 }
2316}
2317#[doc = concat!("Additive request builder for `", "getPredictionV1EventsEventId", "`.")]
2318#[must_use]
2319pub struct GetPredictionV1EventsEventIdBuilder<'a> {
2320 client: &'a HttpClient,
2321 event_id: String,
2322 include_markets: Option<bool>,
2323 include_all_markets: Option<bool>,
2324}
2325impl<'a> GetPredictionV1EventsEventIdBuilder<'a> {
2326 #[doc = concat!("Set the optional `", "includeMarkets", "` operation parameter.")]
2327 #[must_use]
2328 pub fn include_markets(mut self, include_markets: bool) -> Self {
2329 self.include_markets = Some(include_markets);
2330 self
2331 }
2332 #[doc = concat!("Set the optional `", "includeAllMarkets", "` operation parameter.")]
2333 #[must_use]
2334 pub fn include_all_markets(mut self, include_all_markets: bool) -> Self {
2335 self.include_all_markets = Some(include_all_markets);
2336 self
2337 }
2338 pub async fn send(
2340 self,
2341 ) -> Result<PredictionEvent, ApiOpError<GetPredictionV1EventsEventIdApiError>> {
2342 self.client
2343 .get_prediction_v1_events_event_id(
2344 self.event_id,
2345 self.include_markets,
2346 self.include_all_markets,
2347 )
2348 .await
2349 }
2350}
2351#[doc = concat!(
2352 "Additive request builder for `", "getPredictionV1EventsEventIdMarkets", "`."
2353)]
2354#[must_use]
2355pub struct GetPredictionV1EventsEventIdMarketsBuilder<'a> {
2356 client: &'a HttpClient,
2357 event_id: String,
2358 start: Option<i64>,
2359 end: Option<i64>,
2360}
2361impl<'a> GetPredictionV1EventsEventIdMarketsBuilder<'a> {
2362 #[doc = concat!("Set the optional `", "start", "` operation parameter.")]
2363 #[must_use]
2364 pub fn start(mut self, start: i64) -> Self {
2365 self.start = Some(start);
2366 self
2367 }
2368 #[doc = concat!("Set the optional `", "end", "` operation parameter.")]
2369 #[must_use]
2370 pub fn end(mut self, end: i64) -> Self {
2371 self.end = Some(end);
2372 self
2373 }
2374 pub async fn send(
2376 self,
2377 ) -> Result<GetPredictionV1EventsEventIdMarketsResponse, ApiOpError<serde_json::Value>> {
2378 self.client
2379 .get_prediction_v1_events_event_id_markets(self.event_id, self.start, self.end)
2380 .await
2381 }
2382}
2383#[doc = concat!("Additive request builder for `", "getPredictionV1EventsSearch", "`.")]
2384#[must_use]
2385pub struct GetPredictionV1EventsSearchBuilder<'a> {
2386 client: &'a HttpClient,
2387 provider: Option<GetPredictionV1EventsSearchProvider>,
2388 query: String,
2389 limit: Option<i64>,
2390}
2391impl<'a> GetPredictionV1EventsSearchBuilder<'a> {
2392 #[doc = concat!("Set the optional `", "provider", "` operation parameter.")]
2393 #[must_use]
2394 pub fn provider(mut self, provider: GetPredictionV1EventsSearchProvider) -> Self {
2395 self.provider = Some(provider);
2396 self
2397 }
2398 #[doc = concat!("Set the optional `", "limit", "` operation parameter.")]
2399 #[must_use]
2400 pub fn limit(mut self, limit: i64) -> Self {
2401 self.limit = Some(limit);
2402 self
2403 }
2404 pub async fn send(
2406 self,
2407 ) -> Result<GetPredictionV1EventsSearchResponse, ApiOpError<serde_json::Value>> {
2408 self.client
2409 .get_prediction_v1_events_search(self.provider, self.query, self.limit)
2410 .await
2411 }
2412}
2413#[doc = concat!(
2414 "Additive request builder for `", "getPredictionV1EventsSuggestedPubkey", "`."
2415)]
2416#[must_use]
2417pub struct GetPredictionV1EventsSuggestedPubkeyBuilder<'a> {
2418 client: &'a HttpClient,
2419 pubkey: String,
2420 provider: Option<GetPredictionV1EventsSuggestedPubkeyProvider>,
2421}
2422impl<'a> GetPredictionV1EventsSuggestedPubkeyBuilder<'a> {
2423 #[doc = concat!("Set the optional `", "provider", "` operation parameter.")]
2424 #[must_use]
2425 pub fn provider(mut self, provider: GetPredictionV1EventsSuggestedPubkeyProvider) -> Self {
2426 self.provider = Some(provider);
2427 self
2428 }
2429 pub async fn send(
2431 self,
2432 ) -> Result<GetPredictionV1EventsSuggestedPubkeyResponse, ApiOpError<serde_json::Value>> {
2433 self.client
2434 .get_prediction_v1_events_suggested_pubkey(self.pubkey, self.provider)
2435 .await
2436 }
2437}
2438#[doc = concat!("Additive request builder for `", "getPredictionV1History", "`.")]
2439#[must_use]
2440pub struct GetPredictionV1HistoryBuilder<'a> {
2441 client: &'a HttpClient,
2442 start: Option<i64>,
2443 end: Option<i64>,
2444 owner_pubkey: Option<String>,
2445 id: Option<i64>,
2446 position_pubkey: Option<String>,
2447}
2448impl<'a> GetPredictionV1HistoryBuilder<'a> {
2449 #[doc = concat!("Set the optional `", "start", "` operation parameter.")]
2450 #[must_use]
2451 pub fn start(mut self, start: i64) -> Self {
2452 self.start = Some(start);
2453 self
2454 }
2455 #[doc = concat!("Set the optional `", "end", "` operation parameter.")]
2456 #[must_use]
2457 pub fn end(mut self, end: i64) -> Self {
2458 self.end = Some(end);
2459 self
2460 }
2461 #[doc = concat!("Set the optional `", "ownerPubkey", "` operation parameter.")]
2462 #[must_use]
2463 pub fn owner_pubkey(mut self, owner_pubkey: impl Into<String>) -> Self {
2464 self.owner_pubkey = Some(owner_pubkey.into());
2465 self
2466 }
2467 #[doc = concat!("Set the optional `", "id", "` operation parameter.")]
2468 #[must_use]
2469 pub fn id(mut self, id: i64) -> Self {
2470 self.id = Some(id);
2471 self
2472 }
2473 #[doc = concat!("Set the optional `", "positionPubkey", "` operation parameter.")]
2474 #[must_use]
2475 pub fn position_pubkey(mut self, position_pubkey: impl Into<String>) -> Self {
2476 self.position_pubkey = Some(position_pubkey.into());
2477 self
2478 }
2479 pub async fn send(
2481 self,
2482 ) -> Result<GetPredictionV1HistoryResponse, ApiOpError<serde_json::Value>> {
2483 self.client
2484 .get_prediction_v1_history(
2485 self.start,
2486 self.end,
2487 self.owner_pubkey,
2488 self.id,
2489 self.position_pubkey,
2490 )
2491 .await
2492 }
2493}
2494#[doc = concat!("Additive request builder for `", "getPredictionV1Leaderboards", "`.")]
2495#[must_use]
2496pub struct GetPredictionV1LeaderboardsBuilder<'a> {
2497 client: &'a HttpClient,
2498 period: Option<GetPredictionV1LeaderboardsPeriod>,
2499 limit: Option<i64>,
2500 metric: Option<GetPredictionV1LeaderboardsMetric>,
2501}
2502impl<'a> GetPredictionV1LeaderboardsBuilder<'a> {
2503 #[doc = concat!("Set the optional `", "period", "` operation parameter.")]
2504 #[must_use]
2505 pub fn period(mut self, period: GetPredictionV1LeaderboardsPeriod) -> Self {
2506 self.period = Some(period);
2507 self
2508 }
2509 #[doc = concat!("Set the optional `", "limit", "` operation parameter.")]
2510 #[must_use]
2511 pub fn limit(mut self, limit: i64) -> Self {
2512 self.limit = Some(limit);
2513 self
2514 }
2515 #[doc = concat!("Set the optional `", "metric", "` operation parameter.")]
2516 #[must_use]
2517 pub fn metric(mut self, metric: GetPredictionV1LeaderboardsMetric) -> Self {
2518 self.metric = Some(metric);
2519 self
2520 }
2521 pub async fn send(
2523 self,
2524 ) -> Result<GetPredictionV1LeaderboardsResponse, ApiOpError<serde_json::Value>> {
2525 self.client
2526 .get_prediction_v1_leaderboards(self.period, self.limit, self.metric)
2527 .await
2528 }
2529}
2530#[doc = concat!("Additive request builder for `", "getPredictionV1Orders", "`.")]
2531#[must_use]
2532pub struct GetPredictionV1OrdersBuilder<'a> {
2533 client: &'a HttpClient,
2534 start: Option<i64>,
2535 end: Option<i64>,
2536 owner_pubkey: Option<String>,
2537}
2538impl<'a> GetPredictionV1OrdersBuilder<'a> {
2539 #[doc = concat!("Set the optional `", "start", "` operation parameter.")]
2540 #[must_use]
2541 pub fn start(mut self, start: i64) -> Self {
2542 self.start = Some(start);
2543 self
2544 }
2545 #[doc = concat!("Set the optional `", "end", "` operation parameter.")]
2546 #[must_use]
2547 pub fn end(mut self, end: i64) -> Self {
2548 self.end = Some(end);
2549 self
2550 }
2551 #[doc = concat!("Set the optional `", "ownerPubkey", "` operation parameter.")]
2552 #[must_use]
2553 pub fn owner_pubkey(mut self, owner_pubkey: impl Into<String>) -> Self {
2554 self.owner_pubkey = Some(owner_pubkey.into());
2555 self
2556 }
2557 pub async fn send(
2559 self,
2560 ) -> Result<GetPredictionV1OrdersResponse, ApiOpError<GetPredictionV1OrdersApiError>> {
2561 self.client
2562 .get_prediction_v1_orders(self.start, self.end, self.owner_pubkey)
2563 .await
2564 }
2565}
2566#[doc = concat!("Additive request builder for `", "getPredictionV1Positions", "`.")]
2567#[must_use]
2568pub struct GetPredictionV1PositionsBuilder<'a> {
2569 client: &'a HttpClient,
2570 start: Option<i64>,
2571 end: Option<i64>,
2572 owner_pubkey: Option<String>,
2573 market_pubkey: Option<String>,
2574 market_id: Option<String>,
2575 is_yes: Option<GetPredictionV1PositionsIsYes>,
2576}
2577impl<'a> GetPredictionV1PositionsBuilder<'a> {
2578 #[doc = concat!("Set the optional `", "start", "` operation parameter.")]
2579 #[must_use]
2580 pub fn start(mut self, start: i64) -> Self {
2581 self.start = Some(start);
2582 self
2583 }
2584 #[doc = concat!("Set the optional `", "end", "` operation parameter.")]
2585 #[must_use]
2586 pub fn end(mut self, end: i64) -> Self {
2587 self.end = Some(end);
2588 self
2589 }
2590 #[doc = concat!("Set the optional `", "ownerPubkey", "` operation parameter.")]
2591 #[must_use]
2592 pub fn owner_pubkey(mut self, owner_pubkey: impl Into<String>) -> Self {
2593 self.owner_pubkey = Some(owner_pubkey.into());
2594 self
2595 }
2596 #[doc = concat!("Set the optional `", "marketPubkey", "` operation parameter.")]
2597 #[must_use]
2598 pub fn market_pubkey(mut self, market_pubkey: impl Into<String>) -> Self {
2599 self.market_pubkey = Some(market_pubkey.into());
2600 self
2601 }
2602 #[doc = concat!("Set the optional `", "marketId", "` operation parameter.")]
2603 #[must_use]
2604 pub fn market_id(mut self, market_id: impl Into<String>) -> Self {
2605 self.market_id = Some(market_id.into());
2606 self
2607 }
2608 #[doc = concat!("Set the optional `", "isYes", "` operation parameter.")]
2609 #[must_use]
2610 pub fn is_yes(mut self, is_yes: GetPredictionV1PositionsIsYes) -> Self {
2611 self.is_yes = Some(is_yes);
2612 self
2613 }
2614 pub async fn send(
2616 self,
2617 ) -> Result<GetPredictionV1PositionsResponse, ApiOpError<GetPredictionV1PositionsApiError>>
2618 {
2619 self.client
2620 .get_prediction_v1_positions(
2621 self.start,
2622 self.end,
2623 self.owner_pubkey,
2624 self.market_pubkey,
2625 self.market_id,
2626 self.is_yes,
2627 )
2628 .await
2629 }
2630}
2631#[doc = concat!(
2632 "Additive request builder for `", "getPredictionV1ProfilesOwnerPubkeyPnlHistory",
2633 "`."
2634)]
2635#[must_use]
2636pub struct GetPredictionV1ProfilesOwnerPubkeyPnlHistoryBuilder<'a> {
2637 client: &'a HttpClient,
2638 owner_pubkey: String,
2639 interval: Option<GetPredictionV1ProfilesOwnerPubkeyPnlHistoryInterval>,
2640 count: Option<i64>,
2641}
2642impl<'a> GetPredictionV1ProfilesOwnerPubkeyPnlHistoryBuilder<'a> {
2643 #[doc = concat!("Set the optional `", "interval", "` operation parameter.")]
2644 #[must_use]
2645 pub fn interval(
2646 mut self,
2647 interval: GetPredictionV1ProfilesOwnerPubkeyPnlHistoryInterval,
2648 ) -> Self {
2649 self.interval = Some(interval);
2650 self
2651 }
2652 #[doc = concat!("Set the optional `", "count", "` operation parameter.")]
2653 #[must_use]
2654 pub fn count(mut self, count: i64) -> Self {
2655 self.count = Some(count);
2656 self
2657 }
2658 pub async fn send(
2660 self,
2661 ) -> Result<GetPredictionV1ProfilesOwnerPubkeyPnlHistoryResponse, ApiOpError<serde_json::Value>>
2662 {
2663 self.client
2664 .get_prediction_v1_profiles_owner_pubkey_pnl_history(
2665 self.owner_pubkey,
2666 self.interval,
2667 self.count,
2668 )
2669 .await
2670 }
2671}
2672#[doc = concat!("Additive request builder for `", "getPriceV2", "`.")]
2673#[must_use]
2674pub struct GetPriceV2Builder<'a> {
2675 client: &'a HttpClient,
2676 ids: String,
2677 vs_token: Option<String>,
2678 show_extra_info: Option<String>,
2679}
2680impl<'a> GetPriceV2Builder<'a> {
2681 #[doc = concat!("Set the optional `", "vsToken", "` operation parameter.")]
2682 #[must_use]
2683 pub fn vs_token(mut self, vs_token: impl Into<String>) -> Self {
2684 self.vs_token = Some(vs_token.into());
2685 self
2686 }
2687 #[doc = concat!("Set the optional `", "showExtraInfo", "` operation parameter.")]
2688 #[must_use]
2689 pub fn show_extra_info(mut self, show_extra_info: impl Into<String>) -> Self {
2690 self.show_extra_info = Some(show_extra_info.into());
2691 self
2692 }
2693 pub async fn send(self) -> Result<PriceV2PriceResponse, ApiOpError<serde_json::Value>> {
2695 self.client
2696 .get_price_v2(self.ids, self.vs_token, self.show_extra_info)
2697 .await
2698 }
2699}
2700#[doc = concat!("Additive request builder for `", "getSendV1InviteHistory", "`.")]
2701#[must_use]
2702pub struct GetSendV1InviteHistoryBuilder<'a> {
2703 client: &'a HttpClient,
2704 address: String,
2705 page: Option<i64>,
2706}
2707impl<'a> GetSendV1InviteHistoryBuilder<'a> {
2708 #[doc = concat!("Set the optional `", "page", "` operation parameter.")]
2709 #[must_use]
2710 pub fn page(mut self, page: i64) -> Self {
2711 self.page = Some(page);
2712 self
2713 }
2714 pub async fn send(
2716 self,
2717 ) -> Result<SendInviteDataResponse, ApiOpError<GetSendV1InviteHistoryApiError>> {
2718 self.client
2719 .get_send_v1_invite_history(self.address, self.page)
2720 .await
2721 }
2722}
2723#[doc = concat!("Additive request builder for `", "getSendV1PendingInvites", "`.")]
2724#[must_use]
2725pub struct GetSendV1PendingInvitesBuilder<'a> {
2726 client: &'a HttpClient,
2727 address: String,
2728 page: Option<i64>,
2729}
2730impl<'a> GetSendV1PendingInvitesBuilder<'a> {
2731 #[doc = concat!("Set the optional `", "page", "` operation parameter.")]
2732 #[must_use]
2733 pub fn page(mut self, page: i64) -> Self {
2734 self.page = Some(page);
2735 self
2736 }
2737 pub async fn send(
2739 self,
2740 ) -> Result<SendInviteDataResponse, ApiOpError<GetSendV1PendingInvitesApiError>> {
2741 self.client
2742 .get_send_v1_pending_invites(self.address, self.page)
2743 .await
2744 }
2745}
2746#[doc = concat!("Additive request builder for `", "getTokensV1New", "`.")]
2747#[must_use]
2748pub struct GetTokensV1NewBuilder<'a> {
2749 client: &'a HttpClient,
2750 limit: Option<i64>,
2751 offset: Option<i64>,
2752}
2753impl<'a> GetTokensV1NewBuilder<'a> {
2754 #[doc = concat!("Set the optional `", "limit", "` operation parameter.")]
2755 #[must_use]
2756 pub fn limit(mut self, limit: i64) -> Self {
2757 self.limit = Some(limit);
2758 self
2759 }
2760 #[doc = concat!("Set the optional `", "offset", "` operation parameter.")]
2761 #[must_use]
2762 pub fn offset(mut self, offset: i64) -> Self {
2763 self.offset = Some(offset);
2764 self
2765 }
2766 pub async fn send(self) -> Result<GetTokensV1NewResponse, ApiOpError<serde_json::Value>> {
2768 self.client.get_tokens_v1_new(self.limit, self.offset).await
2769 }
2770}
2771#[doc = concat!("Additive request builder for `", "getTokensV2CategoryInterval", "`.")]
2772#[must_use]
2773pub struct GetTokensV2CategoryIntervalBuilder<'a> {
2774 client: &'a HttpClient,
2775 category: GetTokensV2CategoryIntervalCategory,
2776 interval: GetTokensV2CategoryIntervalInterval,
2777 limit: Option<i64>,
2778}
2779impl<'a> GetTokensV2CategoryIntervalBuilder<'a> {
2780 #[doc = concat!("Set the optional `", "limit", "` operation parameter.")]
2781 #[must_use]
2782 pub fn limit(mut self, limit: i64) -> Self {
2783 self.limit = Some(limit);
2784 self
2785 }
2786 pub async fn send(
2788 self,
2789 ) -> Result<GetTokensV2CategoryIntervalResponse, ApiOpError<GetTokensV2CategoryIntervalApiError>>
2790 {
2791 self.client
2792 .get_tokens_v2_category_interval(self.category, self.interval, self.limit)
2793 .await
2794 }
2795}
2796#[doc = concat!(
2797 "Additive request builder for `", "getTokensV2VerifyExpressCraftTxn", "`."
2798)]
2799#[must_use]
2800pub struct GetTokensV2VerifyExpressCraftTxnBuilder<'a> {
2801 client: &'a HttpClient,
2802 sender_address: String,
2803 payment_currency: Option<TokensV2VerificationPaymentCurrency>,
2804}
2805impl<'a> GetTokensV2VerifyExpressCraftTxnBuilder<'a> {
2806 #[doc = concat!("Set the optional `", "paymentCurrency", "` operation parameter.")]
2807 #[must_use]
2808 pub fn payment_currency(
2809 mut self,
2810 payment_currency: TokensV2VerificationPaymentCurrency,
2811 ) -> Self {
2812 self.payment_currency = Some(payment_currency);
2813 self
2814 }
2815 pub async fn send(
2817 self,
2818 ) -> Result<
2819 TokensV2VerificationCraftTxnResponse,
2820 ApiOpError<GetTokensV2VerifyExpressCraftTxnApiError>,
2821 > {
2822 self.client
2823 .get_tokens_v2_verify_express_craft_txn(self.sender_address, self.payment_currency)
2824 .await
2825 }
2826}
2827#[doc = concat!("Additive request builder for `", "getTriggerV1GetTriggerOrders", "`.")]
2828#[must_use]
2829pub struct GetTriggerV1GetTriggerOrdersBuilder<'a> {
2830 client: &'a HttpClient,
2831 user: String,
2832 page: Option<String>,
2833 include_failed_tx: Option<GetTriggerV1GetTriggerOrdersIncludeFailedTx>,
2834 order_status: GetTriggerV1GetTriggerOrdersOrderStatus,
2835 input_mint: Option<String>,
2836 output_mint: Option<String>,
2837}
2838impl<'a> GetTriggerV1GetTriggerOrdersBuilder<'a> {
2839 #[doc = concat!("Set the optional `", "page", "` operation parameter.")]
2840 #[must_use]
2841 pub fn page(mut self, page: impl Into<String>) -> Self {
2842 self.page = Some(page.into());
2843 self
2844 }
2845 #[doc = concat!("Set the optional `", "includeFailedTx", "` operation parameter.")]
2846 #[must_use]
2847 pub fn include_failed_tx(
2848 mut self,
2849 include_failed_tx: GetTriggerV1GetTriggerOrdersIncludeFailedTx,
2850 ) -> Self {
2851 self.include_failed_tx = Some(include_failed_tx);
2852 self
2853 }
2854 #[doc = concat!("Set the optional `", "inputMint", "` operation parameter.")]
2855 #[must_use]
2856 pub fn input_mint(mut self, input_mint: impl Into<String>) -> Self {
2857 self.input_mint = Some(input_mint.into());
2858 self
2859 }
2860 #[doc = concat!("Set the optional `", "outputMint", "` operation parameter.")]
2861 #[must_use]
2862 pub fn output_mint(mut self, output_mint: impl Into<String>) -> Self {
2863 self.output_mint = Some(output_mint.into());
2864 self
2865 }
2866 pub async fn send(
2868 self,
2869 ) -> Result<GetTriggerV1GetTriggerOrdersResponse, ApiOpError<serde_json::Value>> {
2870 self.client
2871 .get_trigger_v1_get_trigger_orders(
2872 self.user,
2873 self.page,
2874 self.include_failed_tx,
2875 self.order_status,
2876 self.input_mint,
2877 self.output_mint,
2878 )
2879 .await
2880 }
2881}
2882#[doc = concat!("Additive request builder for `", "getTriggerV2OrdersHistory", "`.")]
2883#[must_use]
2884pub struct GetTriggerV2OrdersHistoryBuilder<'a> {
2885 client: &'a HttpClient,
2886 state: Option<GetTriggerV2OrdersHistoryState>,
2887 mint: Option<String>,
2888 limit: Option<f64>,
2889 offset: Option<f64>,
2890 sort: Option<GetTriggerV2OrdersHistorySort>,
2891 dir: Option<GetTriggerV2OrdersHistoryDir>,
2892}
2893impl<'a> GetTriggerV2OrdersHistoryBuilder<'a> {
2894 #[doc = concat!("Set the optional `", "state", "` operation parameter.")]
2895 #[must_use]
2896 pub fn state(mut self, state: GetTriggerV2OrdersHistoryState) -> Self {
2897 self.state = Some(state);
2898 self
2899 }
2900 #[doc = concat!("Set the optional `", "mint", "` operation parameter.")]
2901 #[must_use]
2902 pub fn mint(mut self, mint: impl Into<String>) -> Self {
2903 self.mint = Some(mint.into());
2904 self
2905 }
2906 #[doc = concat!("Set the optional `", "limit", "` operation parameter.")]
2907 #[must_use]
2908 pub fn limit(mut self, limit: f64) -> Self {
2909 self.limit = Some(limit);
2910 self
2911 }
2912 #[doc = concat!("Set the optional `", "offset", "` operation parameter.")]
2913 #[must_use]
2914 pub fn offset(mut self, offset: f64) -> Self {
2915 self.offset = Some(offset);
2916 self
2917 }
2918 #[doc = concat!("Set the optional `", "sort", "` operation parameter.")]
2919 #[must_use]
2920 pub fn sort(mut self, sort: GetTriggerV2OrdersHistorySort) -> Self {
2921 self.sort = Some(sort);
2922 self
2923 }
2924 #[doc = concat!("Set the optional `", "dir", "` operation parameter.")]
2925 #[must_use]
2926 pub fn dir(mut self, dir: GetTriggerV2OrdersHistoryDir) -> Self {
2927 self.dir = Some(dir);
2928 self
2929 }
2930 pub async fn send(
2932 self,
2933 ) -> Result<GetTriggerV2OrdersHistoryResponse, ApiOpError<serde_json::Value>> {
2934 self.client
2935 .get_trigger_v2_orders_history(
2936 self.state,
2937 self.mint,
2938 self.limit,
2939 self.offset,
2940 self.sort,
2941 self.dir,
2942 )
2943 .await
2944 }
2945}
2946#[doc = concat!("Additive request builder for `", "getTriggerV2OrdersHistoryDca", "`.")]
2947#[must_use]
2948pub struct GetTriggerV2OrdersHistoryDcaBuilder<'a> {
2949 client: &'a HttpClient,
2950 state: Option<GetTriggerV2OrdersHistoryDcaState>,
2951 mint: Option<String>,
2952 limit: Option<f64>,
2953 offset: Option<f64>,
2954 sort: Option<GetTriggerV2OrdersHistoryDcaSort>,
2955 dir: Option<GetTriggerV2OrdersHistoryDcaDir>,
2956}
2957impl<'a> GetTriggerV2OrdersHistoryDcaBuilder<'a> {
2958 #[doc = concat!("Set the optional `", "state", "` operation parameter.")]
2959 #[must_use]
2960 pub fn state(mut self, state: GetTriggerV2OrdersHistoryDcaState) -> Self {
2961 self.state = Some(state);
2962 self
2963 }
2964 #[doc = concat!("Set the optional `", "mint", "` operation parameter.")]
2965 #[must_use]
2966 pub fn mint(mut self, mint: impl Into<String>) -> Self {
2967 self.mint = Some(mint.into());
2968 self
2969 }
2970 #[doc = concat!("Set the optional `", "limit", "` operation parameter.")]
2971 #[must_use]
2972 pub fn limit(mut self, limit: f64) -> Self {
2973 self.limit = Some(limit);
2974 self
2975 }
2976 #[doc = concat!("Set the optional `", "offset", "` operation parameter.")]
2977 #[must_use]
2978 pub fn offset(mut self, offset: f64) -> Self {
2979 self.offset = Some(offset);
2980 self
2981 }
2982 #[doc = concat!("Set the optional `", "sort", "` operation parameter.")]
2983 #[must_use]
2984 pub fn sort(mut self, sort: GetTriggerV2OrdersHistoryDcaSort) -> Self {
2985 self.sort = Some(sort);
2986 self
2987 }
2988 #[doc = concat!("Set the optional `", "dir", "` operation parameter.")]
2989 #[must_use]
2990 pub fn dir(mut self, dir: GetTriggerV2OrdersHistoryDcaDir) -> Self {
2991 self.dir = Some(dir);
2992 self
2993 }
2994 pub async fn send(
2996 self,
2997 ) -> Result<GetTriggerV2OrdersHistoryDcaResponse, ApiOpError<serde_json::Value>> {
2998 self.client
2999 .get_trigger_v2_orders_history_dca(
3000 self.state,
3001 self.mint,
3002 self.limit,
3003 self.offset,
3004 self.sort,
3005 self.dir,
3006 )
3007 .await
3008 }
3009}
3010#[doc = concat!("Additive request builder for `", "getUltraV1Order", "`.")]
3011#[must_use]
3012pub struct GetUltraV1OrderBuilder<'a> {
3013 client: &'a HttpClient,
3014 input_mint: String,
3015 output_mint: String,
3016 amount: String,
3017 taker: Option<String>,
3018 receiver: Option<String>,
3019 payer: Option<String>,
3020 close_authority: Option<String>,
3021 referral_account: Option<String>,
3022 referral_fee: Option<f64>,
3023 exclude_routers: Option<GetUltraV1OrderExcludeRouters>,
3024 exclude_dexes: Option<String>,
3025}
3026impl<'a> GetUltraV1OrderBuilder<'a> {
3027 #[doc = concat!("Set the optional `", "taker", "` operation parameter.")]
3028 #[must_use]
3029 pub fn taker(mut self, taker: impl Into<String>) -> Self {
3030 self.taker = Some(taker.into());
3031 self
3032 }
3033 #[doc = concat!("Set the optional `", "receiver", "` operation parameter.")]
3034 #[must_use]
3035 pub fn receiver(mut self, receiver: impl Into<String>) -> Self {
3036 self.receiver = Some(receiver.into());
3037 self
3038 }
3039 #[doc = concat!("Set the optional `", "payer", "` operation parameter.")]
3040 #[must_use]
3041 pub fn payer(mut self, payer: impl Into<String>) -> Self {
3042 self.payer = Some(payer.into());
3043 self
3044 }
3045 #[doc = concat!("Set the optional `", "closeAuthority", "` operation parameter.")]
3046 #[must_use]
3047 pub fn close_authority(mut self, close_authority: impl Into<String>) -> Self {
3048 self.close_authority = Some(close_authority.into());
3049 self
3050 }
3051 #[doc = concat!("Set the optional `", "referralAccount", "` operation parameter.")]
3052 #[must_use]
3053 pub fn referral_account(mut self, referral_account: impl Into<String>) -> Self {
3054 self.referral_account = Some(referral_account.into());
3055 self
3056 }
3057 #[doc = concat!("Set the optional `", "referralFee", "` operation parameter.")]
3058 #[must_use]
3059 pub fn referral_fee(mut self, referral_fee: f64) -> Self {
3060 self.referral_fee = Some(referral_fee);
3061 self
3062 }
3063 #[doc = concat!("Set the optional `", "excludeRouters", "` operation parameter.")]
3064 #[must_use]
3065 pub fn exclude_routers(mut self, exclude_routers: GetUltraV1OrderExcludeRouters) -> Self {
3066 self.exclude_routers = Some(exclude_routers);
3067 self
3068 }
3069 #[doc = concat!("Set the optional `", "excludeDexes", "` operation parameter.")]
3070 #[must_use]
3071 pub fn exclude_dexes(mut self, exclude_dexes: impl Into<String>) -> Self {
3072 self.exclude_dexes = Some(exclude_dexes.into());
3073 self
3074 }
3075 pub async fn send(
3077 self,
3078 ) -> Result<GetUltraV1OrderResponse, ApiOpError<GetUltraV1OrderApiError>> {
3079 self.client
3080 .get_ultra_v1_order(
3081 self.input_mint,
3082 self.output_mint,
3083 self.amount,
3084 self.taker,
3085 self.receiver,
3086 self.payer,
3087 self.close_authority,
3088 self.referral_account,
3089 self.referral_fee,
3090 self.exclude_routers,
3091 self.exclude_dexes,
3092 )
3093 .await
3094 }
3095}
3096#[doc = concat!("Additive request builder for `", "listBorrowPositions", "`.")]
3097#[must_use]
3098pub struct ListBorrowPositionsBuilder<'a> {
3099 client: &'a HttpClient,
3100 users: String,
3101 market: Option<LendBorrowMarket>,
3102}
3103impl<'a> ListBorrowPositionsBuilder<'a> {
3104 #[doc = concat!("Set the optional `", "market", "` operation parameter.")]
3105 #[must_use]
3106 pub fn market(mut self, market: LendBorrowMarket) -> Self {
3107 self.market = Some(market);
3108 self
3109 }
3110 pub async fn send(self) -> Result<ListBorrowPositionsResponse, ApiOpError<serde_json::Value>> {
3112 self.client
3113 .list_borrow_positions(self.users, self.market)
3114 .await
3115 }
3116}
3117#[doc = concat!("Additive request builder for `", "listBorrowVaults", "`.")]
3118#[must_use]
3119pub struct ListBorrowVaultsBuilder<'a> {
3120 client: &'a HttpClient,
3121 market: Option<LendBorrowMarket>,
3122 rpc_url: Option<String>,
3123}
3124impl<'a> ListBorrowVaultsBuilder<'a> {
3125 #[doc = concat!("Set the optional `", "market", "` operation parameter.")]
3126 #[must_use]
3127 pub fn market(mut self, market: LendBorrowMarket) -> Self {
3128 self.market = Some(market);
3129 self
3130 }
3131 #[doc = concat!("Set the optional `", "rpcUrl", "` operation parameter.")]
3132 #[must_use]
3133 pub fn rpc_url(mut self, rpc_url: impl Into<String>) -> Self {
3134 self.rpc_url = Some(rpc_url.into());
3135 self
3136 }
3137 pub async fn send(self) -> Result<ListBorrowVaultsResponse, ApiOpError<serde_json::Value>> {
3139 self.client
3140 .list_borrow_vaults(self.market, self.rpc_url)
3141 .await
3142 }
3143}
3144#[doc = concat!(
3145 "Additive request builder for `", "patchTriggerV2OrdersPriceOrderId", "`."
3146)]
3147#[must_use]
3148pub struct PatchTriggerV2OrdersPriceOrderIdBuilder<'a> {
3149 client: &'a HttpClient,
3150 order_id: String,
3151 request: PatchTriggerV2OrdersPriceOrderIdRequest,
3152}
3153impl<'a> PatchTriggerV2OrdersPriceOrderIdBuilder<'a> {
3154 #[must_use]
3156 pub fn request(mut self, request: PatchTriggerV2OrdersPriceOrderIdRequest) -> Self {
3157 self.request = request;
3158 self
3159 }
3160 #[doc = concat!("Set the optional request-body field `", "slPriceUsd", "`.")]
3161 #[must_use]
3162 pub fn sl_price_usd(mut self, sl_price_usd: f64) -> Self {
3163 self.request.sl_price_usd = Some(sl_price_usd);
3164 self
3165 }
3166 #[doc = concat!("Set the optional request-body field `", "slSlippageBps", "`.")]
3167 #[must_use]
3168 pub fn sl_slippage_bps(mut self, sl_slippage_bps: f64) -> Self {
3169 self.request.sl_slippage_bps = Some(sl_slippage_bps);
3170 self
3171 }
3172 #[doc = concat!("Set the optional request-body field `", "slippageBps", "`.")]
3173 #[must_use]
3174 pub fn slippage_bps(mut self, slippage_bps: f64) -> Self {
3175 self.request.slippage_bps = Some(slippage_bps);
3176 self
3177 }
3178 #[doc = concat!("Set the optional request-body field `", "tpPriceUsd", "`.")]
3179 #[must_use]
3180 pub fn tp_price_usd(mut self, tp_price_usd: f64) -> Self {
3181 self.request.tp_price_usd = Some(tp_price_usd);
3182 self
3183 }
3184 #[doc = concat!("Set the optional request-body field `", "tpSlippageBps", "`.")]
3185 #[must_use]
3186 pub fn tp_slippage_bps(mut self, tp_slippage_bps: f64) -> Self {
3187 self.request.tp_slippage_bps = Some(tp_slippage_bps);
3188 self
3189 }
3190 #[doc = concat!("Set the optional request-body field `", "trailingBps", "`.")]
3191 #[must_use]
3192 pub fn trailing_bps(mut self, trailing_bps: f64) -> Self {
3193 self.request.trailing_bps = Some(trailing_bps);
3194 self
3195 }
3196 #[doc = concat!("Set the optional request-body field `", "triggerPriceUsd", "`.")]
3197 #[must_use]
3198 pub fn trigger_price_usd(mut self, trigger_price_usd: f64) -> Self {
3199 self.request.trigger_price_usd = Some(trigger_price_usd);
3200 self
3201 }
3202 pub async fn send(
3204 self,
3205 ) -> Result<PatchTriggerV2OrdersPriceOrderIdResponse, ApiOpError<serde_json::Value>> {
3206 self.client
3207 .patch_trigger_v2_orders_price_order_id(self.order_id, self.request)
3208 .await
3209 }
3210}
3211#[doc = concat!("Additive request builder for `", "postPredictionV1Execute", "`.")]
3212#[must_use]
3213pub struct PostPredictionV1ExecuteBuilder<'a> {
3214 client: &'a HttpClient,
3215 request: PredictionExecuteRequest,
3216}
3217impl<'a> PostPredictionV1ExecuteBuilder<'a> {
3218 #[must_use]
3220 pub fn request(mut self, request: PredictionExecuteRequest) -> Self {
3221 self.request = request;
3222 self
3223 }
3224 #[doc = concat!("Set the optional request-body field `", "context", "`.")]
3225 #[must_use]
3226 pub fn context(mut self, context: PredictionExecuteRequestContext) -> Self {
3227 self.request.context = Some(context);
3228 self
3229 }
3230 #[doc = concat!("Set the optional request-body field `", "requestId", "`.")]
3231 #[must_use]
3232 pub fn request_id(mut self, request_id: String) -> Self {
3233 self.request.request_id = Some(request_id);
3234 self
3235 }
3236 pub async fn send(
3238 self,
3239 ) -> Result<PredictionExecuteResponse, ApiOpError<PostPredictionV1ExecuteApiError>> {
3240 self.client.post_prediction_v1_execute(self.request).await
3241 }
3242}
3243#[doc = concat!("Additive request builder for `", "postPredictionV1Orders", "`.")]
3244#[must_use]
3245pub struct PostPredictionV1OrdersBuilder<'a> {
3246 client: &'a HttpClient,
3247 request: PredictionCreateOrderRequest,
3248}
3249impl<'a> PostPredictionV1OrdersBuilder<'a> {
3250 #[must_use]
3252 pub fn request(mut self, request: PredictionCreateOrderRequest) -> Self {
3253 self.request = request;
3254 self
3255 }
3256 #[doc = concat!("Set the optional request-body field `", "contracts", "`.")]
3257 #[must_use]
3258 pub fn contracts(mut self, contracts: PredictionCreateOrderRequestContracts) -> Self {
3259 self.request.contracts = Some(contracts);
3260 self
3261 }
3262 #[doc = concat!("Set the optional request-body field `", "contractsDecimal", "`.")]
3263 #[must_use]
3264 pub fn contracts_decimal(
3265 mut self,
3266 contracts_decimal: PredictionCreateOrderRequestContractsDecimal,
3267 ) -> Self {
3268 self.request.contracts_decimal = Some(contracts_decimal);
3269 self
3270 }
3271 #[doc = concat!("Set the optional request-body field `", "contractsMicro", "`.")]
3272 #[must_use]
3273 pub fn contracts_micro(
3274 mut self,
3275 contracts_micro: PredictionCreateOrderRequestContractsMicro,
3276 ) -> Self {
3277 self.request.contracts_micro = Some(contracts_micro);
3278 self
3279 }
3280 #[doc = concat!("Set the optional request-body field `", "depositAmount", "`.")]
3281 #[must_use]
3282 pub fn deposit_amount(
3283 mut self,
3284 deposit_amount: PredictionCreateOrderRequestDepositAmount,
3285 ) -> Self {
3286 self.request.deposit_amount = Some(deposit_amount);
3287 self
3288 }
3289 #[doc = concat!("Set the optional request-body field `", "depositMint", "`.")]
3290 #[must_use]
3291 pub fn deposit_mint(mut self, deposit_mint: String) -> Self {
3292 self.request.deposit_mint = Some(deposit_mint);
3293 self
3294 }
3295 #[doc = concat!("Set the optional request-body field `", "isYes", "`.")]
3296 #[must_use]
3297 pub fn is_yes(mut self, is_yes: bool) -> Self {
3298 self.request.is_yes = Some(is_yes);
3299 self
3300 }
3301 #[doc = concat!("Set the optional request-body field `", "marketId", "`.")]
3302 #[must_use]
3303 pub fn market_id(mut self, market_id: String) -> Self {
3304 self.request.market_id = Some(market_id);
3305 self
3306 }
3307 #[doc = concat!("Set the optional request-body field `", "ownerPubkey", "`.")]
3308 #[must_use]
3309 pub fn owner_pubkey(mut self, owner_pubkey: String) -> Self {
3310 self.request.owner_pubkey = Some(owner_pubkey);
3311 self
3312 }
3313 #[doc = concat!("Set the optional request-body field `", "positionPubkey", "`.")]
3314 #[must_use]
3315 pub fn position_pubkey(mut self, position_pubkey: String) -> Self {
3316 self.request.position_pubkey = Some(position_pubkey);
3317 self
3318 }
3319 pub async fn send(
3321 self,
3322 ) -> Result<PredictionCreateOrderResponse, ApiOpError<PostPredictionV1OrdersApiError>> {
3323 self.client.post_prediction_v1_orders(self.request).await
3324 }
3325}
3326#[doc = concat!(
3327 "Additive request builder for `", "postPredictionV1PositionsPositionPubkeyClaim",
3328 "`."
3329)]
3330#[must_use]
3331pub struct PostPredictionV1PositionsPositionPubkeyClaimBuilder<'a> {
3332 client: &'a HttpClient,
3333 position_pubkey: String,
3334 request: PredictionClaimPositionRequest,
3335}
3336impl<'a> PostPredictionV1PositionsPositionPubkeyClaimBuilder<'a> {
3337 #[must_use]
3339 pub fn request(mut self, request: PredictionClaimPositionRequest) -> Self {
3340 self.request = request;
3341 self
3342 }
3343 #[doc = concat!("Set the optional request-body field `", "ownerPubkey", "`.")]
3344 #[must_use]
3345 pub fn owner_pubkey(mut self, owner_pubkey: String) -> Self {
3346 self.request.owner_pubkey = Some(owner_pubkey);
3347 self
3348 }
3349 pub async fn send(
3351 self,
3352 ) -> Result<
3353 PredictionClaimPositionResponse,
3354 ApiOpError<PostPredictionV1PositionsPositionPubkeyClaimApiError>,
3355 > {
3356 self.client
3357 .post_prediction_v1_positions_position_pubkey_claim(self.position_pubkey, self.request)
3358 .await
3359 }
3360}
3361#[doc = concat!("Additive request builder for `", "postSendV1CraftSend", "`.")]
3362#[must_use]
3363pub struct PostSendV1CraftSendBuilder<'a> {
3364 client: &'a HttpClient,
3365 request: PostSendV1CraftSendRequest,
3366}
3367impl<'a> PostSendV1CraftSendBuilder<'a> {
3368 #[must_use]
3370 pub fn request(mut self, request: PostSendV1CraftSendRequest) -> Self {
3371 self.request = request;
3372 self
3373 }
3374 #[doc = concat!("Set the optional request-body field `", "mint", "`.")]
3375 #[must_use]
3376 pub fn mint(mut self, mint: String) -> Self {
3377 self.request.mint = Some(mint);
3378 self
3379 }
3380 pub async fn send(
3382 self,
3383 ) -> Result<PostSendV1CraftSendResponse, ApiOpError<PostSendV1CraftSendApiError>> {
3384 self.client.post_send_v1_craft_send(self.request).await
3385 }
3386}
3387#[doc = concat!("Additive request builder for `", "postStudioV1DbcFee", "`.")]
3388#[must_use]
3389pub struct PostStudioV1DbcFeeBuilder<'a> {
3390 client: &'a HttpClient,
3391 request: Option<PostStudioV1DbcFeeRequest>,
3392}
3393impl<'a> PostStudioV1DbcFeeBuilder<'a> {
3394 #[must_use]
3396 pub fn request(mut self, request: PostStudioV1DbcFeeRequest) -> Self {
3397 self.request = Some(request);
3398 self
3399 }
3400 pub async fn send(
3402 self,
3403 ) -> Result<PostStudioV1DbcFeeResponse, ApiOpError<PostStudioV1DbcFeeApiError>> {
3404 self.client.post_studio_v1_dbc_fee(self.request).await
3405 }
3406}
3407#[doc = concat!("Additive request builder for `", "postStudioV1DbcFeeCreateTx", "`.")]
3408#[must_use]
3409pub struct PostStudioV1DbcFeeCreateTxBuilder<'a> {
3410 client: &'a HttpClient,
3411 request: Option<StudioCreateClaimFeeDBCTransactionRequestBody>,
3412}
3413impl<'a> PostStudioV1DbcFeeCreateTxBuilder<'a> {
3414 #[must_use]
3416 pub fn request(mut self, request: StudioCreateClaimFeeDBCTransactionRequestBody) -> Self {
3417 self.request = Some(request);
3418 self
3419 }
3420 pub async fn send(
3422 self,
3423 ) -> Result<PostStudioV1DbcFeeCreateTxResponse, ApiOpError<PostStudioV1DbcFeeCreateTxApiError>>
3424 {
3425 self.client
3426 .post_studio_v1_dbc_fee_create_tx(self.request)
3427 .await
3428 }
3429}
3430#[doc = concat!("Additive request builder for `", "postStudioV1DbcPoolCreateTx", "`.")]
3431#[must_use]
3432pub struct PostStudioV1DbcPoolCreateTxBuilder<'a> {
3433 client: &'a HttpClient,
3434 request: Option<StudioCreateDBCTransactionRequestBody>,
3435}
3436impl<'a> PostStudioV1DbcPoolCreateTxBuilder<'a> {
3437 #[must_use]
3439 pub fn request(mut self, request: StudioCreateDBCTransactionRequestBody) -> Self {
3440 self.request = Some(request);
3441 self
3442 }
3443 pub async fn send(
3445 self,
3446 ) -> Result<StudioCreateDBCTransactionResponse, ApiOpError<PostStudioV1DbcPoolCreateTxApiError>>
3447 {
3448 self.client
3449 .post_studio_v1_dbc_pool_create_tx(self.request)
3450 .await
3451 }
3452}
3453#[doc = concat!("Additive request builder for `", "postStudioV1DbcPoolSubmit", "`.")]
3454#[must_use]
3455pub struct PostStudioV1DbcPoolSubmitBuilder<'a> {
3456 client: &'a HttpClient,
3457 request: Option<StudioSubmitDBCTransactionRequestBody>,
3458}
3459impl<'a> PostStudioV1DbcPoolSubmitBuilder<'a> {
3460 #[must_use]
3462 pub fn request(mut self, request: StudioSubmitDBCTransactionRequestBody) -> Self {
3463 self.request = Some(request);
3464 self
3465 }
3466 pub async fn send(
3468 self,
3469 ) -> Result<PostStudioV1DbcPoolSubmitResponse, ApiOpError<PostStudioV1DbcPoolSubmitApiError>>
3470 {
3471 self.client
3472 .post_studio_v1_dbc_pool_submit(self.request)
3473 .await
3474 }
3475}
3476#[doc = concat!(
3477 "Additive request builder for `", "postTokensV2VerifyExpressExecute", "`."
3478)]
3479#[must_use]
3480pub struct PostTokensV2VerifyExpressExecuteBuilder<'a> {
3481 client: &'a HttpClient,
3482 request: TokensV2VerificationExpressExecuteBody,
3483}
3484impl<'a> PostTokensV2VerifyExpressExecuteBuilder<'a> {
3485 #[must_use]
3487 pub fn request(mut self, request: TokensV2VerificationExpressExecuteBody) -> Self {
3488 self.request = request;
3489 self
3490 }
3491 #[doc = concat!("Set the optional request-body field `", "jupOutputAmount", "`.")]
3492 #[must_use]
3493 pub fn jup_output_amount(mut self, jup_output_amount: String) -> Self {
3494 self.request.jup_output_amount = Some(jup_output_amount);
3495 self
3496 }
3497 #[doc = concat!("Set the optional request-body field `", "paymentAmount", "`.")]
3498 #[must_use]
3499 pub fn payment_amount(mut self, payment_amount: String) -> Self {
3500 self.request.payment_amount = Some(payment_amount);
3501 self
3502 }
3503 #[doc = concat!("Set the optional request-body field `", "paymentCurrency", "`.")]
3504 #[must_use]
3505 pub fn payment_currency(
3506 mut self,
3507 payment_currency: TokensV2VerificationPaymentCurrency,
3508 ) -> Self {
3509 self.request.payment_currency = Some(payment_currency);
3510 self
3511 }
3512 #[doc = concat!(
3513 "Set the optional request-body field `", "senderTwitterHandle", "`."
3514 )]
3515 #[must_use]
3516 pub fn sender_twitter_handle(mut self, sender_twitter_handle: String) -> Self {
3517 self.request.sender_twitter_handle = Some(sender_twitter_handle);
3518 self
3519 }
3520 #[doc = concat!("Set the optional request-body field `", "tokenMetadata", "`.")]
3521 #[must_use]
3522 pub fn token_metadata(
3523 mut self,
3524 token_metadata: TokensV2VerificationTokenMetadataInput,
3525 ) -> Self {
3526 self.request.token_metadata = Some(token_metadata);
3527 self
3528 }
3529 pub async fn send(
3531 self,
3532 ) -> Result<
3533 TokensV2VerificationExpressExecuteResponse,
3534 ApiOpError<PostTokensV2VerifyExpressExecuteApiError>,
3535 > {
3536 self.client
3537 .post_tokens_v2_verify_express_execute(self.request)
3538 .await
3539 }
3540}
3541#[doc = concat!("Additive request builder for `", "postTriggerV1CancelOrder", "`.")]
3542#[must_use]
3543pub struct PostTriggerV1CancelOrderBuilder<'a> {
3544 client: &'a HttpClient,
3545 request: Option<PostTriggerV1CancelOrderRequest>,
3546}
3547impl<'a> PostTriggerV1CancelOrderBuilder<'a> {
3548 #[must_use]
3550 pub fn request(mut self, request: PostTriggerV1CancelOrderRequest) -> Self {
3551 self.request = Some(request);
3552 self
3553 }
3554 pub async fn send(
3556 self,
3557 ) -> Result<PostTriggerV1CancelOrderResponse, ApiOpError<PostTriggerV1CancelOrderApiError>>
3558 {
3559 self.client.post_trigger_v1_cancel_order(self.request).await
3560 }
3561}
3562#[doc = concat!("Additive request builder for `", "postTriggerV1CancelOrders", "`.")]
3563#[must_use]
3564pub struct PostTriggerV1CancelOrdersBuilder<'a> {
3565 client: &'a HttpClient,
3566 request: Option<PostTriggerV1CancelOrdersRequest>,
3567}
3568impl<'a> PostTriggerV1CancelOrdersBuilder<'a> {
3569 #[must_use]
3571 pub fn request(mut self, request: PostTriggerV1CancelOrdersRequest) -> Self {
3572 self.request = Some(request);
3573 self
3574 }
3575 pub async fn send(
3577 self,
3578 ) -> Result<PostTriggerV1CancelOrdersResponse, ApiOpError<PostTriggerV1CancelOrdersApiError>>
3579 {
3580 self.client
3581 .post_trigger_v1_cancel_orders(self.request)
3582 .await
3583 }
3584}
3585#[doc = concat!("Additive request builder for `", "postTriggerV1CreateOrder", "`.")]
3586#[must_use]
3587pub struct PostTriggerV1CreateOrderBuilder<'a> {
3588 client: &'a HttpClient,
3589 request: Option<PostTriggerV1CreateOrderRequest>,
3590}
3591impl<'a> PostTriggerV1CreateOrderBuilder<'a> {
3592 #[must_use]
3594 pub fn request(mut self, request: PostTriggerV1CreateOrderRequest) -> Self {
3595 self.request = Some(request);
3596 self
3597 }
3598 pub async fn send(
3600 self,
3601 ) -> Result<PostTriggerV1CreateOrderResponse, ApiOpError<PostTriggerV1CreateOrderApiError>>
3602 {
3603 self.client.post_trigger_v1_create_order(self.request).await
3604 }
3605}
3606#[doc = concat!("Additive request builder for `", "postTriggerV2DepositCraft", "`.")]
3607#[must_use]
3608pub struct PostTriggerV2DepositCraftBuilder<'a> {
3609 client: &'a HttpClient,
3610 request: PostTriggerV2DepositCraftRequest,
3611}
3612impl<'a> PostTriggerV2DepositCraftBuilder<'a> {
3613 #[must_use]
3615 pub fn request(mut self, request: PostTriggerV2DepositCraftRequest) -> Self {
3616 self.request = request;
3617 self
3618 }
3619 #[doc = concat!("Set the optional request-body field `", "jlMint", "`.")]
3620 #[must_use]
3621 pub fn jl_mint(mut self, jl_mint: String) -> Self {
3622 self.request.jl_mint = Some(jl_mint);
3623 self
3624 }
3625 #[doc = concat!("Set the optional request-body field `", "orderSubType", "`.")]
3626 #[must_use]
3627 pub fn order_sub_type(
3628 mut self,
3629 order_sub_type: PostTriggerV2DepositCraftRequestOrderSubType,
3630 ) -> Self {
3631 self.request.order_sub_type = Some(order_sub_type);
3632 self
3633 }
3634 pub async fn send(
3636 self,
3637 ) -> Result<PostTriggerV2DepositCraftResponse, ApiOpError<PostTriggerV2DepositCraftApiError>>
3638 {
3639 self.client
3640 .post_trigger_v2_deposit_craft(self.request)
3641 .await
3642 }
3643}
3644#[doc = concat!("Additive request builder for `", "postTriggerV2OrdersDca", "`.")]
3645#[must_use]
3646pub struct PostTriggerV2OrdersDcaBuilder<'a> {
3647 client: &'a HttpClient,
3648 request: PostTriggerV2OrdersDcaRequest,
3649}
3650impl<'a> PostTriggerV2OrdersDcaBuilder<'a> {
3651 #[must_use]
3653 pub fn request(mut self, request: PostTriggerV2OrdersDcaRequest) -> Self {
3654 self.request = request;
3655 self
3656 }
3657 #[doc = concat!("Set the optional request-body field `", "beginFillAt", "`.")]
3658 #[must_use]
3659 pub fn begin_fill_at(mut self, begin_fill_at: String) -> Self {
3660 self.request.begin_fill_at = Some(begin_fill_at);
3661 self
3662 }
3663 #[doc = concat!("Set the optional request-body field `", "jlEnabled", "`.")]
3664 #[must_use]
3665 pub fn jl_enabled(mut self, jl_enabled: bool) -> Self {
3666 self.request.jl_enabled = Some(jl_enabled);
3667 self
3668 }
3669 #[doc = concat!("Set the optional request-body field `", "jlMint", "`.")]
3670 #[must_use]
3671 pub fn jl_mint(mut self, jl_mint: String) -> Self {
3672 self.request.jl_mint = Some(jl_mint);
3673 self
3674 }
3675 #[doc = concat!("Set the optional request-body field `", "maxPriceUsd", "`.")]
3676 #[must_use]
3677 pub fn max_price_usd(mut self, max_price_usd: f64) -> Self {
3678 self.request.max_price_usd = Some(max_price_usd);
3679 self
3680 }
3681 #[doc = concat!("Set the optional request-body field `", "minPriceUsd", "`.")]
3682 #[must_use]
3683 pub fn min_price_usd(mut self, min_price_usd: f64) -> Self {
3684 self.request.min_price_usd = Some(min_price_usd);
3685 self
3686 }
3687 #[doc = concat!("Set the optional request-body field `", "orderType", "`.")]
3688 #[must_use]
3689 pub fn order_type(mut self, order_type: PostTriggerV2OrdersDcaRequestOrderType) -> Self {
3690 self.request.order_type = Some(order_type);
3691 self
3692 }
3693 #[doc = concat!("Set the optional request-body field `", "triggerMint", "`.")]
3694 #[must_use]
3695 pub fn trigger_mint(mut self, trigger_mint: String) -> Self {
3696 self.request.trigger_mint = Some(trigger_mint);
3697 self
3698 }
3699 pub async fn send(
3701 self,
3702 ) -> Result<TriggerV2TxSignatureResponse, ApiOpError<PostTriggerV2OrdersDcaApiError>> {
3703 self.client.post_trigger_v2_orders_dca(self.request).await
3704 }
3705}
3706#[doc = concat!("Additive request builder for `", "postTriggerV2OrdersPrice", "`.")]
3707#[must_use]
3708pub struct PostTriggerV2OrdersPriceBuilder<'a> {
3709 client: &'a HttpClient,
3710 request: PostTriggerV2OrdersPriceRequest,
3711}
3712impl<'a> PostTriggerV2OrdersPriceBuilder<'a> {
3713 #[must_use]
3715 pub fn request(mut self, request: PostTriggerV2OrdersPriceRequest) -> Self {
3716 self.request = request;
3717 self
3718 }
3719 #[doc = concat!("Set the optional request-body field `", "slPriceUsd", "`.")]
3720 #[must_use]
3721 pub fn sl_price_usd(mut self, sl_price_usd: f64) -> Self {
3722 self.request.sl_price_usd = Some(sl_price_usd);
3723 self
3724 }
3725 #[doc = concat!("Set the optional request-body field `", "slSlippageBps", "`.")]
3726 #[must_use]
3727 pub fn sl_slippage_bps(mut self, sl_slippage_bps: f64) -> Self {
3728 self.request.sl_slippage_bps = Some(sl_slippage_bps);
3729 self
3730 }
3731 #[doc = concat!("Set the optional request-body field `", "slippageBps", "`.")]
3732 #[must_use]
3733 pub fn slippage_bps(mut self, slippage_bps: f64) -> Self {
3734 self.request.slippage_bps = Some(slippage_bps);
3735 self
3736 }
3737 #[doc = concat!("Set the optional request-body field `", "tpPriceUsd", "`.")]
3738 #[must_use]
3739 pub fn tp_price_usd(mut self, tp_price_usd: f64) -> Self {
3740 self.request.tp_price_usd = Some(tp_price_usd);
3741 self
3742 }
3743 #[doc = concat!("Set the optional request-body field `", "tpSlippageBps", "`.")]
3744 #[must_use]
3745 pub fn tp_slippage_bps(mut self, tp_slippage_bps: f64) -> Self {
3746 self.request.tp_slippage_bps = Some(tp_slippage_bps);
3747 self
3748 }
3749 #[doc = concat!("Set the optional request-body field `", "trailingBps", "`.")]
3750 #[must_use]
3751 pub fn trailing_bps(mut self, trailing_bps: f64) -> Self {
3752 self.request.trailing_bps = Some(trailing_bps);
3753 self
3754 }
3755 #[doc = concat!("Set the optional request-body field `", "triggerCondition", "`.")]
3756 #[must_use]
3757 pub fn trigger_condition(
3758 mut self,
3759 trigger_condition: PostTriggerV2OrdersPriceRequestTriggerCondition,
3760 ) -> Self {
3761 self.request.trigger_condition = Some(trigger_condition);
3762 self
3763 }
3764 #[doc = concat!("Set the optional request-body field `", "triggerPriceUsd", "`.")]
3765 #[must_use]
3766 pub fn trigger_price_usd(mut self, trigger_price_usd: f64) -> Self {
3767 self.request.trigger_price_usd = Some(trigger_price_usd);
3768 self
3769 }
3770 pub async fn send(
3772 self,
3773 ) -> Result<TriggerV2OrderResponse, ApiOpError<PostTriggerV2OrdersPriceApiError>> {
3774 self.client.post_trigger_v2_orders_price(self.request).await
3775 }
3776}
3777#[doc = concat!("Additive request builder for `", "postUltraV1Execute", "`.")]
3778#[must_use]
3779pub struct PostUltraV1ExecuteBuilder<'a> {
3780 client: &'a HttpClient,
3781 request: Option<PostUltraV1ExecuteRequest>,
3782}
3783impl<'a> PostUltraV1ExecuteBuilder<'a> {
3784 #[must_use]
3786 pub fn request(mut self, request: PostUltraV1ExecuteRequest) -> Self {
3787 self.request = Some(request);
3788 self
3789 }
3790 pub async fn send(
3792 self,
3793 ) -> Result<PostUltraV1ExecuteResponse, ApiOpError<PostUltraV1ExecuteApiError>> {
3794 self.client.post_ultra_v1_execute(self.request).await
3795 }
3796}
3797#[doc = concat!("Additive request builder for `", "price-withdraw", "`.")]
3798#[must_use]
3799pub struct PriceWithdrawBuilder<'a> {
3800 client: &'a HttpClient,
3801 request: RecurringWithdrawPriceRecurring,
3802}
3803impl<'a> PriceWithdrawBuilder<'a> {
3804 #[must_use]
3806 pub fn request(mut self, request: RecurringWithdrawPriceRecurring) -> Self {
3807 self.request = request;
3808 self
3809 }
3810 #[doc = concat!("Set the optional request-body field `", "amount", "`.")]
3811 #[must_use]
3812 pub fn amount(mut self, amount: String) -> Self {
3813 self.request.amount = Some(amount);
3814 self
3815 }
3816 pub async fn send(self) -> Result<RecurringRecurringResponse, ApiOpError<serde_json::Value>> {
3818 self.client.price_withdraw(self.request).await
3819 }
3820}
3821impl HttpClient {
3822 pub async fn get_build(
3835 &self,
3836 input_mint: impl AsRef<str>,
3837 output_mint: impl AsRef<str>,
3838 amount: impl AsRef<str>,
3839 taker: impl AsRef<str>,
3840 slippage_bps: Option<impl AsRef<str>>,
3841 mode: Option<GetBuildMode>,
3842 dexes: Option<impl AsRef<str>>,
3843 exclude_dexes: Option<impl AsRef<str>>,
3844 platform_fee_bps: Option<i64>,
3845 fee_account: Option<impl AsRef<str>>,
3846 max_accounts: Option<i64>,
3847 payer: Option<impl AsRef<str>>,
3848 wrap_and_unwrap_sol: Option<bool>,
3849 destination_token_account: Option<impl AsRef<str>>,
3850 native_destination_account: Option<impl AsRef<str>>,
3851 blockhash_slots_to_expiry: Option<i64>,
3852 tip_amount: Option<impl AsRef<str>>,
3853 compute_unit_price_percentile: Option<impl AsRef<str>>,
3854 for_jito_bundle: Option<bool>,
3855 ) -> Result<GetBuildResponse, ApiOpError<GetBuildApiError>> {
3856 let request_url = format!("{}{}", self.base_url, "/swap/v2/build");
3857 let mut req = self.http_client.get(request_url);
3858 {
3859 let mut query_params: Vec<(String, String)> = Vec::new();
3860 query_params.push(("inputMint".to_string(), input_mint.as_ref().to_string()));
3861 query_params.push(("outputMint".to_string(), output_mint.as_ref().to_string()));
3862 query_params.push(("amount".to_string(), amount.as_ref().to_string()));
3863 query_params.push(("taker".to_string(), taker.as_ref().to_string()));
3864 if let Some(v) = slippage_bps {
3865 query_params.push(("slippageBps".to_string(), v.as_ref().to_string()));
3866 }
3867 if let Some(v) = mode {
3868 query_params.push(("mode".to_string(), v.to_string()));
3869 }
3870 if let Some(v) = dexes {
3871 query_params.push(("dexes".to_string(), v.as_ref().to_string()));
3872 }
3873 if let Some(v) = exclude_dexes {
3874 query_params.push(("excludeDexes".to_string(), v.as_ref().to_string()));
3875 }
3876 if let Some(v) = platform_fee_bps {
3877 query_params.push(("platformFeeBps".to_string(), v.to_string()));
3878 }
3879 if let Some(v) = fee_account {
3880 query_params.push(("feeAccount".to_string(), v.as_ref().to_string()));
3881 }
3882 if let Some(v) = max_accounts {
3883 query_params.push(("maxAccounts".to_string(), v.to_string()));
3884 }
3885 if let Some(v) = payer {
3886 query_params.push(("payer".to_string(), v.as_ref().to_string()));
3887 }
3888 if let Some(v) = wrap_and_unwrap_sol {
3889 query_params.push(("wrapAndUnwrapSol".to_string(), v.to_string()));
3890 }
3891 if let Some(v) = destination_token_account {
3892 query_params.push((
3893 "destinationTokenAccount".to_string(),
3894 v.as_ref().to_string(),
3895 ));
3896 }
3897 if let Some(v) = native_destination_account {
3898 query_params.push((
3899 "nativeDestinationAccount".to_string(),
3900 v.as_ref().to_string(),
3901 ));
3902 }
3903 if let Some(v) = blockhash_slots_to_expiry {
3904 query_params.push(("blockhashSlotsToExpiry".to_string(), v.to_string()));
3905 }
3906 if let Some(v) = tip_amount {
3907 query_params.push(("tipAmount".to_string(), v.as_ref().to_string()));
3908 }
3909 if let Some(v) = compute_unit_price_percentile {
3910 query_params.push((
3911 "computeUnitPricePercentile".to_string(),
3912 v.as_ref().to_string(),
3913 ));
3914 }
3915 if let Some(v) = for_jito_bundle {
3916 query_params.push(("forJitoBundle".to_string(), v.to_string()));
3917 }
3918 if !query_params.is_empty() {
3919 req = req.query(&query_params);
3920 }
3921 }
3922 if let Some(api_key) = &self.api_key {
3923 req = req.header("x-api-key", api_key.as_str());
3924 }
3925 for (name, value) in &self.custom_headers {
3926 if !name.eq_ignore_ascii_case("accept") {
3927 req = req.header(name, value);
3928 }
3929 }
3930 req = req.header(reqwest::header::ACCEPT, "application/json");
3931 let response = req.send().await?;
3932 let status = response.status();
3933 let status_code = status.as_u16();
3934 let headers = response.headers().clone();
3935 let body_bytes =
3936 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
3937 let raw_body = body_bytes;
3938 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
3939 if false || status_code == 200u16 {
3940 match serde_json::from_str(&body_text) {
3941 Ok(body) => Ok(body),
3942 Err(e) => Err(ApiOpError::Api(ApiError {
3943 status: status_code,
3944 headers: headers,
3945 body: body_text,
3946 raw_body,
3947 typed: None,
3948 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
3949 })),
3950 }
3951 } else if status.is_success() {
3952 Err(ApiOpError::Api(ApiError {
3953 status: status_code,
3954 headers,
3955 body: body_text,
3956 raw_body,
3957 typed: None,
3958 parse_error: Some(format!(
3959 "unexpected successful status {}; generated return type selects `{}`",
3960 status_code, "200",
3961 )),
3962 }))
3963 } else {
3964 let typed: Option<GetBuildApiError>;
3965 let parse_error: Option<String>;
3966 match status_code {
3967 400u16 => match serde_json::from_str::<GetBuildResponse400>(&body_text) {
3968 Ok(v) => {
3969 typed = Some(GetBuildApiError::Status400(v));
3970 parse_error = None;
3971 }
3972 Err(e) => {
3973 typed = None;
3974 parse_error = Some(e.to_string());
3975 }
3976 },
3977 _ => {
3978 typed = None;
3979 parse_error = None;
3980 }
3981 }
3982 Err(ApiOpError::Api(ApiError {
3983 status: status_code,
3984 headers,
3985 body: body_text,
3986 raw_body,
3987 typed,
3988 parse_error,
3989 }))
3990 }
3991 }
3992 pub async fn get_order(
4002 &self,
4003 input_mint: impl AsRef<str>,
4004 output_mint: impl AsRef<str>,
4005 amount: impl AsRef<str>,
4006 taker: Option<impl AsRef<str>>,
4007 receiver: Option<impl AsRef<str>>,
4008 swap_mode: Option<GetOrderSwapMode>,
4009 slippage_bps: Option<i64>,
4010 referral_account: Option<impl AsRef<str>>,
4011 referral_fee: Option<f64>,
4012 payer: Option<impl AsRef<str>>,
4013 priority_fee_lamports: Option<f64>,
4014 jito_tip_lamports: Option<f64>,
4015 broadcast_fee_type: Option<GetOrderBroadcastFeeType>,
4016 exclude_routers: Option<impl AsRef<str>>,
4017 exclude_dexes: Option<impl AsRef<str>>,
4018 ) -> Result<GetOrderResponse, ApiOpError<GetOrderApiError>> {
4019 let request_url = format!("{}{}", self.base_url, "/swap/v2/order");
4020 let mut req = self.http_client.get(request_url);
4021 {
4022 let mut query_params: Vec<(String, String)> = Vec::new();
4023 query_params.push(("inputMint".to_string(), input_mint.as_ref().to_string()));
4024 query_params.push(("outputMint".to_string(), output_mint.as_ref().to_string()));
4025 query_params.push(("amount".to_string(), amount.as_ref().to_string()));
4026 if let Some(v) = taker {
4027 query_params.push(("taker".to_string(), v.as_ref().to_string()));
4028 }
4029 if let Some(v) = receiver {
4030 query_params.push(("receiver".to_string(), v.as_ref().to_string()));
4031 }
4032 if let Some(v) = swap_mode {
4033 query_params.push(("swapMode".to_string(), v.to_string()));
4034 }
4035 if let Some(v) = slippage_bps {
4036 query_params.push(("slippageBps".to_string(), v.to_string()));
4037 }
4038 if let Some(v) = referral_account {
4039 query_params.push(("referralAccount".to_string(), v.as_ref().to_string()));
4040 }
4041 if let Some(v) = referral_fee {
4042 query_params.push(("referralFee".to_string(), v.to_string()));
4043 }
4044 if let Some(v) = payer {
4045 query_params.push(("payer".to_string(), v.as_ref().to_string()));
4046 }
4047 if let Some(v) = priority_fee_lamports {
4048 query_params.push(("priorityFeeLamports".to_string(), v.to_string()));
4049 }
4050 if let Some(v) = jito_tip_lamports {
4051 query_params.push(("jitoTipLamports".to_string(), v.to_string()));
4052 }
4053 if let Some(v) = broadcast_fee_type {
4054 query_params.push(("broadcastFeeType".to_string(), v.to_string()));
4055 }
4056 if let Some(v) = exclude_routers {
4057 query_params.push(("excludeRouters".to_string(), v.as_ref().to_string()));
4058 }
4059 if let Some(v) = exclude_dexes {
4060 query_params.push(("excludeDexes".to_string(), v.as_ref().to_string()));
4061 }
4062 if !query_params.is_empty() {
4063 req = req.query(&query_params);
4064 }
4065 }
4066 if let Some(api_key) = &self.api_key {
4067 req = req.header("x-api-key", api_key.as_str());
4068 }
4069 for (name, value) in &self.custom_headers {
4070 if !name.eq_ignore_ascii_case("accept") {
4071 req = req.header(name, value);
4072 }
4073 }
4074 req = req.header(reqwest::header::ACCEPT, "application/json");
4075 let response = req.send().await?;
4076 let status = response.status();
4077 let status_code = status.as_u16();
4078 let headers = response.headers().clone();
4079 let body_bytes =
4080 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
4081 let raw_body = body_bytes;
4082 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
4083 if false || status_code == 200u16 {
4084 match serde_json::from_str(&body_text) {
4085 Ok(body) => Ok(body),
4086 Err(e) => Err(ApiOpError::Api(ApiError {
4087 status: status_code,
4088 headers: headers,
4089 body: body_text,
4090 raw_body,
4091 typed: None,
4092 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
4093 })),
4094 }
4095 } else if status.is_success() {
4096 Err(ApiOpError::Api(ApiError {
4097 status: status_code,
4098 headers,
4099 body: body_text,
4100 raw_body,
4101 typed: None,
4102 parse_error: Some(format!(
4103 "unexpected successful status {}; generated return type selects `{}`",
4104 status_code, "200",
4105 )),
4106 }))
4107 } else {
4108 let typed: Option<GetOrderApiError>;
4109 let parse_error: Option<String>;
4110 match status_code {
4111 400u16 => match serde_json::from_str::<GetOrderResponse400>(&body_text) {
4112 Ok(v) => {
4113 typed = Some(GetOrderApiError::Status400(v));
4114 parse_error = None;
4115 }
4116 Err(e) => {
4117 typed = None;
4118 parse_error = Some(e.to_string());
4119 }
4120 },
4121 _ => {
4122 typed = None;
4123 parse_error = None;
4124 }
4125 }
4126 Err(ApiOpError::Api(ApiError {
4127 status: status_code,
4128 headers,
4129 body: body_text,
4130 raw_body,
4131 typed,
4132 parse_error,
4133 }))
4134 }
4135 }
4136 pub async fn post_execute(
4145 &self,
4146 request: PostExecuteRequest,
4147 ) -> Result<PostExecuteResponse, ApiOpError<PostExecuteApiError>> {
4148 let request_url = format!("{}{}", self.base_url, "/swap/v2/execute");
4149 let mut req = self.http_client.post(request_url);
4150 req = req
4151 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
4152 .header("content-type", "application/json");
4153 if let Some(api_key) = &self.api_key {
4154 req = req.header("x-api-key", api_key.as_str());
4155 }
4156 for (name, value) in &self.custom_headers {
4157 if !name.eq_ignore_ascii_case("accept") {
4158 req = req.header(name, value);
4159 }
4160 }
4161 req = req.header(reqwest::header::ACCEPT, "application/json");
4162 let response = req.send().await?;
4163 let status = response.status();
4164 let status_code = status.as_u16();
4165 let headers = response.headers().clone();
4166 let body_bytes =
4167 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
4168 let raw_body = body_bytes;
4169 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
4170 if false || status_code == 200u16 {
4171 match serde_json::from_str(&body_text) {
4172 Ok(body) => Ok(body),
4173 Err(e) => Err(ApiOpError::Api(ApiError {
4174 status: status_code,
4175 headers: headers,
4176 body: body_text,
4177 raw_body,
4178 typed: None,
4179 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
4180 })),
4181 }
4182 } else if status.is_success() {
4183 Err(ApiOpError::Api(ApiError {
4184 status: status_code,
4185 headers,
4186 body: body_text,
4187 raw_body,
4188 typed: None,
4189 parse_error: Some(format!(
4190 "unexpected successful status {}; generated return type selects `{}`",
4191 status_code, "200",
4192 )),
4193 }))
4194 } else {
4195 let typed: Option<PostExecuteApiError>;
4196 let parse_error: Option<String>;
4197 match status_code {
4198 400u16 => match serde_json::from_str::<PostExecuteResponse400>(&body_text) {
4199 Ok(v) => {
4200 typed = Some(PostExecuteApiError::Status400(v));
4201 parse_error = None;
4202 }
4203 Err(e) => {
4204 typed = None;
4205 parse_error = Some(e.to_string());
4206 }
4207 },
4208 500u16 => match serde_json::from_str::<PostExecuteResponse500>(&body_text) {
4209 Ok(v) => {
4210 typed = Some(PostExecuteApiError::Status500(v));
4211 parse_error = None;
4212 }
4213 Err(e) => {
4214 typed = None;
4215 parse_error = Some(e.to_string());
4216 }
4217 },
4218 _ => {
4219 typed = None;
4220 parse_error = None;
4221 }
4222 }
4223 Err(ApiOpError::Api(ApiError {
4224 status: status_code,
4225 headers,
4226 body: body_text,
4227 raw_body,
4228 typed,
4229 parse_error,
4230 }))
4231 }
4232 }
4233 pub async fn program_id_to_label_get(
4241 &self,
4242 ) -> Result<ProgramIdToLabelGetResponse, ApiOpError<serde_json::Value>> {
4243 let request_url = format!("{}{}", self.base_url, "/swap/v1/program-id-to-label");
4244 let mut req = self.http_client.get(request_url);
4245 if let Some(api_key) = &self.api_key {
4246 req = req.header("x-api-key", api_key.as_str());
4247 }
4248 for (name, value) in &self.custom_headers {
4249 if !name.eq_ignore_ascii_case("accept") {
4250 req = req.header(name, value);
4251 }
4252 }
4253 req = req.header(reqwest::header::ACCEPT, "application/json");
4254 let response = req.send().await?;
4255 let status = response.status();
4256 let status_code = status.as_u16();
4257 let headers = response.headers().clone();
4258 let body_bytes =
4259 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
4260 let raw_body = body_bytes;
4261 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
4262 if false || status_code == 200u16 {
4263 match serde_json::from_str(&body_text) {
4264 Ok(body) => Ok(body),
4265 Err(e) => Err(ApiOpError::Api(ApiError {
4266 status: status_code,
4267 headers: headers,
4268 body: body_text,
4269 raw_body,
4270 typed: None,
4271 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
4272 })),
4273 }
4274 } else if status.is_success() {
4275 Err(ApiOpError::Api(ApiError {
4276 status: status_code,
4277 headers,
4278 body: body_text,
4279 raw_body,
4280 typed: None,
4281 parse_error: Some(format!(
4282 "unexpected successful status {}; generated return type selects `{}`",
4283 status_code, "200",
4284 )),
4285 }))
4286 } else {
4287 let typed: Option<serde_json::Value>;
4288 let parse_error: Option<String>;
4289 match status_code {
4290 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
4291 Ok(v) => {
4292 typed = Some(v);
4293 parse_error = None;
4294 }
4295 Err(e) => {
4296 typed = None;
4297 parse_error = Some(e.to_string());
4298 }
4299 },
4300 }
4301 Err(ApiOpError::Api(ApiError {
4302 status: status_code,
4303 headers,
4304 body: body_text,
4305 raw_body,
4306 typed,
4307 parse_error,
4308 }))
4309 }
4310 }
4311 pub async fn quote_get(
4317 &self,
4318 input_mint: impl AsRef<str>,
4319 output_mint: impl AsRef<str>,
4320 amount: u64,
4321 slippage_bps: Option<i64>,
4322 swap_mode: Option<QuoteGetSwapMode>,
4323 dexes: Option<Vec<String>>,
4324 exclude_dexes: Option<Vec<String>>,
4325 restrict_intermediate_tokens: Option<bool>,
4326 only_direct_routes: Option<bool>,
4327 as_legacy_transaction: Option<bool>,
4328 platform_fee_bps: Option<i64>,
4329 max_accounts: Option<u64>,
4330 instruction_version: Option<QuoteGetInstructionVersion>,
4331 dynamic_slippage: Option<bool>,
4332 for_jito_bundle: Option<bool>,
4333 ) -> Result<SwapV1QuoteResponse, ApiOpError<serde_json::Value>> {
4334 let request_url = format!("{}{}", self.base_url, "/swap/v1/quote");
4335 let mut req = self.http_client.get(request_url);
4336 {
4337 let mut query_params: Vec<(String, String)> = Vec::new();
4338 query_params.push(("inputMint".to_string(), input_mint.as_ref().to_string()));
4339 query_params.push(("outputMint".to_string(), output_mint.as_ref().to_string()));
4340 query_params.push(("amount".to_string(), amount.to_string()));
4341 if let Some(v) = slippage_bps {
4342 query_params.push(("slippageBps".to_string(), v.to_string()));
4343 }
4344 if let Some(v) = swap_mode {
4345 query_params.push(("swapMode".to_string(), v.to_string()));
4346 }
4347 if let Some(v) = dexes {
4348 if v.is_empty() {
4349 query_params.push((format!("{}[]", "dexes"), String::new()));
4350 } else {
4351 for item in v {
4352 query_params.push(("dexes".to_string(), item.to_string()));
4353 }
4354 }
4355 }
4356 if let Some(v) = exclude_dexes {
4357 if v.is_empty() {
4358 query_params.push((format!("{}[]", "excludeDexes"), String::new()));
4359 } else {
4360 for item in v {
4361 query_params.push(("excludeDexes".to_string(), item.to_string()));
4362 }
4363 }
4364 }
4365 if let Some(v) = restrict_intermediate_tokens {
4366 query_params.push(("restrictIntermediateTokens".to_string(), v.to_string()));
4367 }
4368 if let Some(v) = only_direct_routes {
4369 query_params.push(("onlyDirectRoutes".to_string(), v.to_string()));
4370 }
4371 if let Some(v) = as_legacy_transaction {
4372 query_params.push(("asLegacyTransaction".to_string(), v.to_string()));
4373 }
4374 if let Some(v) = platform_fee_bps {
4375 query_params.push(("platformFeeBps".to_string(), v.to_string()));
4376 }
4377 if let Some(v) = max_accounts {
4378 query_params.push(("maxAccounts".to_string(), v.to_string()));
4379 }
4380 if let Some(v) = instruction_version {
4381 query_params.push(("instructionVersion".to_string(), v.to_string()));
4382 }
4383 if let Some(v) = dynamic_slippage {
4384 query_params.push(("dynamicSlippage".to_string(), v.to_string()));
4385 }
4386 if let Some(v) = for_jito_bundle {
4387 query_params.push(("forJitoBundle".to_string(), v.to_string()));
4388 }
4389 if !query_params.is_empty() {
4390 req = req.query(&query_params);
4391 }
4392 }
4393 if let Some(api_key) = &self.api_key {
4394 req = req.header("x-api-key", api_key.as_str());
4395 }
4396 for (name, value) in &self.custom_headers {
4397 if !name.eq_ignore_ascii_case("accept") {
4398 req = req.header(name, value);
4399 }
4400 }
4401 req = req.header(reqwest::header::ACCEPT, "application/json");
4402 let response = req.send().await?;
4403 let status = response.status();
4404 let status_code = status.as_u16();
4405 let headers = response.headers().clone();
4406 let body_bytes =
4407 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
4408 let raw_body = body_bytes;
4409 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
4410 if false || status_code == 200u16 {
4411 match serde_json::from_str(&body_text) {
4412 Ok(body) => Ok(body),
4413 Err(e) => Err(ApiOpError::Api(ApiError {
4414 status: status_code,
4415 headers: headers,
4416 body: body_text,
4417 raw_body,
4418 typed: None,
4419 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
4420 })),
4421 }
4422 } else if status.is_success() {
4423 Err(ApiOpError::Api(ApiError {
4424 status: status_code,
4425 headers,
4426 body: body_text,
4427 raw_body,
4428 typed: None,
4429 parse_error: Some(format!(
4430 "unexpected successful status {}; generated return type selects `{}`",
4431 status_code, "200",
4432 )),
4433 }))
4434 } else {
4435 let typed: Option<serde_json::Value>;
4436 let parse_error: Option<String>;
4437 match status_code {
4438 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
4439 Ok(v) => {
4440 typed = Some(v);
4441 parse_error = None;
4442 }
4443 Err(e) => {
4444 typed = None;
4445 parse_error = Some(e.to_string());
4446 }
4447 },
4448 }
4449 Err(ApiOpError::Api(ApiError {
4450 status: status_code,
4451 headers,
4452 body: body_text,
4453 raw_body,
4454 typed,
4455 parse_error,
4456 }))
4457 }
4458 }
4459 pub async fn swap_instructions_post(
4465 &self,
4466 request: SwapV1SwapRequest,
4467 ) -> Result<SwapV1SwapInstructionsResponse, ApiOpError<serde_json::Value>> {
4468 let request_url = format!("{}{}", self.base_url, "/swap/v1/swap-instructions");
4469 let mut req = self.http_client.post(request_url);
4470 req = req
4471 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
4472 .header("content-type", "application/json");
4473 if let Some(api_key) = &self.api_key {
4474 req = req.header("x-api-key", api_key.as_str());
4475 }
4476 for (name, value) in &self.custom_headers {
4477 if !name.eq_ignore_ascii_case("accept") {
4478 req = req.header(name, value);
4479 }
4480 }
4481 req = req.header(reqwest::header::ACCEPT, "application/json");
4482 let response = req.send().await?;
4483 let status = response.status();
4484 let status_code = status.as_u16();
4485 let headers = response.headers().clone();
4486 let body_bytes =
4487 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
4488 let raw_body = body_bytes;
4489 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
4490 if false || status_code == 200u16 {
4491 match serde_json::from_str(&body_text) {
4492 Ok(body) => Ok(body),
4493 Err(e) => Err(ApiOpError::Api(ApiError {
4494 status: status_code,
4495 headers: headers,
4496 body: body_text,
4497 raw_body,
4498 typed: None,
4499 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
4500 })),
4501 }
4502 } else if status.is_success() {
4503 Err(ApiOpError::Api(ApiError {
4504 status: status_code,
4505 headers,
4506 body: body_text,
4507 raw_body,
4508 typed: None,
4509 parse_error: Some(format!(
4510 "unexpected successful status {}; generated return type selects `{}`",
4511 status_code, "200",
4512 )),
4513 }))
4514 } else {
4515 let typed: Option<serde_json::Value>;
4516 let parse_error: Option<String>;
4517 match status_code {
4518 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
4519 Ok(v) => {
4520 typed = Some(v);
4521 parse_error = None;
4522 }
4523 Err(e) => {
4524 typed = None;
4525 parse_error = Some(e.to_string());
4526 }
4527 },
4528 }
4529 Err(ApiOpError::Api(ApiError {
4530 status: status_code,
4531 headers,
4532 body: body_text,
4533 raw_body,
4534 typed,
4535 parse_error,
4536 }))
4537 }
4538 }
4539 pub async fn swap_post(
4545 &self,
4546 request: SwapV1SwapRequest,
4547 ) -> Result<SwapV1SwapResponse, ApiOpError<serde_json::Value>> {
4548 let request_url = format!("{}{}", self.base_url, "/swap/v1/swap");
4549 let mut req = self.http_client.post(request_url);
4550 req = req
4551 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
4552 .header("content-type", "application/json");
4553 if let Some(api_key) = &self.api_key {
4554 req = req.header("x-api-key", api_key.as_str());
4555 }
4556 for (name, value) in &self.custom_headers {
4557 if !name.eq_ignore_ascii_case("accept") {
4558 req = req.header(name, value);
4559 }
4560 }
4561 req = req.header(reqwest::header::ACCEPT, "application/json");
4562 let response = req.send().await?;
4563 let status = response.status();
4564 let status_code = status.as_u16();
4565 let headers = response.headers().clone();
4566 let body_bytes =
4567 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
4568 let raw_body = body_bytes;
4569 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
4570 if false || status_code == 200u16 {
4571 match serde_json::from_str(&body_text) {
4572 Ok(body) => Ok(body),
4573 Err(e) => Err(ApiOpError::Api(ApiError {
4574 status: status_code,
4575 headers: headers,
4576 body: body_text,
4577 raw_body,
4578 typed: None,
4579 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
4580 })),
4581 }
4582 } else if status.is_success() {
4583 Err(ApiOpError::Api(ApiError {
4584 status: status_code,
4585 headers,
4586 body: body_text,
4587 raw_body,
4588 typed: None,
4589 parse_error: Some(format!(
4590 "unexpected successful status {}; generated return type selects `{}`",
4591 status_code, "200",
4592 )),
4593 }))
4594 } else {
4595 let typed: Option<serde_json::Value>;
4596 let parse_error: Option<String>;
4597 match status_code {
4598 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
4599 Ok(v) => {
4600 typed = Some(v);
4601 parse_error = None;
4602 }
4603 Err(e) => {
4604 typed = None;
4605 parse_error = Some(e.to_string());
4606 }
4607 },
4608 }
4609 Err(ApiOpError::Api(ApiError {
4610 status: status_code,
4611 headers,
4612 body: body_text,
4613 raw_body,
4614 typed,
4615 parse_error,
4616 }))
4617 }
4618 }
4619 pub async fn build_borrow_operate_instructions(
4625 &self,
4626 market: Option<LendBorrowMarket>,
4627 request: LendBorrowOperatePayload,
4628 ) -> Result<LendBorrowOperateInstructionsResponse, ApiOpError<serde_json::Value>> {
4629 let request_url = format!(
4630 "{}{}",
4631 self.base_url, "/lend/v1/borrow/operate-instructions"
4632 );
4633 let mut req = self.http_client.post(request_url);
4634 req = req
4635 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
4636 .header("content-type", "application/json");
4637 {
4638 let mut query_params: Vec<(String, String)> = Vec::new();
4639 if let Some(v) = market {
4640 query_params.push(("market".to_string(), v.to_string()));
4641 }
4642 if !query_params.is_empty() {
4643 req = req.query(&query_params);
4644 }
4645 }
4646 if let Some(api_key) = &self.api_key {
4647 req = req.header("x-api-key", api_key.as_str());
4648 }
4649 for (name, value) in &self.custom_headers {
4650 if !name.eq_ignore_ascii_case("accept") {
4651 req = req.header(name, value);
4652 }
4653 }
4654 req = req.header(reqwest::header::ACCEPT, "application/json");
4655 let response = req.send().await?;
4656 let status = response.status();
4657 let status_code = status.as_u16();
4658 let headers = response.headers().clone();
4659 let body_bytes =
4660 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
4661 let raw_body = body_bytes;
4662 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
4663 if false || status_code == 200u16 {
4664 match serde_json::from_str(&body_text) {
4665 Ok(body) => Ok(body),
4666 Err(e) => Err(ApiOpError::Api(ApiError {
4667 status: status_code,
4668 headers: headers,
4669 body: body_text,
4670 raw_body,
4671 typed: None,
4672 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
4673 })),
4674 }
4675 } else if status.is_success() {
4676 Err(ApiOpError::Api(ApiError {
4677 status: status_code,
4678 headers,
4679 body: body_text,
4680 raw_body,
4681 typed: None,
4682 parse_error: Some(format!(
4683 "unexpected successful status {}; generated return type selects `{}`",
4684 status_code, "200",
4685 )),
4686 }))
4687 } else {
4688 let typed: Option<serde_json::Value>;
4689 let parse_error: Option<String>;
4690 match status_code {
4691 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
4692 Ok(v) => {
4693 typed = Some(v);
4694 parse_error = None;
4695 }
4696 Err(e) => {
4697 typed = None;
4698 parse_error = Some(e.to_string());
4699 }
4700 },
4701 }
4702 Err(ApiOpError::Api(ApiError {
4703 status: status_code,
4704 headers,
4705 body: body_text,
4706 raw_body,
4707 typed,
4708 parse_error,
4709 }))
4710 }
4711 }
4712 pub async fn build_borrow_operate_transaction(
4721 &self,
4722 market: Option<LendBorrowMarket>,
4723 request: LendBorrowOperatePayload,
4724 ) -> Result<LendBorrowOperateTransactionResponse, ApiOpError<serde_json::Value>> {
4725 let request_url = format!("{}{}", self.base_url, "/lend/v1/borrow/operate");
4726 let mut req = self.http_client.post(request_url);
4727 req = req
4728 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
4729 .header("content-type", "application/json");
4730 {
4731 let mut query_params: Vec<(String, String)> = Vec::new();
4732 if let Some(v) = market {
4733 query_params.push(("market".to_string(), v.to_string()));
4734 }
4735 if !query_params.is_empty() {
4736 req = req.query(&query_params);
4737 }
4738 }
4739 if let Some(api_key) = &self.api_key {
4740 req = req.header("x-api-key", api_key.as_str());
4741 }
4742 for (name, value) in &self.custom_headers {
4743 if !name.eq_ignore_ascii_case("accept") {
4744 req = req.header(name, value);
4745 }
4746 }
4747 req = req.header(reqwest::header::ACCEPT, "application/json");
4748 let response = req.send().await?;
4749 let status = response.status();
4750 let status_code = status.as_u16();
4751 let headers = response.headers().clone();
4752 let body_bytes =
4753 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
4754 let raw_body = body_bytes;
4755 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
4756 if false || status_code == 200u16 {
4757 match serde_json::from_str(&body_text) {
4758 Ok(body) => Ok(body),
4759 Err(e) => Err(ApiOpError::Api(ApiError {
4760 status: status_code,
4761 headers: headers,
4762 body: body_text,
4763 raw_body,
4764 typed: None,
4765 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
4766 })),
4767 }
4768 } else if status.is_success() {
4769 Err(ApiOpError::Api(ApiError {
4770 status: status_code,
4771 headers,
4772 body: body_text,
4773 raw_body,
4774 typed: None,
4775 parse_error: Some(format!(
4776 "unexpected successful status {}; generated return type selects `{}`",
4777 status_code, "200",
4778 )),
4779 }))
4780 } else {
4781 let typed: Option<serde_json::Value>;
4782 let parse_error: Option<String>;
4783 match status_code {
4784 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
4785 Ok(v) => {
4786 typed = Some(v);
4787 parse_error = None;
4788 }
4789 Err(e) => {
4790 typed = None;
4791 parse_error = Some(e.to_string());
4792 }
4793 },
4794 }
4795 Err(ApiOpError::Api(ApiError {
4796 status: status_code,
4797 headers,
4798 body: body_text,
4799 raw_body,
4800 typed,
4801 parse_error,
4802 }))
4803 }
4804 }
4805 pub async fn cancel_order(
4811 &self,
4812 request: RecurringCloseRecurring,
4813 ) -> Result<RecurringRecurringResponse, ApiOpError<serde_json::Value>> {
4814 let request_url = format!("{}{}", self.base_url, "/recurring/v1/cancelOrder");
4815 let mut req = self.http_client.post(request_url);
4816 req = req
4817 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
4818 .header("content-type", "application/json");
4819 if let Some(api_key) = &self.api_key {
4820 req = req.header("x-api-key", api_key.as_str());
4821 }
4822 for (name, value) in &self.custom_headers {
4823 if !name.eq_ignore_ascii_case("accept") {
4824 req = req.header(name, value);
4825 }
4826 }
4827 req = req.header(reqwest::header::ACCEPT, "application/json");
4828 let response = req.send().await?;
4829 let status = response.status();
4830 let status_code = status.as_u16();
4831 let headers = response.headers().clone();
4832 let body_bytes =
4833 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
4834 let raw_body = body_bytes;
4835 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
4836 if false || status_code == 200u16 {
4837 match serde_json::from_str(&body_text) {
4838 Ok(body) => Ok(body),
4839 Err(e) => Err(ApiOpError::Api(ApiError {
4840 status: status_code,
4841 headers: headers,
4842 body: body_text,
4843 raw_body,
4844 typed: None,
4845 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
4846 })),
4847 }
4848 } else if status.is_success() {
4849 Err(ApiOpError::Api(ApiError {
4850 status: status_code,
4851 headers,
4852 body: body_text,
4853 raw_body,
4854 typed: None,
4855 parse_error: Some(format!(
4856 "unexpected successful status {}; generated return type selects `{}`",
4857 status_code, "200",
4858 )),
4859 }))
4860 } else {
4861 let typed: Option<serde_json::Value>;
4862 let parse_error: Option<String>;
4863 match status_code {
4864 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
4865 Ok(v) => {
4866 typed = Some(v);
4867 parse_error = None;
4868 }
4869 Err(e) => {
4870 typed = None;
4871 parse_error = Some(e.to_string());
4872 }
4873 },
4874 }
4875 Err(ApiOpError::Api(ApiError {
4876 status: status_code,
4877 headers,
4878 body: body_text,
4879 raw_body,
4880 typed,
4881 parse_error,
4882 }))
4883 }
4884 }
4885 pub async fn create_order(
4891 &self,
4892 request: RecurringCreateRecurring,
4893 ) -> Result<RecurringRecurringResponse, ApiOpError<serde_json::Value>> {
4894 let request_url = format!("{}{}", self.base_url, "/recurring/v1/createOrder");
4895 let mut req = self.http_client.post(request_url);
4896 req = req
4897 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
4898 .header("content-type", "application/json");
4899 if let Some(api_key) = &self.api_key {
4900 req = req.header("x-api-key", api_key.as_str());
4901 }
4902 for (name, value) in &self.custom_headers {
4903 if !name.eq_ignore_ascii_case("accept") {
4904 req = req.header(name, value);
4905 }
4906 }
4907 req = req.header(reqwest::header::ACCEPT, "application/json");
4908 let response = req.send().await?;
4909 let status = response.status();
4910 let status_code = status.as_u16();
4911 let headers = response.headers().clone();
4912 let body_bytes =
4913 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
4914 let raw_body = body_bytes;
4915 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
4916 if false || status_code == 200u16 {
4917 match serde_json::from_str(&body_text) {
4918 Ok(body) => Ok(body),
4919 Err(e) => Err(ApiOpError::Api(ApiError {
4920 status: status_code,
4921 headers: headers,
4922 body: body_text,
4923 raw_body,
4924 typed: None,
4925 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
4926 })),
4927 }
4928 } else if status.is_success() {
4929 Err(ApiOpError::Api(ApiError {
4930 status: status_code,
4931 headers,
4932 body: body_text,
4933 raw_body,
4934 typed: None,
4935 parse_error: Some(format!(
4936 "unexpected successful status {}; generated return type selects `{}`",
4937 status_code, "200",
4938 )),
4939 }))
4940 } else {
4941 let typed: Option<serde_json::Value>;
4942 let parse_error: Option<String>;
4943 match status_code {
4944 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
4945 Ok(v) => {
4946 typed = Some(v);
4947 parse_error = None;
4948 }
4949 Err(e) => {
4950 typed = None;
4951 parse_error = Some(e.to_string());
4952 }
4953 },
4954 }
4955 Err(ApiOpError::Api(ApiError {
4956 status: status_code,
4957 headers,
4958 body: body_text,
4959 raw_body,
4960 typed,
4961 parse_error,
4962 }))
4963 }
4964 }
4965 pub async fn delete_prediction_v1_positions(
4967 &self,
4968 request: PredictionCloseAllPositionsRequest,
4969 ) -> Result<DeletePredictionV1PositionsResponse, ApiOpError<DeletePredictionV1PositionsApiError>>
4970 {
4971 let request_url = format!("{}{}", self.base_url, "/prediction/v1/positions");
4972 let mut req = self.http_client.delete(request_url);
4973 req = req
4974 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
4975 .header("content-type", "application/json");
4976 if let Some(api_key) = &self.api_key {
4977 req = req.header("x-api-key", api_key.as_str());
4978 }
4979 for (name, value) in &self.custom_headers {
4980 if !name.eq_ignore_ascii_case("accept") {
4981 req = req.header(name, value);
4982 }
4983 }
4984 req = req.header(reqwest::header::ACCEPT, "application/json");
4985 let response = req.send().await?;
4986 let status = response.status();
4987 let status_code = status.as_u16();
4988 let headers = response.headers().clone();
4989 let body_bytes =
4990 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
4991 let raw_body = body_bytes;
4992 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
4993 if false || status_code == 200u16 {
4994 match serde_json::from_str(&body_text) {
4995 Ok(body) => Ok(body),
4996 Err(e) => Err(ApiOpError::Api(ApiError {
4997 status: status_code,
4998 headers: headers,
4999 body: body_text,
5000 raw_body,
5001 typed: None,
5002 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
5003 })),
5004 }
5005 } else if status.is_success() {
5006 Err(ApiOpError::Api(ApiError {
5007 status: status_code,
5008 headers,
5009 body: body_text,
5010 raw_body,
5011 typed: None,
5012 parse_error: Some(format!(
5013 "unexpected successful status {}; generated return type selects `{}`",
5014 status_code, "200",
5015 )),
5016 }))
5017 } else {
5018 let typed: Option<DeletePredictionV1PositionsApiError>;
5019 let parse_error: Option<String>;
5020 match status_code {
5021 400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
5022 Ok(v) => {
5023 typed = Some(DeletePredictionV1PositionsApiError::Status400(v));
5024 parse_error = None;
5025 }
5026 Err(e) => {
5027 typed = None;
5028 parse_error = Some(e.to_string());
5029 }
5030 },
5031 _ => {
5032 typed = None;
5033 parse_error = None;
5034 }
5035 }
5036 Err(ApiOpError::Api(ApiError {
5037 status: status_code,
5038 headers,
5039 body: body_text,
5040 raw_body,
5041 typed,
5042 parse_error,
5043 }))
5044 }
5045 }
5046 pub async fn delete_prediction_v1_positions_position_pubkey(
5048 &self,
5049 position_pubkey: impl AsRef<str>,
5050 request: PredictionClosePositionRequest,
5051 ) -> Result<
5052 PredictionCreateOrderResponse,
5053 ApiOpError<DeletePredictionV1PositionsPositionPubkeyApiError>,
5054 > {
5055 let request_url = format!(
5056 "{}{}",
5057 self.base_url,
5058 format!(
5059 "/prediction/v1/positions/{}",
5060 __pct_encode_path_segment(position_pubkey.as_ref())
5061 )
5062 );
5063 let mut req = self.http_client.delete(request_url);
5064 req = req
5065 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
5066 .header("content-type", "application/json");
5067 if let Some(api_key) = &self.api_key {
5068 req = req.header("x-api-key", api_key.as_str());
5069 }
5070 for (name, value) in &self.custom_headers {
5071 if !name.eq_ignore_ascii_case("accept") {
5072 req = req.header(name, value);
5073 }
5074 }
5075 req = req.header(reqwest::header::ACCEPT, "application/json");
5076 let response = req.send().await?;
5077 let status = response.status();
5078 let status_code = status.as_u16();
5079 let headers = response.headers().clone();
5080 let body_bytes =
5081 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
5082 let raw_body = body_bytes;
5083 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
5084 if false || status_code == 200u16 {
5085 match serde_json::from_str(&body_text) {
5086 Ok(body) => Ok(body),
5087 Err(e) => Err(ApiOpError::Api(ApiError {
5088 status: status_code,
5089 headers: headers,
5090 body: body_text,
5091 raw_body,
5092 typed: None,
5093 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
5094 })),
5095 }
5096 } else if status.is_success() {
5097 Err(ApiOpError::Api(ApiError {
5098 status: status_code,
5099 headers,
5100 body: body_text,
5101 raw_body,
5102 typed: None,
5103 parse_error: Some(format!(
5104 "unexpected successful status {}; generated return type selects `{}`",
5105 status_code, "200",
5106 )),
5107 }))
5108 } else {
5109 let typed: Option<DeletePredictionV1PositionsPositionPubkeyApiError>;
5110 let parse_error: Option<String>;
5111 match status_code {
5112 400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
5113 Ok(v) => {
5114 typed =
5115 Some(DeletePredictionV1PositionsPositionPubkeyApiError::Status400(v));
5116 parse_error = None;
5117 }
5118 Err(e) => {
5119 typed = None;
5120 parse_error = Some(e.to_string());
5121 }
5122 },
5123 404u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
5124 Ok(v) => {
5125 typed =
5126 Some(DeletePredictionV1PositionsPositionPubkeyApiError::Status404(v));
5127 parse_error = None;
5128 }
5129 Err(e) => {
5130 typed = None;
5131 parse_error = Some(e.to_string());
5132 }
5133 },
5134 _ => {
5135 typed = None;
5136 parse_error = None;
5137 }
5138 }
5139 Err(ApiOpError::Api(ApiError {
5140 status: status_code,
5141 headers,
5142 body: body_text,
5143 raw_body,
5144 typed,
5145 parse_error,
5146 }))
5147 }
5148 }
5149 pub async fn execute(
5155 &self,
5156 request: RecurringExecuteRecurring,
5157 ) -> Result<RecurringExecuteRecurringResponse, ApiOpError<serde_json::Value>> {
5158 let request_url = format!("{}{}", self.base_url, "/recurring/v1/execute");
5159 let mut req = self.http_client.post(request_url);
5160 req = req
5161 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
5162 .header("content-type", "application/json");
5163 if let Some(api_key) = &self.api_key {
5164 req = req.header("x-api-key", api_key.as_str());
5165 }
5166 for (name, value) in &self.custom_headers {
5167 if !name.eq_ignore_ascii_case("accept") {
5168 req = req.header(name, value);
5169 }
5170 }
5171 req = req.header(reqwest::header::ACCEPT, "application/json");
5172 let response = req.send().await?;
5173 let status = response.status();
5174 let status_code = status.as_u16();
5175 let headers = response.headers().clone();
5176 let body_bytes =
5177 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
5178 let raw_body = body_bytes;
5179 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
5180 if false || status_code == 200u16 {
5181 match serde_json::from_str(&body_text) {
5182 Ok(body) => Ok(body),
5183 Err(e) => Err(ApiOpError::Api(ApiError {
5184 status: status_code,
5185 headers: headers,
5186 body: body_text,
5187 raw_body,
5188 typed: None,
5189 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
5190 })),
5191 }
5192 } else if status.is_success() {
5193 Err(ApiOpError::Api(ApiError {
5194 status: status_code,
5195 headers,
5196 body: body_text,
5197 raw_body,
5198 typed: None,
5199 parse_error: Some(format!(
5200 "unexpected successful status {}; generated return type selects `{}`",
5201 status_code, "200",
5202 )),
5203 }))
5204 } else {
5205 let typed: Option<serde_json::Value>;
5206 let parse_error: Option<String>;
5207 match status_code {
5208 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
5209 Ok(v) => {
5210 typed = Some(v);
5211 parse_error = None;
5212 }
5213 Err(e) => {
5214 typed = None;
5215 parse_error = Some(e.to_string());
5216 }
5217 },
5218 }
5219 Err(ApiOpError::Api(ApiError {
5220 status: status_code,
5221 headers,
5222 body: body_text,
5223 raw_body,
5224 typed,
5225 parse_error,
5226 }))
5227 }
5228 }
5229 pub async fn get_lend_v1_earn_earnings(
5235 &self,
5236 user: impl AsRef<str>,
5237 positions: impl AsRef<str>,
5238 ) -> Result<LendUserEarningsResponse, ApiOpError<serde_json::Value>> {
5239 let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/earnings");
5240 let mut req = self.http_client.get(request_url);
5241 {
5242 let mut query_params: Vec<(String, String)> = Vec::new();
5243 query_params.push(("user".to_string(), user.as_ref().to_string()));
5244 query_params.push(("positions".to_string(), positions.as_ref().to_string()));
5245 if !query_params.is_empty() {
5246 req = req.query(&query_params);
5247 }
5248 }
5249 if let Some(api_key) = &self.api_key {
5250 req = req.header("x-api-key", api_key.as_str());
5251 }
5252 for (name, value) in &self.custom_headers {
5253 if !name.eq_ignore_ascii_case("accept") {
5254 req = req.header(name, value);
5255 }
5256 }
5257 req = req.header(reqwest::header::ACCEPT, "application/json");
5258 let response = req.send().await?;
5259 let status = response.status();
5260 let status_code = status.as_u16();
5261 let headers = response.headers().clone();
5262 let body_bytes =
5263 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
5264 let raw_body = body_bytes;
5265 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
5266 if false || status_code == 200u16 {
5267 match serde_json::from_str(&body_text) {
5268 Ok(body) => Ok(body),
5269 Err(e) => Err(ApiOpError::Api(ApiError {
5270 status: status_code,
5271 headers: headers,
5272 body: body_text,
5273 raw_body,
5274 typed: None,
5275 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
5276 })),
5277 }
5278 } else if status.is_success() {
5279 Err(ApiOpError::Api(ApiError {
5280 status: status_code,
5281 headers,
5282 body: body_text,
5283 raw_body,
5284 typed: None,
5285 parse_error: Some(format!(
5286 "unexpected successful status {}; generated return type selects `{}`",
5287 status_code, "200",
5288 )),
5289 }))
5290 } else {
5291 let typed: Option<serde_json::Value>;
5292 let parse_error: Option<String>;
5293 match status_code {
5294 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
5295 Ok(v) => {
5296 typed = Some(v);
5297 parse_error = None;
5298 }
5299 Err(e) => {
5300 typed = None;
5301 parse_error = Some(e.to_string());
5302 }
5303 },
5304 }
5305 Err(ApiOpError::Api(ApiError {
5306 status: status_code,
5307 headers,
5308 body: body_text,
5309 raw_body,
5310 typed,
5311 parse_error,
5312 }))
5313 }
5314 }
5315 pub async fn get_lend_v1_earn_positions(
5321 &self,
5322 users: impl AsRef<str>,
5323 ) -> Result<LendUserPositionsResponse, ApiOpError<serde_json::Value>> {
5324 let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/positions");
5325 let mut req = self.http_client.get(request_url);
5326 {
5327 let mut query_params: Vec<(String, String)> = Vec::new();
5328 query_params.push(("users".to_string(), users.as_ref().to_string()));
5329 if !query_params.is_empty() {
5330 req = req.query(&query_params);
5331 }
5332 }
5333 if let Some(api_key) = &self.api_key {
5334 req = req.header("x-api-key", api_key.as_str());
5335 }
5336 for (name, value) in &self.custom_headers {
5337 if !name.eq_ignore_ascii_case("accept") {
5338 req = req.header(name, value);
5339 }
5340 }
5341 req = req.header(reqwest::header::ACCEPT, "application/json");
5342 let response = req.send().await?;
5343 let status = response.status();
5344 let status_code = status.as_u16();
5345 let headers = response.headers().clone();
5346 let body_bytes =
5347 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
5348 let raw_body = body_bytes;
5349 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
5350 if false || status_code == 200u16 {
5351 match serde_json::from_str(&body_text) {
5352 Ok(body) => Ok(body),
5353 Err(e) => Err(ApiOpError::Api(ApiError {
5354 status: status_code,
5355 headers: headers,
5356 body: body_text,
5357 raw_body,
5358 typed: None,
5359 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
5360 })),
5361 }
5362 } else if status.is_success() {
5363 Err(ApiOpError::Api(ApiError {
5364 status: status_code,
5365 headers,
5366 body: body_text,
5367 raw_body,
5368 typed: None,
5369 parse_error: Some(format!(
5370 "unexpected successful status {}; generated return type selects `{}`",
5371 status_code, "200",
5372 )),
5373 }))
5374 } else {
5375 let typed: Option<serde_json::Value>;
5376 let parse_error: Option<String>;
5377 match status_code {
5378 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
5379 Ok(v) => {
5380 typed = Some(v);
5381 parse_error = None;
5382 }
5383 Err(e) => {
5384 typed = None;
5385 parse_error = Some(e.to_string());
5386 }
5387 },
5388 }
5389 Err(ApiOpError::Api(ApiError {
5390 status: status_code,
5391 headers,
5392 body: body_text,
5393 raw_body,
5394 typed,
5395 parse_error,
5396 }))
5397 }
5398 }
5399 pub async fn get_lend_v1_earn_tokens(
5405 &self,
5406 ) -> Result<LendTokensResponse, ApiOpError<serde_json::Value>> {
5407 let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/tokens");
5408 let mut req = self.http_client.get(request_url);
5409 if let Some(api_key) = &self.api_key {
5410 req = req.header("x-api-key", api_key.as_str());
5411 }
5412 for (name, value) in &self.custom_headers {
5413 if !name.eq_ignore_ascii_case("accept") {
5414 req = req.header(name, value);
5415 }
5416 }
5417 req = req.header(reqwest::header::ACCEPT, "application/json");
5418 let response = req.send().await?;
5419 let status = response.status();
5420 let status_code = status.as_u16();
5421 let headers = response.headers().clone();
5422 let body_bytes =
5423 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
5424 let raw_body = body_bytes;
5425 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
5426 if false || status_code == 200u16 {
5427 match serde_json::from_str(&body_text) {
5428 Ok(body) => Ok(body),
5429 Err(e) => Err(ApiOpError::Api(ApiError {
5430 status: status_code,
5431 headers: headers,
5432 body: body_text,
5433 raw_body,
5434 typed: None,
5435 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
5436 })),
5437 }
5438 } else if status.is_success() {
5439 Err(ApiOpError::Api(ApiError {
5440 status: status_code,
5441 headers,
5442 body: body_text,
5443 raw_body,
5444 typed: None,
5445 parse_error: Some(format!(
5446 "unexpected successful status {}; generated return type selects `{}`",
5447 status_code, "200",
5448 )),
5449 }))
5450 } else {
5451 let typed: Option<serde_json::Value>;
5452 let parse_error: Option<String>;
5453 match status_code {
5454 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
5455 Ok(v) => {
5456 typed = Some(v);
5457 parse_error = None;
5458 }
5459 Err(e) => {
5460 typed = None;
5461 parse_error = Some(e.to_string());
5462 }
5463 },
5464 }
5465 Err(ApiOpError::Api(ApiError {
5466 status: status_code,
5467 headers,
5468 body: body_text,
5469 raw_body,
5470 typed,
5471 parse_error,
5472 }))
5473 }
5474 }
5475 pub async fn get_portfolio_v1_platforms(
5477 &self,
5478 ) -> Result<GetPortfolioV1PlatformsResponse, ApiOpError<serde_json::Value>> {
5479 let request_url = format!("{}{}", self.base_url, "/portfolio/v1/platforms");
5480 let mut req = self.http_client.get(request_url);
5481 if let Some(api_key) = &self.api_key {
5482 req = req.header("x-api-key", api_key.as_str());
5483 }
5484 for (name, value) in &self.custom_headers {
5485 if !name.eq_ignore_ascii_case("accept") {
5486 req = req.header(name, value);
5487 }
5488 }
5489 req = req.header(reqwest::header::ACCEPT, "application/json");
5490 let response = req.send().await?;
5491 let status = response.status();
5492 let status_code = status.as_u16();
5493 let headers = response.headers().clone();
5494 let body_bytes =
5495 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
5496 let raw_body = body_bytes;
5497 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
5498 if false || status_code == 200u16 {
5499 match serde_json::from_str(&body_text) {
5500 Ok(body) => Ok(body),
5501 Err(e) => Err(ApiOpError::Api(ApiError {
5502 status: status_code,
5503 headers: headers,
5504 body: body_text,
5505 raw_body,
5506 typed: None,
5507 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
5508 })),
5509 }
5510 } else if status.is_success() {
5511 Err(ApiOpError::Api(ApiError {
5512 status: status_code,
5513 headers,
5514 body: body_text,
5515 raw_body,
5516 typed: None,
5517 parse_error: Some(format!(
5518 "unexpected successful status {}; generated return type selects `{}`",
5519 status_code, "200",
5520 )),
5521 }))
5522 } else {
5523 let typed: Option<serde_json::Value>;
5524 let parse_error: Option<String>;
5525 match status_code {
5526 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
5527 Ok(v) => {
5528 typed = Some(v);
5529 parse_error = None;
5530 }
5531 Err(e) => {
5532 typed = None;
5533 parse_error = Some(e.to_string());
5534 }
5535 },
5536 }
5537 Err(ApiOpError::Api(ApiError {
5538 status: status_code,
5539 headers,
5540 body: body_text,
5541 raw_body,
5542 typed,
5543 parse_error,
5544 }))
5545 }
5546 }
5547 pub async fn get_portfolio_v1_positions_address(
5549 &self,
5550 address: impl AsRef<str>,
5551 platforms: Option<impl AsRef<str>>,
5552 ) -> Result<GetPortfolioV1PositionsAddressResponse, ApiOpError<serde_json::Value>> {
5553 let request_url = format!(
5554 "{}{}",
5555 self.base_url,
5556 format!(
5557 "/portfolio/v1/positions/{}",
5558 __pct_encode_path_segment(address.as_ref())
5559 )
5560 );
5561 let mut req = self.http_client.get(request_url);
5562 {
5563 let mut query_params: Vec<(String, String)> = Vec::new();
5564 if let Some(v) = platforms {
5565 query_params.push(("platforms".to_string(), v.as_ref().to_string()));
5566 }
5567 if !query_params.is_empty() {
5568 req = req.query(&query_params);
5569 }
5570 }
5571 if let Some(api_key) = &self.api_key {
5572 req = req.header("x-api-key", api_key.as_str());
5573 }
5574 for (name, value) in &self.custom_headers {
5575 if !name.eq_ignore_ascii_case("accept") {
5576 req = req.header(name, value);
5577 }
5578 }
5579 req = req.header(reqwest::header::ACCEPT, "application/json");
5580 let response = req.send().await?;
5581 let status = response.status();
5582 let status_code = status.as_u16();
5583 let headers = response.headers().clone();
5584 let body_bytes =
5585 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
5586 let raw_body = body_bytes;
5587 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
5588 if false || status_code == 200u16 {
5589 match serde_json::from_str(&body_text) {
5590 Ok(body) => Ok(body),
5591 Err(e) => Err(ApiOpError::Api(ApiError {
5592 status: status_code,
5593 headers: headers,
5594 body: body_text,
5595 raw_body,
5596 typed: None,
5597 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
5598 })),
5599 }
5600 } else if status.is_success() {
5601 Err(ApiOpError::Api(ApiError {
5602 status: status_code,
5603 headers,
5604 body: body_text,
5605 raw_body,
5606 typed: None,
5607 parse_error: Some(format!(
5608 "unexpected successful status {}; generated return type selects `{}`",
5609 status_code, "200",
5610 )),
5611 }))
5612 } else {
5613 let typed: Option<serde_json::Value>;
5614 let parse_error: Option<String>;
5615 match status_code {
5616 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
5617 Ok(v) => {
5618 typed = Some(v);
5619 parse_error = None;
5620 }
5621 Err(e) => {
5622 typed = None;
5623 parse_error = Some(e.to_string());
5624 }
5625 },
5626 }
5627 Err(ApiOpError::Api(ApiError {
5628 status: status_code,
5629 headers,
5630 body: body_text,
5631 raw_body,
5632 typed,
5633 parse_error,
5634 }))
5635 }
5636 }
5637 pub async fn get_portfolio_v1_staked_jup_address(
5639 &self,
5640 address: impl AsRef<str>,
5641 ) -> Result<GetPortfolioV1StakedJupAddressResponse, ApiOpError<serde_json::Value>> {
5642 let request_url = format!(
5643 "{}{}",
5644 self.base_url,
5645 format!(
5646 "/portfolio/v1/staked-jup/{}",
5647 __pct_encode_path_segment(address.as_ref())
5648 )
5649 );
5650 let mut req = self.http_client.get(request_url);
5651 if let Some(api_key) = &self.api_key {
5652 req = req.header("x-api-key", api_key.as_str());
5653 }
5654 for (name, value) in &self.custom_headers {
5655 if !name.eq_ignore_ascii_case("accept") {
5656 req = req.header(name, value);
5657 }
5658 }
5659 req = req.header(reqwest::header::ACCEPT, "application/json");
5660 let response = req.send().await?;
5661 let status = response.status();
5662 let status_code = status.as_u16();
5663 let headers = response.headers().clone();
5664 let body_bytes =
5665 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
5666 let raw_body = body_bytes;
5667 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
5668 if false || status_code == 200u16 {
5669 match serde_json::from_str(&body_text) {
5670 Ok(body) => Ok(body),
5671 Err(e) => Err(ApiOpError::Api(ApiError {
5672 status: status_code,
5673 headers: headers,
5674 body: body_text,
5675 raw_body,
5676 typed: None,
5677 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
5678 })),
5679 }
5680 } else if status.is_success() {
5681 Err(ApiOpError::Api(ApiError {
5682 status: status_code,
5683 headers,
5684 body: body_text,
5685 raw_body,
5686 typed: None,
5687 parse_error: Some(format!(
5688 "unexpected successful status {}; generated return type selects `{}`",
5689 status_code, "200",
5690 )),
5691 }))
5692 } else {
5693 let typed: Option<serde_json::Value>;
5694 let parse_error: Option<String>;
5695 match status_code {
5696 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
5697 Ok(v) => {
5698 typed = Some(v);
5699 parse_error = None;
5700 }
5701 Err(e) => {
5702 typed = None;
5703 parse_error = Some(e.to_string());
5704 }
5705 },
5706 }
5707 Err(ApiOpError::Api(ApiError {
5708 status: status_code,
5709 headers,
5710 body: body_text,
5711 raw_body,
5712 typed,
5713 parse_error,
5714 }))
5715 }
5716 }
5717 pub async fn get_prediction_v1_events(
5719 &self,
5720 provider: Option<GetPredictionV1EventsProvider>,
5721 include_markets: Option<bool>,
5722 include_all_markets: Option<bool>,
5723 start: Option<i64>,
5724 end: Option<i64>,
5725 category: Option<GetPredictionV1EventsCategory>,
5726 subcategory: Option<impl AsRef<str>>,
5727 sort_by: Option<GetPredictionV1EventsSortBy>,
5728 sort_direction: Option<GetPredictionV1EventsSortDirection>,
5729 filter: Option<GetPredictionV1EventsFilter>,
5730 tags: Option<impl AsRef<str>>,
5731 ) -> Result<GetPredictionV1EventsResponse, ApiOpError<serde_json::Value>> {
5732 let request_url = format!("{}{}", self.base_url, "/prediction/v1/events");
5733 let mut req = self.http_client.get(request_url);
5734 {
5735 let mut query_params: Vec<(String, String)> = Vec::new();
5736 if let Some(v) = provider {
5737 query_params.push(("provider".to_string(), v.to_string()));
5738 }
5739 if let Some(v) = include_markets {
5740 query_params.push(("includeMarkets".to_string(), v.to_string()));
5741 }
5742 if let Some(v) = include_all_markets {
5743 query_params.push(("includeAllMarkets".to_string(), v.to_string()));
5744 }
5745 if let Some(v) = start {
5746 query_params.push(("start".to_string(), v.to_string()));
5747 }
5748 if let Some(v) = end {
5749 query_params.push(("end".to_string(), v.to_string()));
5750 }
5751 if let Some(v) = category {
5752 query_params.push(("category".to_string(), v.to_string()));
5753 }
5754 if let Some(v) = subcategory {
5755 query_params.push(("subcategory".to_string(), v.as_ref().to_string()));
5756 }
5757 if let Some(v) = sort_by {
5758 query_params.push(("sortBy".to_string(), v.to_string()));
5759 }
5760 if let Some(v) = sort_direction {
5761 query_params.push(("sortDirection".to_string(), v.to_string()));
5762 }
5763 if let Some(v) = filter {
5764 query_params.push(("filter".to_string(), v.to_string()));
5765 }
5766 if let Some(v) = tags {
5767 query_params.push(("tags".to_string(), v.as_ref().to_string()));
5768 }
5769 if !query_params.is_empty() {
5770 req = req.query(&query_params);
5771 }
5772 }
5773 if let Some(api_key) = &self.api_key {
5774 req = req.header("x-api-key", api_key.as_str());
5775 }
5776 for (name, value) in &self.custom_headers {
5777 if !name.eq_ignore_ascii_case("accept") {
5778 req = req.header(name, value);
5779 }
5780 }
5781 req = req.header(reqwest::header::ACCEPT, "application/json");
5782 let response = req.send().await?;
5783 let status = response.status();
5784 let status_code = status.as_u16();
5785 let headers = response.headers().clone();
5786 let body_bytes =
5787 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
5788 let raw_body = body_bytes;
5789 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
5790 if false || status_code == 200u16 {
5791 match serde_json::from_str(&body_text) {
5792 Ok(body) => Ok(body),
5793 Err(e) => Err(ApiOpError::Api(ApiError {
5794 status: status_code,
5795 headers: headers,
5796 body: body_text,
5797 raw_body,
5798 typed: None,
5799 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
5800 })),
5801 }
5802 } else if status.is_success() {
5803 Err(ApiOpError::Api(ApiError {
5804 status: status_code,
5805 headers,
5806 body: body_text,
5807 raw_body,
5808 typed: None,
5809 parse_error: Some(format!(
5810 "unexpected successful status {}; generated return type selects `{}`",
5811 status_code, "200",
5812 )),
5813 }))
5814 } else {
5815 let typed: Option<serde_json::Value>;
5816 let parse_error: Option<String>;
5817 match status_code {
5818 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
5819 Ok(v) => {
5820 typed = Some(v);
5821 parse_error = None;
5822 }
5823 Err(e) => {
5824 typed = None;
5825 parse_error = Some(e.to_string());
5826 }
5827 },
5828 }
5829 Err(ApiOpError::Api(ApiError {
5830 status: status_code,
5831 headers,
5832 body: body_text,
5833 raw_body,
5834 typed,
5835 parse_error,
5836 }))
5837 }
5838 }
5839 pub async fn get_prediction_v1_events_event_id(
5841 &self,
5842 event_id: impl AsRef<str>,
5843 include_markets: Option<bool>,
5844 include_all_markets: Option<bool>,
5845 ) -> Result<PredictionEvent, ApiOpError<GetPredictionV1EventsEventIdApiError>> {
5846 let request_url = format!(
5847 "{}{}",
5848 self.base_url,
5849 format!(
5850 "/prediction/v1/events/{}",
5851 __pct_encode_path_segment(event_id.as_ref())
5852 )
5853 );
5854 let mut req = self.http_client.get(request_url);
5855 {
5856 let mut query_params: Vec<(String, String)> = Vec::new();
5857 if let Some(v) = include_markets {
5858 query_params.push(("includeMarkets".to_string(), v.to_string()));
5859 }
5860 if let Some(v) = include_all_markets {
5861 query_params.push(("includeAllMarkets".to_string(), v.to_string()));
5862 }
5863 if !query_params.is_empty() {
5864 req = req.query(&query_params);
5865 }
5866 }
5867 if let Some(api_key) = &self.api_key {
5868 req = req.header("x-api-key", api_key.as_str());
5869 }
5870 for (name, value) in &self.custom_headers {
5871 if !name.eq_ignore_ascii_case("accept") {
5872 req = req.header(name, value);
5873 }
5874 }
5875 req = req.header(reqwest::header::ACCEPT, "application/json");
5876 let response = req.send().await?;
5877 let status = response.status();
5878 let status_code = status.as_u16();
5879 let headers = response.headers().clone();
5880 let body_bytes =
5881 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
5882 let raw_body = body_bytes;
5883 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
5884 if false || status_code == 200u16 {
5885 match serde_json::from_str(&body_text) {
5886 Ok(body) => Ok(body),
5887 Err(e) => Err(ApiOpError::Api(ApiError {
5888 status: status_code,
5889 headers: headers,
5890 body: body_text,
5891 raw_body,
5892 typed: None,
5893 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
5894 })),
5895 }
5896 } else if status.is_success() {
5897 Err(ApiOpError::Api(ApiError {
5898 status: status_code,
5899 headers,
5900 body: body_text,
5901 raw_body,
5902 typed: None,
5903 parse_error: Some(format!(
5904 "unexpected successful status {}; generated return type selects `{}`",
5905 status_code, "200",
5906 )),
5907 }))
5908 } else {
5909 let typed: Option<GetPredictionV1EventsEventIdApiError>;
5910 let parse_error: Option<String>;
5911 match status_code {
5912 404u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
5913 Ok(v) => {
5914 typed = Some(GetPredictionV1EventsEventIdApiError::Status404(v));
5915 parse_error = None;
5916 }
5917 Err(e) => {
5918 typed = None;
5919 parse_error = Some(e.to_string());
5920 }
5921 },
5922 _ => {
5923 typed = None;
5924 parse_error = None;
5925 }
5926 }
5927 Err(ApiOpError::Api(ApiError {
5928 status: status_code,
5929 headers,
5930 body: body_text,
5931 raw_body,
5932 typed,
5933 parse_error,
5934 }))
5935 }
5936 }
5937 pub async fn get_prediction_v1_events_event_id_markets(
5939 &self,
5940 event_id: impl AsRef<str>,
5941 start: Option<i64>,
5942 end: Option<i64>,
5943 ) -> Result<GetPredictionV1EventsEventIdMarketsResponse, ApiOpError<serde_json::Value>> {
5944 let request_url = format!(
5945 "{}{}",
5946 self.base_url,
5947 format!(
5948 "/prediction/v1/events/{}/markets",
5949 __pct_encode_path_segment(event_id.as_ref())
5950 )
5951 );
5952 let mut req = self.http_client.get(request_url);
5953 {
5954 let mut query_params: Vec<(String, String)> = Vec::new();
5955 if let Some(v) = start {
5956 query_params.push(("start".to_string(), v.to_string()));
5957 }
5958 if let Some(v) = end {
5959 query_params.push(("end".to_string(), v.to_string()));
5960 }
5961 if !query_params.is_empty() {
5962 req = req.query(&query_params);
5963 }
5964 }
5965 if let Some(api_key) = &self.api_key {
5966 req = req.header("x-api-key", api_key.as_str());
5967 }
5968 for (name, value) in &self.custom_headers {
5969 if !name.eq_ignore_ascii_case("accept") {
5970 req = req.header(name, value);
5971 }
5972 }
5973 req = req.header(reqwest::header::ACCEPT, "application/json");
5974 let response = req.send().await?;
5975 let status = response.status();
5976 let status_code = status.as_u16();
5977 let headers = response.headers().clone();
5978 let body_bytes =
5979 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
5980 let raw_body = body_bytes;
5981 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
5982 if false || status_code == 200u16 {
5983 match serde_json::from_str(&body_text) {
5984 Ok(body) => Ok(body),
5985 Err(e) => Err(ApiOpError::Api(ApiError {
5986 status: status_code,
5987 headers: headers,
5988 body: body_text,
5989 raw_body,
5990 typed: None,
5991 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
5992 })),
5993 }
5994 } else if status.is_success() {
5995 Err(ApiOpError::Api(ApiError {
5996 status: status_code,
5997 headers,
5998 body: body_text,
5999 raw_body,
6000 typed: None,
6001 parse_error: Some(format!(
6002 "unexpected successful status {}; generated return type selects `{}`",
6003 status_code, "200",
6004 )),
6005 }))
6006 } else {
6007 let typed: Option<serde_json::Value>;
6008 let parse_error: Option<String>;
6009 match status_code {
6010 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
6011 Ok(v) => {
6012 typed = Some(v);
6013 parse_error = None;
6014 }
6015 Err(e) => {
6016 typed = None;
6017 parse_error = Some(e.to_string());
6018 }
6019 },
6020 }
6021 Err(ApiOpError::Api(ApiError {
6022 status: status_code,
6023 headers,
6024 body: body_text,
6025 raw_body,
6026 typed,
6027 parse_error,
6028 }))
6029 }
6030 }
6031 pub async fn get_prediction_v1_events_event_id_markets_market_id(
6033 &self,
6034 event_id: impl AsRef<str>,
6035 market_id: impl AsRef<str>,
6036 ) -> Result<PredictionMarket, ApiOpError<GetPredictionV1EventsEventIdMarketsMarketIdApiError>>
6037 {
6038 let request_url = format!(
6039 "{}{}",
6040 self.base_url,
6041 format!(
6042 "/prediction/v1/events/{}/markets/{}",
6043 __pct_encode_path_segment(event_id.as_ref()),
6044 __pct_encode_path_segment(market_id.as_ref())
6045 )
6046 );
6047 let mut req = self.http_client.get(request_url);
6048 if let Some(api_key) = &self.api_key {
6049 req = req.header("x-api-key", api_key.as_str());
6050 }
6051 for (name, value) in &self.custom_headers {
6052 if !name.eq_ignore_ascii_case("accept") {
6053 req = req.header(name, value);
6054 }
6055 }
6056 req = req.header(reqwest::header::ACCEPT, "application/json");
6057 let response = req.send().await?;
6058 let status = response.status();
6059 let status_code = status.as_u16();
6060 let headers = response.headers().clone();
6061 let body_bytes =
6062 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
6063 let raw_body = body_bytes;
6064 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
6065 if false || status_code == 200u16 {
6066 match serde_json::from_str(&body_text) {
6067 Ok(body) => Ok(body),
6068 Err(e) => Err(ApiOpError::Api(ApiError {
6069 status: status_code,
6070 headers: headers,
6071 body: body_text,
6072 raw_body,
6073 typed: None,
6074 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
6075 })),
6076 }
6077 } else if status.is_success() {
6078 Err(ApiOpError::Api(ApiError {
6079 status: status_code,
6080 headers,
6081 body: body_text,
6082 raw_body,
6083 typed: None,
6084 parse_error: Some(format!(
6085 "unexpected successful status {}; generated return type selects `{}`",
6086 status_code, "200",
6087 )),
6088 }))
6089 } else {
6090 let typed: Option<GetPredictionV1EventsEventIdMarketsMarketIdApiError>;
6091 let parse_error: Option<String>;
6092 match status_code {
6093 404u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
6094 Ok(v) => {
6095 typed =
6096 Some(GetPredictionV1EventsEventIdMarketsMarketIdApiError::Status404(v));
6097 parse_error = None;
6098 }
6099 Err(e) => {
6100 typed = None;
6101 parse_error = Some(e.to_string());
6102 }
6103 },
6104 _ => {
6105 typed = None;
6106 parse_error = None;
6107 }
6108 }
6109 Err(ApiOpError::Api(ApiError {
6110 status: status_code,
6111 headers,
6112 body: body_text,
6113 raw_body,
6114 typed,
6115 parse_error,
6116 }))
6117 }
6118 }
6119 pub async fn get_prediction_v1_events_event_id_score(
6121 &self,
6122 event_id: impl AsRef<str>,
6123 ) -> Result<PredictionGameScore, ApiOpError<serde_json::Value>> {
6124 let request_url = format!(
6125 "{}{}",
6126 self.base_url,
6127 format!(
6128 "/prediction/v1/events/{}/score",
6129 __pct_encode_path_segment(event_id.as_ref())
6130 )
6131 );
6132 let mut req = self.http_client.get(request_url);
6133 if let Some(api_key) = &self.api_key {
6134 req = req.header("x-api-key", api_key.as_str());
6135 }
6136 for (name, value) in &self.custom_headers {
6137 if !name.eq_ignore_ascii_case("accept") {
6138 req = req.header(name, value);
6139 }
6140 }
6141 req = req.header(reqwest::header::ACCEPT, "application/json");
6142 let response = req.send().await?;
6143 let status = response.status();
6144 let status_code = status.as_u16();
6145 let headers = response.headers().clone();
6146 let body_bytes =
6147 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
6148 let raw_body = body_bytes;
6149 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
6150 if false || status_code == 200u16 {
6151 match serde_json::from_str(&body_text) {
6152 Ok(body) => Ok(body),
6153 Err(e) => Err(ApiOpError::Api(ApiError {
6154 status: status_code,
6155 headers: headers,
6156 body: body_text,
6157 raw_body,
6158 typed: None,
6159 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
6160 })),
6161 }
6162 } else if status.is_success() {
6163 Err(ApiOpError::Api(ApiError {
6164 status: status_code,
6165 headers,
6166 body: body_text,
6167 raw_body,
6168 typed: None,
6169 parse_error: Some(format!(
6170 "unexpected successful status {}; generated return type selects `{}`",
6171 status_code, "200",
6172 )),
6173 }))
6174 } else {
6175 let typed: Option<serde_json::Value>;
6176 let parse_error: Option<String>;
6177 match status_code {
6178 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
6179 Ok(v) => {
6180 typed = Some(v);
6181 parse_error = None;
6182 }
6183 Err(e) => {
6184 typed = None;
6185 parse_error = Some(e.to_string());
6186 }
6187 },
6188 }
6189 Err(ApiOpError::Api(ApiError {
6190 status: status_code,
6191 headers,
6192 body: body_text,
6193 raw_body,
6194 typed,
6195 parse_error,
6196 }))
6197 }
6198 }
6199 pub async fn get_prediction_v1_events_scores(
6201 &self,
6202 event_ids: impl AsRef<str>,
6203 ) -> Result<GetPredictionV1EventsScoresResponse, ApiOpError<serde_json::Value>> {
6204 let request_url = format!("{}{}", self.base_url, "/prediction/v1/events/scores");
6205 let mut req = self.http_client.get(request_url);
6206 {
6207 let mut query_params: Vec<(String, String)> = Vec::new();
6208 query_params.push(("eventIds".to_string(), event_ids.as_ref().to_string()));
6209 if !query_params.is_empty() {
6210 req = req.query(&query_params);
6211 }
6212 }
6213 if let Some(api_key) = &self.api_key {
6214 req = req.header("x-api-key", api_key.as_str());
6215 }
6216 for (name, value) in &self.custom_headers {
6217 if !name.eq_ignore_ascii_case("accept") {
6218 req = req.header(name, value);
6219 }
6220 }
6221 req = req.header(reqwest::header::ACCEPT, "application/json");
6222 let response = req.send().await?;
6223 let status = response.status();
6224 let status_code = status.as_u16();
6225 let headers = response.headers().clone();
6226 let body_bytes =
6227 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
6228 let raw_body = body_bytes;
6229 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
6230 if false || status_code == 200u16 {
6231 match serde_json::from_str(&body_text) {
6232 Ok(body) => Ok(body),
6233 Err(e) => Err(ApiOpError::Api(ApiError {
6234 status: status_code,
6235 headers: headers,
6236 body: body_text,
6237 raw_body,
6238 typed: None,
6239 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
6240 })),
6241 }
6242 } else if status.is_success() {
6243 Err(ApiOpError::Api(ApiError {
6244 status: status_code,
6245 headers,
6246 body: body_text,
6247 raw_body,
6248 typed: None,
6249 parse_error: Some(format!(
6250 "unexpected successful status {}; generated return type selects `{}`",
6251 status_code, "200",
6252 )),
6253 }))
6254 } else {
6255 let typed: Option<serde_json::Value>;
6256 let parse_error: Option<String>;
6257 match status_code {
6258 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
6259 Ok(v) => {
6260 typed = Some(v);
6261 parse_error = None;
6262 }
6263 Err(e) => {
6264 typed = None;
6265 parse_error = Some(e.to_string());
6266 }
6267 },
6268 }
6269 Err(ApiOpError::Api(ApiError {
6270 status: status_code,
6271 headers,
6272 body: body_text,
6273 raw_body,
6274 typed,
6275 parse_error,
6276 }))
6277 }
6278 }
6279 pub async fn get_prediction_v1_events_search(
6281 &self,
6282 provider: Option<GetPredictionV1EventsSearchProvider>,
6283 query: impl AsRef<str>,
6284 limit: Option<i64>,
6285 ) -> Result<GetPredictionV1EventsSearchResponse, ApiOpError<serde_json::Value>> {
6286 let request_url = format!("{}{}", self.base_url, "/prediction/v1/events/search");
6287 let mut req = self.http_client.get(request_url);
6288 {
6289 let mut query_params: Vec<(String, String)> = Vec::new();
6290 if let Some(v) = provider {
6291 query_params.push(("provider".to_string(), v.to_string()));
6292 }
6293 query_params.push(("query".to_string(), query.as_ref().to_string()));
6294 if let Some(v) = limit {
6295 query_params.push(("limit".to_string(), v.to_string()));
6296 }
6297 if !query_params.is_empty() {
6298 req = req.query(&query_params);
6299 }
6300 }
6301 if let Some(api_key) = &self.api_key {
6302 req = req.header("x-api-key", api_key.as_str());
6303 }
6304 for (name, value) in &self.custom_headers {
6305 if !name.eq_ignore_ascii_case("accept") {
6306 req = req.header(name, value);
6307 }
6308 }
6309 req = req.header(reqwest::header::ACCEPT, "application/json");
6310 let response = req.send().await?;
6311 let status = response.status();
6312 let status_code = status.as_u16();
6313 let headers = response.headers().clone();
6314 let body_bytes =
6315 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
6316 let raw_body = body_bytes;
6317 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
6318 if false || status_code == 200u16 {
6319 match serde_json::from_str(&body_text) {
6320 Ok(body) => Ok(body),
6321 Err(e) => Err(ApiOpError::Api(ApiError {
6322 status: status_code,
6323 headers: headers,
6324 body: body_text,
6325 raw_body,
6326 typed: None,
6327 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
6328 })),
6329 }
6330 } else if status.is_success() {
6331 Err(ApiOpError::Api(ApiError {
6332 status: status_code,
6333 headers,
6334 body: body_text,
6335 raw_body,
6336 typed: None,
6337 parse_error: Some(format!(
6338 "unexpected successful status {}; generated return type selects `{}`",
6339 status_code, "200",
6340 )),
6341 }))
6342 } else {
6343 let typed: Option<serde_json::Value>;
6344 let parse_error: Option<String>;
6345 match status_code {
6346 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
6347 Ok(v) => {
6348 typed = Some(v);
6349 parse_error = None;
6350 }
6351 Err(e) => {
6352 typed = None;
6353 parse_error = Some(e.to_string());
6354 }
6355 },
6356 }
6357 Err(ApiOpError::Api(ApiError {
6358 status: status_code,
6359 headers,
6360 body: body_text,
6361 raw_body,
6362 typed,
6363 parse_error,
6364 }))
6365 }
6366 }
6367 pub async fn get_prediction_v1_events_suggested_pubkey(
6369 &self,
6370 pubkey: impl AsRef<str>,
6371 provider: Option<GetPredictionV1EventsSuggestedPubkeyProvider>,
6372 ) -> Result<GetPredictionV1EventsSuggestedPubkeyResponse, ApiOpError<serde_json::Value>> {
6373 let request_url = format!(
6374 "{}{}",
6375 self.base_url,
6376 format!(
6377 "/prediction/v1/events/suggested/{}",
6378 __pct_encode_path_segment(pubkey.as_ref())
6379 )
6380 );
6381 let mut req = self.http_client.get(request_url);
6382 {
6383 let mut query_params: Vec<(String, String)> = Vec::new();
6384 if let Some(v) = provider {
6385 query_params.push(("provider".to_string(), v.to_string()));
6386 }
6387 if !query_params.is_empty() {
6388 req = req.query(&query_params);
6389 }
6390 }
6391 if let Some(api_key) = &self.api_key {
6392 req = req.header("x-api-key", api_key.as_str());
6393 }
6394 for (name, value) in &self.custom_headers {
6395 if !name.eq_ignore_ascii_case("accept") {
6396 req = req.header(name, value);
6397 }
6398 }
6399 req = req.header(reqwest::header::ACCEPT, "application/json");
6400 let response = req.send().await?;
6401 let status = response.status();
6402 let status_code = status.as_u16();
6403 let headers = response.headers().clone();
6404 let body_bytes =
6405 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
6406 let raw_body = body_bytes;
6407 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
6408 if false || status_code == 200u16 {
6409 match serde_json::from_str(&body_text) {
6410 Ok(body) => Ok(body),
6411 Err(e) => Err(ApiOpError::Api(ApiError {
6412 status: status_code,
6413 headers: headers,
6414 body: body_text,
6415 raw_body,
6416 typed: None,
6417 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
6418 })),
6419 }
6420 } else if status.is_success() {
6421 Err(ApiOpError::Api(ApiError {
6422 status: status_code,
6423 headers,
6424 body: body_text,
6425 raw_body,
6426 typed: None,
6427 parse_error: Some(format!(
6428 "unexpected successful status {}; generated return type selects `{}`",
6429 status_code, "200",
6430 )),
6431 }))
6432 } else {
6433 let typed: Option<serde_json::Value>;
6434 let parse_error: Option<String>;
6435 match status_code {
6436 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
6437 Ok(v) => {
6438 typed = Some(v);
6439 parse_error = None;
6440 }
6441 Err(e) => {
6442 typed = None;
6443 parse_error = Some(e.to_string());
6444 }
6445 },
6446 }
6447 Err(ApiOpError::Api(ApiError {
6448 status: status_code,
6449 headers,
6450 body: body_text,
6451 raw_body,
6452 typed,
6453 parse_error,
6454 }))
6455 }
6456 }
6457 pub async fn get_prediction_v1_forecast(
6459 &self,
6460 market_id: impl AsRef<str>,
6461 ) -> Result<GetPredictionV1ForecastResponse, ApiOpError<GetPredictionV1ForecastApiError>> {
6462 let request_url = format!("{}{}", self.base_url, "/prediction/v1/forecast");
6463 let mut req = self.http_client.get(request_url);
6464 {
6465 let mut query_params: Vec<(String, String)> = Vec::new();
6466 query_params.push(("marketId".to_string(), market_id.as_ref().to_string()));
6467 if !query_params.is_empty() {
6468 req = req.query(&query_params);
6469 }
6470 }
6471 if let Some(api_key) = &self.api_key {
6472 req = req.header("x-api-key", api_key.as_str());
6473 }
6474 for (name, value) in &self.custom_headers {
6475 if !name.eq_ignore_ascii_case("accept") {
6476 req = req.header(name, value);
6477 }
6478 }
6479 req = req.header(reqwest::header::ACCEPT, "application/json");
6480 let response = req.send().await?;
6481 let status = response.status();
6482 let status_code = status.as_u16();
6483 let headers = response.headers().clone();
6484 let body_bytes =
6485 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
6486 let raw_body = body_bytes;
6487 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
6488 if false || status_code == 200u16 {
6489 match serde_json::from_str(&body_text) {
6490 Ok(body) => Ok(body),
6491 Err(e) => Err(ApiOpError::Api(ApiError {
6492 status: status_code,
6493 headers: headers,
6494 body: body_text,
6495 raw_body,
6496 typed: None,
6497 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
6498 })),
6499 }
6500 } else if status.is_success() {
6501 Err(ApiOpError::Api(ApiError {
6502 status: status_code,
6503 headers,
6504 body: body_text,
6505 raw_body,
6506 typed: None,
6507 parse_error: Some(format!(
6508 "unexpected successful status {}; generated return type selects `{}`",
6509 status_code, "200",
6510 )),
6511 }))
6512 } else {
6513 let typed: Option<GetPredictionV1ForecastApiError>;
6514 let parse_error: Option<String>;
6515 match status_code {
6516 400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
6517 Ok(v) => {
6518 typed = Some(GetPredictionV1ForecastApiError::Status400(v));
6519 parse_error = None;
6520 }
6521 Err(e) => {
6522 typed = None;
6523 parse_error = Some(e.to_string());
6524 }
6525 },
6526 502u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
6527 Ok(v) => {
6528 typed = Some(GetPredictionV1ForecastApiError::Status502(v));
6529 parse_error = None;
6530 }
6531 Err(e) => {
6532 typed = None;
6533 parse_error = Some(e.to_string());
6534 }
6535 },
6536 _ => {
6537 typed = None;
6538 parse_error = None;
6539 }
6540 }
6541 Err(ApiOpError::Api(ApiError {
6542 status: status_code,
6543 headers,
6544 body: body_text,
6545 raw_body,
6546 typed,
6547 parse_error,
6548 }))
6549 }
6550 }
6551 pub async fn get_prediction_v1_history(
6553 &self,
6554 start: Option<i64>,
6555 end: Option<i64>,
6556 owner_pubkey: Option<impl AsRef<str>>,
6557 id: Option<i64>,
6558 position_pubkey: Option<impl AsRef<str>>,
6559 ) -> Result<GetPredictionV1HistoryResponse, ApiOpError<serde_json::Value>> {
6560 let request_url = format!("{}{}", self.base_url, "/prediction/v1/history");
6561 let mut req = self.http_client.get(request_url);
6562 {
6563 let mut query_params: Vec<(String, String)> = Vec::new();
6564 if let Some(v) = start {
6565 query_params.push(("start".to_string(), v.to_string()));
6566 }
6567 if let Some(v) = end {
6568 query_params.push(("end".to_string(), v.to_string()));
6569 }
6570 if let Some(v) = owner_pubkey {
6571 query_params.push(("ownerPubkey".to_string(), v.as_ref().to_string()));
6572 }
6573 if let Some(v) = id {
6574 query_params.push(("id".to_string(), v.to_string()));
6575 }
6576 if let Some(v) = position_pubkey {
6577 query_params.push(("positionPubkey".to_string(), v.as_ref().to_string()));
6578 }
6579 if !query_params.is_empty() {
6580 req = req.query(&query_params);
6581 }
6582 }
6583 if let Some(api_key) = &self.api_key {
6584 req = req.header("x-api-key", api_key.as_str());
6585 }
6586 for (name, value) in &self.custom_headers {
6587 if !name.eq_ignore_ascii_case("accept") {
6588 req = req.header(name, value);
6589 }
6590 }
6591 req = req.header(reqwest::header::ACCEPT, "application/json");
6592 let response = req.send().await?;
6593 let status = response.status();
6594 let status_code = status.as_u16();
6595 let headers = response.headers().clone();
6596 let body_bytes =
6597 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
6598 let raw_body = body_bytes;
6599 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
6600 if false || status_code == 200u16 {
6601 match serde_json::from_str(&body_text) {
6602 Ok(body) => Ok(body),
6603 Err(e) => Err(ApiOpError::Api(ApiError {
6604 status: status_code,
6605 headers: headers,
6606 body: body_text,
6607 raw_body,
6608 typed: None,
6609 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
6610 })),
6611 }
6612 } else if status.is_success() {
6613 Err(ApiOpError::Api(ApiError {
6614 status: status_code,
6615 headers,
6616 body: body_text,
6617 raw_body,
6618 typed: None,
6619 parse_error: Some(format!(
6620 "unexpected successful status {}; generated return type selects `{}`",
6621 status_code, "200",
6622 )),
6623 }))
6624 } else {
6625 let typed: Option<serde_json::Value>;
6626 let parse_error: Option<String>;
6627 match status_code {
6628 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
6629 Ok(v) => {
6630 typed = Some(v);
6631 parse_error = None;
6632 }
6633 Err(e) => {
6634 typed = None;
6635 parse_error = Some(e.to_string());
6636 }
6637 },
6638 }
6639 Err(ApiOpError::Api(ApiError {
6640 status: status_code,
6641 headers,
6642 body: body_text,
6643 raw_body,
6644 typed,
6645 parse_error,
6646 }))
6647 }
6648 }
6649 pub async fn get_prediction_v1_leaderboards(
6651 &self,
6652 period: Option<GetPredictionV1LeaderboardsPeriod>,
6653 limit: Option<i64>,
6654 metric: Option<GetPredictionV1LeaderboardsMetric>,
6655 ) -> Result<GetPredictionV1LeaderboardsResponse, ApiOpError<serde_json::Value>> {
6656 let request_url = format!("{}{}", self.base_url, "/prediction/v1/leaderboards");
6657 let mut req = self.http_client.get(request_url);
6658 {
6659 let mut query_params: Vec<(String, String)> = Vec::new();
6660 if let Some(v) = period {
6661 query_params.push(("period".to_string(), v.to_string()));
6662 }
6663 if let Some(v) = limit {
6664 query_params.push(("limit".to_string(), v.to_string()));
6665 }
6666 if let Some(v) = metric {
6667 query_params.push(("metric".to_string(), v.to_string()));
6668 }
6669 if !query_params.is_empty() {
6670 req = req.query(&query_params);
6671 }
6672 }
6673 if let Some(api_key) = &self.api_key {
6674 req = req.header("x-api-key", api_key.as_str());
6675 }
6676 for (name, value) in &self.custom_headers {
6677 if !name.eq_ignore_ascii_case("accept") {
6678 req = req.header(name, value);
6679 }
6680 }
6681 req = req.header(reqwest::header::ACCEPT, "application/json");
6682 let response = req.send().await?;
6683 let status = response.status();
6684 let status_code = status.as_u16();
6685 let headers = response.headers().clone();
6686 let body_bytes =
6687 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
6688 let raw_body = body_bytes;
6689 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
6690 if false || status_code == 200u16 {
6691 match serde_json::from_str(&body_text) {
6692 Ok(body) => Ok(body),
6693 Err(e) => Err(ApiOpError::Api(ApiError {
6694 status: status_code,
6695 headers: headers,
6696 body: body_text,
6697 raw_body,
6698 typed: None,
6699 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
6700 })),
6701 }
6702 } else if status.is_success() {
6703 Err(ApiOpError::Api(ApiError {
6704 status: status_code,
6705 headers,
6706 body: body_text,
6707 raw_body,
6708 typed: None,
6709 parse_error: Some(format!(
6710 "unexpected successful status {}; generated return type selects `{}`",
6711 status_code, "200",
6712 )),
6713 }))
6714 } else {
6715 let typed: Option<serde_json::Value>;
6716 let parse_error: Option<String>;
6717 match status_code {
6718 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
6719 Ok(v) => {
6720 typed = Some(v);
6721 parse_error = None;
6722 }
6723 Err(e) => {
6724 typed = None;
6725 parse_error = Some(e.to_string());
6726 }
6727 },
6728 }
6729 Err(ApiOpError::Api(ApiError {
6730 status: status_code,
6731 headers,
6732 body: body_text,
6733 raw_body,
6734 typed,
6735 parse_error,
6736 }))
6737 }
6738 }
6739 pub async fn get_prediction_v1_markets_market_id(
6741 &self,
6742 market_id: impl AsRef<str>,
6743 ) -> Result<PredictionMarket, ApiOpError<GetPredictionV1MarketsMarketIdApiError>> {
6744 let request_url = format!(
6745 "{}{}",
6746 self.base_url,
6747 format!(
6748 "/prediction/v1/markets/{}",
6749 __pct_encode_path_segment(market_id.as_ref())
6750 )
6751 );
6752 let mut req = self.http_client.get(request_url);
6753 if let Some(api_key) = &self.api_key {
6754 req = req.header("x-api-key", api_key.as_str());
6755 }
6756 for (name, value) in &self.custom_headers {
6757 if !name.eq_ignore_ascii_case("accept") {
6758 req = req.header(name, value);
6759 }
6760 }
6761 req = req.header(reqwest::header::ACCEPT, "application/json");
6762 let response = req.send().await?;
6763 let status = response.status();
6764 let status_code = status.as_u16();
6765 let headers = response.headers().clone();
6766 let body_bytes =
6767 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
6768 let raw_body = body_bytes;
6769 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
6770 if false || status_code == 200u16 {
6771 match serde_json::from_str(&body_text) {
6772 Ok(body) => Ok(body),
6773 Err(e) => Err(ApiOpError::Api(ApiError {
6774 status: status_code,
6775 headers: headers,
6776 body: body_text,
6777 raw_body,
6778 typed: None,
6779 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
6780 })),
6781 }
6782 } else if status.is_success() {
6783 Err(ApiOpError::Api(ApiError {
6784 status: status_code,
6785 headers,
6786 body: body_text,
6787 raw_body,
6788 typed: None,
6789 parse_error: Some(format!(
6790 "unexpected successful status {}; generated return type selects `{}`",
6791 status_code, "200",
6792 )),
6793 }))
6794 } else {
6795 let typed: Option<GetPredictionV1MarketsMarketIdApiError>;
6796 let parse_error: Option<String>;
6797 match status_code {
6798 404u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
6799 Ok(v) => {
6800 typed = Some(GetPredictionV1MarketsMarketIdApiError::Status404(v));
6801 parse_error = None;
6802 }
6803 Err(e) => {
6804 typed = None;
6805 parse_error = Some(e.to_string());
6806 }
6807 },
6808 _ => {
6809 typed = None;
6810 parse_error = None;
6811 }
6812 }
6813 Err(ApiOpError::Api(ApiError {
6814 status: status_code,
6815 headers,
6816 body: body_text,
6817 raw_body,
6818 typed,
6819 parse_error,
6820 }))
6821 }
6822 }
6823 pub async fn get_prediction_v1_orderbook_market_id(
6825 &self,
6826 market_id: impl AsRef<str>,
6827 ) -> Result<
6828 GetPredictionV1OrderbookMarketIdResponse,
6829 ApiOpError<GetPredictionV1OrderbookMarketIdApiError>,
6830 > {
6831 let request_url = format!(
6832 "{}{}",
6833 self.base_url,
6834 format!(
6835 "/prediction/v1/orderbook/{}",
6836 __pct_encode_path_segment(market_id.as_ref())
6837 )
6838 );
6839 let mut req = self.http_client.get(request_url);
6840 if let Some(api_key) = &self.api_key {
6841 req = req.header("x-api-key", api_key.as_str());
6842 }
6843 for (name, value) in &self.custom_headers {
6844 if !name.eq_ignore_ascii_case("accept") {
6845 req = req.header(name, value);
6846 }
6847 }
6848 req = req.header(reqwest::header::ACCEPT, "application/json");
6849 let response = req.send().await?;
6850 let status = response.status();
6851 let status_code = status.as_u16();
6852 let headers = response.headers().clone();
6853 let body_bytes =
6854 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
6855 let raw_body = body_bytes;
6856 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
6857 if false || status_code == 200u16 {
6858 match serde_json::from_str(&body_text) {
6859 Ok(body) => Ok(body),
6860 Err(e) => Err(ApiOpError::Api(ApiError {
6861 status: status_code,
6862 headers: headers,
6863 body: body_text,
6864 raw_body,
6865 typed: None,
6866 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
6867 })),
6868 }
6869 } else if status.is_success() {
6870 Err(ApiOpError::Api(ApiError {
6871 status: status_code,
6872 headers,
6873 body: body_text,
6874 raw_body,
6875 typed: None,
6876 parse_error: Some(format!(
6877 "unexpected successful status {}; generated return type selects `{}`",
6878 status_code, "200",
6879 )),
6880 }))
6881 } else {
6882 let typed: Option<GetPredictionV1OrderbookMarketIdApiError>;
6883 let parse_error: Option<String>;
6884 match status_code {
6885 502u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
6886 Ok(v) => {
6887 typed = Some(GetPredictionV1OrderbookMarketIdApiError::Status502(v));
6888 parse_error = None;
6889 }
6890 Err(e) => {
6891 typed = None;
6892 parse_error = Some(e.to_string());
6893 }
6894 },
6895 _ => {
6896 typed = None;
6897 parse_error = None;
6898 }
6899 }
6900 Err(ApiOpError::Api(ApiError {
6901 status: status_code,
6902 headers,
6903 body: body_text,
6904 raw_body,
6905 typed,
6906 parse_error,
6907 }))
6908 }
6909 }
6910 pub async fn get_prediction_v1_orders(
6912 &self,
6913 start: Option<i64>,
6914 end: Option<i64>,
6915 owner_pubkey: Option<impl AsRef<str>>,
6916 ) -> Result<GetPredictionV1OrdersResponse, ApiOpError<GetPredictionV1OrdersApiError>> {
6917 let request_url = format!("{}{}", self.base_url, "/prediction/v1/orders");
6918 let mut req = self.http_client.get(request_url);
6919 {
6920 let mut query_params: Vec<(String, String)> = Vec::new();
6921 if let Some(v) = start {
6922 query_params.push(("start".to_string(), v.to_string()));
6923 }
6924 if let Some(v) = end {
6925 query_params.push(("end".to_string(), v.to_string()));
6926 }
6927 if let Some(v) = owner_pubkey {
6928 query_params.push(("ownerPubkey".to_string(), v.as_ref().to_string()));
6929 }
6930 if !query_params.is_empty() {
6931 req = req.query(&query_params);
6932 }
6933 }
6934 if let Some(api_key) = &self.api_key {
6935 req = req.header("x-api-key", api_key.as_str());
6936 }
6937 for (name, value) in &self.custom_headers {
6938 if !name.eq_ignore_ascii_case("accept") {
6939 req = req.header(name, value);
6940 }
6941 }
6942 req = req.header(reqwest::header::ACCEPT, "application/json");
6943 let response = req.send().await?;
6944 let status = response.status();
6945 let status_code = status.as_u16();
6946 let headers = response.headers().clone();
6947 let body_bytes =
6948 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
6949 let raw_body = body_bytes;
6950 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
6951 if false || status_code == 200u16 {
6952 match serde_json::from_str(&body_text) {
6953 Ok(body) => Ok(body),
6954 Err(e) => Err(ApiOpError::Api(ApiError {
6955 status: status_code,
6956 headers: headers,
6957 body: body_text,
6958 raw_body,
6959 typed: None,
6960 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
6961 })),
6962 }
6963 } else if status.is_success() {
6964 Err(ApiOpError::Api(ApiError {
6965 status: status_code,
6966 headers,
6967 body: body_text,
6968 raw_body,
6969 typed: None,
6970 parse_error: Some(format!(
6971 "unexpected successful status {}; generated return type selects `{}`",
6972 status_code, "200",
6973 )),
6974 }))
6975 } else {
6976 let typed: Option<GetPredictionV1OrdersApiError>;
6977 let parse_error: Option<String>;
6978 match status_code {
6979 400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
6980 Ok(v) => {
6981 typed = Some(GetPredictionV1OrdersApiError::Status400(v));
6982 parse_error = None;
6983 }
6984 Err(e) => {
6985 typed = None;
6986 parse_error = Some(e.to_string());
6987 }
6988 },
6989 _ => {
6990 typed = None;
6991 parse_error = None;
6992 }
6993 }
6994 Err(ApiOpError::Api(ApiError {
6995 status: status_code,
6996 headers,
6997 body: body_text,
6998 raw_body,
6999 typed,
7000 parse_error,
7001 }))
7002 }
7003 }
7004 pub async fn get_prediction_v1_orders_order_pubkey(
7006 &self,
7007 order_pubkey: impl AsRef<str>,
7008 ) -> Result<PredictionOrder, ApiOpError<GetPredictionV1OrdersOrderPubkeyApiError>> {
7009 let request_url = format!(
7010 "{}{}",
7011 self.base_url,
7012 format!(
7013 "/prediction/v1/orders/{}",
7014 __pct_encode_path_segment(order_pubkey.as_ref())
7015 )
7016 );
7017 let mut req = self.http_client.get(request_url);
7018 if let Some(api_key) = &self.api_key {
7019 req = req.header("x-api-key", api_key.as_str());
7020 }
7021 for (name, value) in &self.custom_headers {
7022 if !name.eq_ignore_ascii_case("accept") {
7023 req = req.header(name, value);
7024 }
7025 }
7026 req = req.header(reqwest::header::ACCEPT, "application/json");
7027 let response = req.send().await?;
7028 let status = response.status();
7029 let status_code = status.as_u16();
7030 let headers = response.headers().clone();
7031 let body_bytes =
7032 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
7033 let raw_body = body_bytes;
7034 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
7035 if false || status_code == 200u16 {
7036 match serde_json::from_str(&body_text) {
7037 Ok(body) => Ok(body),
7038 Err(e) => Err(ApiOpError::Api(ApiError {
7039 status: status_code,
7040 headers: headers,
7041 body: body_text,
7042 raw_body,
7043 typed: None,
7044 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
7045 })),
7046 }
7047 } else if status.is_success() {
7048 Err(ApiOpError::Api(ApiError {
7049 status: status_code,
7050 headers,
7051 body: body_text,
7052 raw_body,
7053 typed: None,
7054 parse_error: Some(format!(
7055 "unexpected successful status {}; generated return type selects `{}`",
7056 status_code, "200",
7057 )),
7058 }))
7059 } else {
7060 let typed: Option<GetPredictionV1OrdersOrderPubkeyApiError>;
7061 let parse_error: Option<String>;
7062 match status_code {
7063 400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
7064 Ok(v) => {
7065 typed = Some(GetPredictionV1OrdersOrderPubkeyApiError::Status400(v));
7066 parse_error = None;
7067 }
7068 Err(e) => {
7069 typed = None;
7070 parse_error = Some(e.to_string());
7071 }
7072 },
7073 404u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
7074 Ok(v) => {
7075 typed = Some(GetPredictionV1OrdersOrderPubkeyApiError::Status404(v));
7076 parse_error = None;
7077 }
7078 Err(e) => {
7079 typed = None;
7080 parse_error = Some(e.to_string());
7081 }
7082 },
7083 _ => {
7084 typed = None;
7085 parse_error = None;
7086 }
7087 }
7088 Err(ApiOpError::Api(ApiError {
7089 status: status_code,
7090 headers,
7091 body: body_text,
7092 raw_body,
7093 typed,
7094 parse_error,
7095 }))
7096 }
7097 }
7098 pub async fn get_prediction_v1_orders_status_order_pubkey(
7100 &self,
7101 order_pubkey: impl AsRef<str>,
7102 ) -> Result<
7103 GetPredictionV1OrdersStatusOrderPubkeyResponse,
7104 ApiOpError<GetPredictionV1OrdersStatusOrderPubkeyApiError>,
7105 > {
7106 let request_url = format!(
7107 "{}{}",
7108 self.base_url,
7109 format!(
7110 "/prediction/v1/orders/status/{}",
7111 __pct_encode_path_segment(order_pubkey.as_ref())
7112 )
7113 );
7114 let mut req = self.http_client.get(request_url);
7115 if let Some(api_key) = &self.api_key {
7116 req = req.header("x-api-key", api_key.as_str());
7117 }
7118 for (name, value) in &self.custom_headers {
7119 if !name.eq_ignore_ascii_case("accept") {
7120 req = req.header(name, value);
7121 }
7122 }
7123 req = req.header(reqwest::header::ACCEPT, "application/json");
7124 let response = req.send().await?;
7125 let status = response.status();
7126 let status_code = status.as_u16();
7127 let headers = response.headers().clone();
7128 let body_bytes =
7129 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
7130 let raw_body = body_bytes;
7131 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
7132 if false || status_code == 200u16 {
7133 match serde_json::from_str(&body_text) {
7134 Ok(body) => Ok(body),
7135 Err(e) => Err(ApiOpError::Api(ApiError {
7136 status: status_code,
7137 headers: headers,
7138 body: body_text,
7139 raw_body,
7140 typed: None,
7141 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
7142 })),
7143 }
7144 } else if status.is_success() {
7145 Err(ApiOpError::Api(ApiError {
7146 status: status_code,
7147 headers,
7148 body: body_text,
7149 raw_body,
7150 typed: None,
7151 parse_error: Some(format!(
7152 "unexpected successful status {}; generated return type selects `{}`",
7153 status_code, "200",
7154 )),
7155 }))
7156 } else {
7157 let typed: Option<GetPredictionV1OrdersStatusOrderPubkeyApiError>;
7158 let parse_error: Option<String>;
7159 match status_code {
7160 400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
7161 Ok(v) => {
7162 typed = Some(GetPredictionV1OrdersStatusOrderPubkeyApiError::Status400(v));
7163 parse_error = None;
7164 }
7165 Err(e) => {
7166 typed = None;
7167 parse_error = Some(e.to_string());
7168 }
7169 },
7170 404u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
7171 Ok(v) => {
7172 typed = Some(GetPredictionV1OrdersStatusOrderPubkeyApiError::Status404(v));
7173 parse_error = None;
7174 }
7175 Err(e) => {
7176 typed = None;
7177 parse_error = Some(e.to_string());
7178 }
7179 },
7180 _ => {
7181 typed = None;
7182 parse_error = None;
7183 }
7184 }
7185 Err(ApiOpError::Api(ApiError {
7186 status: status_code,
7187 headers,
7188 body: body_text,
7189 raw_body,
7190 typed,
7191 parse_error,
7192 }))
7193 }
7194 }
7195 pub async fn get_prediction_v1_positions(
7197 &self,
7198 start: Option<i64>,
7199 end: Option<i64>,
7200 owner_pubkey: Option<impl AsRef<str>>,
7201 market_pubkey: Option<impl AsRef<str>>,
7202 market_id: Option<impl AsRef<str>>,
7203 is_yes: Option<GetPredictionV1PositionsIsYes>,
7204 ) -> Result<GetPredictionV1PositionsResponse, ApiOpError<GetPredictionV1PositionsApiError>>
7205 {
7206 let request_url = format!("{}{}", self.base_url, "/prediction/v1/positions");
7207 let mut req = self.http_client.get(request_url);
7208 {
7209 let mut query_params: Vec<(String, String)> = Vec::new();
7210 if let Some(v) = start {
7211 query_params.push(("start".to_string(), v.to_string()));
7212 }
7213 if let Some(v) = end {
7214 query_params.push(("end".to_string(), v.to_string()));
7215 }
7216 if let Some(v) = owner_pubkey {
7217 query_params.push(("ownerPubkey".to_string(), v.as_ref().to_string()));
7218 }
7219 if let Some(v) = market_pubkey {
7220 query_params.push(("marketPubkey".to_string(), v.as_ref().to_string()));
7221 }
7222 if let Some(v) = market_id {
7223 query_params.push(("marketId".to_string(), v.as_ref().to_string()));
7224 }
7225 if let Some(v) = is_yes {
7226 query_params.push(("isYes".to_string(), v.to_string()));
7227 }
7228 if !query_params.is_empty() {
7229 req = req.query(&query_params);
7230 }
7231 }
7232 if let Some(api_key) = &self.api_key {
7233 req = req.header("x-api-key", api_key.as_str());
7234 }
7235 for (name, value) in &self.custom_headers {
7236 if !name.eq_ignore_ascii_case("accept") {
7237 req = req.header(name, value);
7238 }
7239 }
7240 req = req.header(reqwest::header::ACCEPT, "application/json");
7241 let response = req.send().await?;
7242 let status = response.status();
7243 let status_code = status.as_u16();
7244 let headers = response.headers().clone();
7245 let body_bytes =
7246 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
7247 let raw_body = body_bytes;
7248 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
7249 if false || status_code == 200u16 {
7250 match serde_json::from_str(&body_text) {
7251 Ok(body) => Ok(body),
7252 Err(e) => Err(ApiOpError::Api(ApiError {
7253 status: status_code,
7254 headers: headers,
7255 body: body_text,
7256 raw_body,
7257 typed: None,
7258 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
7259 })),
7260 }
7261 } else if status.is_success() {
7262 Err(ApiOpError::Api(ApiError {
7263 status: status_code,
7264 headers,
7265 body: body_text,
7266 raw_body,
7267 typed: None,
7268 parse_error: Some(format!(
7269 "unexpected successful status {}; generated return type selects `{}`",
7270 status_code, "200",
7271 )),
7272 }))
7273 } else {
7274 let typed: Option<GetPredictionV1PositionsApiError>;
7275 let parse_error: Option<String>;
7276 match status_code {
7277 400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
7278 Ok(v) => {
7279 typed = Some(GetPredictionV1PositionsApiError::Status400(v));
7280 parse_error = None;
7281 }
7282 Err(e) => {
7283 typed = None;
7284 parse_error = Some(e.to_string());
7285 }
7286 },
7287 _ => {
7288 typed = None;
7289 parse_error = None;
7290 }
7291 }
7292 Err(ApiOpError::Api(ApiError {
7293 status: status_code,
7294 headers,
7295 body: body_text,
7296 raw_body,
7297 typed,
7298 parse_error,
7299 }))
7300 }
7301 }
7302 pub async fn get_prediction_v1_positions_position_pubkey(
7304 &self,
7305 position_pubkey: impl AsRef<str>,
7306 ) -> Result<PredictionPosition, ApiOpError<GetPredictionV1PositionsPositionPubkeyApiError>>
7307 {
7308 let request_url = format!(
7309 "{}{}",
7310 self.base_url,
7311 format!(
7312 "/prediction/v1/positions/{}",
7313 __pct_encode_path_segment(position_pubkey.as_ref())
7314 )
7315 );
7316 let mut req = self.http_client.get(request_url);
7317 if let Some(api_key) = &self.api_key {
7318 req = req.header("x-api-key", api_key.as_str());
7319 }
7320 for (name, value) in &self.custom_headers {
7321 if !name.eq_ignore_ascii_case("accept") {
7322 req = req.header(name, value);
7323 }
7324 }
7325 req = req.header(reqwest::header::ACCEPT, "application/json");
7326 let response = req.send().await?;
7327 let status = response.status();
7328 let status_code = status.as_u16();
7329 let headers = response.headers().clone();
7330 let body_bytes =
7331 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
7332 let raw_body = body_bytes;
7333 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
7334 if false || status_code == 200u16 {
7335 match serde_json::from_str(&body_text) {
7336 Ok(body) => Ok(body),
7337 Err(e) => Err(ApiOpError::Api(ApiError {
7338 status: status_code,
7339 headers: headers,
7340 body: body_text,
7341 raw_body,
7342 typed: None,
7343 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
7344 })),
7345 }
7346 } else if status.is_success() {
7347 Err(ApiOpError::Api(ApiError {
7348 status: status_code,
7349 headers,
7350 body: body_text,
7351 raw_body,
7352 typed: None,
7353 parse_error: Some(format!(
7354 "unexpected successful status {}; generated return type selects `{}`",
7355 status_code, "200",
7356 )),
7357 }))
7358 } else {
7359 let typed: Option<GetPredictionV1PositionsPositionPubkeyApiError>;
7360 let parse_error: Option<String>;
7361 match status_code {
7362 400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
7363 Ok(v) => {
7364 typed = Some(GetPredictionV1PositionsPositionPubkeyApiError::Status400(v));
7365 parse_error = None;
7366 }
7367 Err(e) => {
7368 typed = None;
7369 parse_error = Some(e.to_string());
7370 }
7371 },
7372 404u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
7373 Ok(v) => {
7374 typed = Some(GetPredictionV1PositionsPositionPubkeyApiError::Status404(v));
7375 parse_error = None;
7376 }
7377 Err(e) => {
7378 typed = None;
7379 parse_error = Some(e.to_string());
7380 }
7381 },
7382 _ => {
7383 typed = None;
7384 parse_error = None;
7385 }
7386 }
7387 Err(ApiOpError::Api(ApiError {
7388 status: status_code,
7389 headers,
7390 body: body_text,
7391 raw_body,
7392 typed,
7393 parse_error,
7394 }))
7395 }
7396 }
7397 pub async fn get_prediction_v1_profiles_owner_pubkey(
7399 &self,
7400 owner_pubkey: impl AsRef<str>,
7401 ) -> Result<
7402 GetPredictionV1ProfilesOwnerPubkeyResponse,
7403 ApiOpError<GetPredictionV1ProfilesOwnerPubkeyApiError>,
7404 > {
7405 let request_url = format!(
7406 "{}{}",
7407 self.base_url,
7408 format!(
7409 "/prediction/v1/profiles/{}",
7410 __pct_encode_path_segment(owner_pubkey.as_ref())
7411 )
7412 );
7413 let mut req = self.http_client.get(request_url);
7414 if let Some(api_key) = &self.api_key {
7415 req = req.header("x-api-key", api_key.as_str());
7416 }
7417 for (name, value) in &self.custom_headers {
7418 if !name.eq_ignore_ascii_case("accept") {
7419 req = req.header(name, value);
7420 }
7421 }
7422 req = req.header(reqwest::header::ACCEPT, "application/json");
7423 let response = req.send().await?;
7424 let status = response.status();
7425 let status_code = status.as_u16();
7426 let headers = response.headers().clone();
7427 let body_bytes =
7428 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
7429 let raw_body = body_bytes;
7430 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
7431 if false || status_code == 200u16 {
7432 match serde_json::from_str(&body_text) {
7433 Ok(body) => Ok(body),
7434 Err(e) => Err(ApiOpError::Api(ApiError {
7435 status: status_code,
7436 headers: headers,
7437 body: body_text,
7438 raw_body,
7439 typed: None,
7440 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
7441 })),
7442 }
7443 } else if status.is_success() {
7444 Err(ApiOpError::Api(ApiError {
7445 status: status_code,
7446 headers,
7447 body: body_text,
7448 raw_body,
7449 typed: None,
7450 parse_error: Some(format!(
7451 "unexpected successful status {}; generated return type selects `{}`",
7452 status_code, "200",
7453 )),
7454 }))
7455 } else {
7456 let typed: Option<GetPredictionV1ProfilesOwnerPubkeyApiError>;
7457 let parse_error: Option<String>;
7458 match status_code {
7459 404u16 => {
7460 match serde_json::from_str::<GetPredictionV1ProfilesOwnerPubkeyResponse404>(
7461 &body_text,
7462 ) {
7463 Ok(v) => {
7464 typed = Some(GetPredictionV1ProfilesOwnerPubkeyApiError::Status404(v));
7465 parse_error = None;
7466 }
7467 Err(e) => {
7468 typed = None;
7469 parse_error = Some(e.to_string());
7470 }
7471 }
7472 }
7473 _ => {
7474 typed = None;
7475 parse_error = None;
7476 }
7477 }
7478 Err(ApiOpError::Api(ApiError {
7479 status: status_code,
7480 headers,
7481 body: body_text,
7482 raw_body,
7483 typed,
7484 parse_error,
7485 }))
7486 }
7487 }
7488 pub async fn get_prediction_v1_profiles_owner_pubkey_pnl_history(
7490 &self,
7491 owner_pubkey: impl AsRef<str>,
7492 interval: Option<GetPredictionV1ProfilesOwnerPubkeyPnlHistoryInterval>,
7493 count: Option<i64>,
7494 ) -> Result<GetPredictionV1ProfilesOwnerPubkeyPnlHistoryResponse, ApiOpError<serde_json::Value>>
7495 {
7496 let request_url = format!(
7497 "{}{}",
7498 self.base_url,
7499 format!(
7500 "/prediction/v1/profiles/{}/pnl-history",
7501 __pct_encode_path_segment(owner_pubkey.as_ref())
7502 )
7503 );
7504 let mut req = self.http_client.get(request_url);
7505 {
7506 let mut query_params: Vec<(String, String)> = Vec::new();
7507 if let Some(v) = interval {
7508 query_params.push(("interval".to_string(), v.to_string()));
7509 }
7510 if let Some(v) = count {
7511 query_params.push(("count".to_string(), v.to_string()));
7512 }
7513 if !query_params.is_empty() {
7514 req = req.query(&query_params);
7515 }
7516 }
7517 if let Some(api_key) = &self.api_key {
7518 req = req.header("x-api-key", api_key.as_str());
7519 }
7520 for (name, value) in &self.custom_headers {
7521 if !name.eq_ignore_ascii_case("accept") {
7522 req = req.header(name, value);
7523 }
7524 }
7525 req = req.header(reqwest::header::ACCEPT, "application/json");
7526 let response = req.send().await?;
7527 let status = response.status();
7528 let status_code = status.as_u16();
7529 let headers = response.headers().clone();
7530 let body_bytes =
7531 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
7532 let raw_body = body_bytes;
7533 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
7534 if false || status_code == 200u16 {
7535 match serde_json::from_str(&body_text) {
7536 Ok(body) => Ok(body),
7537 Err(e) => Err(ApiOpError::Api(ApiError {
7538 status: status_code,
7539 headers: headers,
7540 body: body_text,
7541 raw_body,
7542 typed: None,
7543 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
7544 })),
7545 }
7546 } else if status.is_success() {
7547 Err(ApiOpError::Api(ApiError {
7548 status: status_code,
7549 headers,
7550 body: body_text,
7551 raw_body,
7552 typed: None,
7553 parse_error: Some(format!(
7554 "unexpected successful status {}; generated return type selects `{}`",
7555 status_code, "200",
7556 )),
7557 }))
7558 } else {
7559 let typed: Option<serde_json::Value>;
7560 let parse_error: Option<String>;
7561 match status_code {
7562 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
7563 Ok(v) => {
7564 typed = Some(v);
7565 parse_error = None;
7566 }
7567 Err(e) => {
7568 typed = None;
7569 parse_error = Some(e.to_string());
7570 }
7571 },
7572 }
7573 Err(ApiOpError::Api(ApiError {
7574 status: status_code,
7575 headers,
7576 body: body_text,
7577 raw_body,
7578 typed,
7579 parse_error,
7580 }))
7581 }
7582 }
7583 pub async fn get_prediction_v1_trades(
7585 &self,
7586 ) -> Result<GetPredictionV1TradesResponse, ApiOpError<serde_json::Value>> {
7587 let request_url = format!("{}{}", self.base_url, "/prediction/v1/trades");
7588 let mut req = self.http_client.get(request_url);
7589 if let Some(api_key) = &self.api_key {
7590 req = req.header("x-api-key", api_key.as_str());
7591 }
7592 for (name, value) in &self.custom_headers {
7593 if !name.eq_ignore_ascii_case("accept") {
7594 req = req.header(name, value);
7595 }
7596 }
7597 req = req.header(reqwest::header::ACCEPT, "application/json");
7598 let response = req.send().await?;
7599 let status = response.status();
7600 let status_code = status.as_u16();
7601 let headers = response.headers().clone();
7602 let body_bytes =
7603 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
7604 let raw_body = body_bytes;
7605 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
7606 if false || status_code == 200u16 {
7607 match serde_json::from_str(&body_text) {
7608 Ok(body) => Ok(body),
7609 Err(e) => Err(ApiOpError::Api(ApiError {
7610 status: status_code,
7611 headers: headers,
7612 body: body_text,
7613 raw_body,
7614 typed: None,
7615 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
7616 })),
7617 }
7618 } else if status.is_success() {
7619 Err(ApiOpError::Api(ApiError {
7620 status: status_code,
7621 headers,
7622 body: body_text,
7623 raw_body,
7624 typed: None,
7625 parse_error: Some(format!(
7626 "unexpected successful status {}; generated return type selects `{}`",
7627 status_code, "200",
7628 )),
7629 }))
7630 } else {
7631 let typed: Option<serde_json::Value>;
7632 let parse_error: Option<String>;
7633 match status_code {
7634 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
7635 Ok(v) => {
7636 typed = Some(v);
7637 parse_error = None;
7638 }
7639 Err(e) => {
7640 typed = None;
7641 parse_error = Some(e.to_string());
7642 }
7643 },
7644 }
7645 Err(ApiOpError::Api(ApiError {
7646 status: status_code,
7647 headers,
7648 body: body_text,
7649 raw_body,
7650 typed,
7651 parse_error,
7652 }))
7653 }
7654 }
7655 pub async fn get_prediction_v1_trading_status(
7657 &self,
7658 ) -> Result<PredictionTradingStatusResponse, ApiOpError<serde_json::Value>> {
7659 let request_url = format!("{}{}", self.base_url, "/prediction/v1/trading-status");
7660 let mut req = self.http_client.get(request_url);
7661 if let Some(api_key) = &self.api_key {
7662 req = req.header("x-api-key", api_key.as_str());
7663 }
7664 for (name, value) in &self.custom_headers {
7665 if !name.eq_ignore_ascii_case("accept") {
7666 req = req.header(name, value);
7667 }
7668 }
7669 req = req.header(reqwest::header::ACCEPT, "application/json");
7670 let response = req.send().await?;
7671 let status = response.status();
7672 let status_code = status.as_u16();
7673 let headers = response.headers().clone();
7674 let body_bytes =
7675 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
7676 let raw_body = body_bytes;
7677 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
7678 if false || status_code == 200u16 {
7679 match serde_json::from_str(&body_text) {
7680 Ok(body) => Ok(body),
7681 Err(e) => Err(ApiOpError::Api(ApiError {
7682 status: status_code,
7683 headers: headers,
7684 body: body_text,
7685 raw_body,
7686 typed: None,
7687 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
7688 })),
7689 }
7690 } else if status.is_success() {
7691 Err(ApiOpError::Api(ApiError {
7692 status: status_code,
7693 headers,
7694 body: body_text,
7695 raw_body,
7696 typed: None,
7697 parse_error: Some(format!(
7698 "unexpected successful status {}; generated return type selects `{}`",
7699 status_code, "200",
7700 )),
7701 }))
7702 } else {
7703 let typed: Option<serde_json::Value>;
7704 let parse_error: Option<String>;
7705 match status_code {
7706 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
7707 Ok(v) => {
7708 typed = Some(v);
7709 parse_error = None;
7710 }
7711 Err(e) => {
7712 typed = None;
7713 parse_error = Some(e.to_string());
7714 }
7715 },
7716 }
7717 Err(ApiOpError::Api(ApiError {
7718 status: status_code,
7719 headers,
7720 body: body_text,
7721 raw_body,
7722 typed,
7723 parse_error,
7724 }))
7725 }
7726 }
7727 pub async fn get_prediction_v1_vault_info(
7729 &self,
7730 ) -> Result<GetPredictionV1VaultInfoResponse, ApiOpError<GetPredictionV1VaultInfoApiError>>
7731 {
7732 let request_url = format!("{}{}", self.base_url, "/prediction/v1/vault-info");
7733 let mut req = self.http_client.get(request_url);
7734 if let Some(api_key) = &self.api_key {
7735 req = req.header("x-api-key", api_key.as_str());
7736 }
7737 for (name, value) in &self.custom_headers {
7738 if !name.eq_ignore_ascii_case("accept") {
7739 req = req.header(name, value);
7740 }
7741 }
7742 req = req.header(reqwest::header::ACCEPT, "application/json");
7743 let response = req.send().await?;
7744 let status = response.status();
7745 let status_code = status.as_u16();
7746 let headers = response.headers().clone();
7747 let body_bytes =
7748 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
7749 let raw_body = body_bytes;
7750 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
7751 if false || status_code == 200u16 {
7752 match serde_json::from_str(&body_text) {
7753 Ok(body) => Ok(body),
7754 Err(e) => Err(ApiOpError::Api(ApiError {
7755 status: status_code,
7756 headers: headers,
7757 body: body_text,
7758 raw_body,
7759 typed: None,
7760 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
7761 })),
7762 }
7763 } else if status.is_success() {
7764 Err(ApiOpError::Api(ApiError {
7765 status: status_code,
7766 headers,
7767 body: body_text,
7768 raw_body,
7769 typed: None,
7770 parse_error: Some(format!(
7771 "unexpected successful status {}; generated return type selects `{}`",
7772 status_code, "200",
7773 )),
7774 }))
7775 } else {
7776 let typed: Option<GetPredictionV1VaultInfoApiError>;
7777 let parse_error: Option<String>;
7778 match status_code {
7779 404u16 => {
7780 match serde_json::from_str::<GetPredictionV1VaultInfoResponse404>(&body_text) {
7781 Ok(v) => {
7782 typed = Some(GetPredictionV1VaultInfoApiError::Status404(v));
7783 parse_error = None;
7784 }
7785 Err(e) => {
7786 typed = None;
7787 parse_error = Some(e.to_string());
7788 }
7789 }
7790 }
7791 _ => {
7792 typed = None;
7793 parse_error = None;
7794 }
7795 }
7796 Err(ApiOpError::Api(ApiError {
7797 status: status_code,
7798 headers,
7799 body: body_text,
7800 raw_body,
7801 typed,
7802 parse_error,
7803 }))
7804 }
7805 }
7806 pub async fn get_price_v2(
7812 &self,
7813 ids: impl AsRef<str>,
7814 vs_token: Option<impl AsRef<str>>,
7815 show_extra_info: Option<impl AsRef<str>>,
7816 ) -> Result<PriceV2PriceResponse, ApiOpError<serde_json::Value>> {
7817 let request_url = format!("{}{}", self.base_url, "/price/v2/");
7818 let mut req = self.http_client.get(request_url);
7819 {
7820 let mut query_params: Vec<(String, String)> = Vec::new();
7821 query_params.push(("ids".to_string(), ids.as_ref().to_string()));
7822 if let Some(v) = vs_token {
7823 query_params.push(("vsToken".to_string(), v.as_ref().to_string()));
7824 }
7825 if let Some(v) = show_extra_info {
7826 query_params.push(("showExtraInfo".to_string(), v.as_ref().to_string()));
7827 }
7828 if !query_params.is_empty() {
7829 req = req.query(&query_params);
7830 }
7831 }
7832 if let Some(api_key) = &self.api_key {
7833 req = req.header("x-api-key", api_key.as_str());
7834 }
7835 for (name, value) in &self.custom_headers {
7836 if !name.eq_ignore_ascii_case("accept") {
7837 req = req.header(name, value);
7838 }
7839 }
7840 req = req.header(reqwest::header::ACCEPT, "application/json");
7841 let response = req.send().await?;
7842 let status = response.status();
7843 let status_code = status.as_u16();
7844 let headers = response.headers().clone();
7845 let body_bytes =
7846 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
7847 let raw_body = body_bytes;
7848 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
7849 if false || status_code == 200u16 {
7850 match serde_json::from_str(&body_text) {
7851 Ok(body) => Ok(body),
7852 Err(e) => Err(ApiOpError::Api(ApiError {
7853 status: status_code,
7854 headers: headers,
7855 body: body_text,
7856 raw_body,
7857 typed: None,
7858 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
7859 })),
7860 }
7861 } else if status.is_success() {
7862 Err(ApiOpError::Api(ApiError {
7863 status: status_code,
7864 headers,
7865 body: body_text,
7866 raw_body,
7867 typed: None,
7868 parse_error: Some(format!(
7869 "unexpected successful status {}; generated return type selects `{}`",
7870 status_code, "200",
7871 )),
7872 }))
7873 } else {
7874 let typed: Option<serde_json::Value>;
7875 let parse_error: Option<String>;
7876 match status_code {
7877 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
7878 Ok(v) => {
7879 typed = Some(v);
7880 parse_error = None;
7881 }
7882 Err(e) => {
7883 typed = None;
7884 parse_error = Some(e.to_string());
7885 }
7886 },
7887 }
7888 Err(ApiOpError::Api(ApiError {
7889 status: status_code,
7890 headers,
7891 body: body_text,
7892 raw_body,
7893 typed,
7894 parse_error,
7895 }))
7896 }
7897 }
7898 pub async fn get_price_v3(
7904 &self,
7905 ids: impl AsRef<str>,
7906 ) -> Result<GetPriceV3Response, ApiOpError<serde_json::Value>> {
7907 let request_url = format!("{}{}", self.base_url, "/price/v3");
7908 let mut req = self.http_client.get(request_url);
7909 {
7910 let mut query_params: Vec<(String, String)> = Vec::new();
7911 query_params.push(("ids".to_string(), ids.as_ref().to_string()));
7912 if !query_params.is_empty() {
7913 req = req.query(&query_params);
7914 }
7915 }
7916 if let Some(api_key) = &self.api_key {
7917 req = req.header("x-api-key", api_key.as_str());
7918 }
7919 for (name, value) in &self.custom_headers {
7920 if !name.eq_ignore_ascii_case("accept") {
7921 req = req.header(name, value);
7922 }
7923 }
7924 req = req.header(reqwest::header::ACCEPT, "application/json");
7925 let response = req.send().await?;
7926 let status = response.status();
7927 let status_code = status.as_u16();
7928 let headers = response.headers().clone();
7929 let body_bytes =
7930 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
7931 let raw_body = body_bytes;
7932 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
7933 if false || status_code == 200u16 {
7934 match serde_json::from_str(&body_text) {
7935 Ok(body) => Ok(body),
7936 Err(e) => Err(ApiOpError::Api(ApiError {
7937 status: status_code,
7938 headers: headers,
7939 body: body_text,
7940 raw_body,
7941 typed: None,
7942 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
7943 })),
7944 }
7945 } else if status.is_success() {
7946 Err(ApiOpError::Api(ApiError {
7947 status: status_code,
7948 headers,
7949 body: body_text,
7950 raw_body,
7951 typed: None,
7952 parse_error: Some(format!(
7953 "unexpected successful status {}; generated return type selects `{}`",
7954 status_code, "200",
7955 )),
7956 }))
7957 } else {
7958 let typed: Option<serde_json::Value>;
7959 let parse_error: Option<String>;
7960 match status_code {
7961 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
7962 Ok(v) => {
7963 typed = Some(v);
7964 parse_error = None;
7965 }
7966 Err(e) => {
7967 typed = None;
7968 parse_error = Some(e.to_string());
7969 }
7970 },
7971 }
7972 Err(ApiOpError::Api(ApiError {
7973 status: status_code,
7974 headers,
7975 body: body_text,
7976 raw_body,
7977 typed,
7978 parse_error,
7979 }))
7980 }
7981 }
7982 pub async fn get_recurring_v1_get_recurring_orders(
7986 &self,
7987 recurring_type: RecurringRecurringOrderType,
7988 order_status: RecurringOrderState,
7989 user: impl AsRef<str>,
7990 page: i64,
7991 mint: impl AsRef<str>,
7992 include_failed_tx: bool,
7993 ) -> Result<RecurringGetRecurringOrderResponse, ApiOpError<serde_json::Value>> {
7994 let request_url = format!("{}{}", self.base_url, "/recurring/v1/getRecurringOrders");
7995 let mut req = self.http_client.get(request_url);
7996 {
7997 let mut query_params: Vec<(String, String)> = Vec::new();
7998 query_params.push(("recurringType".to_string(), recurring_type.to_string()));
7999 query_params.push(("orderStatus".to_string(), order_status.to_string()));
8000 query_params.push(("user".to_string(), user.as_ref().to_string()));
8001 query_params.push(("page".to_string(), page.to_string()));
8002 query_params.push(("mint".to_string(), mint.as_ref().to_string()));
8003 query_params.push(("includeFailedTx".to_string(), include_failed_tx.to_string()));
8004 if !query_params.is_empty() {
8005 req = req.query(&query_params);
8006 }
8007 }
8008 if let Some(api_key) = &self.api_key {
8009 req = req.header("x-api-key", api_key.as_str());
8010 }
8011 for (name, value) in &self.custom_headers {
8012 if !name.eq_ignore_ascii_case("accept") {
8013 req = req.header(name, value);
8014 }
8015 }
8016 req = req.header(reqwest::header::ACCEPT, "application/json");
8017 let response = req.send().await?;
8018 let status = response.status();
8019 let status_code = status.as_u16();
8020 let headers = response.headers().clone();
8021 let body_bytes =
8022 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
8023 let raw_body = body_bytes;
8024 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
8025 if false || status_code == 200u16 {
8026 match serde_json::from_str(&body_text) {
8027 Ok(body) => Ok(body),
8028 Err(e) => Err(ApiOpError::Api(ApiError {
8029 status: status_code,
8030 headers: headers,
8031 body: body_text,
8032 raw_body,
8033 typed: None,
8034 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
8035 })),
8036 }
8037 } else if status.is_success() {
8038 Err(ApiOpError::Api(ApiError {
8039 status: status_code,
8040 headers,
8041 body: body_text,
8042 raw_body,
8043 typed: None,
8044 parse_error: Some(format!(
8045 "unexpected successful status {}; generated return type selects `{}`",
8046 status_code, "200",
8047 )),
8048 }))
8049 } else {
8050 let typed: Option<serde_json::Value>;
8051 let parse_error: Option<String>;
8052 match status_code {
8053 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
8054 Ok(v) => {
8055 typed = Some(v);
8056 parse_error = None;
8057 }
8058 Err(e) => {
8059 typed = None;
8060 parse_error = Some(e.to_string());
8061 }
8062 },
8063 }
8064 Err(ApiOpError::Api(ApiError {
8065 status: status_code,
8066 headers,
8067 body: body_text,
8068 raw_body,
8069 typed,
8070 parse_error,
8071 }))
8072 }
8073 }
8074 pub async fn get_send_v1_invite_history(
8080 &self,
8081 address: impl AsRef<str>,
8082 page: Option<i64>,
8083 ) -> Result<SendInviteDataResponse, ApiOpError<GetSendV1InviteHistoryApiError>> {
8084 let request_url = format!("{}{}", self.base_url, "/send/v1/invite-history");
8085 let mut req = self.http_client.get(request_url);
8086 {
8087 let mut query_params: Vec<(String, String)> = Vec::new();
8088 query_params.push(("address".to_string(), address.as_ref().to_string()));
8089 if let Some(v) = page {
8090 query_params.push(("page".to_string(), v.to_string()));
8091 }
8092 if !query_params.is_empty() {
8093 req = req.query(&query_params);
8094 }
8095 }
8096 if let Some(api_key) = &self.api_key {
8097 req = req.header("x-api-key", api_key.as_str());
8098 }
8099 for (name, value) in &self.custom_headers {
8100 if !name.eq_ignore_ascii_case("accept") {
8101 req = req.header(name, value);
8102 }
8103 }
8104 req = req.header(reqwest::header::ACCEPT, "application/json");
8105 let response = req.send().await?;
8106 let status = response.status();
8107 let status_code = status.as_u16();
8108 let headers = response.headers().clone();
8109 let body_bytes =
8110 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
8111 let raw_body = body_bytes;
8112 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
8113 if false || status_code == 200u16 {
8114 match serde_json::from_str(&body_text) {
8115 Ok(body) => Ok(body),
8116 Err(e) => Err(ApiOpError::Api(ApiError {
8117 status: status_code,
8118 headers: headers,
8119 body: body_text,
8120 raw_body,
8121 typed: None,
8122 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
8123 })),
8124 }
8125 } else if status.is_success() {
8126 Err(ApiOpError::Api(ApiError {
8127 status: status_code,
8128 headers,
8129 body: body_text,
8130 raw_body,
8131 typed: None,
8132 parse_error: Some(format!(
8133 "unexpected successful status {}; generated return type selects `{}`",
8134 status_code, "200",
8135 )),
8136 }))
8137 } else {
8138 let typed: Option<GetSendV1InviteHistoryApiError>;
8139 let parse_error: Option<String>;
8140 match status_code {
8141 400u16 => {
8142 match serde_json::from_str::<GetSendV1InviteHistoryResponse400>(&body_text) {
8143 Ok(v) => {
8144 typed = Some(GetSendV1InviteHistoryApiError::Status400(v));
8145 parse_error = None;
8146 }
8147 Err(e) => {
8148 typed = None;
8149 parse_error = Some(e.to_string());
8150 }
8151 }
8152 }
8153 500u16 => {
8154 match serde_json::from_str::<GetSendV1InviteHistoryResponse500>(&body_text) {
8155 Ok(v) => {
8156 typed = Some(GetSendV1InviteHistoryApiError::Status500(v));
8157 parse_error = None;
8158 }
8159 Err(e) => {
8160 typed = None;
8161 parse_error = Some(e.to_string());
8162 }
8163 }
8164 }
8165 _ => {
8166 typed = None;
8167 parse_error = None;
8168 }
8169 }
8170 Err(ApiOpError::Api(ApiError {
8171 status: status_code,
8172 headers,
8173 body: body_text,
8174 raw_body,
8175 typed,
8176 parse_error,
8177 }))
8178 }
8179 }
8180 pub async fn get_send_v1_pending_invites(
8186 &self,
8187 address: impl AsRef<str>,
8188 page: Option<i64>,
8189 ) -> Result<SendInviteDataResponse, ApiOpError<GetSendV1PendingInvitesApiError>> {
8190 let request_url = format!("{}{}", self.base_url, "/send/v1/pending-invites");
8191 let mut req = self.http_client.get(request_url);
8192 {
8193 let mut query_params: Vec<(String, String)> = Vec::new();
8194 query_params.push(("address".to_string(), address.as_ref().to_string()));
8195 if let Some(v) = page {
8196 query_params.push(("page".to_string(), v.to_string()));
8197 }
8198 if !query_params.is_empty() {
8199 req = req.query(&query_params);
8200 }
8201 }
8202 if let Some(api_key) = &self.api_key {
8203 req = req.header("x-api-key", api_key.as_str());
8204 }
8205 for (name, value) in &self.custom_headers {
8206 if !name.eq_ignore_ascii_case("accept") {
8207 req = req.header(name, value);
8208 }
8209 }
8210 req = req.header(reqwest::header::ACCEPT, "application/json");
8211 let response = req.send().await?;
8212 let status = response.status();
8213 let status_code = status.as_u16();
8214 let headers = response.headers().clone();
8215 let body_bytes =
8216 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
8217 let raw_body = body_bytes;
8218 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
8219 if false || status_code == 200u16 {
8220 match serde_json::from_str(&body_text) {
8221 Ok(body) => Ok(body),
8222 Err(e) => Err(ApiOpError::Api(ApiError {
8223 status: status_code,
8224 headers: headers,
8225 body: body_text,
8226 raw_body,
8227 typed: None,
8228 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
8229 })),
8230 }
8231 } else if status.is_success() {
8232 Err(ApiOpError::Api(ApiError {
8233 status: status_code,
8234 headers,
8235 body: body_text,
8236 raw_body,
8237 typed: None,
8238 parse_error: Some(format!(
8239 "unexpected successful status {}; generated return type selects `{}`",
8240 status_code, "200",
8241 )),
8242 }))
8243 } else {
8244 let typed: Option<GetSendV1PendingInvitesApiError>;
8245 let parse_error: Option<String>;
8246 match status_code {
8247 400u16 => {
8248 match serde_json::from_str::<GetSendV1PendingInvitesResponse400>(&body_text) {
8249 Ok(v) => {
8250 typed = Some(GetSendV1PendingInvitesApiError::Status400(v));
8251 parse_error = None;
8252 }
8253 Err(e) => {
8254 typed = None;
8255 parse_error = Some(e.to_string());
8256 }
8257 }
8258 }
8259 500u16 => {
8260 match serde_json::from_str::<GetSendV1PendingInvitesResponse500>(&body_text) {
8261 Ok(v) => {
8262 typed = Some(GetSendV1PendingInvitesApiError::Status500(v));
8263 parse_error = None;
8264 }
8265 Err(e) => {
8266 typed = None;
8267 parse_error = Some(e.to_string());
8268 }
8269 }
8270 }
8271 _ => {
8272 typed = None;
8273 parse_error = None;
8274 }
8275 }
8276 Err(ApiOpError::Api(ApiError {
8277 status: status_code,
8278 headers,
8279 body: body_text,
8280 raw_body,
8281 typed,
8282 parse_error,
8283 }))
8284 }
8285 }
8286 pub async fn get_studio_v1_dbc_pool_addresses_mint(
8292 &self,
8293 mint: impl AsRef<str>,
8294 ) -> Result<
8295 GetStudioV1DbcPoolAddressesMintResponse,
8296 ApiOpError<GetStudioV1DbcPoolAddressesMintApiError>,
8297 > {
8298 let request_url = format!(
8299 "{}{}",
8300 self.base_url,
8301 format!(
8302 "/studio/v1/dbc-pool/addresses/{}",
8303 __pct_encode_path_segment(mint.as_ref())
8304 )
8305 );
8306 let mut req = self.http_client.get(request_url);
8307 if let Some(api_key) = &self.api_key {
8308 req = req.header("x-api-key", api_key.as_str());
8309 }
8310 for (name, value) in &self.custom_headers {
8311 if !name.eq_ignore_ascii_case("accept") {
8312 req = req.header(name, value);
8313 }
8314 }
8315 req = req.header(reqwest::header::ACCEPT, "application/json");
8316 let response = req.send().await?;
8317 let status = response.status();
8318 let status_code = status.as_u16();
8319 let headers = response.headers().clone();
8320 let body_bytes =
8321 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
8322 let raw_body = body_bytes;
8323 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
8324 if false || status_code == 200u16 {
8325 match serde_json::from_str(&body_text) {
8326 Ok(body) => Ok(body),
8327 Err(e) => Err(ApiOpError::Api(ApiError {
8328 status: status_code,
8329 headers: headers,
8330 body: body_text,
8331 raw_body,
8332 typed: None,
8333 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
8334 })),
8335 }
8336 } else if status.is_success() {
8337 Err(ApiOpError::Api(ApiError {
8338 status: status_code,
8339 headers,
8340 body: body_text,
8341 raw_body,
8342 typed: None,
8343 parse_error: Some(format!(
8344 "unexpected successful status {}; generated return type selects `{}`",
8345 status_code, "200",
8346 )),
8347 }))
8348 } else {
8349 let typed: Option<GetStudioV1DbcPoolAddressesMintApiError>;
8350 let parse_error: Option<String>;
8351 match status_code {
8352 400u16 => {
8353 match serde_json::from_str::<GetStudioV1DbcPoolAddressesMintResponse400>(
8354 &body_text,
8355 ) {
8356 Ok(v) => {
8357 typed = Some(GetStudioV1DbcPoolAddressesMintApiError::Status400(v));
8358 parse_error = None;
8359 }
8360 Err(e) => {
8361 typed = None;
8362 parse_error = Some(e.to_string());
8363 }
8364 }
8365 }
8366 404u16 => {
8367 match serde_json::from_str::<GetStudioV1DbcPoolAddressesMintResponse404>(
8368 &body_text,
8369 ) {
8370 Ok(v) => {
8371 typed = Some(GetStudioV1DbcPoolAddressesMintApiError::Status404(v));
8372 parse_error = None;
8373 }
8374 Err(e) => {
8375 typed = None;
8376 parse_error = Some(e.to_string());
8377 }
8378 }
8379 }
8380 500u16 => {
8381 match serde_json::from_str::<GetStudioV1DbcPoolAddressesMintResponse500>(
8382 &body_text,
8383 ) {
8384 Ok(v) => {
8385 typed = Some(GetStudioV1DbcPoolAddressesMintApiError::Status500(v));
8386 parse_error = None;
8387 }
8388 Err(e) => {
8389 typed = None;
8390 parse_error = Some(e.to_string());
8391 }
8392 }
8393 }
8394 _ => {
8395 typed = None;
8396 parse_error = None;
8397 }
8398 }
8399 Err(ApiOpError::Api(ApiError {
8400 status: status_code,
8401 headers,
8402 body: body_text,
8403 raw_body,
8404 typed,
8405 parse_error,
8406 }))
8407 }
8408 }
8409 pub async fn get_tokens_v1_all(
8415 &self,
8416 ) -> Result<GetTokensV1AllResponse, ApiOpError<serde_json::Value>> {
8417 let request_url = format!("{}{}", self.base_url, "/tokens/v1/all");
8418 let mut req = self.http_client.get(request_url);
8419 if let Some(api_key) = &self.api_key {
8420 req = req.header("x-api-key", api_key.as_str());
8421 }
8422 for (name, value) in &self.custom_headers {
8423 if !name.eq_ignore_ascii_case("accept") {
8424 req = req.header(name, value);
8425 }
8426 }
8427 req = req.header(reqwest::header::ACCEPT, "application/json");
8428 let response = req.send().await?;
8429 let status = response.status();
8430 let status_code = status.as_u16();
8431 let headers = response.headers().clone();
8432 let body_bytes =
8433 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
8434 let raw_body = body_bytes;
8435 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
8436 if false || status_code == 200u16 {
8437 match serde_json::from_str(&body_text) {
8438 Ok(body) => Ok(body),
8439 Err(e) => Err(ApiOpError::Api(ApiError {
8440 status: status_code,
8441 headers: headers,
8442 body: body_text,
8443 raw_body,
8444 typed: None,
8445 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
8446 })),
8447 }
8448 } else if status.is_success() {
8449 Err(ApiOpError::Api(ApiError {
8450 status: status_code,
8451 headers,
8452 body: body_text,
8453 raw_body,
8454 typed: None,
8455 parse_error: Some(format!(
8456 "unexpected successful status {}; generated return type selects `{}`",
8457 status_code, "200",
8458 )),
8459 }))
8460 } else {
8461 let typed: Option<serde_json::Value>;
8462 let parse_error: Option<String>;
8463 match status_code {
8464 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
8465 Ok(v) => {
8466 typed = Some(v);
8467 parse_error = None;
8468 }
8469 Err(e) => {
8470 typed = None;
8471 parse_error = Some(e.to_string());
8472 }
8473 },
8474 }
8475 Err(ApiOpError::Api(ApiError {
8476 status: status_code,
8477 headers,
8478 body: body_text,
8479 raw_body,
8480 typed,
8481 parse_error,
8482 }))
8483 }
8484 }
8485 pub async fn get_tokens_v1_market_market_address_mints(
8491 &self,
8492 market_address: impl AsRef<str>,
8493 ) -> Result<GetTokensV1MarketMarketAddressMintsResponse, ApiOpError<serde_json::Value>> {
8494 let request_url = format!(
8495 "{}{}",
8496 self.base_url,
8497 format!(
8498 "/tokens/v1/market/{}/mints",
8499 __pct_encode_path_segment(market_address.as_ref())
8500 )
8501 );
8502 let mut req = self.http_client.get(request_url);
8503 if let Some(api_key) = &self.api_key {
8504 req = req.header("x-api-key", api_key.as_str());
8505 }
8506 for (name, value) in &self.custom_headers {
8507 if !name.eq_ignore_ascii_case("accept") {
8508 req = req.header(name, value);
8509 }
8510 }
8511 req = req.header(reqwest::header::ACCEPT, "application/json");
8512 let response = req.send().await?;
8513 let status = response.status();
8514 let status_code = status.as_u16();
8515 let headers = response.headers().clone();
8516 let body_bytes =
8517 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
8518 let raw_body = body_bytes;
8519 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
8520 if false || status_code == 200u16 {
8521 match serde_json::from_str(&body_text) {
8522 Ok(body) => Ok(body),
8523 Err(e) => Err(ApiOpError::Api(ApiError {
8524 status: status_code,
8525 headers: headers,
8526 body: body_text,
8527 raw_body,
8528 typed: None,
8529 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
8530 })),
8531 }
8532 } else if status.is_success() {
8533 Err(ApiOpError::Api(ApiError {
8534 status: status_code,
8535 headers,
8536 body: body_text,
8537 raw_body,
8538 typed: None,
8539 parse_error: Some(format!(
8540 "unexpected successful status {}; generated return type selects `{}`",
8541 status_code, "200",
8542 )),
8543 }))
8544 } else {
8545 let typed: Option<serde_json::Value>;
8546 let parse_error: Option<String>;
8547 match status_code {
8548 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
8549 Ok(v) => {
8550 typed = Some(v);
8551 parse_error = None;
8552 }
8553 Err(e) => {
8554 typed = None;
8555 parse_error = Some(e.to_string());
8556 }
8557 },
8558 }
8559 Err(ApiOpError::Api(ApiError {
8560 status: status_code,
8561 headers,
8562 body: body_text,
8563 raw_body,
8564 typed,
8565 parse_error,
8566 }))
8567 }
8568 }
8569 pub async fn get_tokens_v1_mints_tradable(
8575 &self,
8576 ) -> Result<GetTokensV1MintsTradableResponse, ApiOpError<serde_json::Value>> {
8577 let request_url = format!("{}{}", self.base_url, "/tokens/v1/mints/tradable");
8578 let mut req = self.http_client.get(request_url);
8579 if let Some(api_key) = &self.api_key {
8580 req = req.header("x-api-key", api_key.as_str());
8581 }
8582 for (name, value) in &self.custom_headers {
8583 if !name.eq_ignore_ascii_case("accept") {
8584 req = req.header(name, value);
8585 }
8586 }
8587 req = req.header(reqwest::header::ACCEPT, "application/json");
8588 let response = req.send().await?;
8589 let status = response.status();
8590 let status_code = status.as_u16();
8591 let headers = response.headers().clone();
8592 let body_bytes =
8593 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
8594 let raw_body = body_bytes;
8595 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
8596 if false || status_code == 200u16 {
8597 match serde_json::from_str(&body_text) {
8598 Ok(body) => Ok(body),
8599 Err(e) => Err(ApiOpError::Api(ApiError {
8600 status: status_code,
8601 headers: headers,
8602 body: body_text,
8603 raw_body,
8604 typed: None,
8605 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
8606 })),
8607 }
8608 } else if status.is_success() {
8609 Err(ApiOpError::Api(ApiError {
8610 status: status_code,
8611 headers,
8612 body: body_text,
8613 raw_body,
8614 typed: None,
8615 parse_error: Some(format!(
8616 "unexpected successful status {}; generated return type selects `{}`",
8617 status_code, "200",
8618 )),
8619 }))
8620 } else {
8621 let typed: Option<serde_json::Value>;
8622 let parse_error: Option<String>;
8623 match status_code {
8624 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
8625 Ok(v) => {
8626 typed = Some(v);
8627 parse_error = None;
8628 }
8629 Err(e) => {
8630 typed = None;
8631 parse_error = Some(e.to_string());
8632 }
8633 },
8634 }
8635 Err(ApiOpError::Api(ApiError {
8636 status: status_code,
8637 headers,
8638 body: body_text,
8639 raw_body,
8640 typed,
8641 parse_error,
8642 }))
8643 }
8644 }
8645 pub async fn get_tokens_v1_new(
8651 &self,
8652 limit: Option<i64>,
8653 offset: Option<i64>,
8654 ) -> Result<GetTokensV1NewResponse, ApiOpError<serde_json::Value>> {
8655 let request_url = format!("{}{}", self.base_url, "/tokens/v1/new");
8656 let mut req = self.http_client.get(request_url);
8657 {
8658 let mut query_params: Vec<(String, String)> = Vec::new();
8659 if let Some(v) = limit {
8660 query_params.push(("limit".to_string(), v.to_string()));
8661 }
8662 if let Some(v) = offset {
8663 query_params.push(("offset".to_string(), v.to_string()));
8664 }
8665 if !query_params.is_empty() {
8666 req = req.query(&query_params);
8667 }
8668 }
8669 if let Some(api_key) = &self.api_key {
8670 req = req.header("x-api-key", api_key.as_str());
8671 }
8672 for (name, value) in &self.custom_headers {
8673 if !name.eq_ignore_ascii_case("accept") {
8674 req = req.header(name, value);
8675 }
8676 }
8677 req = req.header(reqwest::header::ACCEPT, "application/json");
8678 let response = req.send().await?;
8679 let status = response.status();
8680 let status_code = status.as_u16();
8681 let headers = response.headers().clone();
8682 let body_bytes =
8683 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
8684 let raw_body = body_bytes;
8685 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
8686 if false || status_code == 200u16 {
8687 match serde_json::from_str(&body_text) {
8688 Ok(body) => Ok(body),
8689 Err(e) => Err(ApiOpError::Api(ApiError {
8690 status: status_code,
8691 headers: headers,
8692 body: body_text,
8693 raw_body,
8694 typed: None,
8695 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
8696 })),
8697 }
8698 } else if status.is_success() {
8699 Err(ApiOpError::Api(ApiError {
8700 status: status_code,
8701 headers,
8702 body: body_text,
8703 raw_body,
8704 typed: None,
8705 parse_error: Some(format!(
8706 "unexpected successful status {}; generated return type selects `{}`",
8707 status_code, "200",
8708 )),
8709 }))
8710 } else {
8711 let typed: Option<serde_json::Value>;
8712 let parse_error: Option<String>;
8713 match status_code {
8714 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
8715 Ok(v) => {
8716 typed = Some(v);
8717 parse_error = None;
8718 }
8719 Err(e) => {
8720 typed = None;
8721 parse_error = Some(e.to_string());
8722 }
8723 },
8724 }
8725 Err(ApiOpError::Api(ApiError {
8726 status: status_code,
8727 headers,
8728 body: body_text,
8729 raw_body,
8730 typed,
8731 parse_error,
8732 }))
8733 }
8734 }
8735 pub async fn get_tokens_v1_tagged_tag(
8741 &self,
8742 tag: impl AsRef<str>,
8743 ) -> Result<TokensV1MintIncludingDuplicates, ApiOpError<serde_json::Value>> {
8744 let request_url = format!(
8745 "{}{}",
8746 self.base_url,
8747 format!(
8748 "/tokens/v1/tagged/{}",
8749 __pct_encode_path_segment(tag.as_ref())
8750 )
8751 );
8752 let mut req = self.http_client.get(request_url);
8753 if let Some(api_key) = &self.api_key {
8754 req = req.header("x-api-key", api_key.as_str());
8755 }
8756 for (name, value) in &self.custom_headers {
8757 if !name.eq_ignore_ascii_case("accept") {
8758 req = req.header(name, value);
8759 }
8760 }
8761 req = req.header(reqwest::header::ACCEPT, "application/json");
8762 let response = req.send().await?;
8763 let status = response.status();
8764 let status_code = status.as_u16();
8765 let headers = response.headers().clone();
8766 let body_bytes =
8767 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
8768 let raw_body = body_bytes;
8769 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
8770 if false || status_code == 200u16 {
8771 match serde_json::from_str(&body_text) {
8772 Ok(body) => Ok(body),
8773 Err(e) => Err(ApiOpError::Api(ApiError {
8774 status: status_code,
8775 headers: headers,
8776 body: body_text,
8777 raw_body,
8778 typed: None,
8779 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
8780 })),
8781 }
8782 } else if status.is_success() {
8783 Err(ApiOpError::Api(ApiError {
8784 status: status_code,
8785 headers,
8786 body: body_text,
8787 raw_body,
8788 typed: None,
8789 parse_error: Some(format!(
8790 "unexpected successful status {}; generated return type selects `{}`",
8791 status_code, "200",
8792 )),
8793 }))
8794 } else {
8795 let typed: Option<serde_json::Value>;
8796 let parse_error: Option<String>;
8797 match status_code {
8798 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
8799 Ok(v) => {
8800 typed = Some(v);
8801 parse_error = None;
8802 }
8803 Err(e) => {
8804 typed = None;
8805 parse_error = Some(e.to_string());
8806 }
8807 },
8808 }
8809 Err(ApiOpError::Api(ApiError {
8810 status: status_code,
8811 headers,
8812 body: body_text,
8813 raw_body,
8814 typed,
8815 parse_error,
8816 }))
8817 }
8818 }
8819 pub async fn get_tokens_v1_token_mint_address(
8825 &self,
8826 mint_address: impl AsRef<str>,
8827 ) -> Result<TokensV1MintIncludingDuplicates, ApiOpError<serde_json::Value>> {
8828 let request_url = format!(
8829 "{}{}",
8830 self.base_url,
8831 format!(
8832 "/tokens/v1/token/{}",
8833 __pct_encode_path_segment(mint_address.as_ref())
8834 )
8835 );
8836 let mut req = self.http_client.get(request_url);
8837 if let Some(api_key) = &self.api_key {
8838 req = req.header("x-api-key", api_key.as_str());
8839 }
8840 for (name, value) in &self.custom_headers {
8841 if !name.eq_ignore_ascii_case("accept") {
8842 req = req.header(name, value);
8843 }
8844 }
8845 req = req.header(reqwest::header::ACCEPT, "application/json");
8846 let response = req.send().await?;
8847 let status = response.status();
8848 let status_code = status.as_u16();
8849 let headers = response.headers().clone();
8850 let body_bytes =
8851 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
8852 let raw_body = body_bytes;
8853 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
8854 if false || status_code == 200u16 {
8855 match serde_json::from_str(&body_text) {
8856 Ok(body) => Ok(body),
8857 Err(e) => Err(ApiOpError::Api(ApiError {
8858 status: status_code,
8859 headers: headers,
8860 body: body_text,
8861 raw_body,
8862 typed: None,
8863 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
8864 })),
8865 }
8866 } else if status.is_success() {
8867 Err(ApiOpError::Api(ApiError {
8868 status: status_code,
8869 headers,
8870 body: body_text,
8871 raw_body,
8872 typed: None,
8873 parse_error: Some(format!(
8874 "unexpected successful status {}; generated return type selects `{}`",
8875 status_code, "200",
8876 )),
8877 }))
8878 } else {
8879 let typed: Option<serde_json::Value>;
8880 let parse_error: Option<String>;
8881 match status_code {
8882 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
8883 Ok(v) => {
8884 typed = Some(v);
8885 parse_error = None;
8886 }
8887 Err(e) => {
8888 typed = None;
8889 parse_error = Some(e.to_string());
8890 }
8891 },
8892 }
8893 Err(ApiOpError::Api(ApiError {
8894 status: status_code,
8895 headers,
8896 body: body_text,
8897 raw_body,
8898 typed,
8899 parse_error,
8900 }))
8901 }
8902 }
8903 pub async fn get_tokens_v2_category_interval(
8909 &self,
8910 category: GetTokensV2CategoryIntervalCategory,
8911 interval: GetTokensV2CategoryIntervalInterval,
8912 limit: Option<i64>,
8913 ) -> Result<GetTokensV2CategoryIntervalResponse, ApiOpError<GetTokensV2CategoryIntervalApiError>>
8914 {
8915 let request_url = format!(
8916 "{}{}",
8917 self.base_url,
8918 format!(
8919 "/tokens/v2/{}/{}",
8920 __pct_encode_path_segment(&category.to_string()),
8921 __pct_encode_path_segment(&interval.to_string())
8922 )
8923 );
8924 let mut req = self.http_client.get(request_url);
8925 {
8926 let mut query_params: Vec<(String, String)> = Vec::new();
8927 if let Some(v) = limit {
8928 query_params.push(("limit".to_string(), v.to_string()));
8929 }
8930 if !query_params.is_empty() {
8931 req = req.query(&query_params);
8932 }
8933 }
8934 if let Some(api_key) = &self.api_key {
8935 req = req.header("x-api-key", api_key.as_str());
8936 }
8937 for (name, value) in &self.custom_headers {
8938 if !name.eq_ignore_ascii_case("accept") {
8939 req = req.header(name, value);
8940 }
8941 }
8942 req = req.header(reqwest::header::ACCEPT, "application/json");
8943 let response = req.send().await?;
8944 let status = response.status();
8945 let status_code = status.as_u16();
8946 let headers = response.headers().clone();
8947 let body_bytes =
8948 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
8949 let raw_body = body_bytes;
8950 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
8951 if false || status_code == 200u16 {
8952 match serde_json::from_str(&body_text) {
8953 Ok(body) => Ok(body),
8954 Err(e) => Err(ApiOpError::Api(ApiError {
8955 status: status_code,
8956 headers: headers,
8957 body: body_text,
8958 raw_body,
8959 typed: None,
8960 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
8961 })),
8962 }
8963 } else if status.is_success() {
8964 Err(ApiOpError::Api(ApiError {
8965 status: status_code,
8966 headers,
8967 body: body_text,
8968 raw_body,
8969 typed: None,
8970 parse_error: Some(format!(
8971 "unexpected successful status {}; generated return type selects `{}`",
8972 status_code, "200",
8973 )),
8974 }))
8975 } else {
8976 let typed: Option<GetTokensV2CategoryIntervalApiError>;
8977 let parse_error: Option<String>;
8978 match status_code {
8979 400u16 => {
8980 match serde_json::from_str::<GetTokensV2CategoryIntervalResponse400>(&body_text)
8981 {
8982 Ok(v) => {
8983 typed = Some(GetTokensV2CategoryIntervalApiError::Status400(v));
8984 parse_error = None;
8985 }
8986 Err(e) => {
8987 typed = None;
8988 parse_error = Some(e.to_string());
8989 }
8990 }
8991 }
8992 500u16 => {
8993 match serde_json::from_str::<GetTokensV2CategoryIntervalResponse500>(&body_text)
8994 {
8995 Ok(v) => {
8996 typed = Some(GetTokensV2CategoryIntervalApiError::Status500(v));
8997 parse_error = None;
8998 }
8999 Err(e) => {
9000 typed = None;
9001 parse_error = Some(e.to_string());
9002 }
9003 }
9004 }
9005 _ => {
9006 typed = None;
9007 parse_error = None;
9008 }
9009 }
9010 Err(ApiOpError::Api(ApiError {
9011 status: status_code,
9012 headers,
9013 body: body_text,
9014 raw_body,
9015 typed,
9016 parse_error,
9017 }))
9018 }
9019 }
9020 pub async fn get_tokens_v2_recent(
9027 &self,
9028 ) -> Result<GetTokensV2RecentResponse, ApiOpError<GetTokensV2RecentApiError>> {
9029 let request_url = format!("{}{}", self.base_url, "/tokens/v2/recent");
9030 let mut req = self.http_client.get(request_url);
9031 if let Some(api_key) = &self.api_key {
9032 req = req.header("x-api-key", api_key.as_str());
9033 }
9034 for (name, value) in &self.custom_headers {
9035 if !name.eq_ignore_ascii_case("accept") {
9036 req = req.header(name, value);
9037 }
9038 }
9039 req = req.header(reqwest::header::ACCEPT, "application/json");
9040 let response = req.send().await?;
9041 let status = response.status();
9042 let status_code = status.as_u16();
9043 let headers = response.headers().clone();
9044 let body_bytes =
9045 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
9046 let raw_body = body_bytes;
9047 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
9048 if false || status_code == 200u16 {
9049 match serde_json::from_str(&body_text) {
9050 Ok(body) => Ok(body),
9051 Err(e) => Err(ApiOpError::Api(ApiError {
9052 status: status_code,
9053 headers: headers,
9054 body: body_text,
9055 raw_body,
9056 typed: None,
9057 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
9058 })),
9059 }
9060 } else if status.is_success() {
9061 Err(ApiOpError::Api(ApiError {
9062 status: status_code,
9063 headers,
9064 body: body_text,
9065 raw_body,
9066 typed: None,
9067 parse_error: Some(format!(
9068 "unexpected successful status {}; generated return type selects `{}`",
9069 status_code, "200",
9070 )),
9071 }))
9072 } else {
9073 let typed: Option<GetTokensV2RecentApiError>;
9074 let parse_error: Option<String>;
9075 match status_code {
9076 400u16 => match serde_json::from_str::<GetTokensV2RecentResponse400>(&body_text) {
9077 Ok(v) => {
9078 typed = Some(GetTokensV2RecentApiError::Status400(v));
9079 parse_error = None;
9080 }
9081 Err(e) => {
9082 typed = None;
9083 parse_error = Some(e.to_string());
9084 }
9085 },
9086 500u16 => match serde_json::from_str::<GetTokensV2RecentResponse500>(&body_text) {
9087 Ok(v) => {
9088 typed = Some(GetTokensV2RecentApiError::Status500(v));
9089 parse_error = None;
9090 }
9091 Err(e) => {
9092 typed = None;
9093 parse_error = Some(e.to_string());
9094 }
9095 },
9096 _ => {
9097 typed = None;
9098 parse_error = None;
9099 }
9100 }
9101 Err(ApiOpError::Api(ApiError {
9102 status: status_code,
9103 headers,
9104 body: body_text,
9105 raw_body,
9106 typed,
9107 parse_error,
9108 }))
9109 }
9110 }
9111 pub async fn get_tokens_v2_search(
9117 &self,
9118 query: impl AsRef<str>,
9119 ) -> Result<GetTokensV2SearchResponse, ApiOpError<GetTokensV2SearchApiError>> {
9120 let request_url = format!("{}{}", self.base_url, "/tokens/v2/search");
9121 let mut req = self.http_client.get(request_url);
9122 {
9123 let mut query_params: Vec<(String, String)> = Vec::new();
9124 query_params.push(("query".to_string(), query.as_ref().to_string()));
9125 if !query_params.is_empty() {
9126 req = req.query(&query_params);
9127 }
9128 }
9129 if let Some(api_key) = &self.api_key {
9130 req = req.header("x-api-key", api_key.as_str());
9131 }
9132 for (name, value) in &self.custom_headers {
9133 if !name.eq_ignore_ascii_case("accept") {
9134 req = req.header(name, value);
9135 }
9136 }
9137 req = req.header(reqwest::header::ACCEPT, "application/json");
9138 let response = req.send().await?;
9139 let status = response.status();
9140 let status_code = status.as_u16();
9141 let headers = response.headers().clone();
9142 let body_bytes =
9143 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
9144 let raw_body = body_bytes;
9145 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
9146 if false || status_code == 200u16 {
9147 match serde_json::from_str(&body_text) {
9148 Ok(body) => Ok(body),
9149 Err(e) => Err(ApiOpError::Api(ApiError {
9150 status: status_code,
9151 headers: headers,
9152 body: body_text,
9153 raw_body,
9154 typed: None,
9155 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
9156 })),
9157 }
9158 } else if status.is_success() {
9159 Err(ApiOpError::Api(ApiError {
9160 status: status_code,
9161 headers,
9162 body: body_text,
9163 raw_body,
9164 typed: None,
9165 parse_error: Some(format!(
9166 "unexpected successful status {}; generated return type selects `{}`",
9167 status_code, "200",
9168 )),
9169 }))
9170 } else {
9171 let typed: Option<GetTokensV2SearchApiError>;
9172 let parse_error: Option<String>;
9173 match status_code {
9174 400u16 => match serde_json::from_str::<GetTokensV2SearchResponse400>(&body_text) {
9175 Ok(v) => {
9176 typed = Some(GetTokensV2SearchApiError::Status400(v));
9177 parse_error = None;
9178 }
9179 Err(e) => {
9180 typed = None;
9181 parse_error = Some(e.to_string());
9182 }
9183 },
9184 500u16 => match serde_json::from_str::<GetTokensV2SearchResponse500>(&body_text) {
9185 Ok(v) => {
9186 typed = Some(GetTokensV2SearchApiError::Status500(v));
9187 parse_error = None;
9188 }
9189 Err(e) => {
9190 typed = None;
9191 parse_error = Some(e.to_string());
9192 }
9193 },
9194 _ => {
9195 typed = None;
9196 parse_error = None;
9197 }
9198 }
9199 Err(ApiOpError::Api(ApiError {
9200 status: status_code,
9201 headers,
9202 body: body_text,
9203 raw_body,
9204 typed,
9205 parse_error,
9206 }))
9207 }
9208 }
9209 pub async fn get_tokens_v2_tag(
9216 &self,
9217 query: GetTokensV2TagQuery,
9218 ) -> Result<GetTokensV2TagResponse, ApiOpError<GetTokensV2TagApiError>> {
9219 let request_url = format!("{}{}", self.base_url, "/tokens/v2/tag");
9220 let mut req = self.http_client.get(request_url);
9221 {
9222 let mut query_params: Vec<(String, String)> = Vec::new();
9223 query_params.push(("query".to_string(), query.to_string()));
9224 if !query_params.is_empty() {
9225 req = req.query(&query_params);
9226 }
9227 }
9228 if let Some(api_key) = &self.api_key {
9229 req = req.header("x-api-key", api_key.as_str());
9230 }
9231 for (name, value) in &self.custom_headers {
9232 if !name.eq_ignore_ascii_case("accept") {
9233 req = req.header(name, value);
9234 }
9235 }
9236 req = req.header(reqwest::header::ACCEPT, "application/json");
9237 let response = req.send().await?;
9238 let status = response.status();
9239 let status_code = status.as_u16();
9240 let headers = response.headers().clone();
9241 let body_bytes =
9242 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
9243 let raw_body = body_bytes;
9244 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
9245 if false || status_code == 200u16 {
9246 match serde_json::from_str(&body_text) {
9247 Ok(body) => Ok(body),
9248 Err(e) => Err(ApiOpError::Api(ApiError {
9249 status: status_code,
9250 headers: headers,
9251 body: body_text,
9252 raw_body,
9253 typed: None,
9254 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
9255 })),
9256 }
9257 } else if status.is_success() {
9258 Err(ApiOpError::Api(ApiError {
9259 status: status_code,
9260 headers,
9261 body: body_text,
9262 raw_body,
9263 typed: None,
9264 parse_error: Some(format!(
9265 "unexpected successful status {}; generated return type selects `{}`",
9266 status_code, "200",
9267 )),
9268 }))
9269 } else {
9270 let typed: Option<GetTokensV2TagApiError>;
9271 let parse_error: Option<String>;
9272 match status_code {
9273 400u16 => match serde_json::from_str::<GetTokensV2TagResponse400>(&body_text) {
9274 Ok(v) => {
9275 typed = Some(GetTokensV2TagApiError::Status400(v));
9276 parse_error = None;
9277 }
9278 Err(e) => {
9279 typed = None;
9280 parse_error = Some(e.to_string());
9281 }
9282 },
9283 500u16 => match serde_json::from_str::<GetTokensV2TagResponse500>(&body_text) {
9284 Ok(v) => {
9285 typed = Some(GetTokensV2TagApiError::Status500(v));
9286 parse_error = None;
9287 }
9288 Err(e) => {
9289 typed = None;
9290 parse_error = Some(e.to_string());
9291 }
9292 },
9293 _ => {
9294 typed = None;
9295 parse_error = None;
9296 }
9297 }
9298 Err(ApiOpError::Api(ApiError {
9299 status: status_code,
9300 headers,
9301 body: body_text,
9302 raw_body,
9303 typed,
9304 parse_error,
9305 }))
9306 }
9307 }
9308 pub async fn get_tokens_v2_verify_express_check_eligibility(
9316 &self,
9317 token_id: impl AsRef<str>,
9318 ) -> Result<
9319 TokensV2VerificationCheckEligibilityResponse,
9320 ApiOpError<GetTokensV2VerifyExpressCheckEligibilityApiError>,
9321 > {
9322 let request_url = format!(
9323 "{}{}",
9324 self.base_url, "/tokens/v2/verify/express/check-eligibility"
9325 );
9326 let mut req = self.http_client.get(request_url);
9327 {
9328 let mut query_params: Vec<(String, String)> = Vec::new();
9329 query_params.push(("tokenId".to_string(), token_id.as_ref().to_string()));
9330 if !query_params.is_empty() {
9331 req = req.query(&query_params);
9332 }
9333 }
9334 if let Some(api_key) = &self.api_key {
9335 req = req.header("x-api-key", api_key.as_str());
9336 }
9337 for (name, value) in &self.custom_headers {
9338 if !name.eq_ignore_ascii_case("accept") {
9339 req = req.header(name, value);
9340 }
9341 }
9342 req = req.header(reqwest::header::ACCEPT, "application/json");
9343 let response = req.send().await?;
9344 let status = response.status();
9345 let status_code = status.as_u16();
9346 let headers = response.headers().clone();
9347 let body_bytes =
9348 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
9349 let raw_body = body_bytes;
9350 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
9351 if false || status_code == 200u16 {
9352 match serde_json::from_str(&body_text) {
9353 Ok(body) => Ok(body),
9354 Err(e) => Err(ApiOpError::Api(ApiError {
9355 status: status_code,
9356 headers: headers,
9357 body: body_text,
9358 raw_body,
9359 typed: None,
9360 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
9361 })),
9362 }
9363 } else if status.is_success() {
9364 Err(ApiOpError::Api(ApiError {
9365 status: status_code,
9366 headers,
9367 body: body_text,
9368 raw_body,
9369 typed: None,
9370 parse_error: Some(format!(
9371 "unexpected successful status {}; generated return type selects `{}`",
9372 status_code, "200",
9373 )),
9374 }))
9375 } else {
9376 let typed: Option<GetTokensV2VerifyExpressCheckEligibilityApiError>;
9377 let parse_error: Option<String>;
9378 match status_code {
9379 400u16 => {
9380 match serde_json::from_str::<TokensV2VerificationErrorResponse>(&body_text) {
9381 Ok(v) => {
9382 typed = Some(
9383 GetTokensV2VerifyExpressCheckEligibilityApiError::Status400(v),
9384 );
9385 parse_error = None;
9386 }
9387 Err(e) => {
9388 typed = None;
9389 parse_error = Some(e.to_string());
9390 }
9391 }
9392 }
9393 500u16 => {
9394 match serde_json::from_str::<TokensV2VerificationErrorResponse>(&body_text) {
9395 Ok(v) => {
9396 typed = Some(
9397 GetTokensV2VerifyExpressCheckEligibilityApiError::Status500(v),
9398 );
9399 parse_error = None;
9400 }
9401 Err(e) => {
9402 typed = None;
9403 parse_error = Some(e.to_string());
9404 }
9405 }
9406 }
9407 _ => {
9408 typed = None;
9409 parse_error = None;
9410 }
9411 }
9412 Err(ApiOpError::Api(ApiError {
9413 status: status_code,
9414 headers,
9415 body: body_text,
9416 raw_body,
9417 typed,
9418 parse_error,
9419 }))
9420 }
9421 }
9422 pub async fn get_tokens_v2_verify_express_craft_txn(
9430 &self,
9431 sender_address: impl AsRef<str>,
9432 payment_currency: Option<TokensV2VerificationPaymentCurrency>,
9433 ) -> Result<
9434 TokensV2VerificationCraftTxnResponse,
9435 ApiOpError<GetTokensV2VerifyExpressCraftTxnApiError>,
9436 > {
9437 let request_url = format!("{}{}", self.base_url, "/tokens/v2/verify/express/craft-txn");
9438 let mut req = self.http_client.get(request_url);
9439 {
9440 let mut query_params: Vec<(String, String)> = Vec::new();
9441 query_params.push((
9442 "senderAddress".to_string(),
9443 sender_address.as_ref().to_string(),
9444 ));
9445 if let Some(v) = payment_currency {
9446 query_params.push(("paymentCurrency".to_string(), v.to_string()));
9447 }
9448 if !query_params.is_empty() {
9449 req = req.query(&query_params);
9450 }
9451 }
9452 if let Some(api_key) = &self.api_key {
9453 req = req.header("x-api-key", api_key.as_str());
9454 }
9455 for (name, value) in &self.custom_headers {
9456 if !name.eq_ignore_ascii_case("accept") {
9457 req = req.header(name, value);
9458 }
9459 }
9460 req = req.header(reqwest::header::ACCEPT, "application/json");
9461 let response = req.send().await?;
9462 let status = response.status();
9463 let status_code = status.as_u16();
9464 let headers = response.headers().clone();
9465 let body_bytes =
9466 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
9467 let raw_body = body_bytes;
9468 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
9469 if false || status_code == 200u16 {
9470 match serde_json::from_str(&body_text) {
9471 Ok(body) => Ok(body),
9472 Err(e) => Err(ApiOpError::Api(ApiError {
9473 status: status_code,
9474 headers: headers,
9475 body: body_text,
9476 raw_body,
9477 typed: None,
9478 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
9479 })),
9480 }
9481 } else if status.is_success() {
9482 Err(ApiOpError::Api(ApiError {
9483 status: status_code,
9484 headers,
9485 body: body_text,
9486 raw_body,
9487 typed: None,
9488 parse_error: Some(format!(
9489 "unexpected successful status {}; generated return type selects `{}`",
9490 status_code, "200",
9491 )),
9492 }))
9493 } else {
9494 let typed: Option<GetTokensV2VerifyExpressCraftTxnApiError>;
9495 let parse_error: Option<String>;
9496 match status_code {
9497 400u16 => {
9498 match serde_json::from_str::<TokensV2VerificationErrorResponse>(&body_text) {
9499 Ok(v) => {
9500 typed = Some(GetTokensV2VerifyExpressCraftTxnApiError::Status400(v));
9501 parse_error = None;
9502 }
9503 Err(e) => {
9504 typed = None;
9505 parse_error = Some(e.to_string());
9506 }
9507 }
9508 }
9509 500u16 => {
9510 match serde_json::from_str::<TokensV2VerificationErrorResponse>(&body_text) {
9511 Ok(v) => {
9512 typed = Some(GetTokensV2VerifyExpressCraftTxnApiError::Status500(v));
9513 parse_error = None;
9514 }
9515 Err(e) => {
9516 typed = None;
9517 parse_error = Some(e.to_string());
9518 }
9519 }
9520 }
9521 _ => {
9522 typed = None;
9523 parse_error = None;
9524 }
9525 }
9526 Err(ApiOpError::Api(ApiError {
9527 status: status_code,
9528 headers,
9529 body: body_text,
9530 raw_body,
9531 typed,
9532 parse_error,
9533 }))
9534 }
9535 }
9536 pub async fn get_trigger_v1_get_trigger_orders(
9542 &self,
9543 user: impl AsRef<str>,
9544 page: Option<impl AsRef<str>>,
9545 include_failed_tx: Option<GetTriggerV1GetTriggerOrdersIncludeFailedTx>,
9546 order_status: GetTriggerV1GetTriggerOrdersOrderStatus,
9547 input_mint: Option<impl AsRef<str>>,
9548 output_mint: Option<impl AsRef<str>>,
9549 ) -> Result<GetTriggerV1GetTriggerOrdersResponse, ApiOpError<serde_json::Value>> {
9550 let request_url = format!("{}{}", self.base_url, "/trigger/v1/getTriggerOrders");
9551 let mut req = self.http_client.get(request_url);
9552 {
9553 let mut query_params: Vec<(String, String)> = Vec::new();
9554 query_params.push(("user".to_string(), user.as_ref().to_string()));
9555 if let Some(v) = page {
9556 query_params.push(("page".to_string(), v.as_ref().to_string()));
9557 }
9558 if let Some(v) = include_failed_tx {
9559 query_params.push(("includeFailedTx".to_string(), v.to_string()));
9560 }
9561 query_params.push(("orderStatus".to_string(), order_status.to_string()));
9562 if let Some(v) = input_mint {
9563 query_params.push(("inputMint".to_string(), v.as_ref().to_string()));
9564 }
9565 if let Some(v) = output_mint {
9566 query_params.push(("outputMint".to_string(), v.as_ref().to_string()));
9567 }
9568 if !query_params.is_empty() {
9569 req = req.query(&query_params);
9570 }
9571 }
9572 if let Some(api_key) = &self.api_key {
9573 req = req.header("x-api-key", api_key.as_str());
9574 }
9575 for (name, value) in &self.custom_headers {
9576 if !name.eq_ignore_ascii_case("accept") {
9577 req = req.header(name, value);
9578 }
9579 }
9580 req = req.header(reqwest::header::ACCEPT, "application/json");
9581 let response = req.send().await?;
9582 let status = response.status();
9583 let status_code = status.as_u16();
9584 let headers = response.headers().clone();
9585 let body_bytes =
9586 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
9587 let raw_body = body_bytes;
9588 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
9589 if false || status_code == 200u16 {
9590 match serde_json::from_str(&body_text) {
9591 Ok(body) => Ok(body),
9592 Err(e) => Err(ApiOpError::Api(ApiError {
9593 status: status_code,
9594 headers: headers,
9595 body: body_text,
9596 raw_body,
9597 typed: None,
9598 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
9599 })),
9600 }
9601 } else if status.is_success() {
9602 Err(ApiOpError::Api(ApiError {
9603 status: status_code,
9604 headers,
9605 body: body_text,
9606 raw_body,
9607 typed: None,
9608 parse_error: Some(format!(
9609 "unexpected successful status {}; generated return type selects `{}`",
9610 status_code, "200",
9611 )),
9612 }))
9613 } else {
9614 let typed: Option<serde_json::Value>;
9615 let parse_error: Option<String>;
9616 match status_code {
9617 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
9618 Ok(v) => {
9619 typed = Some(v);
9620 parse_error = None;
9621 }
9622 Err(e) => {
9623 typed = None;
9624 parse_error = Some(e.to_string());
9625 }
9626 },
9627 }
9628 Err(ApiOpError::Api(ApiError {
9629 status: status_code,
9630 headers,
9631 body: body_text,
9632 raw_body,
9633 typed,
9634 parse_error,
9635 }))
9636 }
9637 }
9638 pub async fn get_trigger_v2_orders_history(
9645 &self,
9646 state: Option<GetTriggerV2OrdersHistoryState>,
9647 mint: Option<impl AsRef<str>>,
9648 limit: Option<f64>,
9649 offset: Option<f64>,
9650 sort: Option<GetTriggerV2OrdersHistorySort>,
9651 dir: Option<GetTriggerV2OrdersHistoryDir>,
9652 ) -> Result<GetTriggerV2OrdersHistoryResponse, ApiOpError<serde_json::Value>> {
9653 let request_url = format!("{}{}", self.base_url, "/trigger/v2/orders/history");
9654 let mut req = self.http_client.get(request_url);
9655 {
9656 let mut query_params: Vec<(String, String)> = Vec::new();
9657 if let Some(v) = state {
9658 query_params.push(("state".to_string(), v.to_string()));
9659 }
9660 if let Some(v) = mint {
9661 query_params.push(("mint".to_string(), v.as_ref().to_string()));
9662 }
9663 if let Some(v) = limit {
9664 query_params.push(("limit".to_string(), v.to_string()));
9665 }
9666 if let Some(v) = offset {
9667 query_params.push(("offset".to_string(), v.to_string()));
9668 }
9669 if let Some(v) = sort {
9670 query_params.push(("sort".to_string(), v.to_string()));
9671 }
9672 if let Some(v) = dir {
9673 query_params.push(("dir".to_string(), v.to_string()));
9674 }
9675 if !query_params.is_empty() {
9676 req = req.query(&query_params);
9677 }
9678 }
9679 if let Some(api_key) = &self.api_key {
9680 req = req.header("x-api-key", api_key.as_str());
9681 }
9682 for (name, value) in &self.custom_headers {
9683 if !name.eq_ignore_ascii_case("accept") {
9684 req = req.header(name, value);
9685 }
9686 }
9687 req = req.header(reqwest::header::ACCEPT, "application/json");
9688 let response = req.send().await?;
9689 let status = response.status();
9690 let status_code = status.as_u16();
9691 let headers = response.headers().clone();
9692 let body_bytes =
9693 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
9694 let raw_body = body_bytes;
9695 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
9696 if false || status_code == 200u16 {
9697 match serde_json::from_str(&body_text) {
9698 Ok(body) => Ok(body),
9699 Err(e) => Err(ApiOpError::Api(ApiError {
9700 status: status_code,
9701 headers: headers,
9702 body: body_text,
9703 raw_body,
9704 typed: None,
9705 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
9706 })),
9707 }
9708 } else if status.is_success() {
9709 Err(ApiOpError::Api(ApiError {
9710 status: status_code,
9711 headers,
9712 body: body_text,
9713 raw_body,
9714 typed: None,
9715 parse_error: Some(format!(
9716 "unexpected successful status {}; generated return type selects `{}`",
9717 status_code, "200",
9718 )),
9719 }))
9720 } else {
9721 let typed: Option<serde_json::Value>;
9722 let parse_error: Option<String>;
9723 match status_code {
9724 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
9725 Ok(v) => {
9726 typed = Some(v);
9727 parse_error = None;
9728 }
9729 Err(e) => {
9730 typed = None;
9731 parse_error = Some(e.to_string());
9732 }
9733 },
9734 }
9735 Err(ApiOpError::Api(ApiError {
9736 status: status_code,
9737 headers,
9738 body: body_text,
9739 raw_body,
9740 typed,
9741 parse_error,
9742 }))
9743 }
9744 }
9745 pub async fn get_trigger_v2_orders_history_dca(
9751 &self,
9752 state: Option<GetTriggerV2OrdersHistoryDcaState>,
9753 mint: Option<impl AsRef<str>>,
9754 limit: Option<f64>,
9755 offset: Option<f64>,
9756 sort: Option<GetTriggerV2OrdersHistoryDcaSort>,
9757 dir: Option<GetTriggerV2OrdersHistoryDcaDir>,
9758 ) -> Result<GetTriggerV2OrdersHistoryDcaResponse, ApiOpError<serde_json::Value>> {
9759 let request_url = format!("{}{}", self.base_url, "/trigger/v2/orders/history/dca");
9760 let mut req = self.http_client.get(request_url);
9761 {
9762 let mut query_params: Vec<(String, String)> = Vec::new();
9763 if let Some(v) = state {
9764 query_params.push(("state".to_string(), v.to_string()));
9765 }
9766 if let Some(v) = mint {
9767 query_params.push(("mint".to_string(), v.as_ref().to_string()));
9768 }
9769 if let Some(v) = limit {
9770 query_params.push(("limit".to_string(), v.to_string()));
9771 }
9772 if let Some(v) = offset {
9773 query_params.push(("offset".to_string(), v.to_string()));
9774 }
9775 if let Some(v) = sort {
9776 query_params.push(("sort".to_string(), v.to_string()));
9777 }
9778 if let Some(v) = dir {
9779 query_params.push(("dir".to_string(), v.to_string()));
9780 }
9781 if !query_params.is_empty() {
9782 req = req.query(&query_params);
9783 }
9784 }
9785 if let Some(api_key) = &self.api_key {
9786 req = req.header("x-api-key", api_key.as_str());
9787 }
9788 for (name, value) in &self.custom_headers {
9789 if !name.eq_ignore_ascii_case("accept") {
9790 req = req.header(name, value);
9791 }
9792 }
9793 req = req.header(reqwest::header::ACCEPT, "application/json");
9794 let response = req.send().await?;
9795 let status = response.status();
9796 let status_code = status.as_u16();
9797 let headers = response.headers().clone();
9798 let body_bytes =
9799 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
9800 let raw_body = body_bytes;
9801 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
9802 if false || status_code == 200u16 {
9803 match serde_json::from_str(&body_text) {
9804 Ok(body) => Ok(body),
9805 Err(e) => Err(ApiOpError::Api(ApiError {
9806 status: status_code,
9807 headers: headers,
9808 body: body_text,
9809 raw_body,
9810 typed: None,
9811 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
9812 })),
9813 }
9814 } else if status.is_success() {
9815 Err(ApiOpError::Api(ApiError {
9816 status: status_code,
9817 headers,
9818 body: body_text,
9819 raw_body,
9820 typed: None,
9821 parse_error: Some(format!(
9822 "unexpected successful status {}; generated return type selects `{}`",
9823 status_code, "200",
9824 )),
9825 }))
9826 } else {
9827 let typed: Option<serde_json::Value>;
9828 let parse_error: Option<String>;
9829 match status_code {
9830 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
9831 Ok(v) => {
9832 typed = Some(v);
9833 parse_error = None;
9834 }
9835 Err(e) => {
9836 typed = None;
9837 parse_error = Some(e.to_string());
9838 }
9839 },
9840 }
9841 Err(ApiOpError::Api(ApiError {
9842 status: status_code,
9843 headers,
9844 body: body_text,
9845 raw_body,
9846 typed,
9847 parse_error,
9848 }))
9849 }
9850 }
9851 pub async fn get_trigger_v2_orders_history_dca_id(
9858 &self,
9859 id: impl AsRef<str>,
9860 ) -> Result<TriggerV2DcaHistoryItem, ApiOpError<serde_json::Value>> {
9861 let request_url = format!(
9862 "{}{}",
9863 self.base_url,
9864 format!(
9865 "/trigger/v2/orders/history/dca/{}",
9866 __pct_encode_path_segment(id.as_ref())
9867 )
9868 );
9869 let mut req = self.http_client.get(request_url);
9870 if let Some(api_key) = &self.api_key {
9871 req = req.header("x-api-key", api_key.as_str());
9872 }
9873 for (name, value) in &self.custom_headers {
9874 if !name.eq_ignore_ascii_case("accept") {
9875 req = req.header(name, value);
9876 }
9877 }
9878 req = req.header(reqwest::header::ACCEPT, "application/json");
9879 let response = req.send().await?;
9880 let status = response.status();
9881 let status_code = status.as_u16();
9882 let headers = response.headers().clone();
9883 let body_bytes =
9884 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
9885 let raw_body = body_bytes;
9886 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
9887 if false || status_code == 200u16 {
9888 match serde_json::from_str(&body_text) {
9889 Ok(body) => Ok(body),
9890 Err(e) => Err(ApiOpError::Api(ApiError {
9891 status: status_code,
9892 headers: headers,
9893 body: body_text,
9894 raw_body,
9895 typed: None,
9896 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
9897 })),
9898 }
9899 } else if status.is_success() {
9900 Err(ApiOpError::Api(ApiError {
9901 status: status_code,
9902 headers,
9903 body: body_text,
9904 raw_body,
9905 typed: None,
9906 parse_error: Some(format!(
9907 "unexpected successful status {}; generated return type selects `{}`",
9908 status_code, "200",
9909 )),
9910 }))
9911 } else {
9912 let typed: Option<serde_json::Value>;
9913 let parse_error: Option<String>;
9914 match status_code {
9915 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
9916 Ok(v) => {
9917 typed = Some(v);
9918 parse_error = None;
9919 }
9920 Err(e) => {
9921 typed = None;
9922 parse_error = Some(e.to_string());
9923 }
9924 },
9925 }
9926 Err(ApiOpError::Api(ApiError {
9927 status: status_code,
9928 headers,
9929 body: body_text,
9930 raw_body,
9931 typed,
9932 parse_error,
9933 }))
9934 }
9935 }
9936 pub async fn get_trigger_v2_vault(
9942 &self,
9943 ) -> Result<GetTriggerV2VaultResponse, ApiOpError<serde_json::Value>> {
9944 let request_url = format!("{}{}", self.base_url, "/trigger/v2/vault");
9945 let mut req = self.http_client.get(request_url);
9946 if let Some(api_key) = &self.api_key {
9947 req = req.header("x-api-key", api_key.as_str());
9948 }
9949 for (name, value) in &self.custom_headers {
9950 if !name.eq_ignore_ascii_case("accept") {
9951 req = req.header(name, value);
9952 }
9953 }
9954 req = req.header(reqwest::header::ACCEPT, "application/json");
9955 let response = req.send().await?;
9956 let status = response.status();
9957 let status_code = status.as_u16();
9958 let headers = response.headers().clone();
9959 let body_bytes =
9960 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
9961 let raw_body = body_bytes;
9962 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
9963 if false || status_code == 200u16 {
9964 match serde_json::from_str(&body_text) {
9965 Ok(body) => Ok(body),
9966 Err(e) => Err(ApiOpError::Api(ApiError {
9967 status: status_code,
9968 headers: headers,
9969 body: body_text,
9970 raw_body,
9971 typed: None,
9972 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
9973 })),
9974 }
9975 } else if status.is_success() {
9976 Err(ApiOpError::Api(ApiError {
9977 status: status_code,
9978 headers,
9979 body: body_text,
9980 raw_body,
9981 typed: None,
9982 parse_error: Some(format!(
9983 "unexpected successful status {}; generated return type selects `{}`",
9984 status_code, "200",
9985 )),
9986 }))
9987 } else {
9988 let typed: Option<serde_json::Value>;
9989 let parse_error: Option<String>;
9990 match status_code {
9991 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
9992 Ok(v) => {
9993 typed = Some(v);
9994 parse_error = None;
9995 }
9996 Err(e) => {
9997 typed = None;
9998 parse_error = Some(e.to_string());
9999 }
10000 },
10001 }
10002 Err(ApiOpError::Api(ApiError {
10003 status: status_code,
10004 headers,
10005 body: body_text,
10006 raw_body,
10007 typed,
10008 parse_error,
10009 }))
10010 }
10011 }
10012 pub async fn get_trigger_v2_vault_register(
10019 &self,
10020 ) -> Result<GetTriggerV2VaultRegisterResponse201, ApiOpError<GetTriggerV2VaultRegisterApiError>>
10021 {
10022 let request_url = format!("{}{}", self.base_url, "/trigger/v2/vault/register");
10023 let mut req = self.http_client.get(request_url);
10024 if let Some(api_key) = &self.api_key {
10025 req = req.header("x-api-key", api_key.as_str());
10026 }
10027 for (name, value) in &self.custom_headers {
10028 if !name.eq_ignore_ascii_case("accept") {
10029 req = req.header(name, value);
10030 }
10031 }
10032 req = req.header(reqwest::header::ACCEPT, "application/json");
10033 let response = req.send().await?;
10034 let status = response.status();
10035 let status_code = status.as_u16();
10036 let headers = response.headers().clone();
10037 let body_bytes =
10038 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
10039 let raw_body = body_bytes;
10040 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
10041 if false || status_code == 201u16 {
10042 match serde_json::from_str(&body_text) {
10043 Ok(body) => Ok(body),
10044 Err(e) => Err(ApiOpError::Api(ApiError {
10045 status: status_code,
10046 headers: headers,
10047 body: body_text,
10048 raw_body,
10049 typed: None,
10050 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
10051 })),
10052 }
10053 } else if status.is_success() {
10054 Err(ApiOpError::Api(ApiError {
10055 status: status_code,
10056 headers,
10057 body: body_text,
10058 raw_body,
10059 typed: None,
10060 parse_error: Some(format!(
10061 "unexpected successful status {}; generated return type selects `{}`",
10062 status_code, "201",
10063 )),
10064 }))
10065 } else {
10066 let typed: Option<GetTriggerV2VaultRegisterApiError>;
10067 let parse_error: Option<String>;
10068 match status_code {
10069 409u16 => match serde_json::from_str::<TriggerV2ErrorResponse>(&body_text) {
10070 Ok(v) => {
10071 typed = Some(GetTriggerV2VaultRegisterApiError::Status409(v));
10072 parse_error = None;
10073 }
10074 Err(e) => {
10075 typed = None;
10076 parse_error = Some(e.to_string());
10077 }
10078 },
10079 _ => {
10080 typed = None;
10081 parse_error = None;
10082 }
10083 }
10084 Err(ApiOpError::Api(ApiError {
10085 status: status_code,
10086 headers,
10087 body: body_text,
10088 raw_body,
10089 typed,
10090 parse_error,
10091 }))
10092 }
10093 }
10094 pub async fn get_ultra_v1_balances_address(
10100 &self,
10101 address: impl AsRef<str>,
10102 ) -> Result<GetUltraV1BalancesAddressResponse, ApiOpError<GetUltraV1BalancesAddressApiError>>
10103 {
10104 let request_url = format!(
10105 "{}{}",
10106 self.base_url,
10107 format!(
10108 "/ultra/v1/balances/{}",
10109 __pct_encode_path_segment(address.as_ref())
10110 )
10111 );
10112 let mut req = self.http_client.get(request_url);
10113 if let Some(api_key) = &self.api_key {
10114 req = req.header("x-api-key", api_key.as_str());
10115 }
10116 for (name, value) in &self.custom_headers {
10117 if !name.eq_ignore_ascii_case("accept") {
10118 req = req.header(name, value);
10119 }
10120 }
10121 req = req.header(reqwest::header::ACCEPT, "application/json");
10122 let response = req.send().await?;
10123 let status = response.status();
10124 let status_code = status.as_u16();
10125 let headers = response.headers().clone();
10126 let body_bytes =
10127 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
10128 let raw_body = body_bytes;
10129 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
10130 if false || status_code == 200u16 {
10131 match serde_json::from_str(&body_text) {
10132 Ok(body) => Ok(body),
10133 Err(e) => Err(ApiOpError::Api(ApiError {
10134 status: status_code,
10135 headers: headers,
10136 body: body_text,
10137 raw_body,
10138 typed: None,
10139 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
10140 })),
10141 }
10142 } else if status.is_success() {
10143 Err(ApiOpError::Api(ApiError {
10144 status: status_code,
10145 headers,
10146 body: body_text,
10147 raw_body,
10148 typed: None,
10149 parse_error: Some(format!(
10150 "unexpected successful status {}; generated return type selects `{}`",
10151 status_code, "200",
10152 )),
10153 }))
10154 } else {
10155 let typed: Option<GetUltraV1BalancesAddressApiError>;
10156 let parse_error: Option<String>;
10157 match status_code {
10158 400u16 => {
10159 match serde_json::from_str::<GetUltraV1BalancesAddressResponse400>(&body_text) {
10160 Ok(v) => {
10161 typed = Some(GetUltraV1BalancesAddressApiError::Status400(v));
10162 parse_error = None;
10163 }
10164 Err(e) => {
10165 typed = None;
10166 parse_error = Some(e.to_string());
10167 }
10168 }
10169 }
10170 500u16 => {
10171 match serde_json::from_str::<GetUltraV1BalancesAddressResponse500>(&body_text) {
10172 Ok(v) => {
10173 typed = Some(GetUltraV1BalancesAddressApiError::Status500(v));
10174 parse_error = None;
10175 }
10176 Err(e) => {
10177 typed = None;
10178 parse_error = Some(e.to_string());
10179 }
10180 }
10181 }
10182 _ => {
10183 typed = None;
10184 parse_error = None;
10185 }
10186 }
10187 Err(ApiOpError::Api(ApiError {
10188 status: status_code,
10189 headers,
10190 body: body_text,
10191 raw_body,
10192 typed,
10193 parse_error,
10194 }))
10195 }
10196 }
10197 pub async fn get_ultra_v1_holdings_address(
10203 &self,
10204 address: impl AsRef<str>,
10205 ) -> Result<UltraHoldingsResponse, ApiOpError<serde_json::Value>> {
10206 let request_url = format!(
10207 "{}{}",
10208 self.base_url,
10209 format!(
10210 "/ultra/v1/holdings/{}",
10211 __pct_encode_path_segment(address.as_ref())
10212 )
10213 );
10214 let mut req = self.http_client.get(request_url);
10215 if let Some(api_key) = &self.api_key {
10216 req = req.header("x-api-key", api_key.as_str());
10217 }
10218 for (name, value) in &self.custom_headers {
10219 if !name.eq_ignore_ascii_case("accept") {
10220 req = req.header(name, value);
10221 }
10222 }
10223 req = req.header(reqwest::header::ACCEPT, "application/json");
10224 let response = req.send().await?;
10225 let status = response.status();
10226 let status_code = status.as_u16();
10227 let headers = response.headers().clone();
10228 let body_bytes =
10229 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
10230 let raw_body = body_bytes;
10231 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
10232 if false || status_code == 200u16 {
10233 match serde_json::from_str(&body_text) {
10234 Ok(body) => Ok(body),
10235 Err(e) => Err(ApiOpError::Api(ApiError {
10236 status: status_code,
10237 headers: headers,
10238 body: body_text,
10239 raw_body,
10240 typed: None,
10241 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
10242 })),
10243 }
10244 } else if status.is_success() {
10245 Err(ApiOpError::Api(ApiError {
10246 status: status_code,
10247 headers,
10248 body: body_text,
10249 raw_body,
10250 typed: None,
10251 parse_error: Some(format!(
10252 "unexpected successful status {}; generated return type selects `{}`",
10253 status_code, "200",
10254 )),
10255 }))
10256 } else {
10257 let typed: Option<serde_json::Value>;
10258 let parse_error: Option<String>;
10259 match status_code {
10260 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
10261 Ok(v) => {
10262 typed = Some(v);
10263 parse_error = None;
10264 }
10265 Err(e) => {
10266 typed = None;
10267 parse_error = Some(e.to_string());
10268 }
10269 },
10270 }
10271 Err(ApiOpError::Api(ApiError {
10272 status: status_code,
10273 headers,
10274 body: body_text,
10275 raw_body,
10276 typed,
10277 parse_error,
10278 }))
10279 }
10280 }
10281 pub async fn get_ultra_v1_holdings_address_native(
10287 &self,
10288 address: impl AsRef<str>,
10289 ) -> Result<UltraNativeHoldingsResponse, ApiOpError<serde_json::Value>> {
10290 let request_url = format!(
10291 "{}{}",
10292 self.base_url,
10293 format!(
10294 "/ultra/v1/holdings/{}/native",
10295 __pct_encode_path_segment(address.as_ref())
10296 )
10297 );
10298 let mut req = self.http_client.get(request_url);
10299 if let Some(api_key) = &self.api_key {
10300 req = req.header("x-api-key", api_key.as_str());
10301 }
10302 for (name, value) in &self.custom_headers {
10303 if !name.eq_ignore_ascii_case("accept") {
10304 req = req.header(name, value);
10305 }
10306 }
10307 req = req.header(reqwest::header::ACCEPT, "application/json");
10308 let response = req.send().await?;
10309 let status = response.status();
10310 let status_code = status.as_u16();
10311 let headers = response.headers().clone();
10312 let body_bytes =
10313 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
10314 let raw_body = body_bytes;
10315 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
10316 if false || status_code == 200u16 {
10317 match serde_json::from_str(&body_text) {
10318 Ok(body) => Ok(body),
10319 Err(e) => Err(ApiOpError::Api(ApiError {
10320 status: status_code,
10321 headers: headers,
10322 body: body_text,
10323 raw_body,
10324 typed: None,
10325 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
10326 })),
10327 }
10328 } else if status.is_success() {
10329 Err(ApiOpError::Api(ApiError {
10330 status: status_code,
10331 headers,
10332 body: body_text,
10333 raw_body,
10334 typed: None,
10335 parse_error: Some(format!(
10336 "unexpected successful status {}; generated return type selects `{}`",
10337 status_code, "200",
10338 )),
10339 }))
10340 } else {
10341 let typed: Option<serde_json::Value>;
10342 let parse_error: Option<String>;
10343 match status_code {
10344 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
10345 Ok(v) => {
10346 typed = Some(v);
10347 parse_error = None;
10348 }
10349 Err(e) => {
10350 typed = None;
10351 parse_error = Some(e.to_string());
10352 }
10353 },
10354 }
10355 Err(ApiOpError::Api(ApiError {
10356 status: status_code,
10357 headers,
10358 body: body_text,
10359 raw_body,
10360 typed,
10361 parse_error,
10362 }))
10363 }
10364 }
10365 pub async fn get_ultra_v1_order(
10371 &self,
10372 input_mint: impl AsRef<str>,
10373 output_mint: impl AsRef<str>,
10374 amount: impl AsRef<str>,
10375 taker: Option<impl AsRef<str>>,
10376 receiver: Option<impl AsRef<str>>,
10377 payer: Option<impl AsRef<str>>,
10378 close_authority: Option<impl AsRef<str>>,
10379 referral_account: Option<impl AsRef<str>>,
10380 referral_fee: Option<f64>,
10381 exclude_routers: Option<GetUltraV1OrderExcludeRouters>,
10382 exclude_dexes: Option<impl AsRef<str>>,
10383 ) -> Result<GetUltraV1OrderResponse, ApiOpError<GetUltraV1OrderApiError>> {
10384 let request_url = format!("{}{}", self.base_url, "/ultra/v1/order");
10385 let mut req = self.http_client.get(request_url);
10386 {
10387 let mut query_params: Vec<(String, String)> = Vec::new();
10388 query_params.push(("inputMint".to_string(), input_mint.as_ref().to_string()));
10389 query_params.push(("outputMint".to_string(), output_mint.as_ref().to_string()));
10390 query_params.push(("amount".to_string(), amount.as_ref().to_string()));
10391 if let Some(v) = taker {
10392 query_params.push(("taker".to_string(), v.as_ref().to_string()));
10393 }
10394 if let Some(v) = receiver {
10395 query_params.push(("receiver".to_string(), v.as_ref().to_string()));
10396 }
10397 if let Some(v) = payer {
10398 query_params.push(("payer".to_string(), v.as_ref().to_string()));
10399 }
10400 if let Some(v) = close_authority {
10401 query_params.push(("closeAuthority".to_string(), v.as_ref().to_string()));
10402 }
10403 if let Some(v) = referral_account {
10404 query_params.push(("referralAccount".to_string(), v.as_ref().to_string()));
10405 }
10406 if let Some(v) = referral_fee {
10407 query_params.push(("referralFee".to_string(), v.to_string()));
10408 }
10409 if let Some(v) = exclude_routers {
10410 query_params.push(("excludeRouters".to_string(), v.to_string()));
10411 }
10412 if let Some(v) = exclude_dexes {
10413 query_params.push(("excludeDexes".to_string(), v.as_ref().to_string()));
10414 }
10415 if !query_params.is_empty() {
10416 req = req.query(&query_params);
10417 }
10418 }
10419 if let Some(api_key) = &self.api_key {
10420 req = req.header("x-api-key", api_key.as_str());
10421 }
10422 for (name, value) in &self.custom_headers {
10423 if !name.eq_ignore_ascii_case("accept") {
10424 req = req.header(name, value);
10425 }
10426 }
10427 req = req.header(reqwest::header::ACCEPT, "application/json");
10428 let response = req.send().await?;
10429 let status = response.status();
10430 let status_code = status.as_u16();
10431 let headers = response.headers().clone();
10432 let body_bytes =
10433 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
10434 let raw_body = body_bytes;
10435 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
10436 if false || status_code == 200u16 {
10437 match serde_json::from_str(&body_text) {
10438 Ok(body) => Ok(body),
10439 Err(e) => Err(ApiOpError::Api(ApiError {
10440 status: status_code,
10441 headers: headers,
10442 body: body_text,
10443 raw_body,
10444 typed: None,
10445 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
10446 })),
10447 }
10448 } else if status.is_success() {
10449 Err(ApiOpError::Api(ApiError {
10450 status: status_code,
10451 headers,
10452 body: body_text,
10453 raw_body,
10454 typed: None,
10455 parse_error: Some(format!(
10456 "unexpected successful status {}; generated return type selects `{}`",
10457 status_code, "200",
10458 )),
10459 }))
10460 } else {
10461 let typed: Option<GetUltraV1OrderApiError>;
10462 let parse_error: Option<String>;
10463 match status_code {
10464 400u16 => match serde_json::from_str::<GetUltraV1OrderResponse400>(&body_text) {
10465 Ok(v) => {
10466 typed = Some(GetUltraV1OrderApiError::Status400(v));
10467 parse_error = None;
10468 }
10469 Err(e) => {
10470 typed = None;
10471 parse_error = Some(e.to_string());
10472 }
10473 },
10474 500u16 => match serde_json::from_str::<GetUltraV1OrderResponse500>(&body_text) {
10475 Ok(v) => {
10476 typed = Some(GetUltraV1OrderApiError::Status500(v));
10477 parse_error = None;
10478 }
10479 Err(e) => {
10480 typed = None;
10481 parse_error = Some(e.to_string());
10482 }
10483 },
10484 _ => {
10485 typed = None;
10486 parse_error = None;
10487 }
10488 }
10489 Err(ApiOpError::Api(ApiError {
10490 status: status_code,
10491 headers,
10492 body: body_text,
10493 raw_body,
10494 typed,
10495 parse_error,
10496 }))
10497 }
10498 }
10499 pub async fn get_ultra_v1_order_routers(
10505 &self,
10506 ) -> Result<GetUltraV1OrderRoutersResponse, ApiOpError<serde_json::Value>> {
10507 let request_url = format!("{}{}", self.base_url, "/ultra/v1/order/routers");
10508 let mut req = self.http_client.get(request_url);
10509 if let Some(api_key) = &self.api_key {
10510 req = req.header("x-api-key", api_key.as_str());
10511 }
10512 for (name, value) in &self.custom_headers {
10513 if !name.eq_ignore_ascii_case("accept") {
10514 req = req.header(name, value);
10515 }
10516 }
10517 req = req.header(reqwest::header::ACCEPT, "application/json");
10518 let response = req.send().await?;
10519 let status = response.status();
10520 let status_code = status.as_u16();
10521 let headers = response.headers().clone();
10522 let body_bytes =
10523 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
10524 let raw_body = body_bytes;
10525 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
10526 if false || status_code == 200u16 {
10527 match serde_json::from_str(&body_text) {
10528 Ok(body) => Ok(body),
10529 Err(e) => Err(ApiOpError::Api(ApiError {
10530 status: status_code,
10531 headers: headers,
10532 body: body_text,
10533 raw_body,
10534 typed: None,
10535 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
10536 })),
10537 }
10538 } else if status.is_success() {
10539 Err(ApiOpError::Api(ApiError {
10540 status: status_code,
10541 headers,
10542 body: body_text,
10543 raw_body,
10544 typed: None,
10545 parse_error: Some(format!(
10546 "unexpected successful status {}; generated return type selects `{}`",
10547 status_code, "200",
10548 )),
10549 }))
10550 } else {
10551 let typed: Option<serde_json::Value>;
10552 let parse_error: Option<String>;
10553 match status_code {
10554 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
10555 Ok(v) => {
10556 typed = Some(v);
10557 parse_error = None;
10558 }
10559 Err(e) => {
10560 typed = None;
10561 parse_error = Some(e.to_string());
10562 }
10563 },
10564 }
10565 Err(ApiOpError::Api(ApiError {
10566 status: status_code,
10567 headers,
10568 body: body_text,
10569 raw_body,
10570 typed,
10571 parse_error,
10572 }))
10573 }
10574 }
10575 pub async fn get_ultra_v1_search(
10581 &self,
10582 query: impl AsRef<str>,
10583 ) -> Result<GetUltraV1SearchResponse, ApiOpError<GetUltraV1SearchApiError>> {
10584 let request_url = format!("{}{}", self.base_url, "/ultra/v1/search");
10585 let mut req = self.http_client.get(request_url);
10586 {
10587 let mut query_params: Vec<(String, String)> = Vec::new();
10588 query_params.push(("query".to_string(), query.as_ref().to_string()));
10589 if !query_params.is_empty() {
10590 req = req.query(&query_params);
10591 }
10592 }
10593 if let Some(api_key) = &self.api_key {
10594 req = req.header("x-api-key", api_key.as_str());
10595 }
10596 for (name, value) in &self.custom_headers {
10597 if !name.eq_ignore_ascii_case("accept") {
10598 req = req.header(name, value);
10599 }
10600 }
10601 req = req.header(reqwest::header::ACCEPT, "application/json");
10602 let response = req.send().await?;
10603 let status = response.status();
10604 let status_code = status.as_u16();
10605 let headers = response.headers().clone();
10606 let body_bytes =
10607 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
10608 let raw_body = body_bytes;
10609 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
10610 if false || status_code == 200u16 {
10611 match serde_json::from_str(&body_text) {
10612 Ok(body) => Ok(body),
10613 Err(e) => Err(ApiOpError::Api(ApiError {
10614 status: status_code,
10615 headers: headers,
10616 body: body_text,
10617 raw_body,
10618 typed: None,
10619 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
10620 })),
10621 }
10622 } else if status.is_success() {
10623 Err(ApiOpError::Api(ApiError {
10624 status: status_code,
10625 headers,
10626 body: body_text,
10627 raw_body,
10628 typed: None,
10629 parse_error: Some(format!(
10630 "unexpected successful status {}; generated return type selects `{}`",
10631 status_code, "200",
10632 )),
10633 }))
10634 } else {
10635 let typed: Option<GetUltraV1SearchApiError>;
10636 let parse_error: Option<String>;
10637 match status_code {
10638 400u16 => match serde_json::from_str::<GetUltraV1SearchResponse400>(&body_text) {
10639 Ok(v) => {
10640 typed = Some(GetUltraV1SearchApiError::Status400(v));
10641 parse_error = None;
10642 }
10643 Err(e) => {
10644 typed = None;
10645 parse_error = Some(e.to_string());
10646 }
10647 },
10648 500u16 => match serde_json::from_str::<GetUltraV1SearchResponse500>(&body_text) {
10649 Ok(v) => {
10650 typed = Some(GetUltraV1SearchApiError::Status500(v));
10651 parse_error = None;
10652 }
10653 Err(e) => {
10654 typed = None;
10655 parse_error = Some(e.to_string());
10656 }
10657 },
10658 _ => {
10659 typed = None;
10660 parse_error = None;
10661 }
10662 }
10663 Err(ApiOpError::Api(ApiError {
10664 status: status_code,
10665 headers,
10666 body: body_text,
10667 raw_body,
10668 typed,
10669 parse_error,
10670 }))
10671 }
10672 }
10673 pub async fn get_ultra_v1_shield(
10679 &self,
10680 mints: impl AsRef<str>,
10681 ) -> Result<GetUltraV1ShieldResponse, ApiOpError<GetUltraV1ShieldApiError>> {
10682 let request_url = format!("{}{}", self.base_url, "/ultra/v1/shield");
10683 let mut req = self.http_client.get(request_url);
10684 {
10685 let mut query_params: Vec<(String, String)> = Vec::new();
10686 query_params.push(("mints".to_string(), mints.as_ref().to_string()));
10687 if !query_params.is_empty() {
10688 req = req.query(&query_params);
10689 }
10690 }
10691 if let Some(api_key) = &self.api_key {
10692 req = req.header("x-api-key", api_key.as_str());
10693 }
10694 for (name, value) in &self.custom_headers {
10695 if !name.eq_ignore_ascii_case("accept") {
10696 req = req.header(name, value);
10697 }
10698 }
10699 req = req.header(reqwest::header::ACCEPT, "application/json");
10700 let response = req.send().await?;
10701 let status = response.status();
10702 let status_code = status.as_u16();
10703 let headers = response.headers().clone();
10704 let body_bytes =
10705 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
10706 let raw_body = body_bytes;
10707 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
10708 if false || status_code == 200u16 {
10709 match serde_json::from_str(&body_text) {
10710 Ok(body) => Ok(body),
10711 Err(e) => Err(ApiOpError::Api(ApiError {
10712 status: status_code,
10713 headers: headers,
10714 body: body_text,
10715 raw_body,
10716 typed: None,
10717 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
10718 })),
10719 }
10720 } else if status.is_success() {
10721 Err(ApiOpError::Api(ApiError {
10722 status: status_code,
10723 headers,
10724 body: body_text,
10725 raw_body,
10726 typed: None,
10727 parse_error: Some(format!(
10728 "unexpected successful status {}; generated return type selects `{}`",
10729 status_code, "200",
10730 )),
10731 }))
10732 } else {
10733 let typed: Option<GetUltraV1ShieldApiError>;
10734 let parse_error: Option<String>;
10735 match status_code {
10736 400u16 => match serde_json::from_str::<GetUltraV1ShieldResponse400>(&body_text) {
10737 Ok(v) => {
10738 typed = Some(GetUltraV1ShieldApiError::Status400(v));
10739 parse_error = None;
10740 }
10741 Err(e) => {
10742 typed = None;
10743 parse_error = Some(e.to_string());
10744 }
10745 },
10746 500u16 => match serde_json::from_str::<GetUltraV1ShieldResponse500>(&body_text) {
10747 Ok(v) => {
10748 typed = Some(GetUltraV1ShieldApiError::Status500(v));
10749 parse_error = None;
10750 }
10751 Err(e) => {
10752 typed = None;
10753 parse_error = Some(e.to_string());
10754 }
10755 },
10756 _ => {
10757 typed = None;
10758 parse_error = None;
10759 }
10760 }
10761 Err(ApiOpError::Api(ApiError {
10762 status: status_code,
10763 headers,
10764 body: body_text,
10765 raw_body,
10766 typed,
10767 parse_error,
10768 }))
10769 }
10770 }
10771 pub async fn list_borrow_positions(
10779 &self,
10780 users: impl AsRef<str>,
10781 market: Option<LendBorrowMarket>,
10782 ) -> Result<ListBorrowPositionsResponse, ApiOpError<serde_json::Value>> {
10783 let request_url = format!("{}{}", self.base_url, "/lend/v1/borrow/positions");
10784 let mut req = self.http_client.get(request_url);
10785 {
10786 let mut query_params: Vec<(String, String)> = Vec::new();
10787 query_params.push(("users".to_string(), users.as_ref().to_string()));
10788 if let Some(v) = market {
10789 query_params.push(("market".to_string(), v.to_string()));
10790 }
10791 if !query_params.is_empty() {
10792 req = req.query(&query_params);
10793 }
10794 }
10795 if let Some(api_key) = &self.api_key {
10796 req = req.header("x-api-key", api_key.as_str());
10797 }
10798 for (name, value) in &self.custom_headers {
10799 if !name.eq_ignore_ascii_case("accept") {
10800 req = req.header(name, value);
10801 }
10802 }
10803 req = req.header(reqwest::header::ACCEPT, "application/json");
10804 let response = req.send().await?;
10805 let status = response.status();
10806 let status_code = status.as_u16();
10807 let headers = response.headers().clone();
10808 let body_bytes =
10809 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
10810 let raw_body = body_bytes;
10811 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
10812 if false || status_code == 200u16 {
10813 match serde_json::from_str(&body_text) {
10814 Ok(body) => Ok(body),
10815 Err(e) => Err(ApiOpError::Api(ApiError {
10816 status: status_code,
10817 headers: headers,
10818 body: body_text,
10819 raw_body,
10820 typed: None,
10821 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
10822 })),
10823 }
10824 } else if status.is_success() {
10825 Err(ApiOpError::Api(ApiError {
10826 status: status_code,
10827 headers,
10828 body: body_text,
10829 raw_body,
10830 typed: None,
10831 parse_error: Some(format!(
10832 "unexpected successful status {}; generated return type selects `{}`",
10833 status_code, "200",
10834 )),
10835 }))
10836 } else {
10837 let typed: Option<serde_json::Value>;
10838 let parse_error: Option<String>;
10839 match status_code {
10840 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
10841 Ok(v) => {
10842 typed = Some(v);
10843 parse_error = None;
10844 }
10845 Err(e) => {
10846 typed = None;
10847 parse_error = Some(e.to_string());
10848 }
10849 },
10850 }
10851 Err(ApiOpError::Api(ApiError {
10852 status: status_code,
10853 headers,
10854 body: body_text,
10855 raw_body,
10856 typed,
10857 parse_error,
10858 }))
10859 }
10860 }
10861 pub async fn list_borrow_vaults(
10867 &self,
10868 market: Option<LendBorrowMarket>,
10869 rpc_url: Option<impl AsRef<str>>,
10870 ) -> Result<ListBorrowVaultsResponse, ApiOpError<serde_json::Value>> {
10871 let request_url = format!("{}{}", self.base_url, "/lend/v1/borrow/vaults");
10872 let mut req = self.http_client.get(request_url);
10873 {
10874 let mut query_params: Vec<(String, String)> = Vec::new();
10875 if let Some(v) = market {
10876 query_params.push(("market".to_string(), v.to_string()));
10877 }
10878 if let Some(v) = rpc_url {
10879 query_params.push(("rpcUrl".to_string(), v.as_ref().to_string()));
10880 }
10881 if !query_params.is_empty() {
10882 req = req.query(&query_params);
10883 }
10884 }
10885 if let Some(api_key) = &self.api_key {
10886 req = req.header("x-api-key", api_key.as_str());
10887 }
10888 for (name, value) in &self.custom_headers {
10889 if !name.eq_ignore_ascii_case("accept") {
10890 req = req.header(name, value);
10891 }
10892 }
10893 req = req.header(reqwest::header::ACCEPT, "application/json");
10894 let response = req.send().await?;
10895 let status = response.status();
10896 let status_code = status.as_u16();
10897 let headers = response.headers().clone();
10898 let body_bytes =
10899 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
10900 let raw_body = body_bytes;
10901 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
10902 if false || status_code == 200u16 {
10903 match serde_json::from_str(&body_text) {
10904 Ok(body) => Ok(body),
10905 Err(e) => Err(ApiOpError::Api(ApiError {
10906 status: status_code,
10907 headers: headers,
10908 body: body_text,
10909 raw_body,
10910 typed: None,
10911 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
10912 })),
10913 }
10914 } else if status.is_success() {
10915 Err(ApiOpError::Api(ApiError {
10916 status: status_code,
10917 headers,
10918 body: body_text,
10919 raw_body,
10920 typed: None,
10921 parse_error: Some(format!(
10922 "unexpected successful status {}; generated return type selects `{}`",
10923 status_code, "200",
10924 )),
10925 }))
10926 } else {
10927 let typed: Option<serde_json::Value>;
10928 let parse_error: Option<String>;
10929 match status_code {
10930 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
10931 Ok(v) => {
10932 typed = Some(v);
10933 parse_error = None;
10934 }
10935 Err(e) => {
10936 typed = None;
10937 parse_error = Some(e.to_string());
10938 }
10939 },
10940 }
10941 Err(ApiOpError::Api(ApiError {
10942 status: status_code,
10943 headers,
10944 body: body_text,
10945 raw_body,
10946 typed,
10947 parse_error,
10948 }))
10949 }
10950 }
10951 pub async fn patch_trigger_v2_orders_price_order_id(
10957 &self,
10958 order_id: impl AsRef<str>,
10959 request: PatchTriggerV2OrdersPriceOrderIdRequest,
10960 ) -> Result<PatchTriggerV2OrdersPriceOrderIdResponse, ApiOpError<serde_json::Value>> {
10961 let request_url = format!(
10962 "{}{}",
10963 self.base_url,
10964 format!(
10965 "/trigger/v2/orders/price/{}",
10966 __pct_encode_path_segment(order_id.as_ref())
10967 )
10968 );
10969 let mut req = self.http_client.patch(request_url);
10970 req = req
10971 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
10972 .header("content-type", "application/json");
10973 if let Some(api_key) = &self.api_key {
10974 req = req.header("x-api-key", api_key.as_str());
10975 }
10976 for (name, value) in &self.custom_headers {
10977 if !name.eq_ignore_ascii_case("accept") {
10978 req = req.header(name, value);
10979 }
10980 }
10981 req = req.header(reqwest::header::ACCEPT, "application/json");
10982 let response = req.send().await?;
10983 let status = response.status();
10984 let status_code = status.as_u16();
10985 let headers = response.headers().clone();
10986 let body_bytes =
10987 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
10988 let raw_body = body_bytes;
10989 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
10990 if false || status_code == 200u16 {
10991 match serde_json::from_str(&body_text) {
10992 Ok(body) => Ok(body),
10993 Err(e) => Err(ApiOpError::Api(ApiError {
10994 status: status_code,
10995 headers: headers,
10996 body: body_text,
10997 raw_body,
10998 typed: None,
10999 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
11000 })),
11001 }
11002 } else if status.is_success() {
11003 Err(ApiOpError::Api(ApiError {
11004 status: status_code,
11005 headers,
11006 body: body_text,
11007 raw_body,
11008 typed: None,
11009 parse_error: Some(format!(
11010 "unexpected successful status {}; generated return type selects `{}`",
11011 status_code, "200",
11012 )),
11013 }))
11014 } else {
11015 let typed: Option<serde_json::Value>;
11016 let parse_error: Option<String>;
11017 match status_code {
11018 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
11019 Ok(v) => {
11020 typed = Some(v);
11021 parse_error = None;
11022 }
11023 Err(e) => {
11024 typed = None;
11025 parse_error = Some(e.to_string());
11026 }
11027 },
11028 }
11029 Err(ApiOpError::Api(ApiError {
11030 status: status_code,
11031 headers,
11032 body: body_text,
11033 raw_body,
11034 typed,
11035 parse_error,
11036 }))
11037 }
11038 }
11039 pub async fn post_lend_v1_earn_deposit(
11045 &self,
11046 request: LendEarnAmountRequestBody,
11047 ) -> Result<LendTransactionResponse, ApiOpError<serde_json::Value>> {
11048 let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/deposit");
11049 let mut req = self.http_client.post(request_url);
11050 req = req
11051 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
11052 .header("content-type", "application/json");
11053 if let Some(api_key) = &self.api_key {
11054 req = req.header("x-api-key", api_key.as_str());
11055 }
11056 for (name, value) in &self.custom_headers {
11057 if !name.eq_ignore_ascii_case("accept") {
11058 req = req.header(name, value);
11059 }
11060 }
11061 req = req.header(reqwest::header::ACCEPT, "application/json");
11062 let response = req.send().await?;
11063 let status = response.status();
11064 let status_code = status.as_u16();
11065 let headers = response.headers().clone();
11066 let body_bytes =
11067 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
11068 let raw_body = body_bytes;
11069 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
11070 if false || status_code == 200u16 {
11071 match serde_json::from_str(&body_text) {
11072 Ok(body) => Ok(body),
11073 Err(e) => Err(ApiOpError::Api(ApiError {
11074 status: status_code,
11075 headers: headers,
11076 body: body_text,
11077 raw_body,
11078 typed: None,
11079 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
11080 })),
11081 }
11082 } else if status.is_success() {
11083 Err(ApiOpError::Api(ApiError {
11084 status: status_code,
11085 headers,
11086 body: body_text,
11087 raw_body,
11088 typed: None,
11089 parse_error: Some(format!(
11090 "unexpected successful status {}; generated return type selects `{}`",
11091 status_code, "200",
11092 )),
11093 }))
11094 } else {
11095 let typed: Option<serde_json::Value>;
11096 let parse_error: Option<String>;
11097 match status_code {
11098 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
11099 Ok(v) => {
11100 typed = Some(v);
11101 parse_error = None;
11102 }
11103 Err(e) => {
11104 typed = None;
11105 parse_error = Some(e.to_string());
11106 }
11107 },
11108 }
11109 Err(ApiOpError::Api(ApiError {
11110 status: status_code,
11111 headers,
11112 body: body_text,
11113 raw_body,
11114 typed,
11115 parse_error,
11116 }))
11117 }
11118 }
11119 pub async fn post_lend_v1_earn_deposit_instructions(
11125 &self,
11126 request: LendEarnAmountRequestBody,
11127 ) -> Result<LendInstructionResponse, ApiOpError<serde_json::Value>> {
11128 let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/deposit-instructions");
11129 let mut req = self.http_client.post(request_url);
11130 req = req
11131 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
11132 .header("content-type", "application/json");
11133 if let Some(api_key) = &self.api_key {
11134 req = req.header("x-api-key", api_key.as_str());
11135 }
11136 for (name, value) in &self.custom_headers {
11137 if !name.eq_ignore_ascii_case("accept") {
11138 req = req.header(name, value);
11139 }
11140 }
11141 req = req.header(reqwest::header::ACCEPT, "application/json");
11142 let response = req.send().await?;
11143 let status = response.status();
11144 let status_code = status.as_u16();
11145 let headers = response.headers().clone();
11146 let body_bytes =
11147 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
11148 let raw_body = body_bytes;
11149 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
11150 if false || status_code == 200u16 {
11151 match serde_json::from_str(&body_text) {
11152 Ok(body) => Ok(body),
11153 Err(e) => Err(ApiOpError::Api(ApiError {
11154 status: status_code,
11155 headers: headers,
11156 body: body_text,
11157 raw_body,
11158 typed: None,
11159 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
11160 })),
11161 }
11162 } else if status.is_success() {
11163 Err(ApiOpError::Api(ApiError {
11164 status: status_code,
11165 headers,
11166 body: body_text,
11167 raw_body,
11168 typed: None,
11169 parse_error: Some(format!(
11170 "unexpected successful status {}; generated return type selects `{}`",
11171 status_code, "200",
11172 )),
11173 }))
11174 } else {
11175 let typed: Option<serde_json::Value>;
11176 let parse_error: Option<String>;
11177 match status_code {
11178 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
11179 Ok(v) => {
11180 typed = Some(v);
11181 parse_error = None;
11182 }
11183 Err(e) => {
11184 typed = None;
11185 parse_error = Some(e.to_string());
11186 }
11187 },
11188 }
11189 Err(ApiOpError::Api(ApiError {
11190 status: status_code,
11191 headers,
11192 body: body_text,
11193 raw_body,
11194 typed,
11195 parse_error,
11196 }))
11197 }
11198 }
11199 pub async fn post_lend_v1_earn_mint(
11205 &self,
11206 request: LendEarnSharesRequestBody,
11207 ) -> Result<LendTransactionResponse, ApiOpError<serde_json::Value>> {
11208 let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/mint");
11209 let mut req = self.http_client.post(request_url);
11210 req = req
11211 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
11212 .header("content-type", "application/json");
11213 if let Some(api_key) = &self.api_key {
11214 req = req.header("x-api-key", api_key.as_str());
11215 }
11216 for (name, value) in &self.custom_headers {
11217 if !name.eq_ignore_ascii_case("accept") {
11218 req = req.header(name, value);
11219 }
11220 }
11221 req = req.header(reqwest::header::ACCEPT, "application/json");
11222 let response = req.send().await?;
11223 let status = response.status();
11224 let status_code = status.as_u16();
11225 let headers = response.headers().clone();
11226 let body_bytes =
11227 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
11228 let raw_body = body_bytes;
11229 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
11230 if false || status_code == 200u16 {
11231 match serde_json::from_str(&body_text) {
11232 Ok(body) => Ok(body),
11233 Err(e) => Err(ApiOpError::Api(ApiError {
11234 status: status_code,
11235 headers: headers,
11236 body: body_text,
11237 raw_body,
11238 typed: None,
11239 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
11240 })),
11241 }
11242 } else if status.is_success() {
11243 Err(ApiOpError::Api(ApiError {
11244 status: status_code,
11245 headers,
11246 body: body_text,
11247 raw_body,
11248 typed: None,
11249 parse_error: Some(format!(
11250 "unexpected successful status {}; generated return type selects `{}`",
11251 status_code, "200",
11252 )),
11253 }))
11254 } else {
11255 let typed: Option<serde_json::Value>;
11256 let parse_error: Option<String>;
11257 match status_code {
11258 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
11259 Ok(v) => {
11260 typed = Some(v);
11261 parse_error = None;
11262 }
11263 Err(e) => {
11264 typed = None;
11265 parse_error = Some(e.to_string());
11266 }
11267 },
11268 }
11269 Err(ApiOpError::Api(ApiError {
11270 status: status_code,
11271 headers,
11272 body: body_text,
11273 raw_body,
11274 typed,
11275 parse_error,
11276 }))
11277 }
11278 }
11279 pub async fn post_lend_v1_earn_mint_instructions(
11285 &self,
11286 request: LendEarnSharesRequestBody,
11287 ) -> Result<LendInstructionResponse, ApiOpError<serde_json::Value>> {
11288 let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/mint-instructions");
11289 let mut req = self.http_client.post(request_url);
11290 req = req
11291 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
11292 .header("content-type", "application/json");
11293 if let Some(api_key) = &self.api_key {
11294 req = req.header("x-api-key", api_key.as_str());
11295 }
11296 for (name, value) in &self.custom_headers {
11297 if !name.eq_ignore_ascii_case("accept") {
11298 req = req.header(name, value);
11299 }
11300 }
11301 req = req.header(reqwest::header::ACCEPT, "application/json");
11302 let response = req.send().await?;
11303 let status = response.status();
11304 let status_code = status.as_u16();
11305 let headers = response.headers().clone();
11306 let body_bytes =
11307 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
11308 let raw_body = body_bytes;
11309 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
11310 if false || status_code == 200u16 {
11311 match serde_json::from_str(&body_text) {
11312 Ok(body) => Ok(body),
11313 Err(e) => Err(ApiOpError::Api(ApiError {
11314 status: status_code,
11315 headers: headers,
11316 body: body_text,
11317 raw_body,
11318 typed: None,
11319 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
11320 })),
11321 }
11322 } else if status.is_success() {
11323 Err(ApiOpError::Api(ApiError {
11324 status: status_code,
11325 headers,
11326 body: body_text,
11327 raw_body,
11328 typed: None,
11329 parse_error: Some(format!(
11330 "unexpected successful status {}; generated return type selects `{}`",
11331 status_code, "200",
11332 )),
11333 }))
11334 } else {
11335 let typed: Option<serde_json::Value>;
11336 let parse_error: Option<String>;
11337 match status_code {
11338 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
11339 Ok(v) => {
11340 typed = Some(v);
11341 parse_error = None;
11342 }
11343 Err(e) => {
11344 typed = None;
11345 parse_error = Some(e.to_string());
11346 }
11347 },
11348 }
11349 Err(ApiOpError::Api(ApiError {
11350 status: status_code,
11351 headers,
11352 body: body_text,
11353 raw_body,
11354 typed,
11355 parse_error,
11356 }))
11357 }
11358 }
11359 pub async fn post_lend_v1_earn_redeem(
11365 &self,
11366 request: LendEarnSharesRequestBody,
11367 ) -> Result<LendTransactionResponse, ApiOpError<serde_json::Value>> {
11368 let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/redeem");
11369 let mut req = self.http_client.post(request_url);
11370 req = req
11371 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
11372 .header("content-type", "application/json");
11373 if let Some(api_key) = &self.api_key {
11374 req = req.header("x-api-key", api_key.as_str());
11375 }
11376 for (name, value) in &self.custom_headers {
11377 if !name.eq_ignore_ascii_case("accept") {
11378 req = req.header(name, value);
11379 }
11380 }
11381 req = req.header(reqwest::header::ACCEPT, "application/json");
11382 let response = req.send().await?;
11383 let status = response.status();
11384 let status_code = status.as_u16();
11385 let headers = response.headers().clone();
11386 let body_bytes =
11387 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
11388 let raw_body = body_bytes;
11389 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
11390 if false || status_code == 200u16 {
11391 match serde_json::from_str(&body_text) {
11392 Ok(body) => Ok(body),
11393 Err(e) => Err(ApiOpError::Api(ApiError {
11394 status: status_code,
11395 headers: headers,
11396 body: body_text,
11397 raw_body,
11398 typed: None,
11399 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
11400 })),
11401 }
11402 } else if status.is_success() {
11403 Err(ApiOpError::Api(ApiError {
11404 status: status_code,
11405 headers,
11406 body: body_text,
11407 raw_body,
11408 typed: None,
11409 parse_error: Some(format!(
11410 "unexpected successful status {}; generated return type selects `{}`",
11411 status_code, "200",
11412 )),
11413 }))
11414 } else {
11415 let typed: Option<serde_json::Value>;
11416 let parse_error: Option<String>;
11417 match status_code {
11418 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
11419 Ok(v) => {
11420 typed = Some(v);
11421 parse_error = None;
11422 }
11423 Err(e) => {
11424 typed = None;
11425 parse_error = Some(e.to_string());
11426 }
11427 },
11428 }
11429 Err(ApiOpError::Api(ApiError {
11430 status: status_code,
11431 headers,
11432 body: body_text,
11433 raw_body,
11434 typed,
11435 parse_error,
11436 }))
11437 }
11438 }
11439 pub async fn post_lend_v1_earn_redeem_instructions(
11445 &self,
11446 request: LendEarnSharesRequestBody,
11447 ) -> Result<LendInstructionResponse, ApiOpError<serde_json::Value>> {
11448 let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/redeem-instructions");
11449 let mut req = self.http_client.post(request_url);
11450 req = req
11451 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
11452 .header("content-type", "application/json");
11453 if let Some(api_key) = &self.api_key {
11454 req = req.header("x-api-key", api_key.as_str());
11455 }
11456 for (name, value) in &self.custom_headers {
11457 if !name.eq_ignore_ascii_case("accept") {
11458 req = req.header(name, value);
11459 }
11460 }
11461 req = req.header(reqwest::header::ACCEPT, "application/json");
11462 let response = req.send().await?;
11463 let status = response.status();
11464 let status_code = status.as_u16();
11465 let headers = response.headers().clone();
11466 let body_bytes =
11467 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
11468 let raw_body = body_bytes;
11469 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
11470 if false || status_code == 200u16 {
11471 match serde_json::from_str(&body_text) {
11472 Ok(body) => Ok(body),
11473 Err(e) => Err(ApiOpError::Api(ApiError {
11474 status: status_code,
11475 headers: headers,
11476 body: body_text,
11477 raw_body,
11478 typed: None,
11479 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
11480 })),
11481 }
11482 } else if status.is_success() {
11483 Err(ApiOpError::Api(ApiError {
11484 status: status_code,
11485 headers,
11486 body: body_text,
11487 raw_body,
11488 typed: None,
11489 parse_error: Some(format!(
11490 "unexpected successful status {}; generated return type selects `{}`",
11491 status_code, "200",
11492 )),
11493 }))
11494 } else {
11495 let typed: Option<serde_json::Value>;
11496 let parse_error: Option<String>;
11497 match status_code {
11498 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
11499 Ok(v) => {
11500 typed = Some(v);
11501 parse_error = None;
11502 }
11503 Err(e) => {
11504 typed = None;
11505 parse_error = Some(e.to_string());
11506 }
11507 },
11508 }
11509 Err(ApiOpError::Api(ApiError {
11510 status: status_code,
11511 headers,
11512 body: body_text,
11513 raw_body,
11514 typed,
11515 parse_error,
11516 }))
11517 }
11518 }
11519 pub async fn post_lend_v1_earn_withdraw(
11525 &self,
11526 request: LendEarnAmountRequestBody,
11527 ) -> Result<LendTransactionResponse, ApiOpError<serde_json::Value>> {
11528 let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/withdraw");
11529 let mut req = self.http_client.post(request_url);
11530 req = req
11531 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
11532 .header("content-type", "application/json");
11533 if let Some(api_key) = &self.api_key {
11534 req = req.header("x-api-key", api_key.as_str());
11535 }
11536 for (name, value) in &self.custom_headers {
11537 if !name.eq_ignore_ascii_case("accept") {
11538 req = req.header(name, value);
11539 }
11540 }
11541 req = req.header(reqwest::header::ACCEPT, "application/json");
11542 let response = req.send().await?;
11543 let status = response.status();
11544 let status_code = status.as_u16();
11545 let headers = response.headers().clone();
11546 let body_bytes =
11547 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
11548 let raw_body = body_bytes;
11549 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
11550 if false || status_code == 200u16 {
11551 match serde_json::from_str(&body_text) {
11552 Ok(body) => Ok(body),
11553 Err(e) => Err(ApiOpError::Api(ApiError {
11554 status: status_code,
11555 headers: headers,
11556 body: body_text,
11557 raw_body,
11558 typed: None,
11559 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
11560 })),
11561 }
11562 } else if status.is_success() {
11563 Err(ApiOpError::Api(ApiError {
11564 status: status_code,
11565 headers,
11566 body: body_text,
11567 raw_body,
11568 typed: None,
11569 parse_error: Some(format!(
11570 "unexpected successful status {}; generated return type selects `{}`",
11571 status_code, "200",
11572 )),
11573 }))
11574 } else {
11575 let typed: Option<serde_json::Value>;
11576 let parse_error: Option<String>;
11577 match status_code {
11578 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
11579 Ok(v) => {
11580 typed = Some(v);
11581 parse_error = None;
11582 }
11583 Err(e) => {
11584 typed = None;
11585 parse_error = Some(e.to_string());
11586 }
11587 },
11588 }
11589 Err(ApiOpError::Api(ApiError {
11590 status: status_code,
11591 headers,
11592 body: body_text,
11593 raw_body,
11594 typed,
11595 parse_error,
11596 }))
11597 }
11598 }
11599 pub async fn post_lend_v1_earn_withdraw_instructions(
11605 &self,
11606 request: LendEarnAmountRequestBody,
11607 ) -> Result<LendInstructionResponse, ApiOpError<serde_json::Value>> {
11608 let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/withdraw-instructions");
11609 let mut req = self.http_client.post(request_url);
11610 req = req
11611 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
11612 .header("content-type", "application/json");
11613 if let Some(api_key) = &self.api_key {
11614 req = req.header("x-api-key", api_key.as_str());
11615 }
11616 for (name, value) in &self.custom_headers {
11617 if !name.eq_ignore_ascii_case("accept") {
11618 req = req.header(name, value);
11619 }
11620 }
11621 req = req.header(reqwest::header::ACCEPT, "application/json");
11622 let response = req.send().await?;
11623 let status = response.status();
11624 let status_code = status.as_u16();
11625 let headers = response.headers().clone();
11626 let body_bytes =
11627 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
11628 let raw_body = body_bytes;
11629 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
11630 if false || status_code == 200u16 {
11631 match serde_json::from_str(&body_text) {
11632 Ok(body) => Ok(body),
11633 Err(e) => Err(ApiOpError::Api(ApiError {
11634 status: status_code,
11635 headers: headers,
11636 body: body_text,
11637 raw_body,
11638 typed: None,
11639 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
11640 })),
11641 }
11642 } else if status.is_success() {
11643 Err(ApiOpError::Api(ApiError {
11644 status: status_code,
11645 headers,
11646 body: body_text,
11647 raw_body,
11648 typed: None,
11649 parse_error: Some(format!(
11650 "unexpected successful status {}; generated return type selects `{}`",
11651 status_code, "200",
11652 )),
11653 }))
11654 } else {
11655 let typed: Option<serde_json::Value>;
11656 let parse_error: Option<String>;
11657 match status_code {
11658 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
11659 Ok(v) => {
11660 typed = Some(v);
11661 parse_error = None;
11662 }
11663 Err(e) => {
11664 typed = None;
11665 parse_error = Some(e.to_string());
11666 }
11667 },
11668 }
11669 Err(ApiOpError::Api(ApiError {
11670 status: status_code,
11671 headers,
11672 body: body_text,
11673 raw_body,
11674 typed,
11675 parse_error,
11676 }))
11677 }
11678 }
11679 pub async fn post_prediction_v1_execute(
11685 &self,
11686 request: PredictionExecuteRequest,
11687 ) -> Result<PredictionExecuteResponse, ApiOpError<PostPredictionV1ExecuteApiError>> {
11688 let request_url = format!("{}{}", self.base_url, "/prediction/v1/execute");
11689 let mut req = self.http_client.post(request_url);
11690 req = req
11691 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
11692 .header("content-type", "application/json");
11693 if let Some(api_key) = &self.api_key {
11694 req = req.header("x-api-key", api_key.as_str());
11695 }
11696 for (name, value) in &self.custom_headers {
11697 if !name.eq_ignore_ascii_case("accept") {
11698 req = req.header(name, value);
11699 }
11700 }
11701 req = req.header(reqwest::header::ACCEPT, "application/json");
11702 let response = req.send().await?;
11703 let status = response.status();
11704 let status_code = status.as_u16();
11705 let headers = response.headers().clone();
11706 let body_bytes =
11707 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
11708 let raw_body = body_bytes;
11709 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
11710 if false || status_code == 200u16 {
11711 match serde_json::from_str(&body_text) {
11712 Ok(body) => Ok(body),
11713 Err(e) => Err(ApiOpError::Api(ApiError {
11714 status: status_code,
11715 headers: headers,
11716 body: body_text,
11717 raw_body,
11718 typed: None,
11719 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
11720 })),
11721 }
11722 } else if status.is_success() {
11723 Err(ApiOpError::Api(ApiError {
11724 status: status_code,
11725 headers,
11726 body: body_text,
11727 raw_body,
11728 typed: None,
11729 parse_error: Some(format!(
11730 "unexpected successful status {}; generated return type selects `{}`",
11731 status_code, "200",
11732 )),
11733 }))
11734 } else {
11735 let typed: Option<PostPredictionV1ExecuteApiError>;
11736 let parse_error: Option<String>;
11737 match status_code {
11738 400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
11739 Ok(v) => {
11740 typed = Some(PostPredictionV1ExecuteApiError::Status400(v));
11741 parse_error = None;
11742 }
11743 Err(e) => {
11744 typed = None;
11745 parse_error = Some(e.to_string());
11746 }
11747 },
11748 _ => {
11749 typed = None;
11750 parse_error = None;
11751 }
11752 }
11753 Err(ApiOpError::Api(ApiError {
11754 status: status_code,
11755 headers,
11756 body: body_text,
11757 raw_body,
11758 typed,
11759 parse_error,
11760 }))
11761 }
11762 }
11763 pub async fn post_prediction_v1_orders(
11765 &self,
11766 request: PredictionCreateOrderRequest,
11767 ) -> Result<PredictionCreateOrderResponse, ApiOpError<PostPredictionV1OrdersApiError>> {
11768 let request_url = format!("{}{}", self.base_url, "/prediction/v1/orders");
11769 let mut req = self.http_client.post(request_url);
11770 req = req
11771 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
11772 .header("content-type", "application/json");
11773 if let Some(api_key) = &self.api_key {
11774 req = req.header("x-api-key", api_key.as_str());
11775 }
11776 for (name, value) in &self.custom_headers {
11777 if !name.eq_ignore_ascii_case("accept") {
11778 req = req.header(name, value);
11779 }
11780 }
11781 req = req.header(reqwest::header::ACCEPT, "application/json");
11782 let response = req.send().await?;
11783 let status = response.status();
11784 let status_code = status.as_u16();
11785 let headers = response.headers().clone();
11786 let body_bytes =
11787 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
11788 let raw_body = body_bytes;
11789 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
11790 if false || status_code == 200u16 {
11791 match serde_json::from_str(&body_text) {
11792 Ok(body) => Ok(body),
11793 Err(e) => Err(ApiOpError::Api(ApiError {
11794 status: status_code,
11795 headers: headers,
11796 body: body_text,
11797 raw_body,
11798 typed: None,
11799 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
11800 })),
11801 }
11802 } else if status.is_success() {
11803 Err(ApiOpError::Api(ApiError {
11804 status: status_code,
11805 headers,
11806 body: body_text,
11807 raw_body,
11808 typed: None,
11809 parse_error: Some(format!(
11810 "unexpected successful status {}; generated return type selects `{}`",
11811 status_code, "200",
11812 )),
11813 }))
11814 } else {
11815 let typed: Option<PostPredictionV1OrdersApiError>;
11816 let parse_error: Option<String>;
11817 match status_code {
11818 400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
11819 Ok(v) => {
11820 typed = Some(PostPredictionV1OrdersApiError::Status400(v));
11821 parse_error = None;
11822 }
11823 Err(e) => {
11824 typed = None;
11825 parse_error = Some(e.to_string());
11826 }
11827 },
11828 _ => {
11829 typed = None;
11830 parse_error = None;
11831 }
11832 }
11833 Err(ApiOpError::Api(ApiError {
11834 status: status_code,
11835 headers,
11836 body: body_text,
11837 raw_body,
11838 typed,
11839 parse_error,
11840 }))
11841 }
11842 }
11843 pub async fn post_prediction_v1_positions_position_pubkey_claim(
11845 &self,
11846 position_pubkey: impl AsRef<str>,
11847 request: PredictionClaimPositionRequest,
11848 ) -> Result<
11849 PredictionClaimPositionResponse,
11850 ApiOpError<PostPredictionV1PositionsPositionPubkeyClaimApiError>,
11851 > {
11852 let request_url = format!(
11853 "{}{}",
11854 self.base_url,
11855 format!(
11856 "/prediction/v1/positions/{}/claim",
11857 __pct_encode_path_segment(position_pubkey.as_ref())
11858 )
11859 );
11860 let mut req = self.http_client.post(request_url);
11861 req = req
11862 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
11863 .header("content-type", "application/json");
11864 if let Some(api_key) = &self.api_key {
11865 req = req.header("x-api-key", api_key.as_str());
11866 }
11867 for (name, value) in &self.custom_headers {
11868 if !name.eq_ignore_ascii_case("accept") {
11869 req = req.header(name, value);
11870 }
11871 }
11872 req = req.header(reqwest::header::ACCEPT, "application/json");
11873 let response = req.send().await?;
11874 let status = response.status();
11875 let status_code = status.as_u16();
11876 let headers = response.headers().clone();
11877 let body_bytes =
11878 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
11879 let raw_body = body_bytes;
11880 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
11881 if false || status_code == 200u16 {
11882 match serde_json::from_str(&body_text) {
11883 Ok(body) => Ok(body),
11884 Err(e) => Err(ApiOpError::Api(ApiError {
11885 status: status_code,
11886 headers: headers,
11887 body: body_text,
11888 raw_body,
11889 typed: None,
11890 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
11891 })),
11892 }
11893 } else if status.is_success() {
11894 Err(ApiOpError::Api(ApiError {
11895 status: status_code,
11896 headers,
11897 body: body_text,
11898 raw_body,
11899 typed: None,
11900 parse_error: Some(format!(
11901 "unexpected successful status {}; generated return type selects `{}`",
11902 status_code, "200",
11903 )),
11904 }))
11905 } else {
11906 let typed: Option<PostPredictionV1PositionsPositionPubkeyClaimApiError>;
11907 let parse_error: Option<String>;
11908 match status_code {
11909 400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
11910 Ok(v) => {
11911 typed = Some(
11912 PostPredictionV1PositionsPositionPubkeyClaimApiError::Status400(v),
11913 );
11914 parse_error = None;
11915 }
11916 Err(e) => {
11917 typed = None;
11918 parse_error = Some(e.to_string());
11919 }
11920 },
11921 404u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
11922 Ok(v) => {
11923 typed = Some(
11924 PostPredictionV1PositionsPositionPubkeyClaimApiError::Status404(v),
11925 );
11926 parse_error = None;
11927 }
11928 Err(e) => {
11929 typed = None;
11930 parse_error = Some(e.to_string());
11931 }
11932 },
11933 _ => {
11934 typed = None;
11935 parse_error = None;
11936 }
11937 }
11938 Err(ApiOpError::Api(ApiError {
11939 status: status_code,
11940 headers,
11941 body: body_text,
11942 raw_body,
11943 typed,
11944 parse_error,
11945 }))
11946 }
11947 }
11948 pub async fn post_send_v1_craft_clawback(
11954 &self,
11955 request: PostSendV1CraftClawbackRequest,
11956 ) -> Result<PostSendV1CraftClawbackResponse, ApiOpError<PostSendV1CraftClawbackApiError>> {
11957 let request_url = format!("{}{}", self.base_url, "/send/v1/craft-clawback");
11958 let mut req = self.http_client.post(request_url);
11959 req = req
11960 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
11961 .header("content-type", "application/json");
11962 if let Some(api_key) = &self.api_key {
11963 req = req.header("x-api-key", api_key.as_str());
11964 }
11965 for (name, value) in &self.custom_headers {
11966 if !name.eq_ignore_ascii_case("accept") {
11967 req = req.header(name, value);
11968 }
11969 }
11970 req = req.header(reqwest::header::ACCEPT, "application/json");
11971 let response = req.send().await?;
11972 let status = response.status();
11973 let status_code = status.as_u16();
11974 let headers = response.headers().clone();
11975 let body_bytes =
11976 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
11977 let raw_body = body_bytes;
11978 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
11979 if false || status_code == 200u16 {
11980 match serde_json::from_str(&body_text) {
11981 Ok(body) => Ok(body),
11982 Err(e) => Err(ApiOpError::Api(ApiError {
11983 status: status_code,
11984 headers: headers,
11985 body: body_text,
11986 raw_body,
11987 typed: None,
11988 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
11989 })),
11990 }
11991 } else if status.is_success() {
11992 Err(ApiOpError::Api(ApiError {
11993 status: status_code,
11994 headers,
11995 body: body_text,
11996 raw_body,
11997 typed: None,
11998 parse_error: Some(format!(
11999 "unexpected successful status {}; generated return type selects `{}`",
12000 status_code, "200",
12001 )),
12002 }))
12003 } else {
12004 let typed: Option<PostSendV1CraftClawbackApiError>;
12005 let parse_error: Option<String>;
12006 match status_code {
12007 400u16 => {
12008 match serde_json::from_str::<PostSendV1CraftClawbackResponse400>(&body_text) {
12009 Ok(v) => {
12010 typed = Some(PostSendV1CraftClawbackApiError::Status400(v));
12011 parse_error = None;
12012 }
12013 Err(e) => {
12014 typed = None;
12015 parse_error = Some(e.to_string());
12016 }
12017 }
12018 }
12019 500u16 => {
12020 match serde_json::from_str::<PostSendV1CraftClawbackResponse500>(&body_text) {
12021 Ok(v) => {
12022 typed = Some(PostSendV1CraftClawbackApiError::Status500(v));
12023 parse_error = None;
12024 }
12025 Err(e) => {
12026 typed = None;
12027 parse_error = Some(e.to_string());
12028 }
12029 }
12030 }
12031 _ => {
12032 typed = None;
12033 parse_error = None;
12034 }
12035 }
12036 Err(ApiOpError::Api(ApiError {
12037 status: status_code,
12038 headers,
12039 body: body_text,
12040 raw_body,
12041 typed,
12042 parse_error,
12043 }))
12044 }
12045 }
12046 pub async fn post_send_v1_craft_send(
12052 &self,
12053 request: PostSendV1CraftSendRequest,
12054 ) -> Result<PostSendV1CraftSendResponse, ApiOpError<PostSendV1CraftSendApiError>> {
12055 let request_url = format!("{}{}", self.base_url, "/send/v1/craft-send");
12056 let mut req = self.http_client.post(request_url);
12057 req = req
12058 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
12059 .header("content-type", "application/json");
12060 if let Some(api_key) = &self.api_key {
12061 req = req.header("x-api-key", api_key.as_str());
12062 }
12063 for (name, value) in &self.custom_headers {
12064 if !name.eq_ignore_ascii_case("accept") {
12065 req = req.header(name, value);
12066 }
12067 }
12068 req = req.header(reqwest::header::ACCEPT, "application/json");
12069 let response = req.send().await?;
12070 let status = response.status();
12071 let status_code = status.as_u16();
12072 let headers = response.headers().clone();
12073 let body_bytes =
12074 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
12075 let raw_body = body_bytes;
12076 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
12077 if false || status_code == 200u16 {
12078 match serde_json::from_str(&body_text) {
12079 Ok(body) => Ok(body),
12080 Err(e) => Err(ApiOpError::Api(ApiError {
12081 status: status_code,
12082 headers: headers,
12083 body: body_text,
12084 raw_body,
12085 typed: None,
12086 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
12087 })),
12088 }
12089 } else if status.is_success() {
12090 Err(ApiOpError::Api(ApiError {
12091 status: status_code,
12092 headers,
12093 body: body_text,
12094 raw_body,
12095 typed: None,
12096 parse_error: Some(format!(
12097 "unexpected successful status {}; generated return type selects `{}`",
12098 status_code, "200",
12099 )),
12100 }))
12101 } else {
12102 let typed: Option<PostSendV1CraftSendApiError>;
12103 let parse_error: Option<String>;
12104 match status_code {
12105 400u16 => {
12106 match serde_json::from_str::<PostSendV1CraftSendResponse400>(&body_text) {
12107 Ok(v) => {
12108 typed = Some(PostSendV1CraftSendApiError::Status400(v));
12109 parse_error = None;
12110 }
12111 Err(e) => {
12112 typed = None;
12113 parse_error = Some(e.to_string());
12114 }
12115 }
12116 }
12117 500u16 => {
12118 match serde_json::from_str::<PostSendV1CraftSendResponse500>(&body_text) {
12119 Ok(v) => {
12120 typed = Some(PostSendV1CraftSendApiError::Status500(v));
12121 parse_error = None;
12122 }
12123 Err(e) => {
12124 typed = None;
12125 parse_error = Some(e.to_string());
12126 }
12127 }
12128 }
12129 _ => {
12130 typed = None;
12131 parse_error = None;
12132 }
12133 }
12134 Err(ApiOpError::Api(ApiError {
12135 status: status_code,
12136 headers,
12137 body: body_text,
12138 raw_body,
12139 typed,
12140 parse_error,
12141 }))
12142 }
12143 }
12144 pub async fn post_studio_v1_dbc_fee(
12150 &self,
12151 request: Option<PostStudioV1DbcFeeRequest>,
12152 ) -> Result<PostStudioV1DbcFeeResponse, ApiOpError<PostStudioV1DbcFeeApiError>> {
12153 let request_url = format!("{}{}", self.base_url, "/studio/v1/dbc/fee");
12154 let mut req = self.http_client.post(request_url);
12155 if let Some(request) = request {
12156 req = req
12157 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
12158 .header("content-type", "application/json");
12159 } else {
12160 req = req.header(reqwest::header::CONTENT_LENGTH, "0");
12161 }
12162 if let Some(api_key) = &self.api_key {
12163 req = req.header("x-api-key", api_key.as_str());
12164 }
12165 for (name, value) in &self.custom_headers {
12166 if !name.eq_ignore_ascii_case("accept") {
12167 req = req.header(name, value);
12168 }
12169 }
12170 req = req.header(reqwest::header::ACCEPT, "application/json");
12171 let response = req.send().await?;
12172 let status = response.status();
12173 let status_code = status.as_u16();
12174 let headers = response.headers().clone();
12175 let body_bytes =
12176 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
12177 let raw_body = body_bytes;
12178 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
12179 if false || status_code == 200u16 {
12180 match serde_json::from_str(&body_text) {
12181 Ok(body) => Ok(body),
12182 Err(e) => Err(ApiOpError::Api(ApiError {
12183 status: status_code,
12184 headers: headers,
12185 body: body_text,
12186 raw_body,
12187 typed: None,
12188 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
12189 })),
12190 }
12191 } else if status.is_success() {
12192 Err(ApiOpError::Api(ApiError {
12193 status: status_code,
12194 headers,
12195 body: body_text,
12196 raw_body,
12197 typed: None,
12198 parse_error: Some(format!(
12199 "unexpected successful status {}; generated return type selects `{}`",
12200 status_code, "200",
12201 )),
12202 }))
12203 } else {
12204 let typed: Option<PostStudioV1DbcFeeApiError>;
12205 let parse_error: Option<String>;
12206 match status_code {
12207 400u16 => match serde_json::from_str::<PostStudioV1DbcFeeResponse400>(&body_text) {
12208 Ok(v) => {
12209 typed = Some(PostStudioV1DbcFeeApiError::Status400(v));
12210 parse_error = None;
12211 }
12212 Err(e) => {
12213 typed = None;
12214 parse_error = Some(e.to_string());
12215 }
12216 },
12217 _ => {
12218 typed = None;
12219 parse_error = None;
12220 }
12221 }
12222 Err(ApiOpError::Api(ApiError {
12223 status: status_code,
12224 headers,
12225 body: body_text,
12226 raw_body,
12227 typed,
12228 parse_error,
12229 }))
12230 }
12231 }
12232 pub async fn post_studio_v1_dbc_fee_create_tx(
12239 &self,
12240 request: Option<StudioCreateClaimFeeDBCTransactionRequestBody>,
12241 ) -> Result<PostStudioV1DbcFeeCreateTxResponse, ApiOpError<PostStudioV1DbcFeeCreateTxApiError>>
12242 {
12243 let request_url = format!("{}{}", self.base_url, "/studio/v1/dbc/fee/create-tx");
12244 let mut req = self.http_client.post(request_url);
12245 if let Some(request) = request {
12246 req = req
12247 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
12248 .header("content-type", "application/json");
12249 } else {
12250 req = req.header(reqwest::header::CONTENT_LENGTH, "0");
12251 }
12252 if let Some(api_key) = &self.api_key {
12253 req = req.header("x-api-key", api_key.as_str());
12254 }
12255 for (name, value) in &self.custom_headers {
12256 if !name.eq_ignore_ascii_case("accept") {
12257 req = req.header(name, value);
12258 }
12259 }
12260 req = req.header(reqwest::header::ACCEPT, "application/json");
12261 let response = req.send().await?;
12262 let status = response.status();
12263 let status_code = status.as_u16();
12264 let headers = response.headers().clone();
12265 let body_bytes =
12266 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
12267 let raw_body = body_bytes;
12268 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
12269 if false || status_code == 200u16 {
12270 match serde_json::from_str(&body_text) {
12271 Ok(body) => Ok(body),
12272 Err(e) => Err(ApiOpError::Api(ApiError {
12273 status: status_code,
12274 headers: headers,
12275 body: body_text,
12276 raw_body,
12277 typed: None,
12278 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
12279 })),
12280 }
12281 } else if status.is_success() {
12282 Err(ApiOpError::Api(ApiError {
12283 status: status_code,
12284 headers,
12285 body: body_text,
12286 raw_body,
12287 typed: None,
12288 parse_error: Some(format!(
12289 "unexpected successful status {}; generated return type selects `{}`",
12290 status_code, "200",
12291 )),
12292 }))
12293 } else {
12294 let typed: Option<PostStudioV1DbcFeeCreateTxApiError>;
12295 let parse_error: Option<String>;
12296 match status_code {
12297 400u16 => {
12298 match serde_json::from_str::<PostStudioV1DbcFeeCreateTxResponse400>(&body_text)
12299 {
12300 Ok(v) => {
12301 typed = Some(PostStudioV1DbcFeeCreateTxApiError::Status400(v));
12302 parse_error = None;
12303 }
12304 Err(e) => {
12305 typed = None;
12306 parse_error = Some(e.to_string());
12307 }
12308 }
12309 }
12310 403u16 => {
12311 match serde_json::from_str::<PostStudioV1DbcFeeCreateTxResponse403>(&body_text)
12312 {
12313 Ok(v) => {
12314 typed = Some(PostStudioV1DbcFeeCreateTxApiError::Status403(v));
12315 parse_error = None;
12316 }
12317 Err(e) => {
12318 typed = None;
12319 parse_error = Some(e.to_string());
12320 }
12321 }
12322 }
12323 404u16 => {
12324 match serde_json::from_str::<PostStudioV1DbcFeeCreateTxResponse404>(&body_text)
12325 {
12326 Ok(v) => {
12327 typed = Some(PostStudioV1DbcFeeCreateTxApiError::Status404(v));
12328 parse_error = None;
12329 }
12330 Err(e) => {
12331 typed = None;
12332 parse_error = Some(e.to_string());
12333 }
12334 }
12335 }
12336 _ => {
12337 typed = None;
12338 parse_error = None;
12339 }
12340 }
12341 Err(ApiOpError::Api(ApiError {
12342 status: status_code,
12343 headers,
12344 body: body_text,
12345 raw_body,
12346 typed,
12347 parse_error,
12348 }))
12349 }
12350 }
12351 pub async fn post_studio_v1_dbc_pool_create_tx(
12357 &self,
12358 request: Option<StudioCreateDBCTransactionRequestBody>,
12359 ) -> Result<StudioCreateDBCTransactionResponse, ApiOpError<PostStudioV1DbcPoolCreateTxApiError>>
12360 {
12361 let request_url = format!("{}{}", self.base_url, "/studio/v1/dbc-pool/create-tx");
12362 let mut req = self.http_client.post(request_url);
12363 if let Some(request) = request {
12364 req = req
12365 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
12366 .header("content-type", "application/json");
12367 } else {
12368 req = req.header(reqwest::header::CONTENT_LENGTH, "0");
12369 }
12370 if let Some(api_key) = &self.api_key {
12371 req = req.header("x-api-key", api_key.as_str());
12372 }
12373 for (name, value) in &self.custom_headers {
12374 if !name.eq_ignore_ascii_case("accept") {
12375 req = req.header(name, value);
12376 }
12377 }
12378 req = req.header(reqwest::header::ACCEPT, "application/json");
12379 let response = req.send().await?;
12380 let status = response.status();
12381 let status_code = status.as_u16();
12382 let headers = response.headers().clone();
12383 let body_bytes =
12384 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
12385 let raw_body = body_bytes;
12386 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
12387 if false || status_code == 200u16 {
12388 match serde_json::from_str(&body_text) {
12389 Ok(body) => Ok(body),
12390 Err(e) => Err(ApiOpError::Api(ApiError {
12391 status: status_code,
12392 headers: headers,
12393 body: body_text,
12394 raw_body,
12395 typed: None,
12396 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
12397 })),
12398 }
12399 } else if status.is_success() {
12400 Err(ApiOpError::Api(ApiError {
12401 status: status_code,
12402 headers,
12403 body: body_text,
12404 raw_body,
12405 typed: None,
12406 parse_error: Some(format!(
12407 "unexpected successful status {}; generated return type selects `{}`",
12408 status_code, "200",
12409 )),
12410 }))
12411 } else {
12412 let typed: Option<PostStudioV1DbcPoolCreateTxApiError>;
12413 let parse_error: Option<String>;
12414 match status_code {
12415 400u16 => {
12416 match serde_json::from_str::<PostStudioV1DbcPoolCreateTxResponse400>(&body_text)
12417 {
12418 Ok(v) => {
12419 typed = Some(PostStudioV1DbcPoolCreateTxApiError::Status400(v));
12420 parse_error = None;
12421 }
12422 Err(e) => {
12423 typed = None;
12424 parse_error = Some(e.to_string());
12425 }
12426 }
12427 }
12428 500u16 => {
12429 match serde_json::from_str::<PostStudioV1DbcPoolCreateTxResponse500>(&body_text)
12430 {
12431 Ok(v) => {
12432 typed = Some(PostStudioV1DbcPoolCreateTxApiError::Status500(v));
12433 parse_error = None;
12434 }
12435 Err(e) => {
12436 typed = None;
12437 parse_error = Some(e.to_string());
12438 }
12439 }
12440 }
12441 _ => {
12442 typed = None;
12443 parse_error = None;
12444 }
12445 }
12446 Err(ApiOpError::Api(ApiError {
12447 status: status_code,
12448 headers,
12449 body: body_text,
12450 raw_body,
12451 typed,
12452 parse_error,
12453 }))
12454 }
12455 }
12456 pub async fn post_studio_v1_dbc_pool_submit(
12462 &self,
12463 request: Option<StudioSubmitDBCTransactionRequestBody>,
12464 ) -> Result<PostStudioV1DbcPoolSubmitResponse, ApiOpError<PostStudioV1DbcPoolSubmitApiError>>
12465 {
12466 let request_url = format!("{}{}", self.base_url, "/studio/v1/dbc-pool/submit");
12467 let mut req = self.http_client.post(request_url);
12468 if let Some(request) = request {
12469 let mut form = reqwest::multipart::Form::new();
12470 if let Some(value) = &request.content {
12471 form = form.text("content", value.to_string());
12472 }
12473 if let Some(value) = &request.header_image {
12474 form = form.part(
12475 "headerImage",
12476 reqwest::multipart::Part::bytes(value.to_vec()),
12477 );
12478 }
12479 let value = &request.owner;
12480 form = form.text("owner", value.to_string());
12481 let value = &request.transaction;
12482 form = form.text("transaction", value.to_string());
12483 req = req.multipart(form);
12484 } else {
12485 req = req.header(reqwest::header::CONTENT_LENGTH, "0");
12486 }
12487 if let Some(api_key) = &self.api_key {
12488 req = req.header("x-api-key", api_key.as_str());
12489 }
12490 for (name, value) in &self.custom_headers {
12491 if !name.eq_ignore_ascii_case("accept") {
12492 req = req.header(name, value);
12493 }
12494 }
12495 req = req.header(reqwest::header::ACCEPT, "application/json");
12496 let response = req.send().await?;
12497 let status = response.status();
12498 let status_code = status.as_u16();
12499 let headers = response.headers().clone();
12500 let body_bytes =
12501 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
12502 let raw_body = body_bytes;
12503 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
12504 if false || status_code == 200u16 {
12505 match serde_json::from_str(&body_text) {
12506 Ok(body) => Ok(body),
12507 Err(e) => Err(ApiOpError::Api(ApiError {
12508 status: status_code,
12509 headers: headers,
12510 body: body_text,
12511 raw_body,
12512 typed: None,
12513 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
12514 })),
12515 }
12516 } else if status.is_success() {
12517 Err(ApiOpError::Api(ApiError {
12518 status: status_code,
12519 headers,
12520 body: body_text,
12521 raw_body,
12522 typed: None,
12523 parse_error: Some(format!(
12524 "unexpected successful status {}; generated return type selects `{}`",
12525 status_code, "200",
12526 )),
12527 }))
12528 } else {
12529 let typed: Option<PostStudioV1DbcPoolSubmitApiError>;
12530 let parse_error: Option<String>;
12531 match status_code {
12532 400u16 => {
12533 match serde_json::from_str::<PostStudioV1DbcPoolSubmitResponse400>(&body_text) {
12534 Ok(v) => {
12535 typed = Some(PostStudioV1DbcPoolSubmitApiError::Status400(v));
12536 parse_error = None;
12537 }
12538 Err(e) => {
12539 typed = None;
12540 parse_error = Some(e.to_string());
12541 }
12542 }
12543 }
12544 _ => {
12545 typed = None;
12546 parse_error = None;
12547 }
12548 }
12549 Err(ApiOpError::Api(ApiError {
12550 status: status_code,
12551 headers,
12552 body: body_text,
12553 raw_body,
12554 typed,
12555 parse_error,
12556 }))
12557 }
12558 }
12559 pub async fn post_tokens_v2_verify_express_execute(
12567 &self,
12568 request: TokensV2VerificationExpressExecuteBody,
12569 ) -> Result<
12570 TokensV2VerificationExpressExecuteResponse,
12571 ApiOpError<PostTokensV2VerifyExpressExecuteApiError>,
12572 > {
12573 let request_url = format!("{}{}", self.base_url, "/tokens/v2/verify/express/execute");
12574 let mut req = self.http_client.post(request_url);
12575 req = req
12576 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
12577 .header("content-type", "application/json");
12578 if let Some(api_key) = &self.api_key {
12579 req = req.header("x-api-key", api_key.as_str());
12580 }
12581 for (name, value) in &self.custom_headers {
12582 if !name.eq_ignore_ascii_case("accept") {
12583 req = req.header(name, value);
12584 }
12585 }
12586 req = req.header(reqwest::header::ACCEPT, "application/json");
12587 let response = req.send().await?;
12588 let status = response.status();
12589 let status_code = status.as_u16();
12590 let headers = response.headers().clone();
12591 let body_bytes =
12592 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
12593 let raw_body = body_bytes;
12594 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
12595 if false || status_code == 200u16 {
12596 match serde_json::from_str(&body_text) {
12597 Ok(body) => Ok(body),
12598 Err(e) => Err(ApiOpError::Api(ApiError {
12599 status: status_code,
12600 headers: headers,
12601 body: body_text,
12602 raw_body,
12603 typed: None,
12604 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
12605 })),
12606 }
12607 } else if status.is_success() {
12608 Err(ApiOpError::Api(ApiError {
12609 status: status_code,
12610 headers,
12611 body: body_text,
12612 raw_body,
12613 typed: None,
12614 parse_error: Some(format!(
12615 "unexpected successful status {}; generated return type selects `{}`",
12616 status_code, "200",
12617 )),
12618 }))
12619 } else {
12620 let typed: Option<PostTokensV2VerifyExpressExecuteApiError>;
12621 let parse_error: Option<String>;
12622 match status_code {
12623 400u16 => {
12624 match serde_json::from_str::<TokensV2VerificationErrorResponse>(&body_text) {
12625 Ok(v) => {
12626 typed = Some(PostTokensV2VerifyExpressExecuteApiError::Status400(v));
12627 parse_error = None;
12628 }
12629 Err(e) => {
12630 typed = None;
12631 parse_error = Some(e.to_string());
12632 }
12633 }
12634 }
12635 409u16 => {
12636 match serde_json::from_str::<TokensV2VerificationErrorResponse>(&body_text) {
12637 Ok(v) => {
12638 typed = Some(PostTokensV2VerifyExpressExecuteApiError::Status409(v));
12639 parse_error = None;
12640 }
12641 Err(e) => {
12642 typed = None;
12643 parse_error = Some(e.to_string());
12644 }
12645 }
12646 }
12647 500u16 => {
12648 match serde_json::from_str::<TokensV2VerificationErrorResponse>(&body_text) {
12649 Ok(v) => {
12650 typed = Some(PostTokensV2VerifyExpressExecuteApiError::Status500(v));
12651 parse_error = None;
12652 }
12653 Err(e) => {
12654 typed = None;
12655 parse_error = Some(e.to_string());
12656 }
12657 }
12658 }
12659 _ => {
12660 typed = None;
12661 parse_error = None;
12662 }
12663 }
12664 Err(ApiOpError::Api(ApiError {
12665 status: status_code,
12666 headers,
12667 body: body_text,
12668 raw_body,
12669 typed,
12670 parse_error,
12671 }))
12672 }
12673 }
12674 pub async fn post_trigger_v1_cancel_order(
12680 &self,
12681 request: Option<PostTriggerV1CancelOrderRequest>,
12682 ) -> Result<PostTriggerV1CancelOrderResponse, ApiOpError<PostTriggerV1CancelOrderApiError>>
12683 {
12684 let request_url = format!("{}{}", self.base_url, "/trigger/v1/cancelOrder");
12685 let mut req = self.http_client.post(request_url);
12686 if let Some(request) = request {
12687 req = req
12688 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
12689 .header("content-type", "application/json");
12690 } else {
12691 req = req.header(reqwest::header::CONTENT_LENGTH, "0");
12692 }
12693 if let Some(api_key) = &self.api_key {
12694 req = req.header("x-api-key", api_key.as_str());
12695 }
12696 for (name, value) in &self.custom_headers {
12697 if !name.eq_ignore_ascii_case("accept") {
12698 req = req.header(name, value);
12699 }
12700 }
12701 req = req.header(reqwest::header::ACCEPT, "application/json");
12702 let response = req.send().await?;
12703 let status = response.status();
12704 let status_code = status.as_u16();
12705 let headers = response.headers().clone();
12706 let body_bytes =
12707 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
12708 let raw_body = body_bytes;
12709 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
12710 if false || status_code == 200u16 {
12711 match serde_json::from_str(&body_text) {
12712 Ok(body) => Ok(body),
12713 Err(e) => Err(ApiOpError::Api(ApiError {
12714 status: status_code,
12715 headers: headers,
12716 body: body_text,
12717 raw_body,
12718 typed: None,
12719 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
12720 })),
12721 }
12722 } else if status.is_success() {
12723 Err(ApiOpError::Api(ApiError {
12724 status: status_code,
12725 headers,
12726 body: body_text,
12727 raw_body,
12728 typed: None,
12729 parse_error: Some(format!(
12730 "unexpected successful status {}; generated return type selects `{}`",
12731 status_code, "200",
12732 )),
12733 }))
12734 } else {
12735 let typed: Option<PostTriggerV1CancelOrderApiError>;
12736 let parse_error: Option<String>;
12737 match status_code {
12738 400u16 => {
12739 match serde_json::from_str::<PostTriggerV1CancelOrderResponse400>(&body_text) {
12740 Ok(v) => {
12741 typed = Some(PostTriggerV1CancelOrderApiError::Status400(v));
12742 parse_error = None;
12743 }
12744 Err(e) => {
12745 typed = None;
12746 parse_error = Some(e.to_string());
12747 }
12748 }
12749 }
12750 500u16 => {
12751 match serde_json::from_str::<PostTriggerV1CancelOrderResponse500>(&body_text) {
12752 Ok(v) => {
12753 typed = Some(PostTriggerV1CancelOrderApiError::Status500(v));
12754 parse_error = None;
12755 }
12756 Err(e) => {
12757 typed = None;
12758 parse_error = Some(e.to_string());
12759 }
12760 }
12761 }
12762 _ => {
12763 typed = None;
12764 parse_error = None;
12765 }
12766 }
12767 Err(ApiOpError::Api(ApiError {
12768 status: status_code,
12769 headers,
12770 body: body_text,
12771 raw_body,
12772 typed,
12773 parse_error,
12774 }))
12775 }
12776 }
12777 pub async fn post_trigger_v1_cancel_orders(
12783 &self,
12784 request: Option<PostTriggerV1CancelOrdersRequest>,
12785 ) -> Result<PostTriggerV1CancelOrdersResponse, ApiOpError<PostTriggerV1CancelOrdersApiError>>
12786 {
12787 let request_url = format!("{}{}", self.base_url, "/trigger/v1/cancelOrders");
12788 let mut req = self.http_client.post(request_url);
12789 if let Some(request) = request {
12790 req = req
12791 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
12792 .header("content-type", "application/json");
12793 } else {
12794 req = req.header(reqwest::header::CONTENT_LENGTH, "0");
12795 }
12796 if let Some(api_key) = &self.api_key {
12797 req = req.header("x-api-key", api_key.as_str());
12798 }
12799 for (name, value) in &self.custom_headers {
12800 if !name.eq_ignore_ascii_case("accept") {
12801 req = req.header(name, value);
12802 }
12803 }
12804 req = req.header(reqwest::header::ACCEPT, "application/json");
12805 let response = req.send().await?;
12806 let status = response.status();
12807 let status_code = status.as_u16();
12808 let headers = response.headers().clone();
12809 let body_bytes =
12810 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
12811 let raw_body = body_bytes;
12812 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
12813 if false || status_code == 200u16 {
12814 match serde_json::from_str(&body_text) {
12815 Ok(body) => Ok(body),
12816 Err(e) => Err(ApiOpError::Api(ApiError {
12817 status: status_code,
12818 headers: headers,
12819 body: body_text,
12820 raw_body,
12821 typed: None,
12822 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
12823 })),
12824 }
12825 } else if status.is_success() {
12826 Err(ApiOpError::Api(ApiError {
12827 status: status_code,
12828 headers,
12829 body: body_text,
12830 raw_body,
12831 typed: None,
12832 parse_error: Some(format!(
12833 "unexpected successful status {}; generated return type selects `{}`",
12834 status_code, "200",
12835 )),
12836 }))
12837 } else {
12838 let typed: Option<PostTriggerV1CancelOrdersApiError>;
12839 let parse_error: Option<String>;
12840 match status_code {
12841 400u16 => {
12842 match serde_json::from_str::<PostTriggerV1CancelOrdersResponse400>(&body_text) {
12843 Ok(v) => {
12844 typed = Some(PostTriggerV1CancelOrdersApiError::Status400(v));
12845 parse_error = None;
12846 }
12847 Err(e) => {
12848 typed = None;
12849 parse_error = Some(e.to_string());
12850 }
12851 }
12852 }
12853 500u16 => {
12854 match serde_json::from_str::<PostTriggerV1CancelOrdersResponse500>(&body_text) {
12855 Ok(v) => {
12856 typed = Some(PostTriggerV1CancelOrdersApiError::Status500(v));
12857 parse_error = None;
12858 }
12859 Err(e) => {
12860 typed = None;
12861 parse_error = Some(e.to_string());
12862 }
12863 }
12864 }
12865 _ => {
12866 typed = None;
12867 parse_error = None;
12868 }
12869 }
12870 Err(ApiOpError::Api(ApiError {
12871 status: status_code,
12872 headers,
12873 body: body_text,
12874 raw_body,
12875 typed,
12876 parse_error,
12877 }))
12878 }
12879 }
12880 pub async fn post_trigger_v1_create_order(
12886 &self,
12887 request: Option<PostTriggerV1CreateOrderRequest>,
12888 ) -> Result<PostTriggerV1CreateOrderResponse, ApiOpError<PostTriggerV1CreateOrderApiError>>
12889 {
12890 let request_url = format!("{}{}", self.base_url, "/trigger/v1/createOrder");
12891 let mut req = self.http_client.post(request_url);
12892 if let Some(request) = request {
12893 req = req
12894 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
12895 .header("content-type", "application/json");
12896 } else {
12897 req = req.header(reqwest::header::CONTENT_LENGTH, "0");
12898 }
12899 if let Some(api_key) = &self.api_key {
12900 req = req.header("x-api-key", api_key.as_str());
12901 }
12902 for (name, value) in &self.custom_headers {
12903 if !name.eq_ignore_ascii_case("accept") {
12904 req = req.header(name, value);
12905 }
12906 }
12907 req = req.header(reqwest::header::ACCEPT, "application/json");
12908 let response = req.send().await?;
12909 let status = response.status();
12910 let status_code = status.as_u16();
12911 let headers = response.headers().clone();
12912 let body_bytes =
12913 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
12914 let raw_body = body_bytes;
12915 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
12916 if false || status_code == 200u16 {
12917 match serde_json::from_str(&body_text) {
12918 Ok(body) => Ok(body),
12919 Err(e) => Err(ApiOpError::Api(ApiError {
12920 status: status_code,
12921 headers: headers,
12922 body: body_text,
12923 raw_body,
12924 typed: None,
12925 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
12926 })),
12927 }
12928 } else if status.is_success() {
12929 Err(ApiOpError::Api(ApiError {
12930 status: status_code,
12931 headers,
12932 body: body_text,
12933 raw_body,
12934 typed: None,
12935 parse_error: Some(format!(
12936 "unexpected successful status {}; generated return type selects `{}`",
12937 status_code, "200",
12938 )),
12939 }))
12940 } else {
12941 let typed: Option<PostTriggerV1CreateOrderApiError>;
12942 let parse_error: Option<String>;
12943 match status_code {
12944 400u16 => {
12945 match serde_json::from_str::<PostTriggerV1CreateOrderResponse400>(&body_text) {
12946 Ok(v) => {
12947 typed = Some(PostTriggerV1CreateOrderApiError::Status400(v));
12948 parse_error = None;
12949 }
12950 Err(e) => {
12951 typed = None;
12952 parse_error = Some(e.to_string());
12953 }
12954 }
12955 }
12956 500u16 => {
12957 match serde_json::from_str::<PostTriggerV1CreateOrderResponse500>(&body_text) {
12958 Ok(v) => {
12959 typed = Some(PostTriggerV1CreateOrderApiError::Status500(v));
12960 parse_error = None;
12961 }
12962 Err(e) => {
12963 typed = None;
12964 parse_error = Some(e.to_string());
12965 }
12966 }
12967 }
12968 _ => {
12969 typed = None;
12970 parse_error = None;
12971 }
12972 }
12973 Err(ApiOpError::Api(ApiError {
12974 status: status_code,
12975 headers,
12976 body: body_text,
12977 raw_body,
12978 typed,
12979 parse_error,
12980 }))
12981 }
12982 }
12983 pub async fn post_trigger_v1_execute(
12989 &self,
12990 request: PostTriggerV1ExecuteRequest,
12991 ) -> Result<PostTriggerV1ExecuteResponse, ApiOpError<PostTriggerV1ExecuteApiError>> {
12992 let request_url = format!("{}{}", self.base_url, "/trigger/v1/execute");
12993 let mut req = self.http_client.post(request_url);
12994 req = req
12995 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
12996 .header("content-type", "application/json");
12997 if let Some(api_key) = &self.api_key {
12998 req = req.header("x-api-key", api_key.as_str());
12999 }
13000 for (name, value) in &self.custom_headers {
13001 if !name.eq_ignore_ascii_case("accept") {
13002 req = req.header(name, value);
13003 }
13004 }
13005 req = req.header(reqwest::header::ACCEPT, "application/json");
13006 let response = req.send().await?;
13007 let status = response.status();
13008 let status_code = status.as_u16();
13009 let headers = response.headers().clone();
13010 let body_bytes =
13011 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
13012 let raw_body = body_bytes;
13013 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
13014 if false || status_code == 200u16 {
13015 match serde_json::from_str(&body_text) {
13016 Ok(body) => Ok(body),
13017 Err(e) => Err(ApiOpError::Api(ApiError {
13018 status: status_code,
13019 headers: headers,
13020 body: body_text,
13021 raw_body,
13022 typed: None,
13023 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
13024 })),
13025 }
13026 } else if status.is_success() {
13027 Err(ApiOpError::Api(ApiError {
13028 status: status_code,
13029 headers,
13030 body: body_text,
13031 raw_body,
13032 typed: None,
13033 parse_error: Some(format!(
13034 "unexpected successful status {}; generated return type selects `{}`",
13035 status_code, "200",
13036 )),
13037 }))
13038 } else {
13039 let typed: Option<PostTriggerV1ExecuteApiError>;
13040 let parse_error: Option<String>;
13041 match status_code {
13042 400u16 => {
13043 match serde_json::from_str::<PostTriggerV1ExecuteResponse400>(&body_text) {
13044 Ok(v) => {
13045 typed = Some(PostTriggerV1ExecuteApiError::Status400(v));
13046 parse_error = None;
13047 }
13048 Err(e) => {
13049 typed = None;
13050 parse_error = Some(e.to_string());
13051 }
13052 }
13053 }
13054 500u16 => {
13055 match serde_json::from_str::<PostTriggerV1ExecuteResponse500>(&body_text) {
13056 Ok(v) => {
13057 typed = Some(PostTriggerV1ExecuteApiError::Status500(v));
13058 parse_error = None;
13059 }
13060 Err(e) => {
13061 typed = None;
13062 parse_error = Some(e.to_string());
13063 }
13064 }
13065 }
13066 _ => {
13067 typed = None;
13068 parse_error = None;
13069 }
13070 }
13071 Err(ApiOpError::Api(ApiError {
13072 status: status_code,
13073 headers,
13074 body: body_text,
13075 raw_body,
13076 typed,
13077 parse_error,
13078 }))
13079 }
13080 }
13081 pub async fn post_trigger_v2_auth_challenge(
13089 &self,
13090 request: PostTriggerV2AuthChallengeRequest,
13091 ) -> Result<PostTriggerV2AuthChallengeResponse, ApiOpError<PostTriggerV2AuthChallengeApiError>>
13092 {
13093 let request_url = format!("{}{}", self.base_url, "/trigger/v2/auth/challenge");
13094 let mut req = self.http_client.post(request_url);
13095 req = req
13096 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
13097 .header("content-type", "application/json");
13098 if let Some(api_key) = &self.api_key {
13099 req = req.header("x-api-key", api_key.as_str());
13100 }
13101 for (name, value) in &self.custom_headers {
13102 if !name.eq_ignore_ascii_case("accept") {
13103 req = req.header(name, value);
13104 }
13105 }
13106 req = req.header(reqwest::header::ACCEPT, "application/json");
13107 let response = req.send().await?;
13108 let status = response.status();
13109 let status_code = status.as_u16();
13110 let headers = response.headers().clone();
13111 let body_bytes =
13112 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
13113 let raw_body = body_bytes;
13114 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
13115 if false || status_code == 200u16 {
13116 match serde_json::from_str(&body_text) {
13117 Ok(body) => Ok(body),
13118 Err(e) => Err(ApiOpError::Api(ApiError {
13119 status: status_code,
13120 headers: headers,
13121 body: body_text,
13122 raw_body,
13123 typed: None,
13124 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
13125 })),
13126 }
13127 } else if status.is_success() {
13128 Err(ApiOpError::Api(ApiError {
13129 status: status_code,
13130 headers,
13131 body: body_text,
13132 raw_body,
13133 typed: None,
13134 parse_error: Some(format!(
13135 "unexpected successful status {}; generated return type selects `{}`",
13136 status_code, "200",
13137 )),
13138 }))
13139 } else {
13140 let typed: Option<PostTriggerV2AuthChallengeApiError>;
13141 let parse_error: Option<String>;
13142 match status_code {
13143 400u16 => match serde_json::from_str::<TriggerV2ErrorResponse>(&body_text) {
13144 Ok(v) => {
13145 typed = Some(PostTriggerV2AuthChallengeApiError::Status400(v));
13146 parse_error = None;
13147 }
13148 Err(e) => {
13149 typed = None;
13150 parse_error = Some(e.to_string());
13151 }
13152 },
13153 _ => {
13154 typed = None;
13155 parse_error = None;
13156 }
13157 }
13158 Err(ApiOpError::Api(ApiError {
13159 status: status_code,
13160 headers,
13161 body: body_text,
13162 raw_body,
13163 typed,
13164 parse_error,
13165 }))
13166 }
13167 }
13168 pub async fn post_trigger_v2_auth_verify(
13175 &self,
13176 request: PostTriggerV2AuthVerifyRequest,
13177 ) -> Result<PostTriggerV2AuthVerifyResponse, ApiOpError<PostTriggerV2AuthVerifyApiError>> {
13178 let request_url = format!("{}{}", self.base_url, "/trigger/v2/auth/verify");
13179 let mut req = self.http_client.post(request_url);
13180 req = req
13181 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
13182 .header("content-type", "application/json");
13183 if let Some(api_key) = &self.api_key {
13184 req = req.header("x-api-key", api_key.as_str());
13185 }
13186 for (name, value) in &self.custom_headers {
13187 if !name.eq_ignore_ascii_case("accept") {
13188 req = req.header(name, value);
13189 }
13190 }
13191 req = req.header(reqwest::header::ACCEPT, "application/json");
13192 let response = req.send().await?;
13193 let status = response.status();
13194 let status_code = status.as_u16();
13195 let headers = response.headers().clone();
13196 let body_bytes =
13197 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
13198 let raw_body = body_bytes;
13199 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
13200 if false || status_code == 200u16 {
13201 match serde_json::from_str(&body_text) {
13202 Ok(body) => Ok(body),
13203 Err(e) => Err(ApiOpError::Api(ApiError {
13204 status: status_code,
13205 headers: headers,
13206 body: body_text,
13207 raw_body,
13208 typed: None,
13209 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
13210 })),
13211 }
13212 } else if status.is_success() {
13213 Err(ApiOpError::Api(ApiError {
13214 status: status_code,
13215 headers,
13216 body: body_text,
13217 raw_body,
13218 typed: None,
13219 parse_error: Some(format!(
13220 "unexpected successful status {}; generated return type selects `{}`",
13221 status_code, "200",
13222 )),
13223 }))
13224 } else {
13225 let typed: Option<PostTriggerV2AuthVerifyApiError>;
13226 let parse_error: Option<String>;
13227 match status_code {
13228 400u16 => match serde_json::from_str::<TriggerV2ErrorResponse>(&body_text) {
13229 Ok(v) => {
13230 typed = Some(PostTriggerV2AuthVerifyApiError::Status400(v));
13231 parse_error = None;
13232 }
13233 Err(e) => {
13234 typed = None;
13235 parse_error = Some(e.to_string());
13236 }
13237 },
13238 401u16 => match serde_json::from_str::<TriggerV2ErrorResponse>(&body_text) {
13239 Ok(v) => {
13240 typed = Some(PostTriggerV2AuthVerifyApiError::Status401(v));
13241 parse_error = None;
13242 }
13243 Err(e) => {
13244 typed = None;
13245 parse_error = Some(e.to_string());
13246 }
13247 },
13248 _ => {
13249 typed = None;
13250 parse_error = None;
13251 }
13252 }
13253 Err(ApiOpError::Api(ApiError {
13254 status: status_code,
13255 headers,
13256 body: body_text,
13257 raw_body,
13258 typed,
13259 parse_error,
13260 }))
13261 }
13262 }
13263 pub async fn post_trigger_v2_deposit_craft(
13270 &self,
13271 request: PostTriggerV2DepositCraftRequest,
13272 ) -> Result<PostTriggerV2DepositCraftResponse, ApiOpError<PostTriggerV2DepositCraftApiError>>
13273 {
13274 let request_url = format!("{}{}", self.base_url, "/trigger/v2/deposit/craft");
13275 let mut req = self.http_client.post(request_url);
13276 req = req
13277 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
13278 .header("content-type", "application/json");
13279 if let Some(api_key) = &self.api_key {
13280 req = req.header("x-api-key", api_key.as_str());
13281 }
13282 for (name, value) in &self.custom_headers {
13283 if !name.eq_ignore_ascii_case("accept") {
13284 req = req.header(name, value);
13285 }
13286 }
13287 req = req.header(reqwest::header::ACCEPT, "application/json");
13288 let response = req.send().await?;
13289 let status = response.status();
13290 let status_code = status.as_u16();
13291 let headers = response.headers().clone();
13292 let body_bytes =
13293 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
13294 let raw_body = body_bytes;
13295 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
13296 if false || status_code == 200u16 {
13297 match serde_json::from_str(&body_text) {
13298 Ok(body) => Ok(body),
13299 Err(e) => Err(ApiOpError::Api(ApiError {
13300 status: status_code,
13301 headers: headers,
13302 body: body_text,
13303 raw_body,
13304 typed: None,
13305 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
13306 })),
13307 }
13308 } else if status.is_success() {
13309 Err(ApiOpError::Api(ApiError {
13310 status: status_code,
13311 headers,
13312 body: body_text,
13313 raw_body,
13314 typed: None,
13315 parse_error: Some(format!(
13316 "unexpected successful status {}; generated return type selects `{}`",
13317 status_code, "200",
13318 )),
13319 }))
13320 } else {
13321 let typed: Option<PostTriggerV2DepositCraftApiError>;
13322 let parse_error: Option<String>;
13323 match status_code {
13324 400u16 => match serde_json::from_str::<TriggerV2ErrorResponse>(&body_text) {
13325 Ok(v) => {
13326 typed = Some(PostTriggerV2DepositCraftApiError::Status400(v));
13327 parse_error = None;
13328 }
13329 Err(e) => {
13330 typed = None;
13331 parse_error = Some(e.to_string());
13332 }
13333 },
13334 _ => {
13335 typed = None;
13336 parse_error = None;
13337 }
13338 }
13339 Err(ApiOpError::Api(ApiError {
13340 status: status_code,
13341 headers,
13342 body: body_text,
13343 raw_body,
13344 typed,
13345 parse_error,
13346 }))
13347 }
13348 }
13349 pub async fn post_trigger_v2_orders_dca(
13363 &self,
13364 request: PostTriggerV2OrdersDcaRequest,
13365 ) -> Result<TriggerV2TxSignatureResponse, ApiOpError<PostTriggerV2OrdersDcaApiError>> {
13366 let request_url = format!("{}{}", self.base_url, "/trigger/v2/orders/dca");
13367 let mut req = self.http_client.post(request_url);
13368 req = req
13369 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
13370 .header("content-type", "application/json");
13371 if let Some(api_key) = &self.api_key {
13372 req = req.header("x-api-key", api_key.as_str());
13373 }
13374 for (name, value) in &self.custom_headers {
13375 if !name.eq_ignore_ascii_case("accept") {
13376 req = req.header(name, value);
13377 }
13378 }
13379 req = req.header(reqwest::header::ACCEPT, "application/json");
13380 let response = req.send().await?;
13381 let status = response.status();
13382 let status_code = status.as_u16();
13383 let headers = response.headers().clone();
13384 let body_bytes =
13385 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
13386 let raw_body = body_bytes;
13387 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
13388 if false || status_code == 200u16 {
13389 match serde_json::from_str(&body_text) {
13390 Ok(body) => Ok(body),
13391 Err(e) => Err(ApiOpError::Api(ApiError {
13392 status: status_code,
13393 headers: headers,
13394 body: body_text,
13395 raw_body,
13396 typed: None,
13397 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
13398 })),
13399 }
13400 } else if status.is_success() {
13401 Err(ApiOpError::Api(ApiError {
13402 status: status_code,
13403 headers,
13404 body: body_text,
13405 raw_body,
13406 typed: None,
13407 parse_error: Some(format!(
13408 "unexpected successful status {}; generated return type selects `{}`",
13409 status_code, "200",
13410 )),
13411 }))
13412 } else {
13413 let typed: Option<PostTriggerV2OrdersDcaApiError>;
13414 let parse_error: Option<String>;
13415 match status_code {
13416 400u16 => match serde_json::from_str::<TriggerV2ErrorResponse>(&body_text) {
13417 Ok(v) => {
13418 typed = Some(PostTriggerV2OrdersDcaApiError::Status400(v));
13419 parse_error = None;
13420 }
13421 Err(e) => {
13422 typed = None;
13423 parse_error = Some(e.to_string());
13424 }
13425 },
13426 _ => {
13427 typed = None;
13428 parse_error = None;
13429 }
13430 }
13431 Err(ApiOpError::Api(ApiError {
13432 status: status_code,
13433 headers,
13434 body: body_text,
13435 raw_body,
13436 typed,
13437 parse_error,
13438 }))
13439 }
13440 }
13441 pub async fn post_trigger_v2_orders_dca_cancel_id(
13449 &self,
13450 id: impl AsRef<str>,
13451 ) -> Result<PostTriggerV2OrdersDcaCancelIdResponse, ApiOpError<serde_json::Value>> {
13452 let request_url = format!(
13453 "{}{}",
13454 self.base_url,
13455 format!(
13456 "/trigger/v2/orders/dca/cancel/{}",
13457 __pct_encode_path_segment(id.as_ref())
13458 )
13459 );
13460 let mut req = self.http_client.post(request_url);
13461 req = req.header(reqwest::header::CONTENT_LENGTH, "0");
13462 if let Some(api_key) = &self.api_key {
13463 req = req.header("x-api-key", api_key.as_str());
13464 }
13465 for (name, value) in &self.custom_headers {
13466 if !name.eq_ignore_ascii_case("accept") {
13467 req = req.header(name, value);
13468 }
13469 }
13470 req = req.header(reqwest::header::ACCEPT, "application/json");
13471 let response = req.send().await?;
13472 let status = response.status();
13473 let status_code = status.as_u16();
13474 let headers = response.headers().clone();
13475 let body_bytes =
13476 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
13477 let raw_body = body_bytes;
13478 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
13479 if false || status_code == 200u16 {
13480 match serde_json::from_str(&body_text) {
13481 Ok(body) => Ok(body),
13482 Err(e) => Err(ApiOpError::Api(ApiError {
13483 status: status_code,
13484 headers: headers,
13485 body: body_text,
13486 raw_body,
13487 typed: None,
13488 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
13489 })),
13490 }
13491 } else if status.is_success() {
13492 Err(ApiOpError::Api(ApiError {
13493 status: status_code,
13494 headers,
13495 body: body_text,
13496 raw_body,
13497 typed: None,
13498 parse_error: Some(format!(
13499 "unexpected successful status {}; generated return type selects `{}`",
13500 status_code, "200",
13501 )),
13502 }))
13503 } else {
13504 let typed: Option<serde_json::Value>;
13505 let parse_error: Option<String>;
13506 match status_code {
13507 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
13508 Ok(v) => {
13509 typed = Some(v);
13510 parse_error = None;
13511 }
13512 Err(e) => {
13513 typed = None;
13514 parse_error = Some(e.to_string());
13515 }
13516 },
13517 }
13518 Err(ApiOpError::Api(ApiError {
13519 status: status_code,
13520 headers,
13521 body: body_text,
13522 raw_body,
13523 typed,
13524 parse_error,
13525 }))
13526 }
13527 }
13528 pub async fn post_trigger_v2_orders_dca_confirm_cancel_id(
13535 &self,
13536 id: impl AsRef<str>,
13537 request: PostTriggerV2OrdersDcaConfirmCancelIdRequest,
13538 ) -> Result<TriggerV2TxSignatureResponse, ApiOpError<serde_json::Value>> {
13539 let request_url = format!(
13540 "{}{}",
13541 self.base_url,
13542 format!(
13543 "/trigger/v2/orders/dca/confirm-cancel/{}",
13544 __pct_encode_path_segment(id.as_ref())
13545 )
13546 );
13547 let mut req = self.http_client.post(request_url);
13548 req = req
13549 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
13550 .header("content-type", "application/json");
13551 if let Some(api_key) = &self.api_key {
13552 req = req.header("x-api-key", api_key.as_str());
13553 }
13554 for (name, value) in &self.custom_headers {
13555 if !name.eq_ignore_ascii_case("accept") {
13556 req = req.header(name, value);
13557 }
13558 }
13559 req = req.header(reqwest::header::ACCEPT, "application/json");
13560 let response = req.send().await?;
13561 let status = response.status();
13562 let status_code = status.as_u16();
13563 let headers = response.headers().clone();
13564 let body_bytes =
13565 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
13566 let raw_body = body_bytes;
13567 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
13568 if false || status_code == 200u16 {
13569 match serde_json::from_str(&body_text) {
13570 Ok(body) => Ok(body),
13571 Err(e) => Err(ApiOpError::Api(ApiError {
13572 status: status_code,
13573 headers: headers,
13574 body: body_text,
13575 raw_body,
13576 typed: None,
13577 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
13578 })),
13579 }
13580 } else if status.is_success() {
13581 Err(ApiOpError::Api(ApiError {
13582 status: status_code,
13583 headers,
13584 body: body_text,
13585 raw_body,
13586 typed: None,
13587 parse_error: Some(format!(
13588 "unexpected successful status {}; generated return type selects `{}`",
13589 status_code, "200",
13590 )),
13591 }))
13592 } else {
13593 let typed: Option<serde_json::Value>;
13594 let parse_error: Option<String>;
13595 match status_code {
13596 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
13597 Ok(v) => {
13598 typed = Some(v);
13599 parse_error = None;
13600 }
13601 Err(e) => {
13602 typed = None;
13603 parse_error = Some(e.to_string());
13604 }
13605 },
13606 }
13607 Err(ApiOpError::Api(ApiError {
13608 status: status_code,
13609 headers,
13610 body: body_text,
13611 raw_body,
13612 typed,
13613 parse_error,
13614 }))
13615 }
13616 }
13617 pub async fn post_trigger_v2_orders_price(
13626 &self,
13627 request: PostTriggerV2OrdersPriceRequest,
13628 ) -> Result<TriggerV2OrderResponse, ApiOpError<PostTriggerV2OrdersPriceApiError>> {
13629 let request_url = format!("{}{}", self.base_url, "/trigger/v2/orders/price");
13630 let mut req = self.http_client.post(request_url);
13631 req = req
13632 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
13633 .header("content-type", "application/json");
13634 if let Some(api_key) = &self.api_key {
13635 req = req.header("x-api-key", api_key.as_str());
13636 }
13637 for (name, value) in &self.custom_headers {
13638 if !name.eq_ignore_ascii_case("accept") {
13639 req = req.header(name, value);
13640 }
13641 }
13642 req = req.header(reqwest::header::ACCEPT, "application/json");
13643 let response = req.send().await?;
13644 let status = response.status();
13645 let status_code = status.as_u16();
13646 let headers = response.headers().clone();
13647 let body_bytes =
13648 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
13649 let raw_body = body_bytes;
13650 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
13651 if false || status_code == 200u16 {
13652 match serde_json::from_str(&body_text) {
13653 Ok(body) => Ok(body),
13654 Err(e) => Err(ApiOpError::Api(ApiError {
13655 status: status_code,
13656 headers: headers,
13657 body: body_text,
13658 raw_body,
13659 typed: None,
13660 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
13661 })),
13662 }
13663 } else if status.is_success() {
13664 Err(ApiOpError::Api(ApiError {
13665 status: status_code,
13666 headers,
13667 body: body_text,
13668 raw_body,
13669 typed: None,
13670 parse_error: Some(format!(
13671 "unexpected successful status {}; generated return type selects `{}`",
13672 status_code, "200",
13673 )),
13674 }))
13675 } else {
13676 let typed: Option<PostTriggerV2OrdersPriceApiError>;
13677 let parse_error: Option<String>;
13678 match status_code {
13679 400u16 => match serde_json::from_str::<TriggerV2ErrorResponse>(&body_text) {
13680 Ok(v) => {
13681 typed = Some(PostTriggerV2OrdersPriceApiError::Status400(v));
13682 parse_error = None;
13683 }
13684 Err(e) => {
13685 typed = None;
13686 parse_error = Some(e.to_string());
13687 }
13688 },
13689 _ => {
13690 typed = None;
13691 parse_error = None;
13692 }
13693 }
13694 Err(ApiOpError::Api(ApiError {
13695 status: status_code,
13696 headers,
13697 body: body_text,
13698 raw_body,
13699 typed,
13700 parse_error,
13701 }))
13702 }
13703 }
13704 pub async fn post_trigger_v2_orders_price_cancel_order_id(
13711 &self,
13712 order_id: impl AsRef<str>,
13713 ) -> Result<PostTriggerV2OrdersPriceCancelOrderIdResponse, ApiOpError<serde_json::Value>> {
13714 let request_url = format!(
13715 "{}{}",
13716 self.base_url,
13717 format!(
13718 "/trigger/v2/orders/price/cancel/{}",
13719 __pct_encode_path_segment(order_id.as_ref())
13720 )
13721 );
13722 let mut req = self.http_client.post(request_url);
13723 req = req.header(reqwest::header::CONTENT_LENGTH, "0");
13724 if let Some(api_key) = &self.api_key {
13725 req = req.header("x-api-key", api_key.as_str());
13726 }
13727 for (name, value) in &self.custom_headers {
13728 if !name.eq_ignore_ascii_case("accept") {
13729 req = req.header(name, value);
13730 }
13731 }
13732 req = req.header(reqwest::header::ACCEPT, "application/json");
13733 let response = req.send().await?;
13734 let status = response.status();
13735 let status_code = status.as_u16();
13736 let headers = response.headers().clone();
13737 let body_bytes =
13738 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
13739 let raw_body = body_bytes;
13740 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
13741 if false || status_code == 200u16 {
13742 match serde_json::from_str(&body_text) {
13743 Ok(body) => Ok(body),
13744 Err(e) => Err(ApiOpError::Api(ApiError {
13745 status: status_code,
13746 headers: headers,
13747 body: body_text,
13748 raw_body,
13749 typed: None,
13750 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
13751 })),
13752 }
13753 } else if status.is_success() {
13754 Err(ApiOpError::Api(ApiError {
13755 status: status_code,
13756 headers,
13757 body: body_text,
13758 raw_body,
13759 typed: None,
13760 parse_error: Some(format!(
13761 "unexpected successful status {}; generated return type selects `{}`",
13762 status_code, "200",
13763 )),
13764 }))
13765 } else {
13766 let typed: Option<serde_json::Value>;
13767 let parse_error: Option<String>;
13768 match status_code {
13769 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
13770 Ok(v) => {
13771 typed = Some(v);
13772 parse_error = None;
13773 }
13774 Err(e) => {
13775 typed = None;
13776 parse_error = Some(e.to_string());
13777 }
13778 },
13779 }
13780 Err(ApiOpError::Api(ApiError {
13781 status: status_code,
13782 headers,
13783 body: body_text,
13784 raw_body,
13785 typed,
13786 parse_error,
13787 }))
13788 }
13789 }
13790 pub async fn post_trigger_v2_orders_price_confirm_cancel_order_id(
13797 &self,
13798 order_id: impl AsRef<str>,
13799 request: PostTriggerV2OrdersPriceConfirmCancelOrderIdRequest,
13800 ) -> Result<TriggerV2TxSignatureResponse, ApiOpError<serde_json::Value>> {
13801 let request_url = format!(
13802 "{}{}",
13803 self.base_url,
13804 format!(
13805 "/trigger/v2/orders/price/confirm-cancel/{}",
13806 __pct_encode_path_segment(order_id.as_ref())
13807 )
13808 );
13809 let mut req = self.http_client.post(request_url);
13810 req = req
13811 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
13812 .header("content-type", "application/json");
13813 if let Some(api_key) = &self.api_key {
13814 req = req.header("x-api-key", api_key.as_str());
13815 }
13816 for (name, value) in &self.custom_headers {
13817 if !name.eq_ignore_ascii_case("accept") {
13818 req = req.header(name, value);
13819 }
13820 }
13821 req = req.header(reqwest::header::ACCEPT, "application/json");
13822 let response = req.send().await?;
13823 let status = response.status();
13824 let status_code = status.as_u16();
13825 let headers = response.headers().clone();
13826 let body_bytes =
13827 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
13828 let raw_body = body_bytes;
13829 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
13830 if false || status_code == 200u16 {
13831 match serde_json::from_str(&body_text) {
13832 Ok(body) => Ok(body),
13833 Err(e) => Err(ApiOpError::Api(ApiError {
13834 status: status_code,
13835 headers: headers,
13836 body: body_text,
13837 raw_body,
13838 typed: None,
13839 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
13840 })),
13841 }
13842 } else if status.is_success() {
13843 Err(ApiOpError::Api(ApiError {
13844 status: status_code,
13845 headers,
13846 body: body_text,
13847 raw_body,
13848 typed: None,
13849 parse_error: Some(format!(
13850 "unexpected successful status {}; generated return type selects `{}`",
13851 status_code, "200",
13852 )),
13853 }))
13854 } else {
13855 let typed: Option<serde_json::Value>;
13856 let parse_error: Option<String>;
13857 match status_code {
13858 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
13859 Ok(v) => {
13860 typed = Some(v);
13861 parse_error = None;
13862 }
13863 Err(e) => {
13864 typed = None;
13865 parse_error = Some(e.to_string());
13866 }
13867 },
13868 }
13869 Err(ApiOpError::Api(ApiError {
13870 status: status_code,
13871 headers,
13872 body: body_text,
13873 raw_body,
13874 typed,
13875 parse_error,
13876 }))
13877 }
13878 }
13879 pub async fn post_ultra_v1_execute(
13885 &self,
13886 request: Option<PostUltraV1ExecuteRequest>,
13887 ) -> Result<PostUltraV1ExecuteResponse, ApiOpError<PostUltraV1ExecuteApiError>> {
13888 let request_url = format!("{}{}", self.base_url, "/ultra/v1/execute");
13889 let mut req = self.http_client.post(request_url);
13890 if let Some(request) = request {
13891 req = req
13892 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
13893 .header("content-type", "application/json");
13894 } else {
13895 req = req.header(reqwest::header::CONTENT_LENGTH, "0");
13896 }
13897 if let Some(api_key) = &self.api_key {
13898 req = req.header("x-api-key", api_key.as_str());
13899 }
13900 for (name, value) in &self.custom_headers {
13901 if !name.eq_ignore_ascii_case("accept") {
13902 req = req.header(name, value);
13903 }
13904 }
13905 req = req.header(reqwest::header::ACCEPT, "application/json");
13906 let response = req.send().await?;
13907 let status = response.status();
13908 let status_code = status.as_u16();
13909 let headers = response.headers().clone();
13910 let body_bytes =
13911 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
13912 let raw_body = body_bytes;
13913 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
13914 if false || status_code == 200u16 {
13915 match serde_json::from_str(&body_text) {
13916 Ok(body) => Ok(body),
13917 Err(e) => Err(ApiOpError::Api(ApiError {
13918 status: status_code,
13919 headers: headers,
13920 body: body_text,
13921 raw_body,
13922 typed: None,
13923 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
13924 })),
13925 }
13926 } else if status.is_success() {
13927 Err(ApiOpError::Api(ApiError {
13928 status: status_code,
13929 headers,
13930 body: body_text,
13931 raw_body,
13932 typed: None,
13933 parse_error: Some(format!(
13934 "unexpected successful status {}; generated return type selects `{}`",
13935 status_code, "200",
13936 )),
13937 }))
13938 } else {
13939 let typed: Option<PostUltraV1ExecuteApiError>;
13940 let parse_error: Option<String>;
13941 match status_code {
13942 400u16 => match serde_json::from_str::<PostUltraV1ExecuteResponse400>(&body_text) {
13943 Ok(v) => {
13944 typed = Some(PostUltraV1ExecuteApiError::Status400(v));
13945 parse_error = None;
13946 }
13947 Err(e) => {
13948 typed = None;
13949 parse_error = Some(e.to_string());
13950 }
13951 },
13952 500u16 => match serde_json::from_str::<PostUltraV1ExecuteResponse500>(&body_text) {
13953 Ok(v) => {
13954 typed = Some(PostUltraV1ExecuteApiError::Status500(v));
13955 parse_error = None;
13956 }
13957 Err(e) => {
13958 typed = None;
13959 parse_error = Some(e.to_string());
13960 }
13961 },
13962 _ => {
13963 typed = None;
13964 parse_error = None;
13965 }
13966 }
13967 Err(ApiOpError::Api(ApiError {
13968 status: status_code,
13969 headers,
13970 body: body_text,
13971 raw_body,
13972 typed,
13973 parse_error,
13974 }))
13975 }
13976 }
13977 pub async fn price_deposit(
13983 &self,
13984 request: RecurringDepositPriceRecurring,
13985 ) -> Result<RecurringRecurringResponse, ApiOpError<serde_json::Value>> {
13986 let request_url = format!("{}{}", self.base_url, "/recurring/v1/priceDeposit");
13987 let mut req = self.http_client.post(request_url);
13988 req = req
13989 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
13990 .header("content-type", "application/json");
13991 if let Some(api_key) = &self.api_key {
13992 req = req.header("x-api-key", api_key.as_str());
13993 }
13994 for (name, value) in &self.custom_headers {
13995 if !name.eq_ignore_ascii_case("accept") {
13996 req = req.header(name, value);
13997 }
13998 }
13999 req = req.header(reqwest::header::ACCEPT, "application/json");
14000 let response = req.send().await?;
14001 let status = response.status();
14002 let status_code = status.as_u16();
14003 let headers = response.headers().clone();
14004 let body_bytes =
14005 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
14006 let raw_body = body_bytes;
14007 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
14008 if false || status_code == 200u16 {
14009 match serde_json::from_str(&body_text) {
14010 Ok(body) => Ok(body),
14011 Err(e) => Err(ApiOpError::Api(ApiError {
14012 status: status_code,
14013 headers: headers,
14014 body: body_text,
14015 raw_body,
14016 typed: None,
14017 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
14018 })),
14019 }
14020 } else if status.is_success() {
14021 Err(ApiOpError::Api(ApiError {
14022 status: status_code,
14023 headers,
14024 body: body_text,
14025 raw_body,
14026 typed: None,
14027 parse_error: Some(format!(
14028 "unexpected successful status {}; generated return type selects `{}`",
14029 status_code, "200",
14030 )),
14031 }))
14032 } else {
14033 let typed: Option<serde_json::Value>;
14034 let parse_error: Option<String>;
14035 match status_code {
14036 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
14037 Ok(v) => {
14038 typed = Some(v);
14039 parse_error = None;
14040 }
14041 Err(e) => {
14042 typed = None;
14043 parse_error = Some(e.to_string());
14044 }
14045 },
14046 }
14047 Err(ApiOpError::Api(ApiError {
14048 status: status_code,
14049 headers,
14050 body: body_text,
14051 raw_body,
14052 typed,
14053 parse_error,
14054 }))
14055 }
14056 }
14057 pub async fn price_withdraw(
14063 &self,
14064 request: RecurringWithdrawPriceRecurring,
14065 ) -> Result<RecurringRecurringResponse, ApiOpError<serde_json::Value>> {
14066 let request_url = format!("{}{}", self.base_url, "/recurring/v1/priceWithdraw");
14067 let mut req = self.http_client.post(request_url);
14068 req = req
14069 .body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
14070 .header("content-type", "application/json");
14071 if let Some(api_key) = &self.api_key {
14072 req = req.header("x-api-key", api_key.as_str());
14073 }
14074 for (name, value) in &self.custom_headers {
14075 if !name.eq_ignore_ascii_case("accept") {
14076 req = req.header(name, value);
14077 }
14078 }
14079 req = req.header(reqwest::header::ACCEPT, "application/json");
14080 let response = req.send().await?;
14081 let status = response.status();
14082 let status_code = status.as_u16();
14083 let headers = response.headers().clone();
14084 let body_bytes =
14085 __read_bounded_response_body(response, self.max_response_body_bytes).await?;
14086 let raw_body = body_bytes;
14087 let body_text = String::from_utf8_lossy(&raw_body).into_owned();
14088 if false || status_code == 200u16 {
14089 match serde_json::from_str(&body_text) {
14090 Ok(body) => Ok(body),
14091 Err(e) => Err(ApiOpError::Api(ApiError {
14092 status: status_code,
14093 headers: headers,
14094 body: body_text,
14095 raw_body,
14096 typed: None,
14097 parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
14098 })),
14099 }
14100 } else if status.is_success() {
14101 Err(ApiOpError::Api(ApiError {
14102 status: status_code,
14103 headers,
14104 body: body_text,
14105 raw_body,
14106 typed: None,
14107 parse_error: Some(format!(
14108 "unexpected successful status {}; generated return type selects `{}`",
14109 status_code, "200",
14110 )),
14111 }))
14112 } else {
14113 let typed: Option<serde_json::Value>;
14114 let parse_error: Option<String>;
14115 match status_code {
14116 _ => match serde_json::from_str::<serde_json::Value>(&body_text) {
14117 Ok(v) => {
14118 typed = Some(v);
14119 parse_error = None;
14120 }
14121 Err(e) => {
14122 typed = None;
14123 parse_error = Some(e.to_string());
14124 }
14125 },
14126 }
14127 Err(ApiOpError::Api(ApiError {
14128 status: status_code,
14129 headers,
14130 body: body_text,
14131 raw_body,
14132 typed,
14133 parse_error,
14134 }))
14135 }
14136 }
14137 #[doc = concat!("Start an additive builder for `", "GetBuild", "`.")]
14138 pub fn get_build_builder(
14139 &self,
14140 input_mint: impl Into<String>,
14141 output_mint: impl Into<String>,
14142 amount: impl Into<String>,
14143 taker: impl Into<String>,
14144 ) -> GetBuildBuilder<'_> {
14145 GetBuildBuilder {
14146 client: self,
14147 input_mint: input_mint.into(),
14148 output_mint: output_mint.into(),
14149 amount: amount.into(),
14150 taker: taker.into(),
14151 slippage_bps: None,
14152 mode: None,
14153 dexes: None,
14154 exclude_dexes: None,
14155 platform_fee_bps: None,
14156 fee_account: None,
14157 max_accounts: None,
14158 payer: None,
14159 wrap_and_unwrap_sol: None,
14160 destination_token_account: None,
14161 native_destination_account: None,
14162 blockhash_slots_to_expiry: None,
14163 tip_amount: None,
14164 compute_unit_price_percentile: None,
14165 for_jito_bundle: None,
14166 }
14167 }
14168 #[doc = concat!("Start an additive builder for `", "GetOrder", "`.")]
14169 pub fn get_order_builder(
14170 &self,
14171 input_mint: impl Into<String>,
14172 output_mint: impl Into<String>,
14173 amount: impl Into<String>,
14174 ) -> GetOrderBuilder<'_> {
14175 GetOrderBuilder {
14176 client: self,
14177 input_mint: input_mint.into(),
14178 output_mint: output_mint.into(),
14179 amount: amount.into(),
14180 taker: None,
14181 receiver: None,
14182 swap_mode: None,
14183 slippage_bps: None,
14184 referral_account: None,
14185 referral_fee: None,
14186 payer: None,
14187 priority_fee_lamports: None,
14188 jito_tip_lamports: None,
14189 broadcast_fee_type: None,
14190 exclude_routers: None,
14191 exclude_dexes: None,
14192 }
14193 }
14194 #[doc = concat!("Start an additive builder for `", "PostExecute", "`.")]
14195 pub fn post_execute_builder(
14196 &self,
14197 request_id: String,
14198 signed_transaction: String,
14199 ) -> PostExecuteBuilder<'_> {
14200 PostExecuteBuilder {
14201 client: self,
14202 request: PostExecuteRequest::new(request_id, signed_transaction),
14203 }
14204 }
14205 #[doc = concat!("Start an additive builder for `", "QuoteGet", "`.")]
14206 pub fn quote_get_builder(
14207 &self,
14208 input_mint: impl Into<String>,
14209 output_mint: impl Into<String>,
14210 amount: u64,
14211 ) -> QuoteGetBuilder<'_> {
14212 QuoteGetBuilder {
14213 client: self,
14214 input_mint: input_mint.into(),
14215 output_mint: output_mint.into(),
14216 amount: amount,
14217 slippage_bps: None,
14218 swap_mode: None,
14219 dexes: None,
14220 exclude_dexes: None,
14221 restrict_intermediate_tokens: None,
14222 only_direct_routes: None,
14223 as_legacy_transaction: None,
14224 platform_fee_bps: None,
14225 max_accounts: None,
14226 instruction_version: None,
14227 dynamic_slippage: None,
14228 for_jito_bundle: None,
14229 }
14230 }
14231 #[doc = concat!("Start an additive builder for `", "SwapInstructionsPost", "`.")]
14232 pub fn swap_instructions_post_builder(
14233 &self,
14234 quote_response: SwapV1QuoteResponse,
14235 user_public_key: String,
14236 ) -> SwapInstructionsPostBuilder<'_> {
14237 SwapInstructionsPostBuilder {
14238 client: self,
14239 request: SwapV1SwapRequest::new(quote_response, user_public_key),
14240 }
14241 }
14242 #[doc = concat!("Start an additive builder for `", "SwapPost", "`.")]
14243 pub fn swap_post_builder(
14244 &self,
14245 quote_response: SwapV1QuoteResponse,
14246 user_public_key: String,
14247 ) -> SwapPostBuilder<'_> {
14248 SwapPostBuilder {
14249 client: self,
14250 request: SwapV1SwapRequest::new(quote_response, user_public_key),
14251 }
14252 }
14253 #[doc = concat!(
14254 "Start an additive builder for `", "buildBorrowOperateInstructions", "`."
14255 )]
14256 pub fn build_borrow_operate_instructions_builder(
14257 &self,
14258 col_amount: String,
14259 debt_amount: String,
14260 position_id: i64,
14261 signer: String,
14262 vault_id: i64,
14263 ) -> BuildBorrowOperateInstructionsBuilder<'_> {
14264 BuildBorrowOperateInstructionsBuilder {
14265 client: self,
14266 market: None,
14267 request: LendBorrowOperatePayload::new(
14268 col_amount,
14269 debt_amount,
14270 position_id,
14271 signer,
14272 vault_id,
14273 ),
14274 }
14275 }
14276 #[doc = concat!(
14277 "Start an additive builder for `", "buildBorrowOperateTransaction", "`."
14278 )]
14279 pub fn build_borrow_operate_transaction_builder(
14280 &self,
14281 col_amount: String,
14282 debt_amount: String,
14283 position_id: i64,
14284 signer: String,
14285 vault_id: i64,
14286 ) -> BuildBorrowOperateTransactionBuilder<'_> {
14287 BuildBorrowOperateTransactionBuilder {
14288 client: self,
14289 market: None,
14290 request: LendBorrowOperatePayload::new(
14291 col_amount,
14292 debt_amount,
14293 position_id,
14294 signer,
14295 vault_id,
14296 ),
14297 }
14298 }
14299 #[doc = concat!(
14300 "Start an additive builder for `", "deletePredictionV1Positions", "`."
14301 )]
14302 pub fn delete_prediction_v1_positions_builder(
14303 &self,
14304 min_sell_price_slippage_bps: f64,
14305 ) -> DeletePredictionV1PositionsBuilder<'_> {
14306 DeletePredictionV1PositionsBuilder {
14307 client: self,
14308 request: PredictionCloseAllPositionsRequest::new(min_sell_price_slippage_bps),
14309 }
14310 }
14311 #[doc = concat!(
14312 "Start an additive builder for `", "deletePredictionV1PositionsPositionPubkey",
14313 "`."
14314 )]
14315 pub fn delete_prediction_v1_positions_position_pubkey_builder(
14316 &self,
14317 position_pubkey: impl Into<String>,
14318 ) -> DeletePredictionV1PositionsPositionPubkeyBuilder<'_> {
14319 DeletePredictionV1PositionsPositionPubkeyBuilder {
14320 client: self,
14321 position_pubkey: position_pubkey.into(),
14322 request: Default::default(),
14323 }
14324 }
14325 #[doc = concat!(
14326 "Start an additive builder for `", "getPortfolioV1PositionsAddress", "`."
14327 )]
14328 pub fn get_portfolio_v1_positions_address_builder(
14329 &self,
14330 address: impl Into<String>,
14331 ) -> GetPortfolioV1PositionsAddressBuilder<'_> {
14332 GetPortfolioV1PositionsAddressBuilder {
14333 client: self,
14334 address: address.into(),
14335 platforms: None,
14336 }
14337 }
14338 #[doc = concat!("Start an additive builder for `", "getPredictionV1Events", "`.")]
14339 pub fn get_prediction_v1_events_builder(&self) -> GetPredictionV1EventsBuilder<'_> {
14340 GetPredictionV1EventsBuilder {
14341 client: self,
14342 provider: None,
14343 include_markets: None,
14344 include_all_markets: None,
14345 start: None,
14346 end: None,
14347 category: None,
14348 subcategory: None,
14349 sort_by: None,
14350 sort_direction: None,
14351 filter: None,
14352 tags: None,
14353 }
14354 }
14355 #[doc = concat!(
14356 "Start an additive builder for `", "getPredictionV1EventsEventId", "`."
14357 )]
14358 pub fn get_prediction_v1_events_event_id_builder(
14359 &self,
14360 event_id: impl Into<String>,
14361 ) -> GetPredictionV1EventsEventIdBuilder<'_> {
14362 GetPredictionV1EventsEventIdBuilder {
14363 client: self,
14364 event_id: event_id.into(),
14365 include_markets: None,
14366 include_all_markets: None,
14367 }
14368 }
14369 #[doc = concat!(
14370 "Start an additive builder for `", "getPredictionV1EventsEventIdMarkets", "`."
14371 )]
14372 pub fn get_prediction_v1_events_event_id_markets_builder(
14373 &self,
14374 event_id: impl Into<String>,
14375 ) -> GetPredictionV1EventsEventIdMarketsBuilder<'_> {
14376 GetPredictionV1EventsEventIdMarketsBuilder {
14377 client: self,
14378 event_id: event_id.into(),
14379 start: None,
14380 end: None,
14381 }
14382 }
14383 #[doc = concat!(
14384 "Start an additive builder for `", "getPredictionV1EventsSearch", "`."
14385 )]
14386 pub fn get_prediction_v1_events_search_builder(
14387 &self,
14388 query: impl Into<String>,
14389 ) -> GetPredictionV1EventsSearchBuilder<'_> {
14390 GetPredictionV1EventsSearchBuilder {
14391 client: self,
14392 provider: None,
14393 query: query.into(),
14394 limit: None,
14395 }
14396 }
14397 #[doc = concat!(
14398 "Start an additive builder for `", "getPredictionV1EventsSuggestedPubkey", "`."
14399 )]
14400 pub fn get_prediction_v1_events_suggested_pubkey_builder(
14401 &self,
14402 pubkey: impl Into<String>,
14403 ) -> GetPredictionV1EventsSuggestedPubkeyBuilder<'_> {
14404 GetPredictionV1EventsSuggestedPubkeyBuilder {
14405 client: self,
14406 pubkey: pubkey.into(),
14407 provider: None,
14408 }
14409 }
14410 #[doc = concat!("Start an additive builder for `", "getPredictionV1History", "`.")]
14411 pub fn get_prediction_v1_history_builder(&self) -> GetPredictionV1HistoryBuilder<'_> {
14412 GetPredictionV1HistoryBuilder {
14413 client: self,
14414 start: None,
14415 end: None,
14416 owner_pubkey: None,
14417 id: None,
14418 position_pubkey: None,
14419 }
14420 }
14421 #[doc = concat!(
14422 "Start an additive builder for `", "getPredictionV1Leaderboards", "`."
14423 )]
14424 pub fn get_prediction_v1_leaderboards_builder(&self) -> GetPredictionV1LeaderboardsBuilder<'_> {
14425 GetPredictionV1LeaderboardsBuilder {
14426 client: self,
14427 period: None,
14428 limit: None,
14429 metric: None,
14430 }
14431 }
14432 #[doc = concat!("Start an additive builder for `", "getPredictionV1Orders", "`.")]
14433 pub fn get_prediction_v1_orders_builder(&self) -> GetPredictionV1OrdersBuilder<'_> {
14434 GetPredictionV1OrdersBuilder {
14435 client: self,
14436 start: None,
14437 end: None,
14438 owner_pubkey: None,
14439 }
14440 }
14441 #[doc = concat!("Start an additive builder for `", "getPredictionV1Positions", "`.")]
14442 pub fn get_prediction_v1_positions_builder(&self) -> GetPredictionV1PositionsBuilder<'_> {
14443 GetPredictionV1PositionsBuilder {
14444 client: self,
14445 start: None,
14446 end: None,
14447 owner_pubkey: None,
14448 market_pubkey: None,
14449 market_id: None,
14450 is_yes: None,
14451 }
14452 }
14453 #[doc = concat!(
14454 "Start an additive builder for `",
14455 "getPredictionV1ProfilesOwnerPubkeyPnlHistory", "`."
14456 )]
14457 pub fn get_prediction_v1_profiles_owner_pubkey_pnl_history_builder(
14458 &self,
14459 owner_pubkey: impl Into<String>,
14460 ) -> GetPredictionV1ProfilesOwnerPubkeyPnlHistoryBuilder<'_> {
14461 GetPredictionV1ProfilesOwnerPubkeyPnlHistoryBuilder {
14462 client: self,
14463 owner_pubkey: owner_pubkey.into(),
14464 interval: None,
14465 count: None,
14466 }
14467 }
14468 #[doc = concat!("Start an additive builder for `", "getPriceV2", "`.")]
14469 pub fn get_price_v2_builder(&self, ids: impl Into<String>) -> GetPriceV2Builder<'_> {
14470 GetPriceV2Builder {
14471 client: self,
14472 ids: ids.into(),
14473 vs_token: None,
14474 show_extra_info: None,
14475 }
14476 }
14477 #[doc = concat!("Start an additive builder for `", "getSendV1InviteHistory", "`.")]
14478 pub fn get_send_v1_invite_history_builder(
14479 &self,
14480 address: impl Into<String>,
14481 ) -> GetSendV1InviteHistoryBuilder<'_> {
14482 GetSendV1InviteHistoryBuilder {
14483 client: self,
14484 address: address.into(),
14485 page: None,
14486 }
14487 }
14488 #[doc = concat!("Start an additive builder for `", "getSendV1PendingInvites", "`.")]
14489 pub fn get_send_v1_pending_invites_builder(
14490 &self,
14491 address: impl Into<String>,
14492 ) -> GetSendV1PendingInvitesBuilder<'_> {
14493 GetSendV1PendingInvitesBuilder {
14494 client: self,
14495 address: address.into(),
14496 page: None,
14497 }
14498 }
14499 #[doc = concat!("Start an additive builder for `", "getTokensV1New", "`.")]
14500 pub fn get_tokens_v1_new_builder(&self) -> GetTokensV1NewBuilder<'_> {
14501 GetTokensV1NewBuilder {
14502 client: self,
14503 limit: None,
14504 offset: None,
14505 }
14506 }
14507 #[doc = concat!(
14508 "Start an additive builder for `", "getTokensV2CategoryInterval", "`."
14509 )]
14510 pub fn get_tokens_v2_category_interval_builder(
14511 &self,
14512 category: GetTokensV2CategoryIntervalCategory,
14513 interval: GetTokensV2CategoryIntervalInterval,
14514 ) -> GetTokensV2CategoryIntervalBuilder<'_> {
14515 GetTokensV2CategoryIntervalBuilder {
14516 client: self,
14517 category: category,
14518 interval: interval,
14519 limit: None,
14520 }
14521 }
14522 #[doc = concat!(
14523 "Start an additive builder for `", "getTokensV2VerifyExpressCraftTxn", "`."
14524 )]
14525 pub fn get_tokens_v2_verify_express_craft_txn_builder(
14526 &self,
14527 sender_address: impl Into<String>,
14528 ) -> GetTokensV2VerifyExpressCraftTxnBuilder<'_> {
14529 GetTokensV2VerifyExpressCraftTxnBuilder {
14530 client: self,
14531 sender_address: sender_address.into(),
14532 payment_currency: None,
14533 }
14534 }
14535 #[doc = concat!(
14536 "Start an additive builder for `", "getTriggerV1GetTriggerOrders", "`."
14537 )]
14538 pub fn get_trigger_v1_get_trigger_orders_builder(
14539 &self,
14540 user: impl Into<String>,
14541 order_status: GetTriggerV1GetTriggerOrdersOrderStatus,
14542 ) -> GetTriggerV1GetTriggerOrdersBuilder<'_> {
14543 GetTriggerV1GetTriggerOrdersBuilder {
14544 client: self,
14545 user: user.into(),
14546 page: None,
14547 include_failed_tx: None,
14548 order_status: order_status,
14549 input_mint: None,
14550 output_mint: None,
14551 }
14552 }
14553 #[doc = concat!(
14554 "Start an additive builder for `", "getTriggerV2OrdersHistory", "`."
14555 )]
14556 pub fn get_trigger_v2_orders_history_builder(&self) -> GetTriggerV2OrdersHistoryBuilder<'_> {
14557 GetTriggerV2OrdersHistoryBuilder {
14558 client: self,
14559 state: None,
14560 mint: None,
14561 limit: None,
14562 offset: None,
14563 sort: None,
14564 dir: None,
14565 }
14566 }
14567 #[doc = concat!(
14568 "Start an additive builder for `", "getTriggerV2OrdersHistoryDca", "`."
14569 )]
14570 pub fn get_trigger_v2_orders_history_dca_builder(
14571 &self,
14572 ) -> GetTriggerV2OrdersHistoryDcaBuilder<'_> {
14573 GetTriggerV2OrdersHistoryDcaBuilder {
14574 client: self,
14575 state: None,
14576 mint: None,
14577 limit: None,
14578 offset: None,
14579 sort: None,
14580 dir: None,
14581 }
14582 }
14583 #[doc = concat!("Start an additive builder for `", "getUltraV1Order", "`.")]
14584 pub fn get_ultra_v1_order_builder(
14585 &self,
14586 input_mint: impl Into<String>,
14587 output_mint: impl Into<String>,
14588 amount: impl Into<String>,
14589 ) -> GetUltraV1OrderBuilder<'_> {
14590 GetUltraV1OrderBuilder {
14591 client: self,
14592 input_mint: input_mint.into(),
14593 output_mint: output_mint.into(),
14594 amount: amount.into(),
14595 taker: None,
14596 receiver: None,
14597 payer: None,
14598 close_authority: None,
14599 referral_account: None,
14600 referral_fee: None,
14601 exclude_routers: None,
14602 exclude_dexes: None,
14603 }
14604 }
14605 #[doc = concat!("Start an additive builder for `", "listBorrowPositions", "`.")]
14606 pub fn list_borrow_positions_builder(
14607 &self,
14608 users: impl Into<String>,
14609 ) -> ListBorrowPositionsBuilder<'_> {
14610 ListBorrowPositionsBuilder {
14611 client: self,
14612 users: users.into(),
14613 market: None,
14614 }
14615 }
14616 #[doc = concat!("Start an additive builder for `", "listBorrowVaults", "`.")]
14617 pub fn list_borrow_vaults_builder(&self) -> ListBorrowVaultsBuilder<'_> {
14618 ListBorrowVaultsBuilder {
14619 client: self,
14620 market: None,
14621 rpc_url: None,
14622 }
14623 }
14624 #[doc = concat!(
14625 "Start an additive builder for `", "patchTriggerV2OrdersPriceOrderId", "`."
14626 )]
14627 pub fn patch_trigger_v2_orders_price_order_id_builder(
14628 &self,
14629 order_id: impl Into<String>,
14630 order_type: PatchTriggerV2OrdersPriceOrderIdRequestOrderType,
14631 ) -> PatchTriggerV2OrdersPriceOrderIdBuilder<'_> {
14632 PatchTriggerV2OrdersPriceOrderIdBuilder {
14633 client: self,
14634 order_id: order_id.into(),
14635 request: PatchTriggerV2OrdersPriceOrderIdRequest::new(order_type),
14636 }
14637 }
14638 #[doc = concat!("Start an additive builder for `", "postPredictionV1Execute", "`.")]
14639 pub fn post_prediction_v1_execute_builder(
14640 &self,
14641 signed_transaction: String,
14642 ) -> PostPredictionV1ExecuteBuilder<'_> {
14643 PostPredictionV1ExecuteBuilder {
14644 client: self,
14645 request: PredictionExecuteRequest::new(signed_transaction),
14646 }
14647 }
14648 #[doc = concat!("Start an additive builder for `", "postPredictionV1Orders", "`.")]
14649 pub fn post_prediction_v1_orders_builder(
14650 &self,
14651 is_buy: bool,
14652 ) -> PostPredictionV1OrdersBuilder<'_> {
14653 PostPredictionV1OrdersBuilder {
14654 client: self,
14655 request: PredictionCreateOrderRequest::new(is_buy),
14656 }
14657 }
14658 #[doc = concat!(
14659 "Start an additive builder for `",
14660 "postPredictionV1PositionsPositionPubkeyClaim", "`."
14661 )]
14662 pub fn post_prediction_v1_positions_position_pubkey_claim_builder(
14663 &self,
14664 position_pubkey: impl Into<String>,
14665 ) -> PostPredictionV1PositionsPositionPubkeyClaimBuilder<'_> {
14666 PostPredictionV1PositionsPositionPubkeyClaimBuilder {
14667 client: self,
14668 position_pubkey: position_pubkey.into(),
14669 request: Default::default(),
14670 }
14671 }
14672 #[doc = concat!("Start an additive builder for `", "postSendV1CraftSend", "`.")]
14673 pub fn post_send_v1_craft_send_builder(
14674 &self,
14675 amount: String,
14676 invite_signer: String,
14677 sender: String,
14678 ) -> PostSendV1CraftSendBuilder<'_> {
14679 PostSendV1CraftSendBuilder {
14680 client: self,
14681 request: PostSendV1CraftSendRequest::new(amount, invite_signer, sender),
14682 }
14683 }
14684 #[doc = concat!("Start an additive builder for `", "postStudioV1DbcFee", "`.")]
14685 pub fn post_studio_v1_dbc_fee_builder(&self) -> PostStudioV1DbcFeeBuilder<'_> {
14686 PostStudioV1DbcFeeBuilder {
14687 client: self,
14688 request: None,
14689 }
14690 }
14691 #[doc = concat!(
14692 "Start an additive builder for `", "postStudioV1DbcFeeCreateTx", "`."
14693 )]
14694 pub fn post_studio_v1_dbc_fee_create_tx_builder(
14695 &self,
14696 ) -> PostStudioV1DbcFeeCreateTxBuilder<'_> {
14697 PostStudioV1DbcFeeCreateTxBuilder {
14698 client: self,
14699 request: None,
14700 }
14701 }
14702 #[doc = concat!(
14703 "Start an additive builder for `", "postStudioV1DbcPoolCreateTx", "`."
14704 )]
14705 pub fn post_studio_v1_dbc_pool_create_tx_builder(
14706 &self,
14707 ) -> PostStudioV1DbcPoolCreateTxBuilder<'_> {
14708 PostStudioV1DbcPoolCreateTxBuilder {
14709 client: self,
14710 request: None,
14711 }
14712 }
14713 #[doc = concat!(
14714 "Start an additive builder for `", "postStudioV1DbcPoolSubmit", "`."
14715 )]
14716 pub fn post_studio_v1_dbc_pool_submit_builder(&self) -> PostStudioV1DbcPoolSubmitBuilder<'_> {
14717 PostStudioV1DbcPoolSubmitBuilder {
14718 client: self,
14719 request: None,
14720 }
14721 }
14722 #[doc = concat!(
14723 "Start an additive builder for `", "postTokensV2VerifyExpressExecute", "`."
14724 )]
14725 pub fn post_tokens_v2_verify_express_execute_builder(
14726 &self,
14727 description: String,
14728 request_id: String,
14729 sender_address: String,
14730 token_id: String,
14731 transaction: String,
14732 twitter_handle: String,
14733 ) -> PostTokensV2VerifyExpressExecuteBuilder<'_> {
14734 PostTokensV2VerifyExpressExecuteBuilder {
14735 client: self,
14736 request: TokensV2VerificationExpressExecuteBody::new(
14737 description,
14738 request_id,
14739 sender_address,
14740 token_id,
14741 transaction,
14742 twitter_handle,
14743 ),
14744 }
14745 }
14746 #[doc = concat!("Start an additive builder for `", "postTriggerV1CancelOrder", "`.")]
14747 pub fn post_trigger_v1_cancel_order_builder(&self) -> PostTriggerV1CancelOrderBuilder<'_> {
14748 PostTriggerV1CancelOrderBuilder {
14749 client: self,
14750 request: None,
14751 }
14752 }
14753 #[doc = concat!(
14754 "Start an additive builder for `", "postTriggerV1CancelOrders", "`."
14755 )]
14756 pub fn post_trigger_v1_cancel_orders_builder(&self) -> PostTriggerV1CancelOrdersBuilder<'_> {
14757 PostTriggerV1CancelOrdersBuilder {
14758 client: self,
14759 request: None,
14760 }
14761 }
14762 #[doc = concat!("Start an additive builder for `", "postTriggerV1CreateOrder", "`.")]
14763 pub fn post_trigger_v1_create_order_builder(&self) -> PostTriggerV1CreateOrderBuilder<'_> {
14764 PostTriggerV1CreateOrderBuilder {
14765 client: self,
14766 request: None,
14767 }
14768 }
14769 #[doc = concat!(
14770 "Start an additive builder for `", "postTriggerV2DepositCraft", "`."
14771 )]
14772 pub fn post_trigger_v2_deposit_craft_builder(
14773 &self,
14774 amount: String,
14775 input_mint: String,
14776 order_type: PostTriggerV2DepositCraftRequestOrderType,
14777 output_mint: String,
14778 user_address: String,
14779 ) -> PostTriggerV2DepositCraftBuilder<'_> {
14780 PostTriggerV2DepositCraftBuilder {
14781 client: self,
14782 request: PostTriggerV2DepositCraftRequest::new(
14783 amount,
14784 input_mint,
14785 order_type,
14786 output_mint,
14787 user_address,
14788 ),
14789 }
14790 }
14791 #[doc = concat!("Start an additive builder for `", "postTriggerV2OrdersDca", "`.")]
14792 pub fn post_trigger_v2_orders_dca_builder(
14793 &self,
14794 deposit_request_id: String,
14795 deposit_signed_tx: String,
14796 input_amount: String,
14797 input_mint: String,
14798 interval_seconds: f64,
14799 order_count: f64,
14800 output_mint: String,
14801 user_pubkey: String,
14802 ) -> PostTriggerV2OrdersDcaBuilder<'_> {
14803 PostTriggerV2OrdersDcaBuilder {
14804 client: self,
14805 request: PostTriggerV2OrdersDcaRequest::new(
14806 deposit_request_id,
14807 deposit_signed_tx,
14808 input_amount,
14809 input_mint,
14810 interval_seconds,
14811 order_count,
14812 output_mint,
14813 user_pubkey,
14814 ),
14815 }
14816 }
14817 #[doc = concat!("Start an additive builder for `", "postTriggerV2OrdersPrice", "`.")]
14818 pub fn post_trigger_v2_orders_price_builder(
14819 &self,
14820 deposit_request_id: String,
14821 deposit_signed_tx: String,
14822 expires_at: f64,
14823 input_amount: String,
14824 input_mint: String,
14825 order_type: PostTriggerV2OrdersPriceRequestOrderType,
14826 output_mint: String,
14827 trigger_mint: String,
14828 user_pubkey: String,
14829 ) -> PostTriggerV2OrdersPriceBuilder<'_> {
14830 PostTriggerV2OrdersPriceBuilder {
14831 client: self,
14832 request: PostTriggerV2OrdersPriceRequest::new(
14833 deposit_request_id,
14834 deposit_signed_tx,
14835 expires_at,
14836 input_amount,
14837 input_mint,
14838 order_type,
14839 output_mint,
14840 trigger_mint,
14841 user_pubkey,
14842 ),
14843 }
14844 }
14845 #[doc = concat!("Start an additive builder for `", "postUltraV1Execute", "`.")]
14846 pub fn post_ultra_v1_execute_builder(&self) -> PostUltraV1ExecuteBuilder<'_> {
14847 PostUltraV1ExecuteBuilder {
14848 client: self,
14849 request: None,
14850 }
14851 }
14852 #[doc = concat!("Start an additive builder for `", "price-withdraw", "`.")]
14853 pub fn price_withdraw_builder(
14854 &self,
14855 input_or_output: RecurringWithdrawal,
14856 order: String,
14857 user: String,
14858 ) -> PriceWithdrawBuilder<'_> {
14859 PriceWithdrawBuilder {
14860 client: self,
14861 request: RecurringWithdrawPriceRecurring::new(input_or_output, order, user),
14862 }
14863 }
14864}