#![allow(clippy::format_in_format_args)]
#![allow(clippy::let_unit_value)]
use super::types::*;
use thiserror::Error;
pub mod openapi_to_rust_problem {
#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub struct ProblemDetails {
#[serde(rename = "type")]
pub type_uri: String,
pub title: String,
pub status: u16,
pub code: String,
#[serde(default)]
pub errors: Vec<InvalidParameter>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub detail: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub instance: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub struct InvalidParameter {
pub code: String,
pub location: String,
pub message: String,
}
}
#[derive(Error, Debug)]
pub enum HttpError {
#[error("Network error: {0}")]
Network(#[from] reqwest::Error),
#[error("Middleware error: {0}")]
Middleware(#[from] reqwest_middleware::Error),
#[error("Failed to serialize request: {0}")]
Serialization(String),
#[error("Authentication error: {0}")]
Auth(String),
#[error("Request timeout")]
Timeout,
#[error("Response body exceeded configured limit of {limit} bytes")]
ResponseTooLarge { limit: usize },
#[error("Configuration error: {0}")]
Config(String),
#[error("{0}")]
Other(String),
}
impl HttpError {
pub fn serialization_error(error: impl std::fmt::Display) -> Self {
Self::Serialization(error.to_string())
}
pub fn is_retryable(&self) -> bool {
matches!(self, Self::Network(_) | Self::Middleware(_) | Self::Timeout)
}
}
#[derive(Debug, Clone)]
pub struct ApiError<E> {
pub status: u16,
pub headers: reqwest::header::HeaderMap,
pub body: String,
pub raw_body: Vec<u8>,
pub typed: Option<E>,
pub parse_error: Option<String>,
}
const API_ERROR_BODY_DISPLAY_LIMIT: usize = 500;
const API_ERROR_BODY_TRUNCATION_MARKER: &str = "... [truncated]";
fn display_api_error_body(body: &str) -> std::borrow::Cow<'_, str> {
let Some((end, _)) = body.char_indices().nth(API_ERROR_BODY_DISPLAY_LIMIT) else {
return std::borrow::Cow::Borrowed(body);
};
let mut displayed = String::with_capacity(end + API_ERROR_BODY_TRUNCATION_MARKER.len());
displayed.push_str(&body[..end]);
displayed.push_str(API_ERROR_BODY_TRUNCATION_MARKER);
std::borrow::Cow::Owned(displayed)
}
impl<E> ApiError<E> {
pub fn is_client_error(&self) -> bool {
(400..500).contains(&self.status)
}
pub fn is_server_error(&self) -> bool {
(500..600).contains(&self.status)
}
pub fn is_retryable(&self) -> bool {
matches!(self.status, 429 | 500 | 502 | 503 | 504)
}
pub fn problem_details(&self) -> Option<openapi_to_rust_problem::ProblemDetails> {
let content_type = self
.headers
.get(reqwest::header::CONTENT_TYPE)?
.to_str()
.ok()?;
let media_type = content_type.split(';').next()?.trim();
if !media_type.eq_ignore_ascii_case("application/problem+json") {
return None;
}
serde_json::from_str(&self.body).ok()
}
}
impl<E: std::fmt::Debug> std::fmt::Display for ApiError<E> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"API error {}: {}",
self.status,
display_api_error_body(&self.body)
)?;
if let Some(typed) = &self.typed {
write!(f, "; typed: {typed:?}")?;
}
if let Some(parse_error) = &self.parse_error {
write!(f, "; parse error: {parse_error}")?;
}
Ok(())
}
}
impl<E: std::fmt::Debug> std::error::Error for ApiError<E> {}
#[derive(Debug, Error)]
pub enum ApiOpError<E: std::fmt::Debug> {
#[error(transparent)]
Transport(#[from] HttpError),
#[error(transparent)]
Api(ApiError<E>),
}
impl<E: std::fmt::Debug> ApiOpError<E> {
pub fn api(&self) -> Option<&ApiError<E>> {
match self {
Self::Api(e) => Some(e),
Self::Transport(_) => None,
}
}
pub fn is_api_error(&self) -> bool {
matches!(self, Self::Api(_))
}
}
impl<E: std::fmt::Debug> From<reqwest::Error> for ApiOpError<E> {
fn from(e: reqwest::Error) -> Self {
Self::Transport(HttpError::Network(e))
}
}
impl<E: std::fmt::Debug> From<reqwest_middleware::Error> for ApiOpError<E> {
fn from(e: reqwest_middleware::Error) -> Self {
Self::Transport(HttpError::Middleware(e))
}
}
pub type HttpResult<T> = Result<T, HttpError>;
use reqwest_middleware::{ClientBuilder, ClientWithMiddleware};
use std::collections::BTreeMap;
pub const DEFAULT_MAX_RESPONSE_BODY_BYTES: usize = 8 * 1024 * 1024;
#[derive(Clone)]
pub struct HttpClient {
base_url: String,
api_key: Option<String>,
http_client: ClientWithMiddleware,
custom_headers: BTreeMap<String, String>,
max_response_body_bytes: usize,
}
async fn __read_bounded_response_body(
mut response: reqwest::Response,
limit: usize,
) -> Result<Vec<u8>, HttpError> {
let mut body = Vec::new();
while let Some(chunk) = response.chunk().await.map_err(HttpError::Network)? {
let next_len = body.len().checked_add(chunk.len());
if next_len.is_none_or(|next_len| next_len > limit) {
return Err(HttpError::ResponseTooLarge { limit });
}
body.extend_from_slice(&chunk);
}
Ok(body)
}
impl HttpClient {
pub fn new() -> Self {
Self::with_config(true)
}
pub fn with_config(enable_tracing: bool) -> Self {
let reqwest_client = reqwest::Client::new();
let mut client_builder = ClientBuilder::new(reqwest_client);
if enable_tracing {
use reqwest_tracing::TracingMiddleware;
client_builder = client_builder.with(TracingMiddleware::default());
}
let http_client = client_builder.build();
Self {
base_url: "https://api.jup.ag".to_string(),
api_key: None,
http_client,
custom_headers: BTreeMap::new(),
max_response_body_bytes: 8388608usize,
}
}
pub fn with_base_url(mut self, base_url: impl Into<String>) -> Self {
self.base_url = base_url.into();
self
}
pub fn with_api_key(mut self, api_key: impl Into<String>) -> Self {
self.api_key = Some(api_key.into());
self
}
pub fn with_max_response_body_bytes(mut self, limit: usize) -> Self {
self.max_response_body_bytes = limit;
self
}
pub fn with_header(mut self, name: impl Into<String>, value: impl Into<String>) -> Self {
self.custom_headers.insert(name.into(), value.into());
self
}
pub fn with_headers(mut self, headers: BTreeMap<String, String>) -> Self {
self.custom_headers.extend(headers);
self
}
}
impl Default for HttpClient {
fn default() -> Self {
Self::new()
}
}
fn __pct_encode_path_segment(s: &str) -> String {
let mut out = String::with_capacity(s.len());
for &b in s.as_bytes() {
match b {
b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'.' | b'_' | b'~' => {
out.push(b as char);
}
_ => {
out.push('%');
out.push_str(&format!("{:02X}", b));
}
}
}
out
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetBuildMode {
#[serde(rename = "fast")]
Fast,
}
impl GetBuildMode {
pub fn as_str(&self) -> &'static str {
match self {
Self::Fast => "fast",
}
}
}
impl std::fmt::Display for GetBuildMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetBuildMode {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetOrderBroadcastFeeType {
#[serde(rename = "maxCap")]
MaxCap,
#[serde(rename = "exactFee")]
ExactFee,
}
impl GetOrderBroadcastFeeType {
pub fn as_str(&self) -> &'static str {
match self {
Self::MaxCap => "maxCap",
Self::ExactFee => "exactFee",
}
}
}
impl std::fmt::Display for GetOrderBroadcastFeeType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetOrderBroadcastFeeType {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetOrderSwapMode {
#[serde(rename = "ExactIn")]
ExactIn,
}
impl GetOrderSwapMode {
pub fn as_str(&self) -> &'static str {
match self {
Self::ExactIn => "ExactIn",
}
}
}
impl std::fmt::Display for GetOrderSwapMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetOrderSwapMode {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetPredictionV1EventsCategory {
#[serde(rename = "all")]
All,
#[serde(rename = "crypto")]
Crypto,
#[serde(rename = "sports")]
Sports,
#[serde(rename = "politics")]
Politics,
#[serde(rename = "esports")]
Esports,
#[serde(rename = "culture")]
Culture,
#[serde(rename = "economics")]
Economics,
#[serde(rename = "tech")]
Tech,
}
impl GetPredictionV1EventsCategory {
pub fn as_str(&self) -> &'static str {
match self {
Self::All => "all",
Self::Crypto => "crypto",
Self::Sports => "sports",
Self::Politics => "politics",
Self::Esports => "esports",
Self::Culture => "culture",
Self::Economics => "economics",
Self::Tech => "tech",
}
}
}
impl std::fmt::Display for GetPredictionV1EventsCategory {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetPredictionV1EventsCategory {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetPredictionV1EventsFilter {
#[serde(rename = "new")]
New,
#[serde(rename = "live")]
Live,
#[serde(rename = "trending")]
Trending,
#[serde(rename = "upcoming")]
Upcoming,
}
impl GetPredictionV1EventsFilter {
pub fn as_str(&self) -> &'static str {
match self {
Self::New => "new",
Self::Live => "live",
Self::Trending => "trending",
Self::Upcoming => "upcoming",
}
}
}
impl std::fmt::Display for GetPredictionV1EventsFilter {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetPredictionV1EventsFilter {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetPredictionV1EventsProvider {
#[serde(rename = "kalshi")]
Kalshi,
#[serde(rename = "polymarket")]
Polymarket,
#[serde(rename = "bisonfi")]
Bisonfi,
}
impl GetPredictionV1EventsProvider {
pub fn as_str(&self) -> &'static str {
match self {
Self::Kalshi => "kalshi",
Self::Polymarket => "polymarket",
Self::Bisonfi => "bisonfi",
}
}
}
impl std::fmt::Display for GetPredictionV1EventsProvider {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetPredictionV1EventsProvider {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetPredictionV1EventsSearchProvider {
#[serde(rename = "kalshi")]
Kalshi,
#[serde(rename = "polymarket")]
Polymarket,
#[serde(rename = "bisonfi")]
Bisonfi,
}
impl GetPredictionV1EventsSearchProvider {
pub fn as_str(&self) -> &'static str {
match self {
Self::Kalshi => "kalshi",
Self::Polymarket => "polymarket",
Self::Bisonfi => "bisonfi",
}
}
}
impl std::fmt::Display for GetPredictionV1EventsSearchProvider {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetPredictionV1EventsSearchProvider {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetPredictionV1EventsSortBy {
#[serde(rename = "volume")]
Volume,
#[serde(rename = "beginAt")]
BeginAt,
}
impl GetPredictionV1EventsSortBy {
pub fn as_str(&self) -> &'static str {
match self {
Self::Volume => "volume",
Self::BeginAt => "beginAt",
}
}
}
impl std::fmt::Display for GetPredictionV1EventsSortBy {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetPredictionV1EventsSortBy {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetPredictionV1EventsSortDirection {
#[serde(rename = "asc")]
Asc,
#[serde(rename = "desc")]
Desc,
}
impl GetPredictionV1EventsSortDirection {
pub fn as_str(&self) -> &'static str {
match self {
Self::Asc => "asc",
Self::Desc => "desc",
}
}
}
impl std::fmt::Display for GetPredictionV1EventsSortDirection {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetPredictionV1EventsSortDirection {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetPredictionV1EventsSuggestedPubkeyProvider {
#[serde(rename = "kalshi")]
Kalshi,
#[serde(rename = "polymarket")]
Polymarket,
#[serde(rename = "bisonfi")]
Bisonfi,
}
impl GetPredictionV1EventsSuggestedPubkeyProvider {
pub fn as_str(&self) -> &'static str {
match self {
Self::Kalshi => "kalshi",
Self::Polymarket => "polymarket",
Self::Bisonfi => "bisonfi",
}
}
}
impl std::fmt::Display for GetPredictionV1EventsSuggestedPubkeyProvider {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetPredictionV1EventsSuggestedPubkeyProvider {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetPredictionV1LeaderboardsMetric {
#[serde(rename = "pnl")]
Pnl,
#[serde(rename = "volume")]
Volume,
#[serde(rename = "win_rate")]
WinRate,
}
impl GetPredictionV1LeaderboardsMetric {
pub fn as_str(&self) -> &'static str {
match self {
Self::Pnl => "pnl",
Self::Volume => "volume",
Self::WinRate => "win_rate",
}
}
}
impl std::fmt::Display for GetPredictionV1LeaderboardsMetric {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetPredictionV1LeaderboardsMetric {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetPredictionV1LeaderboardsPeriod {
#[serde(rename = "all_time")]
AllTime,
#[serde(rename = "weekly")]
Weekly,
#[serde(rename = "monthly")]
Monthly,
}
impl GetPredictionV1LeaderboardsPeriod {
pub fn as_str(&self) -> &'static str {
match self {
Self::AllTime => "all_time",
Self::Weekly => "weekly",
Self::Monthly => "monthly",
}
}
}
impl std::fmt::Display for GetPredictionV1LeaderboardsPeriod {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetPredictionV1LeaderboardsPeriod {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetPredictionV1PositionsIsYes {
#[serde(rename = "true")]
TrueValue,
#[serde(rename = "false")]
FalseValue,
}
impl GetPredictionV1PositionsIsYes {
pub fn as_str(&self) -> &'static str {
match self {
Self::TrueValue => "true",
Self::FalseValue => "false",
}
}
}
impl std::fmt::Display for GetPredictionV1PositionsIsYes {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetPredictionV1PositionsIsYes {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetPredictionV1ProfilesOwnerPubkeyPnlHistoryInterval {
#[serde(rename = "24h")]
Variant24h,
#[serde(rename = "1w")]
Variant1w,
#[serde(rename = "1m")]
Variant1m,
}
impl GetPredictionV1ProfilesOwnerPubkeyPnlHistoryInterval {
pub fn as_str(&self) -> &'static str {
match self {
Self::Variant24h => "24h",
Self::Variant1w => "1w",
Self::Variant1m => "1m",
}
}
}
impl std::fmt::Display for GetPredictionV1ProfilesOwnerPubkeyPnlHistoryInterval {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetPredictionV1ProfilesOwnerPubkeyPnlHistoryInterval {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetTokensV2CategoryIntervalCategory {
#[serde(rename = "toporganicscore")]
Toporganicscore,
#[serde(rename = "toptraded")]
Toptraded,
#[serde(rename = "toptrending")]
Toptrending,
}
impl GetTokensV2CategoryIntervalCategory {
pub fn as_str(&self) -> &'static str {
match self {
Self::Toporganicscore => "toporganicscore",
Self::Toptraded => "toptraded",
Self::Toptrending => "toptrending",
}
}
}
impl std::fmt::Display for GetTokensV2CategoryIntervalCategory {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetTokensV2CategoryIntervalCategory {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetTokensV2CategoryIntervalInterval {
#[serde(rename = "5m")]
Variant5m,
#[serde(rename = "1h")]
Variant1h,
#[serde(rename = "6h")]
Variant6h,
#[serde(rename = "24h")]
Variant24h,
}
impl GetTokensV2CategoryIntervalInterval {
pub fn as_str(&self) -> &'static str {
match self {
Self::Variant5m => "5m",
Self::Variant1h => "1h",
Self::Variant6h => "6h",
Self::Variant24h => "24h",
}
}
}
impl std::fmt::Display for GetTokensV2CategoryIntervalInterval {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetTokensV2CategoryIntervalInterval {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetTokensV2TagQuery {
#[serde(rename = "lst")]
Lst,
#[serde(rename = "verified")]
Verified,
#[serde(rename = "stocks")]
Stocks,
}
impl GetTokensV2TagQuery {
pub fn as_str(&self) -> &'static str {
match self {
Self::Lst => "lst",
Self::Verified => "verified",
Self::Stocks => "stocks",
}
}
}
impl std::fmt::Display for GetTokensV2TagQuery {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetTokensV2TagQuery {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetTriggerV1GetTriggerOrdersIncludeFailedTx {
#[serde(rename = "true")]
TrueValue,
#[serde(rename = "false")]
FalseValue,
}
impl GetTriggerV1GetTriggerOrdersIncludeFailedTx {
pub fn as_str(&self) -> &'static str {
match self {
Self::TrueValue => "true",
Self::FalseValue => "false",
}
}
}
impl std::fmt::Display for GetTriggerV1GetTriggerOrdersIncludeFailedTx {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetTriggerV1GetTriggerOrdersIncludeFailedTx {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetTriggerV1GetTriggerOrdersOrderStatus {
#[serde(rename = "active")]
Active,
#[serde(rename = "history")]
History,
}
impl GetTriggerV1GetTriggerOrdersOrderStatus {
pub fn as_str(&self) -> &'static str {
match self {
Self::Active => "active",
Self::History => "history",
}
}
}
impl std::fmt::Display for GetTriggerV1GetTriggerOrdersOrderStatus {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetTriggerV1GetTriggerOrdersOrderStatus {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetTriggerV2OrdersHistoryDcaDir {
#[serde(rename = "asc")]
Asc,
#[serde(rename = "desc")]
Desc,
}
impl GetTriggerV2OrdersHistoryDcaDir {
pub fn as_str(&self) -> &'static str {
match self {
Self::Asc => "asc",
Self::Desc => "desc",
}
}
}
impl std::fmt::Display for GetTriggerV2OrdersHistoryDcaDir {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetTriggerV2OrdersHistoryDcaDir {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetTriggerV2OrdersHistoryDcaSort {
#[serde(rename = "updated_at")]
UpdatedAt,
#[serde(rename = "created_at")]
CreatedAt,
#[serde(rename = "next_fill_at")]
NextFillAt,
}
impl GetTriggerV2OrdersHistoryDcaSort {
pub fn as_str(&self) -> &'static str {
match self {
Self::UpdatedAt => "updated_at",
Self::CreatedAt => "created_at",
Self::NextFillAt => "next_fill_at",
}
}
}
impl std::fmt::Display for GetTriggerV2OrdersHistoryDcaSort {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetTriggerV2OrdersHistoryDcaSort {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetTriggerV2OrdersHistoryDcaState {
#[serde(rename = "active")]
Active,
#[serde(rename = "past")]
Past,
}
impl GetTriggerV2OrdersHistoryDcaState {
pub fn as_str(&self) -> &'static str {
match self {
Self::Active => "active",
Self::Past => "past",
}
}
}
impl std::fmt::Display for GetTriggerV2OrdersHistoryDcaState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetTriggerV2OrdersHistoryDcaState {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetTriggerV2OrdersHistoryDir {
#[serde(rename = "asc")]
Asc,
#[serde(rename = "desc")]
Desc,
}
impl GetTriggerV2OrdersHistoryDir {
pub fn as_str(&self) -> &'static str {
match self {
Self::Asc => "asc",
Self::Desc => "desc",
}
}
}
impl std::fmt::Display for GetTriggerV2OrdersHistoryDir {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetTriggerV2OrdersHistoryDir {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetTriggerV2OrdersHistorySort {
#[serde(rename = "updated_at")]
UpdatedAt,
#[serde(rename = "created_at")]
CreatedAt,
#[serde(rename = "expires_at")]
ExpiresAt,
}
impl GetTriggerV2OrdersHistorySort {
pub fn as_str(&self) -> &'static str {
match self {
Self::UpdatedAt => "updated_at",
Self::CreatedAt => "created_at",
Self::ExpiresAt => "expires_at",
}
}
}
impl std::fmt::Display for GetTriggerV2OrdersHistorySort {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetTriggerV2OrdersHistorySort {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetTriggerV2OrdersHistoryState {
#[serde(rename = "active")]
Active,
#[serde(rename = "past")]
Past,
}
impl GetTriggerV2OrdersHistoryState {
pub fn as_str(&self) -> &'static str {
match self {
Self::Active => "active",
Self::Past => "past",
}
}
}
impl std::fmt::Display for GetTriggerV2OrdersHistoryState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetTriggerV2OrdersHistoryState {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum GetUltraV1OrderExcludeRouters {
#[serde(rename = "metis")]
Metis,
#[serde(rename = "jupiterz")]
Jupiterz,
#[serde(rename = "dflow")]
Dflow,
#[serde(rename = "okx")]
Okx,
}
impl GetUltraV1OrderExcludeRouters {
pub fn as_str(&self) -> &'static str {
match self {
Self::Metis => "metis",
Self::Jupiterz => "jupiterz",
Self::Dflow => "dflow",
Self::Okx => "okx",
}
}
}
impl std::fmt::Display for GetUltraV1OrderExcludeRouters {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for GetUltraV1OrderExcludeRouters {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum QuoteGetInstructionVersion {
#[serde(rename = "V1")]
V1,
#[serde(rename = "V2")]
V2,
}
impl QuoteGetInstructionVersion {
pub fn as_str(&self) -> &'static str {
match self {
Self::V1 => "V1",
Self::V2 => "V2",
}
}
}
impl std::fmt::Display for QuoteGetInstructionVersion {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for QuoteGetInstructionVersion {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum QuoteGetSwapMode {
#[serde(rename = "ExactIn")]
ExactIn,
#[serde(rename = "ExactOut")]
ExactOut,
}
impl QuoteGetSwapMode {
pub fn as_str(&self) -> &'static str {
match self {
Self::ExactIn => "ExactIn",
Self::ExactOut => "ExactOut",
}
}
}
impl std::fmt::Display for QuoteGetSwapMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl AsRef<str> for QuoteGetSwapMode {
fn as_ref(&self) -> &str {
self.as_str()
}
}
#[derive(Debug, Clone)]
pub enum GetBuildApiError {
Status400(GetBuildResponse400),
}
#[derive(Debug, Clone)]
pub enum GetOrderApiError {
Status400(GetOrderResponse400),
}
#[derive(Debug, Clone)]
pub enum PostExecuteApiError {
Status400(PostExecuteResponse400),
Status500(PostExecuteResponse500),
}
#[derive(Debug, Clone)]
pub enum DeletePredictionV1PositionsApiError {
Status400(PredictionErrorResponse),
}
#[derive(Debug, Clone)]
pub enum DeletePredictionV1PositionsPositionPubkeyApiError {
Status400(PredictionErrorResponse),
Status404(PredictionErrorResponse),
}
#[derive(Debug, Clone)]
pub enum GetPredictionV1EventsEventIdApiError {
Status404(PredictionErrorResponse),
}
#[derive(Debug, Clone)]
pub enum GetPredictionV1EventsEventIdMarketsMarketIdApiError {
Status404(PredictionErrorResponse),
}
#[derive(Debug, Clone)]
pub enum GetPredictionV1ForecastApiError {
Status400(PredictionErrorResponse),
Status502(PredictionErrorResponse),
}
#[derive(Debug, Clone)]
pub enum GetPredictionV1MarketsMarketIdApiError {
Status404(PredictionErrorResponse),
}
#[derive(Debug, Clone)]
pub enum GetPredictionV1OrderbookMarketIdApiError {
Status502(PredictionErrorResponse),
}
#[derive(Debug, Clone)]
pub enum GetPredictionV1OrdersApiError {
Status400(PredictionErrorResponse),
}
#[derive(Debug, Clone)]
pub enum GetPredictionV1OrdersOrderPubkeyApiError {
Status400(PredictionErrorResponse),
Status404(PredictionErrorResponse),
}
#[derive(Debug, Clone)]
pub enum GetPredictionV1OrdersStatusOrderPubkeyApiError {
Status400(PredictionErrorResponse),
Status404(PredictionErrorResponse),
}
#[derive(Debug, Clone)]
pub enum GetPredictionV1PositionsApiError {
Status400(PredictionErrorResponse),
}
#[derive(Debug, Clone)]
pub enum GetPredictionV1PositionsPositionPubkeyApiError {
Status400(PredictionErrorResponse),
Status404(PredictionErrorResponse),
}
#[derive(Debug, Clone)]
pub enum GetPredictionV1ProfilesOwnerPubkeyApiError {
Status404(GetPredictionV1ProfilesOwnerPubkeyResponse404),
}
#[derive(Debug, Clone)]
pub enum GetPredictionV1VaultInfoApiError {
Status404(GetPredictionV1VaultInfoResponse404),
}
#[derive(Debug, Clone)]
pub enum GetSendV1InviteHistoryApiError {
Status400(GetSendV1InviteHistoryResponse400),
Status500(GetSendV1InviteHistoryResponse500),
}
#[derive(Debug, Clone)]
pub enum GetSendV1PendingInvitesApiError {
Status400(GetSendV1PendingInvitesResponse400),
Status500(GetSendV1PendingInvitesResponse500),
}
#[derive(Debug, Clone)]
pub enum GetStudioV1DbcPoolAddressesMintApiError {
Status400(GetStudioV1DbcPoolAddressesMintResponse400),
Status404(GetStudioV1DbcPoolAddressesMintResponse404),
Status500(GetStudioV1DbcPoolAddressesMintResponse500),
}
#[derive(Debug, Clone)]
pub enum GetTokensV2CategoryIntervalApiError {
Status400(GetTokensV2CategoryIntervalResponse400),
Status500(GetTokensV2CategoryIntervalResponse500),
}
#[derive(Debug, Clone)]
pub enum GetTokensV2RecentApiError {
Status400(GetTokensV2RecentResponse400),
Status500(GetTokensV2RecentResponse500),
}
#[derive(Debug, Clone)]
pub enum GetTokensV2SearchApiError {
Status400(GetTokensV2SearchResponse400),
Status500(GetTokensV2SearchResponse500),
}
#[derive(Debug, Clone)]
pub enum GetTokensV2TagApiError {
Status400(GetTokensV2TagResponse400),
Status500(GetTokensV2TagResponse500),
}
#[derive(Debug, Clone)]
pub enum GetTokensV2VerifyExpressCheckEligibilityApiError {
Status400(TokensV2VerificationErrorResponse),
Status500(TokensV2VerificationErrorResponse),
}
#[derive(Debug, Clone)]
pub enum GetTokensV2VerifyExpressCraftTxnApiError {
Status400(TokensV2VerificationErrorResponse),
Status500(TokensV2VerificationErrorResponse),
}
#[derive(Debug, Clone)]
pub enum GetTriggerV2VaultRegisterApiError {
Status409(TriggerV2ErrorResponse),
}
#[derive(Debug, Clone)]
pub enum GetUltraV1BalancesAddressApiError {
Status400(GetUltraV1BalancesAddressResponse400),
Status500(GetUltraV1BalancesAddressResponse500),
}
#[derive(Debug, Clone)]
pub enum GetUltraV1OrderApiError {
Status400(GetUltraV1OrderResponse400),
Status500(GetUltraV1OrderResponse500),
}
#[derive(Debug, Clone)]
pub enum GetUltraV1SearchApiError {
Status400(GetUltraV1SearchResponse400),
Status500(GetUltraV1SearchResponse500),
}
#[derive(Debug, Clone)]
pub enum GetUltraV1ShieldApiError {
Status400(GetUltraV1ShieldResponse400),
Status500(GetUltraV1ShieldResponse500),
}
#[derive(Debug, Clone)]
pub enum PostPredictionV1ExecuteApiError {
Status400(PredictionErrorResponse),
}
#[derive(Debug, Clone)]
pub enum PostPredictionV1OrdersApiError {
Status400(PredictionErrorResponse),
}
#[derive(Debug, Clone)]
pub enum PostPredictionV1PositionsPositionPubkeyClaimApiError {
Status400(PredictionErrorResponse),
Status404(PredictionErrorResponse),
}
#[derive(Debug, Clone)]
pub enum PostSendV1CraftClawbackApiError {
Status400(PostSendV1CraftClawbackResponse400),
Status500(PostSendV1CraftClawbackResponse500),
}
#[derive(Debug, Clone)]
pub enum PostSendV1CraftSendApiError {
Status400(PostSendV1CraftSendResponse400),
Status500(PostSendV1CraftSendResponse500),
}
#[derive(Debug, Clone)]
pub enum PostStudioV1DbcFeeApiError {
Status400(PostStudioV1DbcFeeResponse400),
}
#[derive(Debug, Clone)]
pub enum PostStudioV1DbcFeeCreateTxApiError {
Status400(PostStudioV1DbcFeeCreateTxResponse400),
Status403(PostStudioV1DbcFeeCreateTxResponse403),
Status404(PostStudioV1DbcFeeCreateTxResponse404),
}
#[derive(Debug, Clone)]
pub enum PostStudioV1DbcPoolCreateTxApiError {
Status400(PostStudioV1DbcPoolCreateTxResponse400),
Status500(PostStudioV1DbcPoolCreateTxResponse500),
}
#[derive(Debug, Clone)]
pub enum PostStudioV1DbcPoolSubmitApiError {
Status400(PostStudioV1DbcPoolSubmitResponse400),
}
#[derive(Debug, Clone)]
pub enum PostTokensV2VerifyExpressExecuteApiError {
Status400(TokensV2VerificationErrorResponse),
Status409(TokensV2VerificationErrorResponse),
Status500(TokensV2VerificationErrorResponse),
}
#[derive(Debug, Clone)]
pub enum PostTriggerV1CancelOrderApiError {
Status400(PostTriggerV1CancelOrderResponse400),
Status500(PostTriggerV1CancelOrderResponse500),
}
#[derive(Debug, Clone)]
pub enum PostTriggerV1CancelOrdersApiError {
Status400(PostTriggerV1CancelOrdersResponse400),
Status500(PostTriggerV1CancelOrdersResponse500),
}
#[derive(Debug, Clone)]
pub enum PostTriggerV1CreateOrderApiError {
Status400(PostTriggerV1CreateOrderResponse400),
Status500(PostTriggerV1CreateOrderResponse500),
}
#[derive(Debug, Clone)]
pub enum PostTriggerV1ExecuteApiError {
Status400(PostTriggerV1ExecuteResponse400),
Status500(PostTriggerV1ExecuteResponse500),
}
#[derive(Debug, Clone)]
pub enum PostTriggerV2AuthChallengeApiError {
Status400(TriggerV2ErrorResponse),
}
#[derive(Debug, Clone)]
pub enum PostTriggerV2AuthVerifyApiError {
Status400(TriggerV2ErrorResponse),
Status401(TriggerV2ErrorResponse),
}
#[derive(Debug, Clone)]
pub enum PostTriggerV2DepositCraftApiError {
Status400(TriggerV2ErrorResponse),
}
#[derive(Debug, Clone)]
pub enum PostTriggerV2OrdersDcaApiError {
Status400(TriggerV2ErrorResponse),
}
#[derive(Debug, Clone)]
pub enum PostTriggerV2OrdersPriceApiError {
Status400(TriggerV2ErrorResponse),
}
#[derive(Debug, Clone)]
pub enum PostUltraV1ExecuteApiError {
Status400(PostUltraV1ExecuteResponse400),
Status500(PostUltraV1ExecuteResponse500),
}
#[doc = concat!("Additive request builder for `", "GetBuild", "`.")]
#[must_use]
pub struct GetBuildBuilder<'a> {
client: &'a HttpClient,
input_mint: String,
output_mint: String,
amount: String,
taker: String,
slippage_bps: Option<String>,
mode: Option<GetBuildMode>,
dexes: Option<String>,
exclude_dexes: Option<String>,
platform_fee_bps: Option<i64>,
fee_account: Option<String>,
max_accounts: Option<i64>,
payer: Option<String>,
wrap_and_unwrap_sol: Option<bool>,
destination_token_account: Option<String>,
native_destination_account: Option<String>,
blockhash_slots_to_expiry: Option<i64>,
tip_amount: Option<String>,
compute_unit_price_percentile: Option<String>,
for_jito_bundle: Option<bool>,
}
impl<'a> GetBuildBuilder<'a> {
#[doc = concat!("Set the optional `", "slippageBps", "` operation parameter.")]
#[must_use]
pub fn slippage_bps(mut self, slippage_bps: impl Into<String>) -> Self {
self.slippage_bps = Some(slippage_bps.into());
self
}
#[doc = concat!("Set the optional `", "mode", "` operation parameter.")]
#[must_use]
pub fn mode(mut self, mode: GetBuildMode) -> Self {
self.mode = Some(mode);
self
}
#[doc = concat!("Set the optional `", "dexes", "` operation parameter.")]
#[must_use]
pub fn dexes(mut self, dexes: impl Into<String>) -> Self {
self.dexes = Some(dexes.into());
self
}
#[doc = concat!("Set the optional `", "excludeDexes", "` operation parameter.")]
#[must_use]
pub fn exclude_dexes(mut self, exclude_dexes: impl Into<String>) -> Self {
self.exclude_dexes = Some(exclude_dexes.into());
self
}
#[doc = concat!("Set the optional `", "platformFeeBps", "` operation parameter.")]
#[must_use]
pub fn platform_fee_bps(mut self, platform_fee_bps: i64) -> Self {
self.platform_fee_bps = Some(platform_fee_bps);
self
}
#[doc = concat!("Set the optional `", "feeAccount", "` operation parameter.")]
#[must_use]
pub fn fee_account(mut self, fee_account: impl Into<String>) -> Self {
self.fee_account = Some(fee_account.into());
self
}
#[doc = concat!("Set the optional `", "maxAccounts", "` operation parameter.")]
#[must_use]
pub fn max_accounts(mut self, max_accounts: i64) -> Self {
self.max_accounts = Some(max_accounts);
self
}
#[doc = concat!("Set the optional `", "payer", "` operation parameter.")]
#[must_use]
pub fn payer(mut self, payer: impl Into<String>) -> Self {
self.payer = Some(payer.into());
self
}
#[doc = concat!("Set the optional `", "wrapAndUnwrapSol", "` operation parameter.")]
#[must_use]
pub fn wrap_and_unwrap_sol(mut self, wrap_and_unwrap_sol: bool) -> Self {
self.wrap_and_unwrap_sol = Some(wrap_and_unwrap_sol);
self
}
#[doc = concat!(
"Set the optional `", "destinationTokenAccount", "` operation parameter."
)]
#[must_use]
pub fn destination_token_account(
mut self,
destination_token_account: impl Into<String>,
) -> Self {
self.destination_token_account = Some(destination_token_account.into());
self
}
#[doc = concat!(
"Set the optional `", "nativeDestinationAccount", "` operation parameter."
)]
#[must_use]
pub fn native_destination_account(
mut self,
native_destination_account: impl Into<String>,
) -> Self {
self.native_destination_account = Some(native_destination_account.into());
self
}
#[doc = concat!(
"Set the optional `", "blockhashSlotsToExpiry", "` operation parameter."
)]
#[must_use]
pub fn blockhash_slots_to_expiry(mut self, blockhash_slots_to_expiry: i64) -> Self {
self.blockhash_slots_to_expiry = Some(blockhash_slots_to_expiry);
self
}
#[doc = concat!("Set the optional `", "tipAmount", "` operation parameter.")]
#[must_use]
pub fn tip_amount(mut self, tip_amount: impl Into<String>) -> Self {
self.tip_amount = Some(tip_amount.into());
self
}
#[doc = concat!(
"Set the optional `", "computeUnitPricePercentile", "` operation parameter."
)]
#[must_use]
pub fn compute_unit_price_percentile(
mut self,
compute_unit_price_percentile: impl Into<String>,
) -> Self {
self.compute_unit_price_percentile = Some(compute_unit_price_percentile.into());
self
}
#[doc = concat!("Set the optional `", "forJitoBundle", "` operation parameter.")]
#[must_use]
pub fn for_jito_bundle(mut self, for_jito_bundle: bool) -> Self {
self.for_jito_bundle = Some(for_jito_bundle);
self
}
pub async fn send(self) -> Result<GetBuildResponse, ApiOpError<GetBuildApiError>> {
self.client
.get_build(
self.input_mint,
self.output_mint,
self.amount,
self.taker,
self.slippage_bps,
self.mode,
self.dexes,
self.exclude_dexes,
self.platform_fee_bps,
self.fee_account,
self.max_accounts,
self.payer,
self.wrap_and_unwrap_sol,
self.destination_token_account,
self.native_destination_account,
self.blockhash_slots_to_expiry,
self.tip_amount,
self.compute_unit_price_percentile,
self.for_jito_bundle,
)
.await
}
}
#[doc = concat!("Additive request builder for `", "GetOrder", "`.")]
#[must_use]
pub struct GetOrderBuilder<'a> {
client: &'a HttpClient,
input_mint: String,
output_mint: String,
amount: String,
taker: Option<String>,
receiver: Option<String>,
swap_mode: Option<GetOrderSwapMode>,
slippage_bps: Option<i64>,
referral_account: Option<String>,
referral_fee: Option<f64>,
payer: Option<String>,
priority_fee_lamports: Option<f64>,
jito_tip_lamports: Option<f64>,
broadcast_fee_type: Option<GetOrderBroadcastFeeType>,
exclude_routers: Option<String>,
exclude_dexes: Option<String>,
}
impl<'a> GetOrderBuilder<'a> {
#[doc = concat!("Set the optional `", "taker", "` operation parameter.")]
#[must_use]
pub fn taker(mut self, taker: impl Into<String>) -> Self {
self.taker = Some(taker.into());
self
}
#[doc = concat!("Set the optional `", "receiver", "` operation parameter.")]
#[must_use]
pub fn receiver(mut self, receiver: impl Into<String>) -> Self {
self.receiver = Some(receiver.into());
self
}
#[doc = concat!("Set the optional `", "swapMode", "` operation parameter.")]
#[must_use]
pub fn swap_mode(mut self, swap_mode: GetOrderSwapMode) -> Self {
self.swap_mode = Some(swap_mode);
self
}
#[doc = concat!("Set the optional `", "slippageBps", "` operation parameter.")]
#[must_use]
pub fn slippage_bps(mut self, slippage_bps: i64) -> Self {
self.slippage_bps = Some(slippage_bps);
self
}
#[doc = concat!("Set the optional `", "referralAccount", "` operation parameter.")]
#[must_use]
pub fn referral_account(mut self, referral_account: impl Into<String>) -> Self {
self.referral_account = Some(referral_account.into());
self
}
#[doc = concat!("Set the optional `", "referralFee", "` operation parameter.")]
#[must_use]
pub fn referral_fee(mut self, referral_fee: f64) -> Self {
self.referral_fee = Some(referral_fee);
self
}
#[doc = concat!("Set the optional `", "payer", "` operation parameter.")]
#[must_use]
pub fn payer(mut self, payer: impl Into<String>) -> Self {
self.payer = Some(payer.into());
self
}
#[doc = concat!(
"Set the optional `", "priorityFeeLamports", "` operation parameter."
)]
#[must_use]
pub fn priority_fee_lamports(mut self, priority_fee_lamports: f64) -> Self {
self.priority_fee_lamports = Some(priority_fee_lamports);
self
}
#[doc = concat!("Set the optional `", "jitoTipLamports", "` operation parameter.")]
#[must_use]
pub fn jito_tip_lamports(mut self, jito_tip_lamports: f64) -> Self {
self.jito_tip_lamports = Some(jito_tip_lamports);
self
}
#[doc = concat!("Set the optional `", "broadcastFeeType", "` operation parameter.")]
#[must_use]
pub fn broadcast_fee_type(mut self, broadcast_fee_type: GetOrderBroadcastFeeType) -> Self {
self.broadcast_fee_type = Some(broadcast_fee_type);
self
}
#[doc = concat!("Set the optional `", "excludeRouters", "` operation parameter.")]
#[must_use]
pub fn exclude_routers(mut self, exclude_routers: impl Into<String>) -> Self {
self.exclude_routers = Some(exclude_routers.into());
self
}
#[doc = concat!("Set the optional `", "excludeDexes", "` operation parameter.")]
#[must_use]
pub fn exclude_dexes(mut self, exclude_dexes: impl Into<String>) -> Self {
self.exclude_dexes = Some(exclude_dexes.into());
self
}
pub async fn send(self) -> Result<GetOrderResponse, ApiOpError<GetOrderApiError>> {
self.client
.get_order(
self.input_mint,
self.output_mint,
self.amount,
self.taker,
self.receiver,
self.swap_mode,
self.slippage_bps,
self.referral_account,
self.referral_fee,
self.payer,
self.priority_fee_lamports,
self.jito_tip_lamports,
self.broadcast_fee_type,
self.exclude_routers,
self.exclude_dexes,
)
.await
}
}
#[doc = concat!("Additive request builder for `", "PostExecute", "`.")]
#[must_use]
pub struct PostExecuteBuilder<'a> {
client: &'a HttpClient,
request: PostExecuteRequest,
}
impl<'a> PostExecuteBuilder<'a> {
#[must_use]
pub fn request(mut self, request: PostExecuteRequest) -> Self {
self.request = request;
self
}
#[doc = concat!(
"Set the optional request-body field `", "lastValidBlockHeight", "`."
)]
#[must_use]
pub fn last_valid_block_height(mut self, last_valid_block_height: String) -> Self {
self.request.last_valid_block_height = Some(last_valid_block_height);
self
}
pub async fn send(self) -> Result<PostExecuteResponse, ApiOpError<PostExecuteApiError>> {
self.client.post_execute(self.request).await
}
}
#[doc = concat!("Additive request builder for `", "QuoteGet", "`.")]
#[must_use]
pub struct QuoteGetBuilder<'a> {
client: &'a HttpClient,
input_mint: String,
output_mint: String,
amount: u64,
slippage_bps: Option<i64>,
swap_mode: Option<QuoteGetSwapMode>,
dexes: Option<Vec<String>>,
exclude_dexes: Option<Vec<String>>,
restrict_intermediate_tokens: Option<bool>,
only_direct_routes: Option<bool>,
as_legacy_transaction: Option<bool>,
platform_fee_bps: Option<i64>,
max_accounts: Option<u64>,
instruction_version: Option<QuoteGetInstructionVersion>,
dynamic_slippage: Option<bool>,
for_jito_bundle: Option<bool>,
}
impl<'a> QuoteGetBuilder<'a> {
#[doc = concat!("Set the optional `", "slippageBps", "` operation parameter.")]
#[must_use]
pub fn slippage_bps(mut self, slippage_bps: i64) -> Self {
self.slippage_bps = Some(slippage_bps);
self
}
#[doc = concat!("Set the optional `", "swapMode", "` operation parameter.")]
#[must_use]
pub fn swap_mode(mut self, swap_mode: QuoteGetSwapMode) -> Self {
self.swap_mode = Some(swap_mode);
self
}
#[doc = concat!("Set the optional `", "dexes", "` operation parameter.")]
#[must_use]
pub fn dexes(mut self, dexes: Vec<String>) -> Self {
self.dexes = Some(dexes);
self
}
#[doc = concat!("Set the optional `", "excludeDexes", "` operation parameter.")]
#[must_use]
pub fn exclude_dexes(mut self, exclude_dexes: Vec<String>) -> Self {
self.exclude_dexes = Some(exclude_dexes);
self
}
#[doc = concat!(
"Set the optional `", "restrictIntermediateTokens", "` operation parameter."
)]
#[must_use]
pub fn restrict_intermediate_tokens(mut self, restrict_intermediate_tokens: bool) -> Self {
self.restrict_intermediate_tokens = Some(restrict_intermediate_tokens);
self
}
#[doc = concat!("Set the optional `", "onlyDirectRoutes", "` operation parameter.")]
#[must_use]
pub fn only_direct_routes(mut self, only_direct_routes: bool) -> Self {
self.only_direct_routes = Some(only_direct_routes);
self
}
#[doc = concat!(
"Set the optional `", "asLegacyTransaction", "` operation parameter."
)]
#[must_use]
pub fn as_legacy_transaction(mut self, as_legacy_transaction: bool) -> Self {
self.as_legacy_transaction = Some(as_legacy_transaction);
self
}
#[doc = concat!("Set the optional `", "platformFeeBps", "` operation parameter.")]
#[must_use]
pub fn platform_fee_bps(mut self, platform_fee_bps: i64) -> Self {
self.platform_fee_bps = Some(platform_fee_bps);
self
}
#[doc = concat!("Set the optional `", "maxAccounts", "` operation parameter.")]
#[must_use]
pub fn max_accounts(mut self, max_accounts: u64) -> Self {
self.max_accounts = Some(max_accounts);
self
}
#[doc = concat!(
"Set the optional `", "instructionVersion", "` operation parameter."
)]
#[must_use]
pub fn instruction_version(mut self, instruction_version: QuoteGetInstructionVersion) -> Self {
self.instruction_version = Some(instruction_version);
self
}
#[doc = concat!("Set the optional `", "dynamicSlippage", "` operation parameter.")]
#[must_use]
pub fn dynamic_slippage(mut self, dynamic_slippage: bool) -> Self {
self.dynamic_slippage = Some(dynamic_slippage);
self
}
#[doc = concat!("Set the optional `", "forJitoBundle", "` operation parameter.")]
#[must_use]
pub fn for_jito_bundle(mut self, for_jito_bundle: bool) -> Self {
self.for_jito_bundle = Some(for_jito_bundle);
self
}
pub async fn send(self) -> Result<SwapV1QuoteResponse, ApiOpError<serde_json::Value>> {
self.client
.quote_get(
self.input_mint,
self.output_mint,
self.amount,
self.slippage_bps,
self.swap_mode,
self.dexes,
self.exclude_dexes,
self.restrict_intermediate_tokens,
self.only_direct_routes,
self.as_legacy_transaction,
self.platform_fee_bps,
self.max_accounts,
self.instruction_version,
self.dynamic_slippage,
self.for_jito_bundle,
)
.await
}
}
#[doc = concat!("Additive request builder for `", "SwapInstructionsPost", "`.")]
#[must_use]
pub struct SwapInstructionsPostBuilder<'a> {
client: &'a HttpClient,
request: SwapV1SwapRequest,
}
impl<'a> SwapInstructionsPostBuilder<'a> {
#[must_use]
pub fn request(mut self, request: SwapV1SwapRequest) -> Self {
self.request = request;
self
}
#[doc = concat!(
"Set the optional request-body field `", "asLegacyTransaction", "`."
)]
#[must_use]
pub fn as_legacy_transaction(mut self, as_legacy_transaction: bool) -> Self {
self.request.as_legacy_transaction = Some(as_legacy_transaction);
self
}
#[doc = concat!(
"Set the optional request-body field `", "blockhashSlotsToExpiry", "`."
)]
#[must_use]
pub fn blockhash_slots_to_expiry(mut self, blockhash_slots_to_expiry: i64) -> Self {
self.request.blockhash_slots_to_expiry = Some(blockhash_slots_to_expiry);
self
}
#[doc = concat!(
"Set the optional request-body field `", "computeUnitPriceMicroLamports", "`."
)]
#[must_use]
pub fn compute_unit_price_micro_lamports(
mut self,
compute_unit_price_micro_lamports: u64,
) -> Self {
self.request.compute_unit_price_micro_lamports = Some(compute_unit_price_micro_lamports);
self
}
#[doc = concat!(
"Set the optional request-body field `", "destinationTokenAccount", "`."
)]
#[must_use]
pub fn destination_token_account(mut self, destination_token_account: String) -> Self {
self.request.destination_token_account = Some(destination_token_account);
self
}
#[doc = concat!(
"Set the optional request-body field `", "dynamicComputeUnitLimit", "`."
)]
#[must_use]
pub fn dynamic_compute_unit_limit(mut self, dynamic_compute_unit_limit: bool) -> Self {
self.request.dynamic_compute_unit_limit = Some(dynamic_compute_unit_limit);
self
}
#[doc = concat!("Set the optional request-body field `", "dynamicSlippage", "`.")]
#[must_use]
pub fn dynamic_slippage(mut self, dynamic_slippage: bool) -> Self {
self.request.dynamic_slippage = Some(dynamic_slippage);
self
}
#[doc = concat!("Set the optional request-body field `", "feeAccount", "`.")]
#[must_use]
pub fn fee_account(mut self, fee_account: String) -> Self {
self.request.fee_account = Some(fee_account);
self
}
#[doc = concat!(
"Set the optional request-body field `", "nativeDestinationAccount", "`."
)]
#[must_use]
pub fn native_destination_account(mut self, native_destination_account: String) -> Self {
self.request.native_destination_account = Some(native_destination_account);
self
}
#[doc = concat!("Set the optional request-body field `", "payer", "`.")]
#[must_use]
pub fn payer(mut self, payer: String) -> Self {
self.request.payer = Some(payer);
self
}
#[doc = concat!(
"Set the optional request-body field `", "prioritizationFeeLamports", "`."
)]
#[must_use]
pub fn prioritization_fee_lamports(
mut self,
prioritization_fee_lamports: SwapV1SwapRequestPrioritizationFeeLamports,
) -> Self {
self.request.prioritization_fee_lamports = Some(prioritization_fee_lamports);
self
}
#[doc = concat!(
"Set the optional request-body field `", "skipUserAccountsRpcCalls", "`."
)]
#[must_use]
pub fn skip_user_accounts_rpc_calls(mut self, skip_user_accounts_rpc_calls: bool) -> Self {
self.request.skip_user_accounts_rpc_calls = Some(skip_user_accounts_rpc_calls);
self
}
#[doc = concat!("Set the optional request-body field `", "trackingAccount", "`.")]
#[must_use]
pub fn tracking_account(mut self, tracking_account: String) -> Self {
self.request.tracking_account = Some(tracking_account);
self
}
#[doc = concat!("Set the optional request-body field `", "useSharedAccounts", "`.")]
#[must_use]
pub fn use_shared_accounts(mut self, use_shared_accounts: bool) -> Self {
self.request.use_shared_accounts = Some(use_shared_accounts);
self
}
#[doc = concat!("Set the optional request-body field `", "wrapAndUnwrapSol", "`.")]
#[must_use]
pub fn wrap_and_unwrap_sol(mut self, wrap_and_unwrap_sol: bool) -> Self {
self.request.wrap_and_unwrap_sol = Some(wrap_and_unwrap_sol);
self
}
pub async fn send(
self,
) -> Result<SwapV1SwapInstructionsResponse, ApiOpError<serde_json::Value>> {
self.client.swap_instructions_post(self.request).await
}
}
#[doc = concat!("Additive request builder for `", "SwapPost", "`.")]
#[must_use]
pub struct SwapPostBuilder<'a> {
client: &'a HttpClient,
request: SwapV1SwapRequest,
}
impl<'a> SwapPostBuilder<'a> {
#[must_use]
pub fn request(mut self, request: SwapV1SwapRequest) -> Self {
self.request = request;
self
}
#[doc = concat!(
"Set the optional request-body field `", "asLegacyTransaction", "`."
)]
#[must_use]
pub fn as_legacy_transaction(mut self, as_legacy_transaction: bool) -> Self {
self.request.as_legacy_transaction = Some(as_legacy_transaction);
self
}
#[doc = concat!(
"Set the optional request-body field `", "blockhashSlotsToExpiry", "`."
)]
#[must_use]
pub fn blockhash_slots_to_expiry(mut self, blockhash_slots_to_expiry: i64) -> Self {
self.request.blockhash_slots_to_expiry = Some(blockhash_slots_to_expiry);
self
}
#[doc = concat!(
"Set the optional request-body field `", "computeUnitPriceMicroLamports", "`."
)]
#[must_use]
pub fn compute_unit_price_micro_lamports(
mut self,
compute_unit_price_micro_lamports: u64,
) -> Self {
self.request.compute_unit_price_micro_lamports = Some(compute_unit_price_micro_lamports);
self
}
#[doc = concat!(
"Set the optional request-body field `", "destinationTokenAccount", "`."
)]
#[must_use]
pub fn destination_token_account(mut self, destination_token_account: String) -> Self {
self.request.destination_token_account = Some(destination_token_account);
self
}
#[doc = concat!(
"Set the optional request-body field `", "dynamicComputeUnitLimit", "`."
)]
#[must_use]
pub fn dynamic_compute_unit_limit(mut self, dynamic_compute_unit_limit: bool) -> Self {
self.request.dynamic_compute_unit_limit = Some(dynamic_compute_unit_limit);
self
}
#[doc = concat!("Set the optional request-body field `", "dynamicSlippage", "`.")]
#[must_use]
pub fn dynamic_slippage(mut self, dynamic_slippage: bool) -> Self {
self.request.dynamic_slippage = Some(dynamic_slippage);
self
}
#[doc = concat!("Set the optional request-body field `", "feeAccount", "`.")]
#[must_use]
pub fn fee_account(mut self, fee_account: String) -> Self {
self.request.fee_account = Some(fee_account);
self
}
#[doc = concat!(
"Set the optional request-body field `", "nativeDestinationAccount", "`."
)]
#[must_use]
pub fn native_destination_account(mut self, native_destination_account: String) -> Self {
self.request.native_destination_account = Some(native_destination_account);
self
}
#[doc = concat!("Set the optional request-body field `", "payer", "`.")]
#[must_use]
pub fn payer(mut self, payer: String) -> Self {
self.request.payer = Some(payer);
self
}
#[doc = concat!(
"Set the optional request-body field `", "prioritizationFeeLamports", "`."
)]
#[must_use]
pub fn prioritization_fee_lamports(
mut self,
prioritization_fee_lamports: SwapV1SwapRequestPrioritizationFeeLamports,
) -> Self {
self.request.prioritization_fee_lamports = Some(prioritization_fee_lamports);
self
}
#[doc = concat!(
"Set the optional request-body field `", "skipUserAccountsRpcCalls", "`."
)]
#[must_use]
pub fn skip_user_accounts_rpc_calls(mut self, skip_user_accounts_rpc_calls: bool) -> Self {
self.request.skip_user_accounts_rpc_calls = Some(skip_user_accounts_rpc_calls);
self
}
#[doc = concat!("Set the optional request-body field `", "trackingAccount", "`.")]
#[must_use]
pub fn tracking_account(mut self, tracking_account: String) -> Self {
self.request.tracking_account = Some(tracking_account);
self
}
#[doc = concat!("Set the optional request-body field `", "useSharedAccounts", "`.")]
#[must_use]
pub fn use_shared_accounts(mut self, use_shared_accounts: bool) -> Self {
self.request.use_shared_accounts = Some(use_shared_accounts);
self
}
#[doc = concat!("Set the optional request-body field `", "wrapAndUnwrapSol", "`.")]
#[must_use]
pub fn wrap_and_unwrap_sol(mut self, wrap_and_unwrap_sol: bool) -> Self {
self.request.wrap_and_unwrap_sol = Some(wrap_and_unwrap_sol);
self
}
pub async fn send(self) -> Result<SwapV1SwapResponse, ApiOpError<serde_json::Value>> {
self.client.swap_post(self.request).await
}
}
#[doc = concat!(
"Additive request builder for `", "buildBorrowOperateInstructions", "`."
)]
#[must_use]
pub struct BuildBorrowOperateInstructionsBuilder<'a> {
client: &'a HttpClient,
market: Option<LendBorrowMarket>,
request: LendBorrowOperatePayload,
}
impl<'a> BuildBorrowOperateInstructionsBuilder<'a> {
#[doc = concat!("Set the optional `", "market", "` operation parameter.")]
#[must_use]
pub fn market(mut self, market: LendBorrowMarket) -> Self {
self.market = Some(market);
self
}
#[must_use]
pub fn request(mut self, request: LendBorrowOperatePayload) -> Self {
self.request = request;
self
}
#[doc = concat!("Set the optional request-body field `", "positionOwner", "`.")]
#[must_use]
pub fn position_owner(mut self, position_owner: String) -> Self {
self.request.position_owner = Some(position_owner);
self
}
pub async fn send(
self,
) -> Result<LendBorrowOperateInstructionsResponse, ApiOpError<serde_json::Value>> {
self.client
.build_borrow_operate_instructions(self.market, self.request)
.await
}
}
#[doc = concat!("Additive request builder for `", "buildBorrowOperateTransaction", "`.")]
#[must_use]
pub struct BuildBorrowOperateTransactionBuilder<'a> {
client: &'a HttpClient,
market: Option<LendBorrowMarket>,
request: LendBorrowOperatePayload,
}
impl<'a> BuildBorrowOperateTransactionBuilder<'a> {
#[doc = concat!("Set the optional `", "market", "` operation parameter.")]
#[must_use]
pub fn market(mut self, market: LendBorrowMarket) -> Self {
self.market = Some(market);
self
}
#[must_use]
pub fn request(mut self, request: LendBorrowOperatePayload) -> Self {
self.request = request;
self
}
#[doc = concat!("Set the optional request-body field `", "positionOwner", "`.")]
#[must_use]
pub fn position_owner(mut self, position_owner: String) -> Self {
self.request.position_owner = Some(position_owner);
self
}
pub async fn send(
self,
) -> Result<LendBorrowOperateTransactionResponse, ApiOpError<serde_json::Value>> {
self.client
.build_borrow_operate_transaction(self.market, self.request)
.await
}
}
#[doc = concat!("Additive request builder for `", "deletePredictionV1Positions", "`.")]
#[must_use]
pub struct DeletePredictionV1PositionsBuilder<'a> {
client: &'a HttpClient,
request: PredictionCloseAllPositionsRequest,
}
impl<'a> DeletePredictionV1PositionsBuilder<'a> {
#[must_use]
pub fn request(mut self, request: PredictionCloseAllPositionsRequest) -> Self {
self.request = request;
self
}
#[doc = concat!("Set the optional request-body field `", "ownerPubkey", "`.")]
#[must_use]
pub fn owner_pubkey(mut self, owner_pubkey: String) -> Self {
self.request.owner_pubkey = Some(owner_pubkey);
self
}
pub async fn send(
self,
) -> Result<DeletePredictionV1PositionsResponse, ApiOpError<DeletePredictionV1PositionsApiError>>
{
self.client
.delete_prediction_v1_positions(self.request)
.await
}
}
#[doc = concat!(
"Additive request builder for `", "deletePredictionV1PositionsPositionPubkey", "`."
)]
#[must_use]
pub struct DeletePredictionV1PositionsPositionPubkeyBuilder<'a> {
client: &'a HttpClient,
position_pubkey: String,
request: PredictionClosePositionRequest,
}
impl<'a> DeletePredictionV1PositionsPositionPubkeyBuilder<'a> {
#[must_use]
pub fn request(mut self, request: PredictionClosePositionRequest) -> Self {
self.request = request;
self
}
#[doc = concat!("Set the optional request-body field `", "ownerPubkey", "`.")]
#[must_use]
pub fn owner_pubkey(mut self, owner_pubkey: String) -> Self {
self.request.owner_pubkey = Some(owner_pubkey);
self
}
pub async fn send(
self,
) -> Result<
PredictionCreateOrderResponse,
ApiOpError<DeletePredictionV1PositionsPositionPubkeyApiError>,
> {
self.client
.delete_prediction_v1_positions_position_pubkey(self.position_pubkey, self.request)
.await
}
}
#[doc = concat!(
"Additive request builder for `", "getPortfolioV1PositionsAddress", "`."
)]
#[must_use]
pub struct GetPortfolioV1PositionsAddressBuilder<'a> {
client: &'a HttpClient,
address: String,
platforms: Option<String>,
}
impl<'a> GetPortfolioV1PositionsAddressBuilder<'a> {
#[doc = concat!("Set the optional `", "platforms", "` operation parameter.")]
#[must_use]
pub fn platforms(mut self, platforms: impl Into<String>) -> Self {
self.platforms = Some(platforms.into());
self
}
pub async fn send(
self,
) -> Result<GetPortfolioV1PositionsAddressResponse, ApiOpError<serde_json::Value>> {
self.client
.get_portfolio_v1_positions_address(self.address, self.platforms)
.await
}
}
#[doc = concat!("Additive request builder for `", "getPredictionV1Events", "`.")]
#[must_use]
pub struct GetPredictionV1EventsBuilder<'a> {
client: &'a HttpClient,
provider: Option<GetPredictionV1EventsProvider>,
include_markets: Option<bool>,
include_all_markets: Option<bool>,
start: Option<i64>,
end: Option<i64>,
category: Option<GetPredictionV1EventsCategory>,
subcategory: Option<String>,
sort_by: Option<GetPredictionV1EventsSortBy>,
sort_direction: Option<GetPredictionV1EventsSortDirection>,
filter: Option<GetPredictionV1EventsFilter>,
tags: Option<String>,
}
impl<'a> GetPredictionV1EventsBuilder<'a> {
#[doc = concat!("Set the optional `", "provider", "` operation parameter.")]
#[must_use]
pub fn provider(mut self, provider: GetPredictionV1EventsProvider) -> Self {
self.provider = Some(provider);
self
}
#[doc = concat!("Set the optional `", "includeMarkets", "` operation parameter.")]
#[must_use]
pub fn include_markets(mut self, include_markets: bool) -> Self {
self.include_markets = Some(include_markets);
self
}
#[doc = concat!("Set the optional `", "includeAllMarkets", "` operation parameter.")]
#[must_use]
pub fn include_all_markets(mut self, include_all_markets: bool) -> Self {
self.include_all_markets = Some(include_all_markets);
self
}
#[doc = concat!("Set the optional `", "start", "` operation parameter.")]
#[must_use]
pub fn start(mut self, start: i64) -> Self {
self.start = Some(start);
self
}
#[doc = concat!("Set the optional `", "end", "` operation parameter.")]
#[must_use]
pub fn end(mut self, end: i64) -> Self {
self.end = Some(end);
self
}
#[doc = concat!("Set the optional `", "category", "` operation parameter.")]
#[must_use]
pub fn category(mut self, category: GetPredictionV1EventsCategory) -> Self {
self.category = Some(category);
self
}
#[doc = concat!("Set the optional `", "subcategory", "` operation parameter.")]
#[must_use]
pub fn subcategory(mut self, subcategory: impl Into<String>) -> Self {
self.subcategory = Some(subcategory.into());
self
}
#[doc = concat!("Set the optional `", "sortBy", "` operation parameter.")]
#[must_use]
pub fn sort_by(mut self, sort_by: GetPredictionV1EventsSortBy) -> Self {
self.sort_by = Some(sort_by);
self
}
#[doc = concat!("Set the optional `", "sortDirection", "` operation parameter.")]
#[must_use]
pub fn sort_direction(mut self, sort_direction: GetPredictionV1EventsSortDirection) -> Self {
self.sort_direction = Some(sort_direction);
self
}
#[doc = concat!("Set the optional `", "filter", "` operation parameter.")]
#[must_use]
pub fn filter(mut self, filter: GetPredictionV1EventsFilter) -> Self {
self.filter = Some(filter);
self
}
#[doc = concat!("Set the optional `", "tags", "` operation parameter.")]
#[must_use]
pub fn tags(mut self, tags: impl Into<String>) -> Self {
self.tags = Some(tags.into());
self
}
pub async fn send(
self,
) -> Result<GetPredictionV1EventsResponse, ApiOpError<serde_json::Value>> {
self.client
.get_prediction_v1_events(
self.provider,
self.include_markets,
self.include_all_markets,
self.start,
self.end,
self.category,
self.subcategory,
self.sort_by,
self.sort_direction,
self.filter,
self.tags,
)
.await
}
}
#[doc = concat!("Additive request builder for `", "getPredictionV1EventsEventId", "`.")]
#[must_use]
pub struct GetPredictionV1EventsEventIdBuilder<'a> {
client: &'a HttpClient,
event_id: String,
include_markets: Option<bool>,
include_all_markets: Option<bool>,
}
impl<'a> GetPredictionV1EventsEventIdBuilder<'a> {
#[doc = concat!("Set the optional `", "includeMarkets", "` operation parameter.")]
#[must_use]
pub fn include_markets(mut self, include_markets: bool) -> Self {
self.include_markets = Some(include_markets);
self
}
#[doc = concat!("Set the optional `", "includeAllMarkets", "` operation parameter.")]
#[must_use]
pub fn include_all_markets(mut self, include_all_markets: bool) -> Self {
self.include_all_markets = Some(include_all_markets);
self
}
pub async fn send(
self,
) -> Result<PredictionEvent, ApiOpError<GetPredictionV1EventsEventIdApiError>> {
self.client
.get_prediction_v1_events_event_id(
self.event_id,
self.include_markets,
self.include_all_markets,
)
.await
}
}
#[doc = concat!(
"Additive request builder for `", "getPredictionV1EventsEventIdMarkets", "`."
)]
#[must_use]
pub struct GetPredictionV1EventsEventIdMarketsBuilder<'a> {
client: &'a HttpClient,
event_id: String,
start: Option<i64>,
end: Option<i64>,
}
impl<'a> GetPredictionV1EventsEventIdMarketsBuilder<'a> {
#[doc = concat!("Set the optional `", "start", "` operation parameter.")]
#[must_use]
pub fn start(mut self, start: i64) -> Self {
self.start = Some(start);
self
}
#[doc = concat!("Set the optional `", "end", "` operation parameter.")]
#[must_use]
pub fn end(mut self, end: i64) -> Self {
self.end = Some(end);
self
}
pub async fn send(
self,
) -> Result<GetPredictionV1EventsEventIdMarketsResponse, ApiOpError<serde_json::Value>> {
self.client
.get_prediction_v1_events_event_id_markets(self.event_id, self.start, self.end)
.await
}
}
#[doc = concat!("Additive request builder for `", "getPredictionV1EventsSearch", "`.")]
#[must_use]
pub struct GetPredictionV1EventsSearchBuilder<'a> {
client: &'a HttpClient,
provider: Option<GetPredictionV1EventsSearchProvider>,
query: String,
limit: Option<i64>,
}
impl<'a> GetPredictionV1EventsSearchBuilder<'a> {
#[doc = concat!("Set the optional `", "provider", "` operation parameter.")]
#[must_use]
pub fn provider(mut self, provider: GetPredictionV1EventsSearchProvider) -> Self {
self.provider = Some(provider);
self
}
#[doc = concat!("Set the optional `", "limit", "` operation parameter.")]
#[must_use]
pub fn limit(mut self, limit: i64) -> Self {
self.limit = Some(limit);
self
}
pub async fn send(
self,
) -> Result<GetPredictionV1EventsSearchResponse, ApiOpError<serde_json::Value>> {
self.client
.get_prediction_v1_events_search(self.provider, self.query, self.limit)
.await
}
}
#[doc = concat!(
"Additive request builder for `", "getPredictionV1EventsSuggestedPubkey", "`."
)]
#[must_use]
pub struct GetPredictionV1EventsSuggestedPubkeyBuilder<'a> {
client: &'a HttpClient,
pubkey: String,
provider: Option<GetPredictionV1EventsSuggestedPubkeyProvider>,
}
impl<'a> GetPredictionV1EventsSuggestedPubkeyBuilder<'a> {
#[doc = concat!("Set the optional `", "provider", "` operation parameter.")]
#[must_use]
pub fn provider(mut self, provider: GetPredictionV1EventsSuggestedPubkeyProvider) -> Self {
self.provider = Some(provider);
self
}
pub async fn send(
self,
) -> Result<GetPredictionV1EventsSuggestedPubkeyResponse, ApiOpError<serde_json::Value>> {
self.client
.get_prediction_v1_events_suggested_pubkey(self.pubkey, self.provider)
.await
}
}
#[doc = concat!("Additive request builder for `", "getPredictionV1History", "`.")]
#[must_use]
pub struct GetPredictionV1HistoryBuilder<'a> {
client: &'a HttpClient,
start: Option<i64>,
end: Option<i64>,
owner_pubkey: Option<String>,
id: Option<i64>,
position_pubkey: Option<String>,
}
impl<'a> GetPredictionV1HistoryBuilder<'a> {
#[doc = concat!("Set the optional `", "start", "` operation parameter.")]
#[must_use]
pub fn start(mut self, start: i64) -> Self {
self.start = Some(start);
self
}
#[doc = concat!("Set the optional `", "end", "` operation parameter.")]
#[must_use]
pub fn end(mut self, end: i64) -> Self {
self.end = Some(end);
self
}
#[doc = concat!("Set the optional `", "ownerPubkey", "` operation parameter.")]
#[must_use]
pub fn owner_pubkey(mut self, owner_pubkey: impl Into<String>) -> Self {
self.owner_pubkey = Some(owner_pubkey.into());
self
}
#[doc = concat!("Set the optional `", "id", "` operation parameter.")]
#[must_use]
pub fn id(mut self, id: i64) -> Self {
self.id = Some(id);
self
}
#[doc = concat!("Set the optional `", "positionPubkey", "` operation parameter.")]
#[must_use]
pub fn position_pubkey(mut self, position_pubkey: impl Into<String>) -> Self {
self.position_pubkey = Some(position_pubkey.into());
self
}
pub async fn send(
self,
) -> Result<GetPredictionV1HistoryResponse, ApiOpError<serde_json::Value>> {
self.client
.get_prediction_v1_history(
self.start,
self.end,
self.owner_pubkey,
self.id,
self.position_pubkey,
)
.await
}
}
#[doc = concat!("Additive request builder for `", "getPredictionV1Leaderboards", "`.")]
#[must_use]
pub struct GetPredictionV1LeaderboardsBuilder<'a> {
client: &'a HttpClient,
period: Option<GetPredictionV1LeaderboardsPeriod>,
limit: Option<i64>,
metric: Option<GetPredictionV1LeaderboardsMetric>,
}
impl<'a> GetPredictionV1LeaderboardsBuilder<'a> {
#[doc = concat!("Set the optional `", "period", "` operation parameter.")]
#[must_use]
pub fn period(mut self, period: GetPredictionV1LeaderboardsPeriod) -> Self {
self.period = Some(period);
self
}
#[doc = concat!("Set the optional `", "limit", "` operation parameter.")]
#[must_use]
pub fn limit(mut self, limit: i64) -> Self {
self.limit = Some(limit);
self
}
#[doc = concat!("Set the optional `", "metric", "` operation parameter.")]
#[must_use]
pub fn metric(mut self, metric: GetPredictionV1LeaderboardsMetric) -> Self {
self.metric = Some(metric);
self
}
pub async fn send(
self,
) -> Result<GetPredictionV1LeaderboardsResponse, ApiOpError<serde_json::Value>> {
self.client
.get_prediction_v1_leaderboards(self.period, self.limit, self.metric)
.await
}
}
#[doc = concat!("Additive request builder for `", "getPredictionV1Orders", "`.")]
#[must_use]
pub struct GetPredictionV1OrdersBuilder<'a> {
client: &'a HttpClient,
start: Option<i64>,
end: Option<i64>,
owner_pubkey: Option<String>,
}
impl<'a> GetPredictionV1OrdersBuilder<'a> {
#[doc = concat!("Set the optional `", "start", "` operation parameter.")]
#[must_use]
pub fn start(mut self, start: i64) -> Self {
self.start = Some(start);
self
}
#[doc = concat!("Set the optional `", "end", "` operation parameter.")]
#[must_use]
pub fn end(mut self, end: i64) -> Self {
self.end = Some(end);
self
}
#[doc = concat!("Set the optional `", "ownerPubkey", "` operation parameter.")]
#[must_use]
pub fn owner_pubkey(mut self, owner_pubkey: impl Into<String>) -> Self {
self.owner_pubkey = Some(owner_pubkey.into());
self
}
pub async fn send(
self,
) -> Result<GetPredictionV1OrdersResponse, ApiOpError<GetPredictionV1OrdersApiError>> {
self.client
.get_prediction_v1_orders(self.start, self.end, self.owner_pubkey)
.await
}
}
#[doc = concat!("Additive request builder for `", "getPredictionV1Positions", "`.")]
#[must_use]
pub struct GetPredictionV1PositionsBuilder<'a> {
client: &'a HttpClient,
start: Option<i64>,
end: Option<i64>,
owner_pubkey: Option<String>,
market_pubkey: Option<String>,
market_id: Option<String>,
is_yes: Option<GetPredictionV1PositionsIsYes>,
}
impl<'a> GetPredictionV1PositionsBuilder<'a> {
#[doc = concat!("Set the optional `", "start", "` operation parameter.")]
#[must_use]
pub fn start(mut self, start: i64) -> Self {
self.start = Some(start);
self
}
#[doc = concat!("Set the optional `", "end", "` operation parameter.")]
#[must_use]
pub fn end(mut self, end: i64) -> Self {
self.end = Some(end);
self
}
#[doc = concat!("Set the optional `", "ownerPubkey", "` operation parameter.")]
#[must_use]
pub fn owner_pubkey(mut self, owner_pubkey: impl Into<String>) -> Self {
self.owner_pubkey = Some(owner_pubkey.into());
self
}
#[doc = concat!("Set the optional `", "marketPubkey", "` operation parameter.")]
#[must_use]
pub fn market_pubkey(mut self, market_pubkey: impl Into<String>) -> Self {
self.market_pubkey = Some(market_pubkey.into());
self
}
#[doc = concat!("Set the optional `", "marketId", "` operation parameter.")]
#[must_use]
pub fn market_id(mut self, market_id: impl Into<String>) -> Self {
self.market_id = Some(market_id.into());
self
}
#[doc = concat!("Set the optional `", "isYes", "` operation parameter.")]
#[must_use]
pub fn is_yes(mut self, is_yes: GetPredictionV1PositionsIsYes) -> Self {
self.is_yes = Some(is_yes);
self
}
pub async fn send(
self,
) -> Result<GetPredictionV1PositionsResponse, ApiOpError<GetPredictionV1PositionsApiError>>
{
self.client
.get_prediction_v1_positions(
self.start,
self.end,
self.owner_pubkey,
self.market_pubkey,
self.market_id,
self.is_yes,
)
.await
}
}
#[doc = concat!(
"Additive request builder for `", "getPredictionV1ProfilesOwnerPubkeyPnlHistory",
"`."
)]
#[must_use]
pub struct GetPredictionV1ProfilesOwnerPubkeyPnlHistoryBuilder<'a> {
client: &'a HttpClient,
owner_pubkey: String,
interval: Option<GetPredictionV1ProfilesOwnerPubkeyPnlHistoryInterval>,
count: Option<i64>,
}
impl<'a> GetPredictionV1ProfilesOwnerPubkeyPnlHistoryBuilder<'a> {
#[doc = concat!("Set the optional `", "interval", "` operation parameter.")]
#[must_use]
pub fn interval(
mut self,
interval: GetPredictionV1ProfilesOwnerPubkeyPnlHistoryInterval,
) -> Self {
self.interval = Some(interval);
self
}
#[doc = concat!("Set the optional `", "count", "` operation parameter.")]
#[must_use]
pub fn count(mut self, count: i64) -> Self {
self.count = Some(count);
self
}
pub async fn send(
self,
) -> Result<GetPredictionV1ProfilesOwnerPubkeyPnlHistoryResponse, ApiOpError<serde_json::Value>>
{
self.client
.get_prediction_v1_profiles_owner_pubkey_pnl_history(
self.owner_pubkey,
self.interval,
self.count,
)
.await
}
}
#[doc = concat!("Additive request builder for `", "getPriceV2", "`.")]
#[must_use]
pub struct GetPriceV2Builder<'a> {
client: &'a HttpClient,
ids: String,
vs_token: Option<String>,
show_extra_info: Option<String>,
}
impl<'a> GetPriceV2Builder<'a> {
#[doc = concat!("Set the optional `", "vsToken", "` operation parameter.")]
#[must_use]
pub fn vs_token(mut self, vs_token: impl Into<String>) -> Self {
self.vs_token = Some(vs_token.into());
self
}
#[doc = concat!("Set the optional `", "showExtraInfo", "` operation parameter.")]
#[must_use]
pub fn show_extra_info(mut self, show_extra_info: impl Into<String>) -> Self {
self.show_extra_info = Some(show_extra_info.into());
self
}
pub async fn send(self) -> Result<PriceV2PriceResponse, ApiOpError<serde_json::Value>> {
self.client
.get_price_v2(self.ids, self.vs_token, self.show_extra_info)
.await
}
}
#[doc = concat!("Additive request builder for `", "getSendV1InviteHistory", "`.")]
#[must_use]
pub struct GetSendV1InviteHistoryBuilder<'a> {
client: &'a HttpClient,
address: String,
page: Option<i64>,
}
impl<'a> GetSendV1InviteHistoryBuilder<'a> {
#[doc = concat!("Set the optional `", "page", "` operation parameter.")]
#[must_use]
pub fn page(mut self, page: i64) -> Self {
self.page = Some(page);
self
}
pub async fn send(
self,
) -> Result<SendInviteDataResponse, ApiOpError<GetSendV1InviteHistoryApiError>> {
self.client
.get_send_v1_invite_history(self.address, self.page)
.await
}
}
#[doc = concat!("Additive request builder for `", "getSendV1PendingInvites", "`.")]
#[must_use]
pub struct GetSendV1PendingInvitesBuilder<'a> {
client: &'a HttpClient,
address: String,
page: Option<i64>,
}
impl<'a> GetSendV1PendingInvitesBuilder<'a> {
#[doc = concat!("Set the optional `", "page", "` operation parameter.")]
#[must_use]
pub fn page(mut self, page: i64) -> Self {
self.page = Some(page);
self
}
pub async fn send(
self,
) -> Result<SendInviteDataResponse, ApiOpError<GetSendV1PendingInvitesApiError>> {
self.client
.get_send_v1_pending_invites(self.address, self.page)
.await
}
}
#[doc = concat!("Additive request builder for `", "getTokensV1New", "`.")]
#[must_use]
pub struct GetTokensV1NewBuilder<'a> {
client: &'a HttpClient,
limit: Option<i64>,
offset: Option<i64>,
}
impl<'a> GetTokensV1NewBuilder<'a> {
#[doc = concat!("Set the optional `", "limit", "` operation parameter.")]
#[must_use]
pub fn limit(mut self, limit: i64) -> Self {
self.limit = Some(limit);
self
}
#[doc = concat!("Set the optional `", "offset", "` operation parameter.")]
#[must_use]
pub fn offset(mut self, offset: i64) -> Self {
self.offset = Some(offset);
self
}
pub async fn send(self) -> Result<GetTokensV1NewResponse, ApiOpError<serde_json::Value>> {
self.client.get_tokens_v1_new(self.limit, self.offset).await
}
}
#[doc = concat!("Additive request builder for `", "getTokensV2CategoryInterval", "`.")]
#[must_use]
pub struct GetTokensV2CategoryIntervalBuilder<'a> {
client: &'a HttpClient,
category: GetTokensV2CategoryIntervalCategory,
interval: GetTokensV2CategoryIntervalInterval,
limit: Option<i64>,
}
impl<'a> GetTokensV2CategoryIntervalBuilder<'a> {
#[doc = concat!("Set the optional `", "limit", "` operation parameter.")]
#[must_use]
pub fn limit(mut self, limit: i64) -> Self {
self.limit = Some(limit);
self
}
pub async fn send(
self,
) -> Result<GetTokensV2CategoryIntervalResponse, ApiOpError<GetTokensV2CategoryIntervalApiError>>
{
self.client
.get_tokens_v2_category_interval(self.category, self.interval, self.limit)
.await
}
}
#[doc = concat!(
"Additive request builder for `", "getTokensV2VerifyExpressCraftTxn", "`."
)]
#[must_use]
pub struct GetTokensV2VerifyExpressCraftTxnBuilder<'a> {
client: &'a HttpClient,
sender_address: String,
payment_currency: Option<TokensV2VerificationPaymentCurrency>,
}
impl<'a> GetTokensV2VerifyExpressCraftTxnBuilder<'a> {
#[doc = concat!("Set the optional `", "paymentCurrency", "` operation parameter.")]
#[must_use]
pub fn payment_currency(
mut self,
payment_currency: TokensV2VerificationPaymentCurrency,
) -> Self {
self.payment_currency = Some(payment_currency);
self
}
pub async fn send(
self,
) -> Result<
TokensV2VerificationCraftTxnResponse,
ApiOpError<GetTokensV2VerifyExpressCraftTxnApiError>,
> {
self.client
.get_tokens_v2_verify_express_craft_txn(self.sender_address, self.payment_currency)
.await
}
}
#[doc = concat!("Additive request builder for `", "getTriggerV1GetTriggerOrders", "`.")]
#[must_use]
pub struct GetTriggerV1GetTriggerOrdersBuilder<'a> {
client: &'a HttpClient,
user: String,
page: Option<String>,
include_failed_tx: Option<GetTriggerV1GetTriggerOrdersIncludeFailedTx>,
order_status: GetTriggerV1GetTriggerOrdersOrderStatus,
input_mint: Option<String>,
output_mint: Option<String>,
}
impl<'a> GetTriggerV1GetTriggerOrdersBuilder<'a> {
#[doc = concat!("Set the optional `", "page", "` operation parameter.")]
#[must_use]
pub fn page(mut self, page: impl Into<String>) -> Self {
self.page = Some(page.into());
self
}
#[doc = concat!("Set the optional `", "includeFailedTx", "` operation parameter.")]
#[must_use]
pub fn include_failed_tx(
mut self,
include_failed_tx: GetTriggerV1GetTriggerOrdersIncludeFailedTx,
) -> Self {
self.include_failed_tx = Some(include_failed_tx);
self
}
#[doc = concat!("Set the optional `", "inputMint", "` operation parameter.")]
#[must_use]
pub fn input_mint(mut self, input_mint: impl Into<String>) -> Self {
self.input_mint = Some(input_mint.into());
self
}
#[doc = concat!("Set the optional `", "outputMint", "` operation parameter.")]
#[must_use]
pub fn output_mint(mut self, output_mint: impl Into<String>) -> Self {
self.output_mint = Some(output_mint.into());
self
}
pub async fn send(
self,
) -> Result<GetTriggerV1GetTriggerOrdersResponse, ApiOpError<serde_json::Value>> {
self.client
.get_trigger_v1_get_trigger_orders(
self.user,
self.page,
self.include_failed_tx,
self.order_status,
self.input_mint,
self.output_mint,
)
.await
}
}
#[doc = concat!("Additive request builder for `", "getTriggerV2OrdersHistory", "`.")]
#[must_use]
pub struct GetTriggerV2OrdersHistoryBuilder<'a> {
client: &'a HttpClient,
state: Option<GetTriggerV2OrdersHistoryState>,
mint: Option<String>,
limit: Option<f64>,
offset: Option<f64>,
sort: Option<GetTriggerV2OrdersHistorySort>,
dir: Option<GetTriggerV2OrdersHistoryDir>,
}
impl<'a> GetTriggerV2OrdersHistoryBuilder<'a> {
#[doc = concat!("Set the optional `", "state", "` operation parameter.")]
#[must_use]
pub fn state(mut self, state: GetTriggerV2OrdersHistoryState) -> Self {
self.state = Some(state);
self
}
#[doc = concat!("Set the optional `", "mint", "` operation parameter.")]
#[must_use]
pub fn mint(mut self, mint: impl Into<String>) -> Self {
self.mint = Some(mint.into());
self
}
#[doc = concat!("Set the optional `", "limit", "` operation parameter.")]
#[must_use]
pub fn limit(mut self, limit: f64) -> Self {
self.limit = Some(limit);
self
}
#[doc = concat!("Set the optional `", "offset", "` operation parameter.")]
#[must_use]
pub fn offset(mut self, offset: f64) -> Self {
self.offset = Some(offset);
self
}
#[doc = concat!("Set the optional `", "sort", "` operation parameter.")]
#[must_use]
pub fn sort(mut self, sort: GetTriggerV2OrdersHistorySort) -> Self {
self.sort = Some(sort);
self
}
#[doc = concat!("Set the optional `", "dir", "` operation parameter.")]
#[must_use]
pub fn dir(mut self, dir: GetTriggerV2OrdersHistoryDir) -> Self {
self.dir = Some(dir);
self
}
pub async fn send(
self,
) -> Result<GetTriggerV2OrdersHistoryResponse, ApiOpError<serde_json::Value>> {
self.client
.get_trigger_v2_orders_history(
self.state,
self.mint,
self.limit,
self.offset,
self.sort,
self.dir,
)
.await
}
}
#[doc = concat!("Additive request builder for `", "getTriggerV2OrdersHistoryDca", "`.")]
#[must_use]
pub struct GetTriggerV2OrdersHistoryDcaBuilder<'a> {
client: &'a HttpClient,
state: Option<GetTriggerV2OrdersHistoryDcaState>,
mint: Option<String>,
limit: Option<f64>,
offset: Option<f64>,
sort: Option<GetTriggerV2OrdersHistoryDcaSort>,
dir: Option<GetTriggerV2OrdersHistoryDcaDir>,
}
impl<'a> GetTriggerV2OrdersHistoryDcaBuilder<'a> {
#[doc = concat!("Set the optional `", "state", "` operation parameter.")]
#[must_use]
pub fn state(mut self, state: GetTriggerV2OrdersHistoryDcaState) -> Self {
self.state = Some(state);
self
}
#[doc = concat!("Set the optional `", "mint", "` operation parameter.")]
#[must_use]
pub fn mint(mut self, mint: impl Into<String>) -> Self {
self.mint = Some(mint.into());
self
}
#[doc = concat!("Set the optional `", "limit", "` operation parameter.")]
#[must_use]
pub fn limit(mut self, limit: f64) -> Self {
self.limit = Some(limit);
self
}
#[doc = concat!("Set the optional `", "offset", "` operation parameter.")]
#[must_use]
pub fn offset(mut self, offset: f64) -> Self {
self.offset = Some(offset);
self
}
#[doc = concat!("Set the optional `", "sort", "` operation parameter.")]
#[must_use]
pub fn sort(mut self, sort: GetTriggerV2OrdersHistoryDcaSort) -> Self {
self.sort = Some(sort);
self
}
#[doc = concat!("Set the optional `", "dir", "` operation parameter.")]
#[must_use]
pub fn dir(mut self, dir: GetTriggerV2OrdersHistoryDcaDir) -> Self {
self.dir = Some(dir);
self
}
pub async fn send(
self,
) -> Result<GetTriggerV2OrdersHistoryDcaResponse, ApiOpError<serde_json::Value>> {
self.client
.get_trigger_v2_orders_history_dca(
self.state,
self.mint,
self.limit,
self.offset,
self.sort,
self.dir,
)
.await
}
}
#[doc = concat!("Additive request builder for `", "getUltraV1Order", "`.")]
#[must_use]
pub struct GetUltraV1OrderBuilder<'a> {
client: &'a HttpClient,
input_mint: String,
output_mint: String,
amount: String,
taker: Option<String>,
receiver: Option<String>,
payer: Option<String>,
close_authority: Option<String>,
referral_account: Option<String>,
referral_fee: Option<f64>,
exclude_routers: Option<GetUltraV1OrderExcludeRouters>,
exclude_dexes: Option<String>,
}
impl<'a> GetUltraV1OrderBuilder<'a> {
#[doc = concat!("Set the optional `", "taker", "` operation parameter.")]
#[must_use]
pub fn taker(mut self, taker: impl Into<String>) -> Self {
self.taker = Some(taker.into());
self
}
#[doc = concat!("Set the optional `", "receiver", "` operation parameter.")]
#[must_use]
pub fn receiver(mut self, receiver: impl Into<String>) -> Self {
self.receiver = Some(receiver.into());
self
}
#[doc = concat!("Set the optional `", "payer", "` operation parameter.")]
#[must_use]
pub fn payer(mut self, payer: impl Into<String>) -> Self {
self.payer = Some(payer.into());
self
}
#[doc = concat!("Set the optional `", "closeAuthority", "` operation parameter.")]
#[must_use]
pub fn close_authority(mut self, close_authority: impl Into<String>) -> Self {
self.close_authority = Some(close_authority.into());
self
}
#[doc = concat!("Set the optional `", "referralAccount", "` operation parameter.")]
#[must_use]
pub fn referral_account(mut self, referral_account: impl Into<String>) -> Self {
self.referral_account = Some(referral_account.into());
self
}
#[doc = concat!("Set the optional `", "referralFee", "` operation parameter.")]
#[must_use]
pub fn referral_fee(mut self, referral_fee: f64) -> Self {
self.referral_fee = Some(referral_fee);
self
}
#[doc = concat!("Set the optional `", "excludeRouters", "` operation parameter.")]
#[must_use]
pub fn exclude_routers(mut self, exclude_routers: GetUltraV1OrderExcludeRouters) -> Self {
self.exclude_routers = Some(exclude_routers);
self
}
#[doc = concat!("Set the optional `", "excludeDexes", "` operation parameter.")]
#[must_use]
pub fn exclude_dexes(mut self, exclude_dexes: impl Into<String>) -> Self {
self.exclude_dexes = Some(exclude_dexes.into());
self
}
pub async fn send(
self,
) -> Result<GetUltraV1OrderResponse, ApiOpError<GetUltraV1OrderApiError>> {
self.client
.get_ultra_v1_order(
self.input_mint,
self.output_mint,
self.amount,
self.taker,
self.receiver,
self.payer,
self.close_authority,
self.referral_account,
self.referral_fee,
self.exclude_routers,
self.exclude_dexes,
)
.await
}
}
#[doc = concat!("Additive request builder for `", "listBorrowPositions", "`.")]
#[must_use]
pub struct ListBorrowPositionsBuilder<'a> {
client: &'a HttpClient,
users: String,
market: Option<LendBorrowMarket>,
}
impl<'a> ListBorrowPositionsBuilder<'a> {
#[doc = concat!("Set the optional `", "market", "` operation parameter.")]
#[must_use]
pub fn market(mut self, market: LendBorrowMarket) -> Self {
self.market = Some(market);
self
}
pub async fn send(self) -> Result<ListBorrowPositionsResponse, ApiOpError<serde_json::Value>> {
self.client
.list_borrow_positions(self.users, self.market)
.await
}
}
#[doc = concat!("Additive request builder for `", "listBorrowVaults", "`.")]
#[must_use]
pub struct ListBorrowVaultsBuilder<'a> {
client: &'a HttpClient,
market: Option<LendBorrowMarket>,
rpc_url: Option<String>,
}
impl<'a> ListBorrowVaultsBuilder<'a> {
#[doc = concat!("Set the optional `", "market", "` operation parameter.")]
#[must_use]
pub fn market(mut self, market: LendBorrowMarket) -> Self {
self.market = Some(market);
self
}
#[doc = concat!("Set the optional `", "rpcUrl", "` operation parameter.")]
#[must_use]
pub fn rpc_url(mut self, rpc_url: impl Into<String>) -> Self {
self.rpc_url = Some(rpc_url.into());
self
}
pub async fn send(self) -> Result<ListBorrowVaultsResponse, ApiOpError<serde_json::Value>> {
self.client
.list_borrow_vaults(self.market, self.rpc_url)
.await
}
}
#[doc = concat!(
"Additive request builder for `", "patchTriggerV2OrdersPriceOrderId", "`."
)]
#[must_use]
pub struct PatchTriggerV2OrdersPriceOrderIdBuilder<'a> {
client: &'a HttpClient,
order_id: String,
request: PatchTriggerV2OrdersPriceOrderIdRequest,
}
impl<'a> PatchTriggerV2OrdersPriceOrderIdBuilder<'a> {
#[must_use]
pub fn request(mut self, request: PatchTriggerV2OrdersPriceOrderIdRequest) -> Self {
self.request = request;
self
}
#[doc = concat!("Set the optional request-body field `", "slPriceUsd", "`.")]
#[must_use]
pub fn sl_price_usd(mut self, sl_price_usd: f64) -> Self {
self.request.sl_price_usd = Some(sl_price_usd);
self
}
#[doc = concat!("Set the optional request-body field `", "slSlippageBps", "`.")]
#[must_use]
pub fn sl_slippage_bps(mut self, sl_slippage_bps: f64) -> Self {
self.request.sl_slippage_bps = Some(sl_slippage_bps);
self
}
#[doc = concat!("Set the optional request-body field `", "slippageBps", "`.")]
#[must_use]
pub fn slippage_bps(mut self, slippage_bps: f64) -> Self {
self.request.slippage_bps = Some(slippage_bps);
self
}
#[doc = concat!("Set the optional request-body field `", "tpPriceUsd", "`.")]
#[must_use]
pub fn tp_price_usd(mut self, tp_price_usd: f64) -> Self {
self.request.tp_price_usd = Some(tp_price_usd);
self
}
#[doc = concat!("Set the optional request-body field `", "tpSlippageBps", "`.")]
#[must_use]
pub fn tp_slippage_bps(mut self, tp_slippage_bps: f64) -> Self {
self.request.tp_slippage_bps = Some(tp_slippage_bps);
self
}
#[doc = concat!("Set the optional request-body field `", "trailingBps", "`.")]
#[must_use]
pub fn trailing_bps(mut self, trailing_bps: f64) -> Self {
self.request.trailing_bps = Some(trailing_bps);
self
}
#[doc = concat!("Set the optional request-body field `", "triggerPriceUsd", "`.")]
#[must_use]
pub fn trigger_price_usd(mut self, trigger_price_usd: f64) -> Self {
self.request.trigger_price_usd = Some(trigger_price_usd);
self
}
pub async fn send(
self,
) -> Result<PatchTriggerV2OrdersPriceOrderIdResponse, ApiOpError<serde_json::Value>> {
self.client
.patch_trigger_v2_orders_price_order_id(self.order_id, self.request)
.await
}
}
#[doc = concat!("Additive request builder for `", "postPredictionV1Execute", "`.")]
#[must_use]
pub struct PostPredictionV1ExecuteBuilder<'a> {
client: &'a HttpClient,
request: PredictionExecuteRequest,
}
impl<'a> PostPredictionV1ExecuteBuilder<'a> {
#[must_use]
pub fn request(mut self, request: PredictionExecuteRequest) -> Self {
self.request = request;
self
}
#[doc = concat!("Set the optional request-body field `", "context", "`.")]
#[must_use]
pub fn context(mut self, context: PredictionExecuteRequestContext) -> Self {
self.request.context = Some(context);
self
}
#[doc = concat!("Set the optional request-body field `", "requestId", "`.")]
#[must_use]
pub fn request_id(mut self, request_id: String) -> Self {
self.request.request_id = Some(request_id);
self
}
pub async fn send(
self,
) -> Result<PredictionExecuteResponse, ApiOpError<PostPredictionV1ExecuteApiError>> {
self.client.post_prediction_v1_execute(self.request).await
}
}
#[doc = concat!("Additive request builder for `", "postPredictionV1Orders", "`.")]
#[must_use]
pub struct PostPredictionV1OrdersBuilder<'a> {
client: &'a HttpClient,
request: PredictionCreateOrderRequest,
}
impl<'a> PostPredictionV1OrdersBuilder<'a> {
#[must_use]
pub fn request(mut self, request: PredictionCreateOrderRequest) -> Self {
self.request = request;
self
}
#[doc = concat!("Set the optional request-body field `", "contracts", "`.")]
#[must_use]
pub fn contracts(mut self, contracts: PredictionCreateOrderRequestContracts) -> Self {
self.request.contracts = Some(contracts);
self
}
#[doc = concat!("Set the optional request-body field `", "contractsDecimal", "`.")]
#[must_use]
pub fn contracts_decimal(
mut self,
contracts_decimal: PredictionCreateOrderRequestContractsDecimal,
) -> Self {
self.request.contracts_decimal = Some(contracts_decimal);
self
}
#[doc = concat!("Set the optional request-body field `", "contractsMicro", "`.")]
#[must_use]
pub fn contracts_micro(
mut self,
contracts_micro: PredictionCreateOrderRequestContractsMicro,
) -> Self {
self.request.contracts_micro = Some(contracts_micro);
self
}
#[doc = concat!("Set the optional request-body field `", "depositAmount", "`.")]
#[must_use]
pub fn deposit_amount(
mut self,
deposit_amount: PredictionCreateOrderRequestDepositAmount,
) -> Self {
self.request.deposit_amount = Some(deposit_amount);
self
}
#[doc = concat!("Set the optional request-body field `", "depositMint", "`.")]
#[must_use]
pub fn deposit_mint(mut self, deposit_mint: String) -> Self {
self.request.deposit_mint = Some(deposit_mint);
self
}
#[doc = concat!("Set the optional request-body field `", "isYes", "`.")]
#[must_use]
pub fn is_yes(mut self, is_yes: bool) -> Self {
self.request.is_yes = Some(is_yes);
self
}
#[doc = concat!("Set the optional request-body field `", "marketId", "`.")]
#[must_use]
pub fn market_id(mut self, market_id: String) -> Self {
self.request.market_id = Some(market_id);
self
}
#[doc = concat!("Set the optional request-body field `", "ownerPubkey", "`.")]
#[must_use]
pub fn owner_pubkey(mut self, owner_pubkey: String) -> Self {
self.request.owner_pubkey = Some(owner_pubkey);
self
}
#[doc = concat!("Set the optional request-body field `", "positionPubkey", "`.")]
#[must_use]
pub fn position_pubkey(mut self, position_pubkey: String) -> Self {
self.request.position_pubkey = Some(position_pubkey);
self
}
pub async fn send(
self,
) -> Result<PredictionCreateOrderResponse, ApiOpError<PostPredictionV1OrdersApiError>> {
self.client.post_prediction_v1_orders(self.request).await
}
}
#[doc = concat!(
"Additive request builder for `", "postPredictionV1PositionsPositionPubkeyClaim",
"`."
)]
#[must_use]
pub struct PostPredictionV1PositionsPositionPubkeyClaimBuilder<'a> {
client: &'a HttpClient,
position_pubkey: String,
request: PredictionClaimPositionRequest,
}
impl<'a> PostPredictionV1PositionsPositionPubkeyClaimBuilder<'a> {
#[must_use]
pub fn request(mut self, request: PredictionClaimPositionRequest) -> Self {
self.request = request;
self
}
#[doc = concat!("Set the optional request-body field `", "ownerPubkey", "`.")]
#[must_use]
pub fn owner_pubkey(mut self, owner_pubkey: String) -> Self {
self.request.owner_pubkey = Some(owner_pubkey);
self
}
pub async fn send(
self,
) -> Result<
PredictionClaimPositionResponse,
ApiOpError<PostPredictionV1PositionsPositionPubkeyClaimApiError>,
> {
self.client
.post_prediction_v1_positions_position_pubkey_claim(self.position_pubkey, self.request)
.await
}
}
#[doc = concat!("Additive request builder for `", "postSendV1CraftSend", "`.")]
#[must_use]
pub struct PostSendV1CraftSendBuilder<'a> {
client: &'a HttpClient,
request: PostSendV1CraftSendRequest,
}
impl<'a> PostSendV1CraftSendBuilder<'a> {
#[must_use]
pub fn request(mut self, request: PostSendV1CraftSendRequest) -> Self {
self.request = request;
self
}
#[doc = concat!("Set the optional request-body field `", "mint", "`.")]
#[must_use]
pub fn mint(mut self, mint: String) -> Self {
self.request.mint = Some(mint);
self
}
pub async fn send(
self,
) -> Result<PostSendV1CraftSendResponse, ApiOpError<PostSendV1CraftSendApiError>> {
self.client.post_send_v1_craft_send(self.request).await
}
}
#[doc = concat!("Additive request builder for `", "postStudioV1DbcFee", "`.")]
#[must_use]
pub struct PostStudioV1DbcFeeBuilder<'a> {
client: &'a HttpClient,
request: Option<PostStudioV1DbcFeeRequest>,
}
impl<'a> PostStudioV1DbcFeeBuilder<'a> {
#[must_use]
pub fn request(mut self, request: PostStudioV1DbcFeeRequest) -> Self {
self.request = Some(request);
self
}
pub async fn send(
self,
) -> Result<PostStudioV1DbcFeeResponse, ApiOpError<PostStudioV1DbcFeeApiError>> {
self.client.post_studio_v1_dbc_fee(self.request).await
}
}
#[doc = concat!("Additive request builder for `", "postStudioV1DbcFeeCreateTx", "`.")]
#[must_use]
pub struct PostStudioV1DbcFeeCreateTxBuilder<'a> {
client: &'a HttpClient,
request: Option<StudioCreateClaimFeeDBCTransactionRequestBody>,
}
impl<'a> PostStudioV1DbcFeeCreateTxBuilder<'a> {
#[must_use]
pub fn request(mut self, request: StudioCreateClaimFeeDBCTransactionRequestBody) -> Self {
self.request = Some(request);
self
}
pub async fn send(
self,
) -> Result<PostStudioV1DbcFeeCreateTxResponse, ApiOpError<PostStudioV1DbcFeeCreateTxApiError>>
{
self.client
.post_studio_v1_dbc_fee_create_tx(self.request)
.await
}
}
#[doc = concat!("Additive request builder for `", "postStudioV1DbcPoolCreateTx", "`.")]
#[must_use]
pub struct PostStudioV1DbcPoolCreateTxBuilder<'a> {
client: &'a HttpClient,
request: Option<StudioCreateDBCTransactionRequestBody>,
}
impl<'a> PostStudioV1DbcPoolCreateTxBuilder<'a> {
#[must_use]
pub fn request(mut self, request: StudioCreateDBCTransactionRequestBody) -> Self {
self.request = Some(request);
self
}
pub async fn send(
self,
) -> Result<StudioCreateDBCTransactionResponse, ApiOpError<PostStudioV1DbcPoolCreateTxApiError>>
{
self.client
.post_studio_v1_dbc_pool_create_tx(self.request)
.await
}
}
#[doc = concat!("Additive request builder for `", "postStudioV1DbcPoolSubmit", "`.")]
#[must_use]
pub struct PostStudioV1DbcPoolSubmitBuilder<'a> {
client: &'a HttpClient,
request: Option<StudioSubmitDBCTransactionRequestBody>,
}
impl<'a> PostStudioV1DbcPoolSubmitBuilder<'a> {
#[must_use]
pub fn request(mut self, request: StudioSubmitDBCTransactionRequestBody) -> Self {
self.request = Some(request);
self
}
pub async fn send(
self,
) -> Result<PostStudioV1DbcPoolSubmitResponse, ApiOpError<PostStudioV1DbcPoolSubmitApiError>>
{
self.client
.post_studio_v1_dbc_pool_submit(self.request)
.await
}
}
#[doc = concat!(
"Additive request builder for `", "postTokensV2VerifyExpressExecute", "`."
)]
#[must_use]
pub struct PostTokensV2VerifyExpressExecuteBuilder<'a> {
client: &'a HttpClient,
request: TokensV2VerificationExpressExecuteBody,
}
impl<'a> PostTokensV2VerifyExpressExecuteBuilder<'a> {
#[must_use]
pub fn request(mut self, request: TokensV2VerificationExpressExecuteBody) -> Self {
self.request = request;
self
}
#[doc = concat!("Set the optional request-body field `", "jupOutputAmount", "`.")]
#[must_use]
pub fn jup_output_amount(mut self, jup_output_amount: String) -> Self {
self.request.jup_output_amount = Some(jup_output_amount);
self
}
#[doc = concat!("Set the optional request-body field `", "paymentAmount", "`.")]
#[must_use]
pub fn payment_amount(mut self, payment_amount: String) -> Self {
self.request.payment_amount = Some(payment_amount);
self
}
#[doc = concat!("Set the optional request-body field `", "paymentCurrency", "`.")]
#[must_use]
pub fn payment_currency(
mut self,
payment_currency: TokensV2VerificationPaymentCurrency,
) -> Self {
self.request.payment_currency = Some(payment_currency);
self
}
#[doc = concat!(
"Set the optional request-body field `", "senderTwitterHandle", "`."
)]
#[must_use]
pub fn sender_twitter_handle(mut self, sender_twitter_handle: String) -> Self {
self.request.sender_twitter_handle = Some(sender_twitter_handle);
self
}
#[doc = concat!("Set the optional request-body field `", "tokenMetadata", "`.")]
#[must_use]
pub fn token_metadata(
mut self,
token_metadata: TokensV2VerificationTokenMetadataInput,
) -> Self {
self.request.token_metadata = Some(token_metadata);
self
}
pub async fn send(
self,
) -> Result<
TokensV2VerificationExpressExecuteResponse,
ApiOpError<PostTokensV2VerifyExpressExecuteApiError>,
> {
self.client
.post_tokens_v2_verify_express_execute(self.request)
.await
}
}
#[doc = concat!("Additive request builder for `", "postTriggerV1CancelOrder", "`.")]
#[must_use]
pub struct PostTriggerV1CancelOrderBuilder<'a> {
client: &'a HttpClient,
request: Option<PostTriggerV1CancelOrderRequest>,
}
impl<'a> PostTriggerV1CancelOrderBuilder<'a> {
#[must_use]
pub fn request(mut self, request: PostTriggerV1CancelOrderRequest) -> Self {
self.request = Some(request);
self
}
pub async fn send(
self,
) -> Result<PostTriggerV1CancelOrderResponse, ApiOpError<PostTriggerV1CancelOrderApiError>>
{
self.client.post_trigger_v1_cancel_order(self.request).await
}
}
#[doc = concat!("Additive request builder for `", "postTriggerV1CancelOrders", "`.")]
#[must_use]
pub struct PostTriggerV1CancelOrdersBuilder<'a> {
client: &'a HttpClient,
request: Option<PostTriggerV1CancelOrdersRequest>,
}
impl<'a> PostTriggerV1CancelOrdersBuilder<'a> {
#[must_use]
pub fn request(mut self, request: PostTriggerV1CancelOrdersRequest) -> Self {
self.request = Some(request);
self
}
pub async fn send(
self,
) -> Result<PostTriggerV1CancelOrdersResponse, ApiOpError<PostTriggerV1CancelOrdersApiError>>
{
self.client
.post_trigger_v1_cancel_orders(self.request)
.await
}
}
#[doc = concat!("Additive request builder for `", "postTriggerV1CreateOrder", "`.")]
#[must_use]
pub struct PostTriggerV1CreateOrderBuilder<'a> {
client: &'a HttpClient,
request: Option<PostTriggerV1CreateOrderRequest>,
}
impl<'a> PostTriggerV1CreateOrderBuilder<'a> {
#[must_use]
pub fn request(mut self, request: PostTriggerV1CreateOrderRequest) -> Self {
self.request = Some(request);
self
}
pub async fn send(
self,
) -> Result<PostTriggerV1CreateOrderResponse, ApiOpError<PostTriggerV1CreateOrderApiError>>
{
self.client.post_trigger_v1_create_order(self.request).await
}
}
#[doc = concat!("Additive request builder for `", "postTriggerV2DepositCraft", "`.")]
#[must_use]
pub struct PostTriggerV2DepositCraftBuilder<'a> {
client: &'a HttpClient,
request: PostTriggerV2DepositCraftRequest,
}
impl<'a> PostTriggerV2DepositCraftBuilder<'a> {
#[must_use]
pub fn request(mut self, request: PostTriggerV2DepositCraftRequest) -> Self {
self.request = request;
self
}
#[doc = concat!("Set the optional request-body field `", "jlMint", "`.")]
#[must_use]
pub fn jl_mint(mut self, jl_mint: String) -> Self {
self.request.jl_mint = Some(jl_mint);
self
}
#[doc = concat!("Set the optional request-body field `", "orderSubType", "`.")]
#[must_use]
pub fn order_sub_type(
mut self,
order_sub_type: PostTriggerV2DepositCraftRequestOrderSubType,
) -> Self {
self.request.order_sub_type = Some(order_sub_type);
self
}
pub async fn send(
self,
) -> Result<PostTriggerV2DepositCraftResponse, ApiOpError<PostTriggerV2DepositCraftApiError>>
{
self.client
.post_trigger_v2_deposit_craft(self.request)
.await
}
}
#[doc = concat!("Additive request builder for `", "postTriggerV2OrdersDca", "`.")]
#[must_use]
pub struct PostTriggerV2OrdersDcaBuilder<'a> {
client: &'a HttpClient,
request: PostTriggerV2OrdersDcaRequest,
}
impl<'a> PostTriggerV2OrdersDcaBuilder<'a> {
#[must_use]
pub fn request(mut self, request: PostTriggerV2OrdersDcaRequest) -> Self {
self.request = request;
self
}
#[doc = concat!("Set the optional request-body field `", "beginFillAt", "`.")]
#[must_use]
pub fn begin_fill_at(mut self, begin_fill_at: String) -> Self {
self.request.begin_fill_at = Some(begin_fill_at);
self
}
#[doc = concat!("Set the optional request-body field `", "jlEnabled", "`.")]
#[must_use]
pub fn jl_enabled(mut self, jl_enabled: bool) -> Self {
self.request.jl_enabled = Some(jl_enabled);
self
}
#[doc = concat!("Set the optional request-body field `", "jlMint", "`.")]
#[must_use]
pub fn jl_mint(mut self, jl_mint: String) -> Self {
self.request.jl_mint = Some(jl_mint);
self
}
#[doc = concat!("Set the optional request-body field `", "maxPriceUsd", "`.")]
#[must_use]
pub fn max_price_usd(mut self, max_price_usd: f64) -> Self {
self.request.max_price_usd = Some(max_price_usd);
self
}
#[doc = concat!("Set the optional request-body field `", "minPriceUsd", "`.")]
#[must_use]
pub fn min_price_usd(mut self, min_price_usd: f64) -> Self {
self.request.min_price_usd = Some(min_price_usd);
self
}
#[doc = concat!("Set the optional request-body field `", "orderType", "`.")]
#[must_use]
pub fn order_type(mut self, order_type: PostTriggerV2OrdersDcaRequestOrderType) -> Self {
self.request.order_type = Some(order_type);
self
}
#[doc = concat!("Set the optional request-body field `", "triggerMint", "`.")]
#[must_use]
pub fn trigger_mint(mut self, trigger_mint: String) -> Self {
self.request.trigger_mint = Some(trigger_mint);
self
}
pub async fn send(
self,
) -> Result<TriggerV2TxSignatureResponse, ApiOpError<PostTriggerV2OrdersDcaApiError>> {
self.client.post_trigger_v2_orders_dca(self.request).await
}
}
#[doc = concat!("Additive request builder for `", "postTriggerV2OrdersPrice", "`.")]
#[must_use]
pub struct PostTriggerV2OrdersPriceBuilder<'a> {
client: &'a HttpClient,
request: PostTriggerV2OrdersPriceRequest,
}
impl<'a> PostTriggerV2OrdersPriceBuilder<'a> {
#[must_use]
pub fn request(mut self, request: PostTriggerV2OrdersPriceRequest) -> Self {
self.request = request;
self
}
#[doc = concat!("Set the optional request-body field `", "slPriceUsd", "`.")]
#[must_use]
pub fn sl_price_usd(mut self, sl_price_usd: f64) -> Self {
self.request.sl_price_usd = Some(sl_price_usd);
self
}
#[doc = concat!("Set the optional request-body field `", "slSlippageBps", "`.")]
#[must_use]
pub fn sl_slippage_bps(mut self, sl_slippage_bps: f64) -> Self {
self.request.sl_slippage_bps = Some(sl_slippage_bps);
self
}
#[doc = concat!("Set the optional request-body field `", "slippageBps", "`.")]
#[must_use]
pub fn slippage_bps(mut self, slippage_bps: f64) -> Self {
self.request.slippage_bps = Some(slippage_bps);
self
}
#[doc = concat!("Set the optional request-body field `", "tpPriceUsd", "`.")]
#[must_use]
pub fn tp_price_usd(mut self, tp_price_usd: f64) -> Self {
self.request.tp_price_usd = Some(tp_price_usd);
self
}
#[doc = concat!("Set the optional request-body field `", "tpSlippageBps", "`.")]
#[must_use]
pub fn tp_slippage_bps(mut self, tp_slippage_bps: f64) -> Self {
self.request.tp_slippage_bps = Some(tp_slippage_bps);
self
}
#[doc = concat!("Set the optional request-body field `", "trailingBps", "`.")]
#[must_use]
pub fn trailing_bps(mut self, trailing_bps: f64) -> Self {
self.request.trailing_bps = Some(trailing_bps);
self
}
#[doc = concat!("Set the optional request-body field `", "triggerCondition", "`.")]
#[must_use]
pub fn trigger_condition(
mut self,
trigger_condition: PostTriggerV2OrdersPriceRequestTriggerCondition,
) -> Self {
self.request.trigger_condition = Some(trigger_condition);
self
}
#[doc = concat!("Set the optional request-body field `", "triggerPriceUsd", "`.")]
#[must_use]
pub fn trigger_price_usd(mut self, trigger_price_usd: f64) -> Self {
self.request.trigger_price_usd = Some(trigger_price_usd);
self
}
pub async fn send(
self,
) -> Result<TriggerV2OrderResponse, ApiOpError<PostTriggerV2OrdersPriceApiError>> {
self.client.post_trigger_v2_orders_price(self.request).await
}
}
#[doc = concat!("Additive request builder for `", "postUltraV1Execute", "`.")]
#[must_use]
pub struct PostUltraV1ExecuteBuilder<'a> {
client: &'a HttpClient,
request: Option<PostUltraV1ExecuteRequest>,
}
impl<'a> PostUltraV1ExecuteBuilder<'a> {
#[must_use]
pub fn request(mut self, request: PostUltraV1ExecuteRequest) -> Self {
self.request = Some(request);
self
}
pub async fn send(
self,
) -> Result<PostUltraV1ExecuteResponse, ApiOpError<PostUltraV1ExecuteApiError>> {
self.client.post_ultra_v1_execute(self.request).await
}
}
#[doc = concat!("Additive request builder for `", "price-withdraw", "`.")]
#[must_use]
pub struct PriceWithdrawBuilder<'a> {
client: &'a HttpClient,
request: RecurringWithdrawPriceRecurring,
}
impl<'a> PriceWithdrawBuilder<'a> {
#[must_use]
pub fn request(mut self, request: RecurringWithdrawPriceRecurring) -> Self {
self.request = request;
self
}
#[doc = concat!("Set the optional request-body field `", "amount", "`.")]
#[must_use]
pub fn amount(mut self, amount: String) -> Self {
self.request.amount = Some(amount);
self
}
pub async fn send(self) -> Result<RecurringRecurringResponse, ApiOpError<serde_json::Value>> {
self.client.price_withdraw(self.request).await
}
}
impl HttpClient {
pub async fn get_build(
&self,
input_mint: impl AsRef<str>,
output_mint: impl AsRef<str>,
amount: impl AsRef<str>,
taker: impl AsRef<str>,
slippage_bps: Option<impl AsRef<str>>,
mode: Option<GetBuildMode>,
dexes: Option<impl AsRef<str>>,
exclude_dexes: Option<impl AsRef<str>>,
platform_fee_bps: Option<i64>,
fee_account: Option<impl AsRef<str>>,
max_accounts: Option<i64>,
payer: Option<impl AsRef<str>>,
wrap_and_unwrap_sol: Option<bool>,
destination_token_account: Option<impl AsRef<str>>,
native_destination_account: Option<impl AsRef<str>>,
blockhash_slots_to_expiry: Option<i64>,
tip_amount: Option<impl AsRef<str>>,
compute_unit_price_percentile: Option<impl AsRef<str>>,
for_jito_bundle: Option<bool>,
) -> Result<GetBuildResponse, ApiOpError<GetBuildApiError>> {
let request_url = format!("{}{}", self.base_url, "/swap/v2/build");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("inputMint".to_string(), input_mint.as_ref().to_string()));
query_params.push(("outputMint".to_string(), output_mint.as_ref().to_string()));
query_params.push(("amount".to_string(), amount.as_ref().to_string()));
query_params.push(("taker".to_string(), taker.as_ref().to_string()));
if let Some(v) = slippage_bps {
query_params.push(("slippageBps".to_string(), v.as_ref().to_string()));
}
if let Some(v) = mode {
query_params.push(("mode".to_string(), v.to_string()));
}
if let Some(v) = dexes {
query_params.push(("dexes".to_string(), v.as_ref().to_string()));
}
if let Some(v) = exclude_dexes {
query_params.push(("excludeDexes".to_string(), v.as_ref().to_string()));
}
if let Some(v) = platform_fee_bps {
query_params.push(("platformFeeBps".to_string(), v.to_string()));
}
if let Some(v) = fee_account {
query_params.push(("feeAccount".to_string(), v.as_ref().to_string()));
}
if let Some(v) = max_accounts {
query_params.push(("maxAccounts".to_string(), v.to_string()));
}
if let Some(v) = payer {
query_params.push(("payer".to_string(), v.as_ref().to_string()));
}
if let Some(v) = wrap_and_unwrap_sol {
query_params.push(("wrapAndUnwrapSol".to_string(), v.to_string()));
}
if let Some(v) = destination_token_account {
query_params.push((
"destinationTokenAccount".to_string(),
v.as_ref().to_string(),
));
}
if let Some(v) = native_destination_account {
query_params.push((
"nativeDestinationAccount".to_string(),
v.as_ref().to_string(),
));
}
if let Some(v) = blockhash_slots_to_expiry {
query_params.push(("blockhashSlotsToExpiry".to_string(), v.to_string()));
}
if let Some(v) = tip_amount {
query_params.push(("tipAmount".to_string(), v.as_ref().to_string()));
}
if let Some(v) = compute_unit_price_percentile {
query_params.push((
"computeUnitPricePercentile".to_string(),
v.as_ref().to_string(),
));
}
if let Some(v) = for_jito_bundle {
query_params.push(("forJitoBundle".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetBuildApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<GetBuildResponse400>(&body_text) {
Ok(v) => {
typed = Some(GetBuildApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_order(
&self,
input_mint: impl AsRef<str>,
output_mint: impl AsRef<str>,
amount: impl AsRef<str>,
taker: Option<impl AsRef<str>>,
receiver: Option<impl AsRef<str>>,
swap_mode: Option<GetOrderSwapMode>,
slippage_bps: Option<i64>,
referral_account: Option<impl AsRef<str>>,
referral_fee: Option<f64>,
payer: Option<impl AsRef<str>>,
priority_fee_lamports: Option<f64>,
jito_tip_lamports: Option<f64>,
broadcast_fee_type: Option<GetOrderBroadcastFeeType>,
exclude_routers: Option<impl AsRef<str>>,
exclude_dexes: Option<impl AsRef<str>>,
) -> Result<GetOrderResponse, ApiOpError<GetOrderApiError>> {
let request_url = format!("{}{}", self.base_url, "/swap/v2/order");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("inputMint".to_string(), input_mint.as_ref().to_string()));
query_params.push(("outputMint".to_string(), output_mint.as_ref().to_string()));
query_params.push(("amount".to_string(), amount.as_ref().to_string()));
if let Some(v) = taker {
query_params.push(("taker".to_string(), v.as_ref().to_string()));
}
if let Some(v) = receiver {
query_params.push(("receiver".to_string(), v.as_ref().to_string()));
}
if let Some(v) = swap_mode {
query_params.push(("swapMode".to_string(), v.to_string()));
}
if let Some(v) = slippage_bps {
query_params.push(("slippageBps".to_string(), v.to_string()));
}
if let Some(v) = referral_account {
query_params.push(("referralAccount".to_string(), v.as_ref().to_string()));
}
if let Some(v) = referral_fee {
query_params.push(("referralFee".to_string(), v.to_string()));
}
if let Some(v) = payer {
query_params.push(("payer".to_string(), v.as_ref().to_string()));
}
if let Some(v) = priority_fee_lamports {
query_params.push(("priorityFeeLamports".to_string(), v.to_string()));
}
if let Some(v) = jito_tip_lamports {
query_params.push(("jitoTipLamports".to_string(), v.to_string()));
}
if let Some(v) = broadcast_fee_type {
query_params.push(("broadcastFeeType".to_string(), v.to_string()));
}
if let Some(v) = exclude_routers {
query_params.push(("excludeRouters".to_string(), v.as_ref().to_string()));
}
if let Some(v) = exclude_dexes {
query_params.push(("excludeDexes".to_string(), v.as_ref().to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetOrderApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<GetOrderResponse400>(&body_text) {
Ok(v) => {
typed = Some(GetOrderApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_execute(
&self,
request: PostExecuteRequest,
) -> Result<PostExecuteResponse, ApiOpError<PostExecuteApiError>> {
let request_url = format!("{}{}", self.base_url, "/swap/v2/execute");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostExecuteApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<PostExecuteResponse400>(&body_text) {
Ok(v) => {
typed = Some(PostExecuteApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
500u16 => match serde_json::from_str::<PostExecuteResponse500>(&body_text) {
Ok(v) => {
typed = Some(PostExecuteApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn program_id_to_label_get(
&self,
) -> Result<ProgramIdToLabelGetResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/swap/v1/program-id-to-label");
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn quote_get(
&self,
input_mint: impl AsRef<str>,
output_mint: impl AsRef<str>,
amount: u64,
slippage_bps: Option<i64>,
swap_mode: Option<QuoteGetSwapMode>,
dexes: Option<Vec<String>>,
exclude_dexes: Option<Vec<String>>,
restrict_intermediate_tokens: Option<bool>,
only_direct_routes: Option<bool>,
as_legacy_transaction: Option<bool>,
platform_fee_bps: Option<i64>,
max_accounts: Option<u64>,
instruction_version: Option<QuoteGetInstructionVersion>,
dynamic_slippage: Option<bool>,
for_jito_bundle: Option<bool>,
) -> Result<SwapV1QuoteResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/swap/v1/quote");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("inputMint".to_string(), input_mint.as_ref().to_string()));
query_params.push(("outputMint".to_string(), output_mint.as_ref().to_string()));
query_params.push(("amount".to_string(), amount.to_string()));
if let Some(v) = slippage_bps {
query_params.push(("slippageBps".to_string(), v.to_string()));
}
if let Some(v) = swap_mode {
query_params.push(("swapMode".to_string(), v.to_string()));
}
if let Some(v) = dexes {
if v.is_empty() {
query_params.push((format!("{}[]", "dexes"), String::new()));
} else {
for item in v {
query_params.push(("dexes".to_string(), item.to_string()));
}
}
}
if let Some(v) = exclude_dexes {
if v.is_empty() {
query_params.push((format!("{}[]", "excludeDexes"), String::new()));
} else {
for item in v {
query_params.push(("excludeDexes".to_string(), item.to_string()));
}
}
}
if let Some(v) = restrict_intermediate_tokens {
query_params.push(("restrictIntermediateTokens".to_string(), v.to_string()));
}
if let Some(v) = only_direct_routes {
query_params.push(("onlyDirectRoutes".to_string(), v.to_string()));
}
if let Some(v) = as_legacy_transaction {
query_params.push(("asLegacyTransaction".to_string(), v.to_string()));
}
if let Some(v) = platform_fee_bps {
query_params.push(("platformFeeBps".to_string(), v.to_string()));
}
if let Some(v) = max_accounts {
query_params.push(("maxAccounts".to_string(), v.to_string()));
}
if let Some(v) = instruction_version {
query_params.push(("instructionVersion".to_string(), v.to_string()));
}
if let Some(v) = dynamic_slippage {
query_params.push(("dynamicSlippage".to_string(), v.to_string()));
}
if let Some(v) = for_jito_bundle {
query_params.push(("forJitoBundle".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn swap_instructions_post(
&self,
request: SwapV1SwapRequest,
) -> Result<SwapV1SwapInstructionsResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/swap/v1/swap-instructions");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn swap_post(
&self,
request: SwapV1SwapRequest,
) -> Result<SwapV1SwapResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/swap/v1/swap");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn build_borrow_operate_instructions(
&self,
market: Option<LendBorrowMarket>,
request: LendBorrowOperatePayload,
) -> Result<LendBorrowOperateInstructionsResponse, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url, "/lend/v1/borrow/operate-instructions"
);
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = market {
query_params.push(("market".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn build_borrow_operate_transaction(
&self,
market: Option<LendBorrowMarket>,
request: LendBorrowOperatePayload,
) -> Result<LendBorrowOperateTransactionResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/lend/v1/borrow/operate");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = market {
query_params.push(("market".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn cancel_order(
&self,
request: RecurringCloseRecurring,
) -> Result<RecurringRecurringResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/recurring/v1/cancelOrder");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn create_order(
&self,
request: RecurringCreateRecurring,
) -> Result<RecurringRecurringResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/recurring/v1/createOrder");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn delete_prediction_v1_positions(
&self,
request: PredictionCloseAllPositionsRequest,
) -> Result<DeletePredictionV1PositionsResponse, ApiOpError<DeletePredictionV1PositionsApiError>>
{
let request_url = format!("{}{}", self.base_url, "/prediction/v1/positions");
let mut req = self.http_client.delete(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<DeletePredictionV1PositionsApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(DeletePredictionV1PositionsApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn delete_prediction_v1_positions_position_pubkey(
&self,
position_pubkey: impl AsRef<str>,
request: PredictionClosePositionRequest,
) -> Result<
PredictionCreateOrderResponse,
ApiOpError<DeletePredictionV1PositionsPositionPubkeyApiError>,
> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/prediction/v1/positions/{}",
__pct_encode_path_segment(position_pubkey.as_ref())
)
);
let mut req = self.http_client.delete(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<DeletePredictionV1PositionsPositionPubkeyApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed =
Some(DeletePredictionV1PositionsPositionPubkeyApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
404u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed =
Some(DeletePredictionV1PositionsPositionPubkeyApiError::Status404(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn execute(
&self,
request: RecurringExecuteRecurring,
) -> Result<RecurringExecuteRecurringResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/recurring/v1/execute");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_lend_v1_earn_earnings(
&self,
user: impl AsRef<str>,
positions: impl AsRef<str>,
) -> Result<LendUserEarningsResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/earnings");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("user".to_string(), user.as_ref().to_string()));
query_params.push(("positions".to_string(), positions.as_ref().to_string()));
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_lend_v1_earn_positions(
&self,
users: impl AsRef<str>,
) -> Result<LendUserPositionsResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/positions");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("users".to_string(), users.as_ref().to_string()));
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_lend_v1_earn_tokens(
&self,
) -> Result<LendTokensResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/tokens");
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_portfolio_v1_platforms(
&self,
) -> Result<GetPortfolioV1PlatformsResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/portfolio/v1/platforms");
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_portfolio_v1_positions_address(
&self,
address: impl AsRef<str>,
platforms: Option<impl AsRef<str>>,
) -> Result<GetPortfolioV1PositionsAddressResponse, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/portfolio/v1/positions/{}",
__pct_encode_path_segment(address.as_ref())
)
);
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = platforms {
query_params.push(("platforms".to_string(), v.as_ref().to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_portfolio_v1_staked_jup_address(
&self,
address: impl AsRef<str>,
) -> Result<GetPortfolioV1StakedJupAddressResponse, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/portfolio/v1/staked-jup/{}",
__pct_encode_path_segment(address.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_events(
&self,
provider: Option<GetPredictionV1EventsProvider>,
include_markets: Option<bool>,
include_all_markets: Option<bool>,
start: Option<i64>,
end: Option<i64>,
category: Option<GetPredictionV1EventsCategory>,
subcategory: Option<impl AsRef<str>>,
sort_by: Option<GetPredictionV1EventsSortBy>,
sort_direction: Option<GetPredictionV1EventsSortDirection>,
filter: Option<GetPredictionV1EventsFilter>,
tags: Option<impl AsRef<str>>,
) -> Result<GetPredictionV1EventsResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/prediction/v1/events");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = provider {
query_params.push(("provider".to_string(), v.to_string()));
}
if let Some(v) = include_markets {
query_params.push(("includeMarkets".to_string(), v.to_string()));
}
if let Some(v) = include_all_markets {
query_params.push(("includeAllMarkets".to_string(), v.to_string()));
}
if let Some(v) = start {
query_params.push(("start".to_string(), v.to_string()));
}
if let Some(v) = end {
query_params.push(("end".to_string(), v.to_string()));
}
if let Some(v) = category {
query_params.push(("category".to_string(), v.to_string()));
}
if let Some(v) = subcategory {
query_params.push(("subcategory".to_string(), v.as_ref().to_string()));
}
if let Some(v) = sort_by {
query_params.push(("sortBy".to_string(), v.to_string()));
}
if let Some(v) = sort_direction {
query_params.push(("sortDirection".to_string(), v.to_string()));
}
if let Some(v) = filter {
query_params.push(("filter".to_string(), v.to_string()));
}
if let Some(v) = tags {
query_params.push(("tags".to_string(), v.as_ref().to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_events_event_id(
&self,
event_id: impl AsRef<str>,
include_markets: Option<bool>,
include_all_markets: Option<bool>,
) -> Result<PredictionEvent, ApiOpError<GetPredictionV1EventsEventIdApiError>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/prediction/v1/events/{}",
__pct_encode_path_segment(event_id.as_ref())
)
);
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = include_markets {
query_params.push(("includeMarkets".to_string(), v.to_string()));
}
if let Some(v) = include_all_markets {
query_params.push(("includeAllMarkets".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetPredictionV1EventsEventIdApiError>;
let parse_error: Option<String>;
match status_code {
404u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(GetPredictionV1EventsEventIdApiError::Status404(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_events_event_id_markets(
&self,
event_id: impl AsRef<str>,
start: Option<i64>,
end: Option<i64>,
) -> Result<GetPredictionV1EventsEventIdMarketsResponse, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/prediction/v1/events/{}/markets",
__pct_encode_path_segment(event_id.as_ref())
)
);
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = start {
query_params.push(("start".to_string(), v.to_string()));
}
if let Some(v) = end {
query_params.push(("end".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_events_event_id_markets_market_id(
&self,
event_id: impl AsRef<str>,
market_id: impl AsRef<str>,
) -> Result<PredictionMarket, ApiOpError<GetPredictionV1EventsEventIdMarketsMarketIdApiError>>
{
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/prediction/v1/events/{}/markets/{}",
__pct_encode_path_segment(event_id.as_ref()),
__pct_encode_path_segment(market_id.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetPredictionV1EventsEventIdMarketsMarketIdApiError>;
let parse_error: Option<String>;
match status_code {
404u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed =
Some(GetPredictionV1EventsEventIdMarketsMarketIdApiError::Status404(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_events_event_id_score(
&self,
event_id: impl AsRef<str>,
) -> Result<PredictionGameScore, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/prediction/v1/events/{}/score",
__pct_encode_path_segment(event_id.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_events_scores(
&self,
event_ids: impl AsRef<str>,
) -> Result<GetPredictionV1EventsScoresResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/prediction/v1/events/scores");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("eventIds".to_string(), event_ids.as_ref().to_string()));
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_events_search(
&self,
provider: Option<GetPredictionV1EventsSearchProvider>,
query: impl AsRef<str>,
limit: Option<i64>,
) -> Result<GetPredictionV1EventsSearchResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/prediction/v1/events/search");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = provider {
query_params.push(("provider".to_string(), v.to_string()));
}
query_params.push(("query".to_string(), query.as_ref().to_string()));
if let Some(v) = limit {
query_params.push(("limit".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_events_suggested_pubkey(
&self,
pubkey: impl AsRef<str>,
provider: Option<GetPredictionV1EventsSuggestedPubkeyProvider>,
) -> Result<GetPredictionV1EventsSuggestedPubkeyResponse, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/prediction/v1/events/suggested/{}",
__pct_encode_path_segment(pubkey.as_ref())
)
);
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = provider {
query_params.push(("provider".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_forecast(
&self,
market_id: impl AsRef<str>,
) -> Result<GetPredictionV1ForecastResponse, ApiOpError<GetPredictionV1ForecastApiError>> {
let request_url = format!("{}{}", self.base_url, "/prediction/v1/forecast");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("marketId".to_string(), market_id.as_ref().to_string()));
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetPredictionV1ForecastApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(GetPredictionV1ForecastApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
502u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(GetPredictionV1ForecastApiError::Status502(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_history(
&self,
start: Option<i64>,
end: Option<i64>,
owner_pubkey: Option<impl AsRef<str>>,
id: Option<i64>,
position_pubkey: Option<impl AsRef<str>>,
) -> Result<GetPredictionV1HistoryResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/prediction/v1/history");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = start {
query_params.push(("start".to_string(), v.to_string()));
}
if let Some(v) = end {
query_params.push(("end".to_string(), v.to_string()));
}
if let Some(v) = owner_pubkey {
query_params.push(("ownerPubkey".to_string(), v.as_ref().to_string()));
}
if let Some(v) = id {
query_params.push(("id".to_string(), v.to_string()));
}
if let Some(v) = position_pubkey {
query_params.push(("positionPubkey".to_string(), v.as_ref().to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_leaderboards(
&self,
period: Option<GetPredictionV1LeaderboardsPeriod>,
limit: Option<i64>,
metric: Option<GetPredictionV1LeaderboardsMetric>,
) -> Result<GetPredictionV1LeaderboardsResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/prediction/v1/leaderboards");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = period {
query_params.push(("period".to_string(), v.to_string()));
}
if let Some(v) = limit {
query_params.push(("limit".to_string(), v.to_string()));
}
if let Some(v) = metric {
query_params.push(("metric".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_markets_market_id(
&self,
market_id: impl AsRef<str>,
) -> Result<PredictionMarket, ApiOpError<GetPredictionV1MarketsMarketIdApiError>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/prediction/v1/markets/{}",
__pct_encode_path_segment(market_id.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetPredictionV1MarketsMarketIdApiError>;
let parse_error: Option<String>;
match status_code {
404u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(GetPredictionV1MarketsMarketIdApiError::Status404(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_orderbook_market_id(
&self,
market_id: impl AsRef<str>,
) -> Result<
GetPredictionV1OrderbookMarketIdResponse,
ApiOpError<GetPredictionV1OrderbookMarketIdApiError>,
> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/prediction/v1/orderbook/{}",
__pct_encode_path_segment(market_id.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetPredictionV1OrderbookMarketIdApiError>;
let parse_error: Option<String>;
match status_code {
502u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(GetPredictionV1OrderbookMarketIdApiError::Status502(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_orders(
&self,
start: Option<i64>,
end: Option<i64>,
owner_pubkey: Option<impl AsRef<str>>,
) -> Result<GetPredictionV1OrdersResponse, ApiOpError<GetPredictionV1OrdersApiError>> {
let request_url = format!("{}{}", self.base_url, "/prediction/v1/orders");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = start {
query_params.push(("start".to_string(), v.to_string()));
}
if let Some(v) = end {
query_params.push(("end".to_string(), v.to_string()));
}
if let Some(v) = owner_pubkey {
query_params.push(("ownerPubkey".to_string(), v.as_ref().to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetPredictionV1OrdersApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(GetPredictionV1OrdersApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_orders_order_pubkey(
&self,
order_pubkey: impl AsRef<str>,
) -> Result<PredictionOrder, ApiOpError<GetPredictionV1OrdersOrderPubkeyApiError>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/prediction/v1/orders/{}",
__pct_encode_path_segment(order_pubkey.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetPredictionV1OrdersOrderPubkeyApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(GetPredictionV1OrdersOrderPubkeyApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
404u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(GetPredictionV1OrdersOrderPubkeyApiError::Status404(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_orders_status_order_pubkey(
&self,
order_pubkey: impl AsRef<str>,
) -> Result<
GetPredictionV1OrdersStatusOrderPubkeyResponse,
ApiOpError<GetPredictionV1OrdersStatusOrderPubkeyApiError>,
> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/prediction/v1/orders/status/{}",
__pct_encode_path_segment(order_pubkey.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetPredictionV1OrdersStatusOrderPubkeyApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(GetPredictionV1OrdersStatusOrderPubkeyApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
404u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(GetPredictionV1OrdersStatusOrderPubkeyApiError::Status404(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_positions(
&self,
start: Option<i64>,
end: Option<i64>,
owner_pubkey: Option<impl AsRef<str>>,
market_pubkey: Option<impl AsRef<str>>,
market_id: Option<impl AsRef<str>>,
is_yes: Option<GetPredictionV1PositionsIsYes>,
) -> Result<GetPredictionV1PositionsResponse, ApiOpError<GetPredictionV1PositionsApiError>>
{
let request_url = format!("{}{}", self.base_url, "/prediction/v1/positions");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = start {
query_params.push(("start".to_string(), v.to_string()));
}
if let Some(v) = end {
query_params.push(("end".to_string(), v.to_string()));
}
if let Some(v) = owner_pubkey {
query_params.push(("ownerPubkey".to_string(), v.as_ref().to_string()));
}
if let Some(v) = market_pubkey {
query_params.push(("marketPubkey".to_string(), v.as_ref().to_string()));
}
if let Some(v) = market_id {
query_params.push(("marketId".to_string(), v.as_ref().to_string()));
}
if let Some(v) = is_yes {
query_params.push(("isYes".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetPredictionV1PositionsApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(GetPredictionV1PositionsApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_positions_position_pubkey(
&self,
position_pubkey: impl AsRef<str>,
) -> Result<PredictionPosition, ApiOpError<GetPredictionV1PositionsPositionPubkeyApiError>>
{
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/prediction/v1/positions/{}",
__pct_encode_path_segment(position_pubkey.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetPredictionV1PositionsPositionPubkeyApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(GetPredictionV1PositionsPositionPubkeyApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
404u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(GetPredictionV1PositionsPositionPubkeyApiError::Status404(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_profiles_owner_pubkey(
&self,
owner_pubkey: impl AsRef<str>,
) -> Result<
GetPredictionV1ProfilesOwnerPubkeyResponse,
ApiOpError<GetPredictionV1ProfilesOwnerPubkeyApiError>,
> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/prediction/v1/profiles/{}",
__pct_encode_path_segment(owner_pubkey.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetPredictionV1ProfilesOwnerPubkeyApiError>;
let parse_error: Option<String>;
match status_code {
404u16 => {
match serde_json::from_str::<GetPredictionV1ProfilesOwnerPubkeyResponse404>(
&body_text,
) {
Ok(v) => {
typed = Some(GetPredictionV1ProfilesOwnerPubkeyApiError::Status404(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_profiles_owner_pubkey_pnl_history(
&self,
owner_pubkey: impl AsRef<str>,
interval: Option<GetPredictionV1ProfilesOwnerPubkeyPnlHistoryInterval>,
count: Option<i64>,
) -> Result<GetPredictionV1ProfilesOwnerPubkeyPnlHistoryResponse, ApiOpError<serde_json::Value>>
{
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/prediction/v1/profiles/{}/pnl-history",
__pct_encode_path_segment(owner_pubkey.as_ref())
)
);
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = interval {
query_params.push(("interval".to_string(), v.to_string()));
}
if let Some(v) = count {
query_params.push(("count".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_trades(
&self,
) -> Result<GetPredictionV1TradesResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/prediction/v1/trades");
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_trading_status(
&self,
) -> Result<PredictionTradingStatusResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/prediction/v1/trading-status");
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_prediction_v1_vault_info(
&self,
) -> Result<GetPredictionV1VaultInfoResponse, ApiOpError<GetPredictionV1VaultInfoApiError>>
{
let request_url = format!("{}{}", self.base_url, "/prediction/v1/vault-info");
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetPredictionV1VaultInfoApiError>;
let parse_error: Option<String>;
match status_code {
404u16 => {
match serde_json::from_str::<GetPredictionV1VaultInfoResponse404>(&body_text) {
Ok(v) => {
typed = Some(GetPredictionV1VaultInfoApiError::Status404(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_price_v2(
&self,
ids: impl AsRef<str>,
vs_token: Option<impl AsRef<str>>,
show_extra_info: Option<impl AsRef<str>>,
) -> Result<PriceV2PriceResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/price/v2/");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("ids".to_string(), ids.as_ref().to_string()));
if let Some(v) = vs_token {
query_params.push(("vsToken".to_string(), v.as_ref().to_string()));
}
if let Some(v) = show_extra_info {
query_params.push(("showExtraInfo".to_string(), v.as_ref().to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_price_v3(
&self,
ids: impl AsRef<str>,
) -> Result<GetPriceV3Response, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/price/v3");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("ids".to_string(), ids.as_ref().to_string()));
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_recurring_v1_get_recurring_orders(
&self,
recurring_type: RecurringRecurringOrderType,
order_status: RecurringOrderState,
user: impl AsRef<str>,
page: i64,
mint: impl AsRef<str>,
include_failed_tx: bool,
) -> Result<RecurringGetRecurringOrderResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/recurring/v1/getRecurringOrders");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("recurringType".to_string(), recurring_type.to_string()));
query_params.push(("orderStatus".to_string(), order_status.to_string()));
query_params.push(("user".to_string(), user.as_ref().to_string()));
query_params.push(("page".to_string(), page.to_string()));
query_params.push(("mint".to_string(), mint.as_ref().to_string()));
query_params.push(("includeFailedTx".to_string(), include_failed_tx.to_string()));
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_send_v1_invite_history(
&self,
address: impl AsRef<str>,
page: Option<i64>,
) -> Result<SendInviteDataResponse, ApiOpError<GetSendV1InviteHistoryApiError>> {
let request_url = format!("{}{}", self.base_url, "/send/v1/invite-history");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("address".to_string(), address.as_ref().to_string()));
if let Some(v) = page {
query_params.push(("page".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetSendV1InviteHistoryApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<GetSendV1InviteHistoryResponse400>(&body_text) {
Ok(v) => {
typed = Some(GetSendV1InviteHistoryApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
500u16 => {
match serde_json::from_str::<GetSendV1InviteHistoryResponse500>(&body_text) {
Ok(v) => {
typed = Some(GetSendV1InviteHistoryApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_send_v1_pending_invites(
&self,
address: impl AsRef<str>,
page: Option<i64>,
) -> Result<SendInviteDataResponse, ApiOpError<GetSendV1PendingInvitesApiError>> {
let request_url = format!("{}{}", self.base_url, "/send/v1/pending-invites");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("address".to_string(), address.as_ref().to_string()));
if let Some(v) = page {
query_params.push(("page".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetSendV1PendingInvitesApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<GetSendV1PendingInvitesResponse400>(&body_text) {
Ok(v) => {
typed = Some(GetSendV1PendingInvitesApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
500u16 => {
match serde_json::from_str::<GetSendV1PendingInvitesResponse500>(&body_text) {
Ok(v) => {
typed = Some(GetSendV1PendingInvitesApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_studio_v1_dbc_pool_addresses_mint(
&self,
mint: impl AsRef<str>,
) -> Result<
GetStudioV1DbcPoolAddressesMintResponse,
ApiOpError<GetStudioV1DbcPoolAddressesMintApiError>,
> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/studio/v1/dbc-pool/addresses/{}",
__pct_encode_path_segment(mint.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetStudioV1DbcPoolAddressesMintApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<GetStudioV1DbcPoolAddressesMintResponse400>(
&body_text,
) {
Ok(v) => {
typed = Some(GetStudioV1DbcPoolAddressesMintApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
404u16 => {
match serde_json::from_str::<GetStudioV1DbcPoolAddressesMintResponse404>(
&body_text,
) {
Ok(v) => {
typed = Some(GetStudioV1DbcPoolAddressesMintApiError::Status404(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
500u16 => {
match serde_json::from_str::<GetStudioV1DbcPoolAddressesMintResponse500>(
&body_text,
) {
Ok(v) => {
typed = Some(GetStudioV1DbcPoolAddressesMintApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_tokens_v1_all(
&self,
) -> Result<GetTokensV1AllResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/tokens/v1/all");
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_tokens_v1_market_market_address_mints(
&self,
market_address: impl AsRef<str>,
) -> Result<GetTokensV1MarketMarketAddressMintsResponse, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/tokens/v1/market/{}/mints",
__pct_encode_path_segment(market_address.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_tokens_v1_mints_tradable(
&self,
) -> Result<GetTokensV1MintsTradableResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/tokens/v1/mints/tradable");
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_tokens_v1_new(
&self,
limit: Option<i64>,
offset: Option<i64>,
) -> Result<GetTokensV1NewResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/tokens/v1/new");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = limit {
query_params.push(("limit".to_string(), v.to_string()));
}
if let Some(v) = offset {
query_params.push(("offset".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_tokens_v1_tagged_tag(
&self,
tag: impl AsRef<str>,
) -> Result<TokensV1MintIncludingDuplicates, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/tokens/v1/tagged/{}",
__pct_encode_path_segment(tag.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_tokens_v1_token_mint_address(
&self,
mint_address: impl AsRef<str>,
) -> Result<TokensV1MintIncludingDuplicates, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/tokens/v1/token/{}",
__pct_encode_path_segment(mint_address.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_tokens_v2_category_interval(
&self,
category: GetTokensV2CategoryIntervalCategory,
interval: GetTokensV2CategoryIntervalInterval,
limit: Option<i64>,
) -> Result<GetTokensV2CategoryIntervalResponse, ApiOpError<GetTokensV2CategoryIntervalApiError>>
{
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/tokens/v2/{}/{}",
__pct_encode_path_segment(&category.to_string()),
__pct_encode_path_segment(&interval.to_string())
)
);
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = limit {
query_params.push(("limit".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetTokensV2CategoryIntervalApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<GetTokensV2CategoryIntervalResponse400>(&body_text)
{
Ok(v) => {
typed = Some(GetTokensV2CategoryIntervalApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
500u16 => {
match serde_json::from_str::<GetTokensV2CategoryIntervalResponse500>(&body_text)
{
Ok(v) => {
typed = Some(GetTokensV2CategoryIntervalApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_tokens_v2_recent(
&self,
) -> Result<GetTokensV2RecentResponse, ApiOpError<GetTokensV2RecentApiError>> {
let request_url = format!("{}{}", self.base_url, "/tokens/v2/recent");
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetTokensV2RecentApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<GetTokensV2RecentResponse400>(&body_text) {
Ok(v) => {
typed = Some(GetTokensV2RecentApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
500u16 => match serde_json::from_str::<GetTokensV2RecentResponse500>(&body_text) {
Ok(v) => {
typed = Some(GetTokensV2RecentApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_tokens_v2_search(
&self,
query: impl AsRef<str>,
) -> Result<GetTokensV2SearchResponse, ApiOpError<GetTokensV2SearchApiError>> {
let request_url = format!("{}{}", self.base_url, "/tokens/v2/search");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("query".to_string(), query.as_ref().to_string()));
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetTokensV2SearchApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<GetTokensV2SearchResponse400>(&body_text) {
Ok(v) => {
typed = Some(GetTokensV2SearchApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
500u16 => match serde_json::from_str::<GetTokensV2SearchResponse500>(&body_text) {
Ok(v) => {
typed = Some(GetTokensV2SearchApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_tokens_v2_tag(
&self,
query: GetTokensV2TagQuery,
) -> Result<GetTokensV2TagResponse, ApiOpError<GetTokensV2TagApiError>> {
let request_url = format!("{}{}", self.base_url, "/tokens/v2/tag");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("query".to_string(), query.to_string()));
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetTokensV2TagApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<GetTokensV2TagResponse400>(&body_text) {
Ok(v) => {
typed = Some(GetTokensV2TagApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
500u16 => match serde_json::from_str::<GetTokensV2TagResponse500>(&body_text) {
Ok(v) => {
typed = Some(GetTokensV2TagApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_tokens_v2_verify_express_check_eligibility(
&self,
token_id: impl AsRef<str>,
) -> Result<
TokensV2VerificationCheckEligibilityResponse,
ApiOpError<GetTokensV2VerifyExpressCheckEligibilityApiError>,
> {
let request_url = format!(
"{}{}",
self.base_url, "/tokens/v2/verify/express/check-eligibility"
);
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("tokenId".to_string(), token_id.as_ref().to_string()));
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetTokensV2VerifyExpressCheckEligibilityApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<TokensV2VerificationErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(
GetTokensV2VerifyExpressCheckEligibilityApiError::Status400(v),
);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
500u16 => {
match serde_json::from_str::<TokensV2VerificationErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(
GetTokensV2VerifyExpressCheckEligibilityApiError::Status500(v),
);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_tokens_v2_verify_express_craft_txn(
&self,
sender_address: impl AsRef<str>,
payment_currency: Option<TokensV2VerificationPaymentCurrency>,
) -> Result<
TokensV2VerificationCraftTxnResponse,
ApiOpError<GetTokensV2VerifyExpressCraftTxnApiError>,
> {
let request_url = format!("{}{}", self.base_url, "/tokens/v2/verify/express/craft-txn");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push((
"senderAddress".to_string(),
sender_address.as_ref().to_string(),
));
if let Some(v) = payment_currency {
query_params.push(("paymentCurrency".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetTokensV2VerifyExpressCraftTxnApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<TokensV2VerificationErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(GetTokensV2VerifyExpressCraftTxnApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
500u16 => {
match serde_json::from_str::<TokensV2VerificationErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(GetTokensV2VerifyExpressCraftTxnApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_trigger_v1_get_trigger_orders(
&self,
user: impl AsRef<str>,
page: Option<impl AsRef<str>>,
include_failed_tx: Option<GetTriggerV1GetTriggerOrdersIncludeFailedTx>,
order_status: GetTriggerV1GetTriggerOrdersOrderStatus,
input_mint: Option<impl AsRef<str>>,
output_mint: Option<impl AsRef<str>>,
) -> Result<GetTriggerV1GetTriggerOrdersResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/trigger/v1/getTriggerOrders");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("user".to_string(), user.as_ref().to_string()));
if let Some(v) = page {
query_params.push(("page".to_string(), v.as_ref().to_string()));
}
if let Some(v) = include_failed_tx {
query_params.push(("includeFailedTx".to_string(), v.to_string()));
}
query_params.push(("orderStatus".to_string(), order_status.to_string()));
if let Some(v) = input_mint {
query_params.push(("inputMint".to_string(), v.as_ref().to_string()));
}
if let Some(v) = output_mint {
query_params.push(("outputMint".to_string(), v.as_ref().to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_trigger_v2_orders_history(
&self,
state: Option<GetTriggerV2OrdersHistoryState>,
mint: Option<impl AsRef<str>>,
limit: Option<f64>,
offset: Option<f64>,
sort: Option<GetTriggerV2OrdersHistorySort>,
dir: Option<GetTriggerV2OrdersHistoryDir>,
) -> Result<GetTriggerV2OrdersHistoryResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/trigger/v2/orders/history");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = state {
query_params.push(("state".to_string(), v.to_string()));
}
if let Some(v) = mint {
query_params.push(("mint".to_string(), v.as_ref().to_string()));
}
if let Some(v) = limit {
query_params.push(("limit".to_string(), v.to_string()));
}
if let Some(v) = offset {
query_params.push(("offset".to_string(), v.to_string()));
}
if let Some(v) = sort {
query_params.push(("sort".to_string(), v.to_string()));
}
if let Some(v) = dir {
query_params.push(("dir".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_trigger_v2_orders_history_dca(
&self,
state: Option<GetTriggerV2OrdersHistoryDcaState>,
mint: Option<impl AsRef<str>>,
limit: Option<f64>,
offset: Option<f64>,
sort: Option<GetTriggerV2OrdersHistoryDcaSort>,
dir: Option<GetTriggerV2OrdersHistoryDcaDir>,
) -> Result<GetTriggerV2OrdersHistoryDcaResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/trigger/v2/orders/history/dca");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = state {
query_params.push(("state".to_string(), v.to_string()));
}
if let Some(v) = mint {
query_params.push(("mint".to_string(), v.as_ref().to_string()));
}
if let Some(v) = limit {
query_params.push(("limit".to_string(), v.to_string()));
}
if let Some(v) = offset {
query_params.push(("offset".to_string(), v.to_string()));
}
if let Some(v) = sort {
query_params.push(("sort".to_string(), v.to_string()));
}
if let Some(v) = dir {
query_params.push(("dir".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_trigger_v2_orders_history_dca_id(
&self,
id: impl AsRef<str>,
) -> Result<TriggerV2DcaHistoryItem, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/trigger/v2/orders/history/dca/{}",
__pct_encode_path_segment(id.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_trigger_v2_vault(
&self,
) -> Result<GetTriggerV2VaultResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/trigger/v2/vault");
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_trigger_v2_vault_register(
&self,
) -> Result<GetTriggerV2VaultRegisterResponse201, ApiOpError<GetTriggerV2VaultRegisterApiError>>
{
let request_url = format!("{}{}", self.base_url, "/trigger/v2/vault/register");
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 201u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "201",
)),
}))
} else {
let typed: Option<GetTriggerV2VaultRegisterApiError>;
let parse_error: Option<String>;
match status_code {
409u16 => match serde_json::from_str::<TriggerV2ErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(GetTriggerV2VaultRegisterApiError::Status409(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_ultra_v1_balances_address(
&self,
address: impl AsRef<str>,
) -> Result<GetUltraV1BalancesAddressResponse, ApiOpError<GetUltraV1BalancesAddressApiError>>
{
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/ultra/v1/balances/{}",
__pct_encode_path_segment(address.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetUltraV1BalancesAddressApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<GetUltraV1BalancesAddressResponse400>(&body_text) {
Ok(v) => {
typed = Some(GetUltraV1BalancesAddressApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
500u16 => {
match serde_json::from_str::<GetUltraV1BalancesAddressResponse500>(&body_text) {
Ok(v) => {
typed = Some(GetUltraV1BalancesAddressApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_ultra_v1_holdings_address(
&self,
address: impl AsRef<str>,
) -> Result<UltraHoldingsResponse, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/ultra/v1/holdings/{}",
__pct_encode_path_segment(address.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_ultra_v1_holdings_address_native(
&self,
address: impl AsRef<str>,
) -> Result<UltraNativeHoldingsResponse, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/ultra/v1/holdings/{}/native",
__pct_encode_path_segment(address.as_ref())
)
);
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_ultra_v1_order(
&self,
input_mint: impl AsRef<str>,
output_mint: impl AsRef<str>,
amount: impl AsRef<str>,
taker: Option<impl AsRef<str>>,
receiver: Option<impl AsRef<str>>,
payer: Option<impl AsRef<str>>,
close_authority: Option<impl AsRef<str>>,
referral_account: Option<impl AsRef<str>>,
referral_fee: Option<f64>,
exclude_routers: Option<GetUltraV1OrderExcludeRouters>,
exclude_dexes: Option<impl AsRef<str>>,
) -> Result<GetUltraV1OrderResponse, ApiOpError<GetUltraV1OrderApiError>> {
let request_url = format!("{}{}", self.base_url, "/ultra/v1/order");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("inputMint".to_string(), input_mint.as_ref().to_string()));
query_params.push(("outputMint".to_string(), output_mint.as_ref().to_string()));
query_params.push(("amount".to_string(), amount.as_ref().to_string()));
if let Some(v) = taker {
query_params.push(("taker".to_string(), v.as_ref().to_string()));
}
if let Some(v) = receiver {
query_params.push(("receiver".to_string(), v.as_ref().to_string()));
}
if let Some(v) = payer {
query_params.push(("payer".to_string(), v.as_ref().to_string()));
}
if let Some(v) = close_authority {
query_params.push(("closeAuthority".to_string(), v.as_ref().to_string()));
}
if let Some(v) = referral_account {
query_params.push(("referralAccount".to_string(), v.as_ref().to_string()));
}
if let Some(v) = referral_fee {
query_params.push(("referralFee".to_string(), v.to_string()));
}
if let Some(v) = exclude_routers {
query_params.push(("excludeRouters".to_string(), v.to_string()));
}
if let Some(v) = exclude_dexes {
query_params.push(("excludeDexes".to_string(), v.as_ref().to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetUltraV1OrderApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<GetUltraV1OrderResponse400>(&body_text) {
Ok(v) => {
typed = Some(GetUltraV1OrderApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
500u16 => match serde_json::from_str::<GetUltraV1OrderResponse500>(&body_text) {
Ok(v) => {
typed = Some(GetUltraV1OrderApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_ultra_v1_order_routers(
&self,
) -> Result<GetUltraV1OrderRoutersResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/ultra/v1/order/routers");
let mut req = self.http_client.get(request_url);
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_ultra_v1_search(
&self,
query: impl AsRef<str>,
) -> Result<GetUltraV1SearchResponse, ApiOpError<GetUltraV1SearchApiError>> {
let request_url = format!("{}{}", self.base_url, "/ultra/v1/search");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("query".to_string(), query.as_ref().to_string()));
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetUltraV1SearchApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<GetUltraV1SearchResponse400>(&body_text) {
Ok(v) => {
typed = Some(GetUltraV1SearchApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
500u16 => match serde_json::from_str::<GetUltraV1SearchResponse500>(&body_text) {
Ok(v) => {
typed = Some(GetUltraV1SearchApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn get_ultra_v1_shield(
&self,
mints: impl AsRef<str>,
) -> Result<GetUltraV1ShieldResponse, ApiOpError<GetUltraV1ShieldApiError>> {
let request_url = format!("{}{}", self.base_url, "/ultra/v1/shield");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("mints".to_string(), mints.as_ref().to_string()));
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<GetUltraV1ShieldApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<GetUltraV1ShieldResponse400>(&body_text) {
Ok(v) => {
typed = Some(GetUltraV1ShieldApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
500u16 => match serde_json::from_str::<GetUltraV1ShieldResponse500>(&body_text) {
Ok(v) => {
typed = Some(GetUltraV1ShieldApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn list_borrow_positions(
&self,
users: impl AsRef<str>,
market: Option<LendBorrowMarket>,
) -> Result<ListBorrowPositionsResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/lend/v1/borrow/positions");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
query_params.push(("users".to_string(), users.as_ref().to_string()));
if let Some(v) = market {
query_params.push(("market".to_string(), v.to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn list_borrow_vaults(
&self,
market: Option<LendBorrowMarket>,
rpc_url: Option<impl AsRef<str>>,
) -> Result<ListBorrowVaultsResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/lend/v1/borrow/vaults");
let mut req = self.http_client.get(request_url);
{
let mut query_params: Vec<(String, String)> = Vec::new();
if let Some(v) = market {
query_params.push(("market".to_string(), v.to_string()));
}
if let Some(v) = rpc_url {
query_params.push(("rpcUrl".to_string(), v.as_ref().to_string()));
}
if !query_params.is_empty() {
req = req.query(&query_params);
}
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn patch_trigger_v2_orders_price_order_id(
&self,
order_id: impl AsRef<str>,
request: PatchTriggerV2OrdersPriceOrderIdRequest,
) -> Result<PatchTriggerV2OrdersPriceOrderIdResponse, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/trigger/v2/orders/price/{}",
__pct_encode_path_segment(order_id.as_ref())
)
);
let mut req = self.http_client.patch(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_lend_v1_earn_deposit(
&self,
request: LendEarnAmountRequestBody,
) -> Result<LendTransactionResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/deposit");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_lend_v1_earn_deposit_instructions(
&self,
request: LendEarnAmountRequestBody,
) -> Result<LendInstructionResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/deposit-instructions");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_lend_v1_earn_mint(
&self,
request: LendEarnSharesRequestBody,
) -> Result<LendTransactionResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/mint");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_lend_v1_earn_mint_instructions(
&self,
request: LendEarnSharesRequestBody,
) -> Result<LendInstructionResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/mint-instructions");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_lend_v1_earn_redeem(
&self,
request: LendEarnSharesRequestBody,
) -> Result<LendTransactionResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/redeem");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_lend_v1_earn_redeem_instructions(
&self,
request: LendEarnSharesRequestBody,
) -> Result<LendInstructionResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/redeem-instructions");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_lend_v1_earn_withdraw(
&self,
request: LendEarnAmountRequestBody,
) -> Result<LendTransactionResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/withdraw");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_lend_v1_earn_withdraw_instructions(
&self,
request: LendEarnAmountRequestBody,
) -> Result<LendInstructionResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/lend/v1/earn/withdraw-instructions");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_prediction_v1_execute(
&self,
request: PredictionExecuteRequest,
) -> Result<PredictionExecuteResponse, ApiOpError<PostPredictionV1ExecuteApiError>> {
let request_url = format!("{}{}", self.base_url, "/prediction/v1/execute");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostPredictionV1ExecuteApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(PostPredictionV1ExecuteApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_prediction_v1_orders(
&self,
request: PredictionCreateOrderRequest,
) -> Result<PredictionCreateOrderResponse, ApiOpError<PostPredictionV1OrdersApiError>> {
let request_url = format!("{}{}", self.base_url, "/prediction/v1/orders");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostPredictionV1OrdersApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(PostPredictionV1OrdersApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_prediction_v1_positions_position_pubkey_claim(
&self,
position_pubkey: impl AsRef<str>,
request: PredictionClaimPositionRequest,
) -> Result<
PredictionClaimPositionResponse,
ApiOpError<PostPredictionV1PositionsPositionPubkeyClaimApiError>,
> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/prediction/v1/positions/{}/claim",
__pct_encode_path_segment(position_pubkey.as_ref())
)
);
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostPredictionV1PositionsPositionPubkeyClaimApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(
PostPredictionV1PositionsPositionPubkeyClaimApiError::Status400(v),
);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
404u16 => match serde_json::from_str::<PredictionErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(
PostPredictionV1PositionsPositionPubkeyClaimApiError::Status404(v),
);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_send_v1_craft_clawback(
&self,
request: PostSendV1CraftClawbackRequest,
) -> Result<PostSendV1CraftClawbackResponse, ApiOpError<PostSendV1CraftClawbackApiError>> {
let request_url = format!("{}{}", self.base_url, "/send/v1/craft-clawback");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostSendV1CraftClawbackApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<PostSendV1CraftClawbackResponse400>(&body_text) {
Ok(v) => {
typed = Some(PostSendV1CraftClawbackApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
500u16 => {
match serde_json::from_str::<PostSendV1CraftClawbackResponse500>(&body_text) {
Ok(v) => {
typed = Some(PostSendV1CraftClawbackApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_send_v1_craft_send(
&self,
request: PostSendV1CraftSendRequest,
) -> Result<PostSendV1CraftSendResponse, ApiOpError<PostSendV1CraftSendApiError>> {
let request_url = format!("{}{}", self.base_url, "/send/v1/craft-send");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostSendV1CraftSendApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<PostSendV1CraftSendResponse400>(&body_text) {
Ok(v) => {
typed = Some(PostSendV1CraftSendApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
500u16 => {
match serde_json::from_str::<PostSendV1CraftSendResponse500>(&body_text) {
Ok(v) => {
typed = Some(PostSendV1CraftSendApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_studio_v1_dbc_fee(
&self,
request: Option<PostStudioV1DbcFeeRequest>,
) -> Result<PostStudioV1DbcFeeResponse, ApiOpError<PostStudioV1DbcFeeApiError>> {
let request_url = format!("{}{}", self.base_url, "/studio/v1/dbc/fee");
let mut req = self.http_client.post(request_url);
if let Some(request) = request {
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
} else {
req = req.header(reqwest::header::CONTENT_LENGTH, "0");
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostStudioV1DbcFeeApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<PostStudioV1DbcFeeResponse400>(&body_text) {
Ok(v) => {
typed = Some(PostStudioV1DbcFeeApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_studio_v1_dbc_fee_create_tx(
&self,
request: Option<StudioCreateClaimFeeDBCTransactionRequestBody>,
) -> Result<PostStudioV1DbcFeeCreateTxResponse, ApiOpError<PostStudioV1DbcFeeCreateTxApiError>>
{
let request_url = format!("{}{}", self.base_url, "/studio/v1/dbc/fee/create-tx");
let mut req = self.http_client.post(request_url);
if let Some(request) = request {
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
} else {
req = req.header(reqwest::header::CONTENT_LENGTH, "0");
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostStudioV1DbcFeeCreateTxApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<PostStudioV1DbcFeeCreateTxResponse400>(&body_text)
{
Ok(v) => {
typed = Some(PostStudioV1DbcFeeCreateTxApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
403u16 => {
match serde_json::from_str::<PostStudioV1DbcFeeCreateTxResponse403>(&body_text)
{
Ok(v) => {
typed = Some(PostStudioV1DbcFeeCreateTxApiError::Status403(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
404u16 => {
match serde_json::from_str::<PostStudioV1DbcFeeCreateTxResponse404>(&body_text)
{
Ok(v) => {
typed = Some(PostStudioV1DbcFeeCreateTxApiError::Status404(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_studio_v1_dbc_pool_create_tx(
&self,
request: Option<StudioCreateDBCTransactionRequestBody>,
) -> Result<StudioCreateDBCTransactionResponse, ApiOpError<PostStudioV1DbcPoolCreateTxApiError>>
{
let request_url = format!("{}{}", self.base_url, "/studio/v1/dbc-pool/create-tx");
let mut req = self.http_client.post(request_url);
if let Some(request) = request {
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
} else {
req = req.header(reqwest::header::CONTENT_LENGTH, "0");
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostStudioV1DbcPoolCreateTxApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<PostStudioV1DbcPoolCreateTxResponse400>(&body_text)
{
Ok(v) => {
typed = Some(PostStudioV1DbcPoolCreateTxApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
500u16 => {
match serde_json::from_str::<PostStudioV1DbcPoolCreateTxResponse500>(&body_text)
{
Ok(v) => {
typed = Some(PostStudioV1DbcPoolCreateTxApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_studio_v1_dbc_pool_submit(
&self,
request: Option<StudioSubmitDBCTransactionRequestBody>,
) -> Result<PostStudioV1DbcPoolSubmitResponse, ApiOpError<PostStudioV1DbcPoolSubmitApiError>>
{
let request_url = format!("{}{}", self.base_url, "/studio/v1/dbc-pool/submit");
let mut req = self.http_client.post(request_url);
if let Some(request) = request {
let mut form = reqwest::multipart::Form::new();
if let Some(value) = &request.content {
form = form.text("content", value.to_string());
}
if let Some(value) = &request.header_image {
form = form.part(
"headerImage",
reqwest::multipart::Part::bytes(value.to_vec()),
);
}
let value = &request.owner;
form = form.text("owner", value.to_string());
let value = &request.transaction;
form = form.text("transaction", value.to_string());
req = req.multipart(form);
} else {
req = req.header(reqwest::header::CONTENT_LENGTH, "0");
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostStudioV1DbcPoolSubmitApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<PostStudioV1DbcPoolSubmitResponse400>(&body_text) {
Ok(v) => {
typed = Some(PostStudioV1DbcPoolSubmitApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_tokens_v2_verify_express_execute(
&self,
request: TokensV2VerificationExpressExecuteBody,
) -> Result<
TokensV2VerificationExpressExecuteResponse,
ApiOpError<PostTokensV2VerifyExpressExecuteApiError>,
> {
let request_url = format!("{}{}", self.base_url, "/tokens/v2/verify/express/execute");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostTokensV2VerifyExpressExecuteApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<TokensV2VerificationErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(PostTokensV2VerifyExpressExecuteApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
409u16 => {
match serde_json::from_str::<TokensV2VerificationErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(PostTokensV2VerifyExpressExecuteApiError::Status409(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
500u16 => {
match serde_json::from_str::<TokensV2VerificationErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(PostTokensV2VerifyExpressExecuteApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_trigger_v1_cancel_order(
&self,
request: Option<PostTriggerV1CancelOrderRequest>,
) -> Result<PostTriggerV1CancelOrderResponse, ApiOpError<PostTriggerV1CancelOrderApiError>>
{
let request_url = format!("{}{}", self.base_url, "/trigger/v1/cancelOrder");
let mut req = self.http_client.post(request_url);
if let Some(request) = request {
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
} else {
req = req.header(reqwest::header::CONTENT_LENGTH, "0");
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostTriggerV1CancelOrderApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<PostTriggerV1CancelOrderResponse400>(&body_text) {
Ok(v) => {
typed = Some(PostTriggerV1CancelOrderApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
500u16 => {
match serde_json::from_str::<PostTriggerV1CancelOrderResponse500>(&body_text) {
Ok(v) => {
typed = Some(PostTriggerV1CancelOrderApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_trigger_v1_cancel_orders(
&self,
request: Option<PostTriggerV1CancelOrdersRequest>,
) -> Result<PostTriggerV1CancelOrdersResponse, ApiOpError<PostTriggerV1CancelOrdersApiError>>
{
let request_url = format!("{}{}", self.base_url, "/trigger/v1/cancelOrders");
let mut req = self.http_client.post(request_url);
if let Some(request) = request {
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
} else {
req = req.header(reqwest::header::CONTENT_LENGTH, "0");
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostTriggerV1CancelOrdersApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<PostTriggerV1CancelOrdersResponse400>(&body_text) {
Ok(v) => {
typed = Some(PostTriggerV1CancelOrdersApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
500u16 => {
match serde_json::from_str::<PostTriggerV1CancelOrdersResponse500>(&body_text) {
Ok(v) => {
typed = Some(PostTriggerV1CancelOrdersApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_trigger_v1_create_order(
&self,
request: Option<PostTriggerV1CreateOrderRequest>,
) -> Result<PostTriggerV1CreateOrderResponse, ApiOpError<PostTriggerV1CreateOrderApiError>>
{
let request_url = format!("{}{}", self.base_url, "/trigger/v1/createOrder");
let mut req = self.http_client.post(request_url);
if let Some(request) = request {
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
} else {
req = req.header(reqwest::header::CONTENT_LENGTH, "0");
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostTriggerV1CreateOrderApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<PostTriggerV1CreateOrderResponse400>(&body_text) {
Ok(v) => {
typed = Some(PostTriggerV1CreateOrderApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
500u16 => {
match serde_json::from_str::<PostTriggerV1CreateOrderResponse500>(&body_text) {
Ok(v) => {
typed = Some(PostTriggerV1CreateOrderApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_trigger_v1_execute(
&self,
request: PostTriggerV1ExecuteRequest,
) -> Result<PostTriggerV1ExecuteResponse, ApiOpError<PostTriggerV1ExecuteApiError>> {
let request_url = format!("{}{}", self.base_url, "/trigger/v1/execute");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostTriggerV1ExecuteApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => {
match serde_json::from_str::<PostTriggerV1ExecuteResponse400>(&body_text) {
Ok(v) => {
typed = Some(PostTriggerV1ExecuteApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
500u16 => {
match serde_json::from_str::<PostTriggerV1ExecuteResponse500>(&body_text) {
Ok(v) => {
typed = Some(PostTriggerV1ExecuteApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
}
}
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_trigger_v2_auth_challenge(
&self,
request: PostTriggerV2AuthChallengeRequest,
) -> Result<PostTriggerV2AuthChallengeResponse, ApiOpError<PostTriggerV2AuthChallengeApiError>>
{
let request_url = format!("{}{}", self.base_url, "/trigger/v2/auth/challenge");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostTriggerV2AuthChallengeApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<TriggerV2ErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(PostTriggerV2AuthChallengeApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_trigger_v2_auth_verify(
&self,
request: PostTriggerV2AuthVerifyRequest,
) -> Result<PostTriggerV2AuthVerifyResponse, ApiOpError<PostTriggerV2AuthVerifyApiError>> {
let request_url = format!("{}{}", self.base_url, "/trigger/v2/auth/verify");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostTriggerV2AuthVerifyApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<TriggerV2ErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(PostTriggerV2AuthVerifyApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
401u16 => match serde_json::from_str::<TriggerV2ErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(PostTriggerV2AuthVerifyApiError::Status401(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_trigger_v2_deposit_craft(
&self,
request: PostTriggerV2DepositCraftRequest,
) -> Result<PostTriggerV2DepositCraftResponse, ApiOpError<PostTriggerV2DepositCraftApiError>>
{
let request_url = format!("{}{}", self.base_url, "/trigger/v2/deposit/craft");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostTriggerV2DepositCraftApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<TriggerV2ErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(PostTriggerV2DepositCraftApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_trigger_v2_orders_dca(
&self,
request: PostTriggerV2OrdersDcaRequest,
) -> Result<TriggerV2TxSignatureResponse, ApiOpError<PostTriggerV2OrdersDcaApiError>> {
let request_url = format!("{}{}", self.base_url, "/trigger/v2/orders/dca");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostTriggerV2OrdersDcaApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<TriggerV2ErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(PostTriggerV2OrdersDcaApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_trigger_v2_orders_dca_cancel_id(
&self,
id: impl AsRef<str>,
) -> Result<PostTriggerV2OrdersDcaCancelIdResponse, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/trigger/v2/orders/dca/cancel/{}",
__pct_encode_path_segment(id.as_ref())
)
);
let mut req = self.http_client.post(request_url);
req = req.header(reqwest::header::CONTENT_LENGTH, "0");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_trigger_v2_orders_dca_confirm_cancel_id(
&self,
id: impl AsRef<str>,
request: PostTriggerV2OrdersDcaConfirmCancelIdRequest,
) -> Result<TriggerV2TxSignatureResponse, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/trigger/v2/orders/dca/confirm-cancel/{}",
__pct_encode_path_segment(id.as_ref())
)
);
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_trigger_v2_orders_price(
&self,
request: PostTriggerV2OrdersPriceRequest,
) -> Result<TriggerV2OrderResponse, ApiOpError<PostTriggerV2OrdersPriceApiError>> {
let request_url = format!("{}{}", self.base_url, "/trigger/v2/orders/price");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostTriggerV2OrdersPriceApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<TriggerV2ErrorResponse>(&body_text) {
Ok(v) => {
typed = Some(PostTriggerV2OrdersPriceApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_trigger_v2_orders_price_cancel_order_id(
&self,
order_id: impl AsRef<str>,
) -> Result<PostTriggerV2OrdersPriceCancelOrderIdResponse, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/trigger/v2/orders/price/cancel/{}",
__pct_encode_path_segment(order_id.as_ref())
)
);
let mut req = self.http_client.post(request_url);
req = req.header(reqwest::header::CONTENT_LENGTH, "0");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_trigger_v2_orders_price_confirm_cancel_order_id(
&self,
order_id: impl AsRef<str>,
request: PostTriggerV2OrdersPriceConfirmCancelOrderIdRequest,
) -> Result<TriggerV2TxSignatureResponse, ApiOpError<serde_json::Value>> {
let request_url = format!(
"{}{}",
self.base_url,
format!(
"/trigger/v2/orders/price/confirm-cancel/{}",
__pct_encode_path_segment(order_id.as_ref())
)
);
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn post_ultra_v1_execute(
&self,
request: Option<PostUltraV1ExecuteRequest>,
) -> Result<PostUltraV1ExecuteResponse, ApiOpError<PostUltraV1ExecuteApiError>> {
let request_url = format!("{}{}", self.base_url, "/ultra/v1/execute");
let mut req = self.http_client.post(request_url);
if let Some(request) = request {
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
} else {
req = req.header(reqwest::header::CONTENT_LENGTH, "0");
}
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<PostUltraV1ExecuteApiError>;
let parse_error: Option<String>;
match status_code {
400u16 => match serde_json::from_str::<PostUltraV1ExecuteResponse400>(&body_text) {
Ok(v) => {
typed = Some(PostUltraV1ExecuteApiError::Status400(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
500u16 => match serde_json::from_str::<PostUltraV1ExecuteResponse500>(&body_text) {
Ok(v) => {
typed = Some(PostUltraV1ExecuteApiError::Status500(v));
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
_ => {
typed = None;
parse_error = None;
}
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn price_deposit(
&self,
request: RecurringDepositPriceRecurring,
) -> Result<RecurringRecurringResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/recurring/v1/priceDeposit");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
pub async fn price_withdraw(
&self,
request: RecurringWithdrawPriceRecurring,
) -> Result<RecurringRecurringResponse, ApiOpError<serde_json::Value>> {
let request_url = format!("{}{}", self.base_url, "/recurring/v1/priceWithdraw");
let mut req = self.http_client.post(request_url);
req = req
.body(serde_json::to_vec(&request).map_err(HttpError::serialization_error)?)
.header("content-type", "application/json");
if let Some(api_key) = &self.api_key {
req = req.header("x-api-key", api_key.as_str());
}
for (name, value) in &self.custom_headers {
if !name.eq_ignore_ascii_case("accept") {
req = req.header(name, value);
}
}
req = req.header(reqwest::header::ACCEPT, "application/json");
let response = req.send().await?;
let status = response.status();
let status_code = status.as_u16();
let headers = response.headers().clone();
let body_bytes =
__read_bounded_response_body(response, self.max_response_body_bytes).await?;
let raw_body = body_bytes;
let body_text = String::from_utf8_lossy(&raw_body).into_owned();
if false || status_code == 200u16 {
match serde_json::from_str(&body_text) {
Ok(body) => Ok(body),
Err(e) => Err(ApiOpError::Api(ApiError {
status: status_code,
headers: headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!("failed to deserialize 2xx response body: {}", e)),
})),
}
} else if status.is_success() {
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed: None,
parse_error: Some(format!(
"unexpected successful status {}; generated return type selects `{}`",
status_code, "200",
)),
}))
} else {
let typed: Option<serde_json::Value>;
let parse_error: Option<String>;
match status_code {
_ => match serde_json::from_str::<serde_json::Value>(&body_text) {
Ok(v) => {
typed = Some(v);
parse_error = None;
}
Err(e) => {
typed = None;
parse_error = Some(e.to_string());
}
},
}
Err(ApiOpError::Api(ApiError {
status: status_code,
headers,
body: body_text,
raw_body,
typed,
parse_error,
}))
}
}
#[doc = concat!("Start an additive builder for `", "GetBuild", "`.")]
pub fn get_build_builder(
&self,
input_mint: impl Into<String>,
output_mint: impl Into<String>,
amount: impl Into<String>,
taker: impl Into<String>,
) -> GetBuildBuilder<'_> {
GetBuildBuilder {
client: self,
input_mint: input_mint.into(),
output_mint: output_mint.into(),
amount: amount.into(),
taker: taker.into(),
slippage_bps: None,
mode: None,
dexes: None,
exclude_dexes: None,
platform_fee_bps: None,
fee_account: None,
max_accounts: None,
payer: None,
wrap_and_unwrap_sol: None,
destination_token_account: None,
native_destination_account: None,
blockhash_slots_to_expiry: None,
tip_amount: None,
compute_unit_price_percentile: None,
for_jito_bundle: None,
}
}
#[doc = concat!("Start an additive builder for `", "GetOrder", "`.")]
pub fn get_order_builder(
&self,
input_mint: impl Into<String>,
output_mint: impl Into<String>,
amount: impl Into<String>,
) -> GetOrderBuilder<'_> {
GetOrderBuilder {
client: self,
input_mint: input_mint.into(),
output_mint: output_mint.into(),
amount: amount.into(),
taker: None,
receiver: None,
swap_mode: None,
slippage_bps: None,
referral_account: None,
referral_fee: None,
payer: None,
priority_fee_lamports: None,
jito_tip_lamports: None,
broadcast_fee_type: None,
exclude_routers: None,
exclude_dexes: None,
}
}
#[doc = concat!("Start an additive builder for `", "PostExecute", "`.")]
pub fn post_execute_builder(
&self,
request_id: String,
signed_transaction: String,
) -> PostExecuteBuilder<'_> {
PostExecuteBuilder {
client: self,
request: PostExecuteRequest::new(request_id, signed_transaction),
}
}
#[doc = concat!("Start an additive builder for `", "QuoteGet", "`.")]
pub fn quote_get_builder(
&self,
input_mint: impl Into<String>,
output_mint: impl Into<String>,
amount: u64,
) -> QuoteGetBuilder<'_> {
QuoteGetBuilder {
client: self,
input_mint: input_mint.into(),
output_mint: output_mint.into(),
amount: amount,
slippage_bps: None,
swap_mode: None,
dexes: None,
exclude_dexes: None,
restrict_intermediate_tokens: None,
only_direct_routes: None,
as_legacy_transaction: None,
platform_fee_bps: None,
max_accounts: None,
instruction_version: None,
dynamic_slippage: None,
for_jito_bundle: None,
}
}
#[doc = concat!("Start an additive builder for `", "SwapInstructionsPost", "`.")]
pub fn swap_instructions_post_builder(
&self,
quote_response: SwapV1QuoteResponse,
user_public_key: String,
) -> SwapInstructionsPostBuilder<'_> {
SwapInstructionsPostBuilder {
client: self,
request: SwapV1SwapRequest::new(quote_response, user_public_key),
}
}
#[doc = concat!("Start an additive builder for `", "SwapPost", "`.")]
pub fn swap_post_builder(
&self,
quote_response: SwapV1QuoteResponse,
user_public_key: String,
) -> SwapPostBuilder<'_> {
SwapPostBuilder {
client: self,
request: SwapV1SwapRequest::new(quote_response, user_public_key),
}
}
#[doc = concat!(
"Start an additive builder for `", "buildBorrowOperateInstructions", "`."
)]
pub fn build_borrow_operate_instructions_builder(
&self,
col_amount: String,
debt_amount: String,
position_id: i64,
signer: String,
vault_id: i64,
) -> BuildBorrowOperateInstructionsBuilder<'_> {
BuildBorrowOperateInstructionsBuilder {
client: self,
market: None,
request: LendBorrowOperatePayload::new(
col_amount,
debt_amount,
position_id,
signer,
vault_id,
),
}
}
#[doc = concat!(
"Start an additive builder for `", "buildBorrowOperateTransaction", "`."
)]
pub fn build_borrow_operate_transaction_builder(
&self,
col_amount: String,
debt_amount: String,
position_id: i64,
signer: String,
vault_id: i64,
) -> BuildBorrowOperateTransactionBuilder<'_> {
BuildBorrowOperateTransactionBuilder {
client: self,
market: None,
request: LendBorrowOperatePayload::new(
col_amount,
debt_amount,
position_id,
signer,
vault_id,
),
}
}
#[doc = concat!(
"Start an additive builder for `", "deletePredictionV1Positions", "`."
)]
pub fn delete_prediction_v1_positions_builder(
&self,
min_sell_price_slippage_bps: f64,
) -> DeletePredictionV1PositionsBuilder<'_> {
DeletePredictionV1PositionsBuilder {
client: self,
request: PredictionCloseAllPositionsRequest::new(min_sell_price_slippage_bps),
}
}
#[doc = concat!(
"Start an additive builder for `", "deletePredictionV1PositionsPositionPubkey",
"`."
)]
pub fn delete_prediction_v1_positions_position_pubkey_builder(
&self,
position_pubkey: impl Into<String>,
) -> DeletePredictionV1PositionsPositionPubkeyBuilder<'_> {
DeletePredictionV1PositionsPositionPubkeyBuilder {
client: self,
position_pubkey: position_pubkey.into(),
request: Default::default(),
}
}
#[doc = concat!(
"Start an additive builder for `", "getPortfolioV1PositionsAddress", "`."
)]
pub fn get_portfolio_v1_positions_address_builder(
&self,
address: impl Into<String>,
) -> GetPortfolioV1PositionsAddressBuilder<'_> {
GetPortfolioV1PositionsAddressBuilder {
client: self,
address: address.into(),
platforms: None,
}
}
#[doc = concat!("Start an additive builder for `", "getPredictionV1Events", "`.")]
pub fn get_prediction_v1_events_builder(&self) -> GetPredictionV1EventsBuilder<'_> {
GetPredictionV1EventsBuilder {
client: self,
provider: None,
include_markets: None,
include_all_markets: None,
start: None,
end: None,
category: None,
subcategory: None,
sort_by: None,
sort_direction: None,
filter: None,
tags: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "getPredictionV1EventsEventId", "`."
)]
pub fn get_prediction_v1_events_event_id_builder(
&self,
event_id: impl Into<String>,
) -> GetPredictionV1EventsEventIdBuilder<'_> {
GetPredictionV1EventsEventIdBuilder {
client: self,
event_id: event_id.into(),
include_markets: None,
include_all_markets: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "getPredictionV1EventsEventIdMarkets", "`."
)]
pub fn get_prediction_v1_events_event_id_markets_builder(
&self,
event_id: impl Into<String>,
) -> GetPredictionV1EventsEventIdMarketsBuilder<'_> {
GetPredictionV1EventsEventIdMarketsBuilder {
client: self,
event_id: event_id.into(),
start: None,
end: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "getPredictionV1EventsSearch", "`."
)]
pub fn get_prediction_v1_events_search_builder(
&self,
query: impl Into<String>,
) -> GetPredictionV1EventsSearchBuilder<'_> {
GetPredictionV1EventsSearchBuilder {
client: self,
provider: None,
query: query.into(),
limit: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "getPredictionV1EventsSuggestedPubkey", "`."
)]
pub fn get_prediction_v1_events_suggested_pubkey_builder(
&self,
pubkey: impl Into<String>,
) -> GetPredictionV1EventsSuggestedPubkeyBuilder<'_> {
GetPredictionV1EventsSuggestedPubkeyBuilder {
client: self,
pubkey: pubkey.into(),
provider: None,
}
}
#[doc = concat!("Start an additive builder for `", "getPredictionV1History", "`.")]
pub fn get_prediction_v1_history_builder(&self) -> GetPredictionV1HistoryBuilder<'_> {
GetPredictionV1HistoryBuilder {
client: self,
start: None,
end: None,
owner_pubkey: None,
id: None,
position_pubkey: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "getPredictionV1Leaderboards", "`."
)]
pub fn get_prediction_v1_leaderboards_builder(&self) -> GetPredictionV1LeaderboardsBuilder<'_> {
GetPredictionV1LeaderboardsBuilder {
client: self,
period: None,
limit: None,
metric: None,
}
}
#[doc = concat!("Start an additive builder for `", "getPredictionV1Orders", "`.")]
pub fn get_prediction_v1_orders_builder(&self) -> GetPredictionV1OrdersBuilder<'_> {
GetPredictionV1OrdersBuilder {
client: self,
start: None,
end: None,
owner_pubkey: None,
}
}
#[doc = concat!("Start an additive builder for `", "getPredictionV1Positions", "`.")]
pub fn get_prediction_v1_positions_builder(&self) -> GetPredictionV1PositionsBuilder<'_> {
GetPredictionV1PositionsBuilder {
client: self,
start: None,
end: None,
owner_pubkey: None,
market_pubkey: None,
market_id: None,
is_yes: None,
}
}
#[doc = concat!(
"Start an additive builder for `",
"getPredictionV1ProfilesOwnerPubkeyPnlHistory", "`."
)]
pub fn get_prediction_v1_profiles_owner_pubkey_pnl_history_builder(
&self,
owner_pubkey: impl Into<String>,
) -> GetPredictionV1ProfilesOwnerPubkeyPnlHistoryBuilder<'_> {
GetPredictionV1ProfilesOwnerPubkeyPnlHistoryBuilder {
client: self,
owner_pubkey: owner_pubkey.into(),
interval: None,
count: None,
}
}
#[doc = concat!("Start an additive builder for `", "getPriceV2", "`.")]
pub fn get_price_v2_builder(&self, ids: impl Into<String>) -> GetPriceV2Builder<'_> {
GetPriceV2Builder {
client: self,
ids: ids.into(),
vs_token: None,
show_extra_info: None,
}
}
#[doc = concat!("Start an additive builder for `", "getSendV1InviteHistory", "`.")]
pub fn get_send_v1_invite_history_builder(
&self,
address: impl Into<String>,
) -> GetSendV1InviteHistoryBuilder<'_> {
GetSendV1InviteHistoryBuilder {
client: self,
address: address.into(),
page: None,
}
}
#[doc = concat!("Start an additive builder for `", "getSendV1PendingInvites", "`.")]
pub fn get_send_v1_pending_invites_builder(
&self,
address: impl Into<String>,
) -> GetSendV1PendingInvitesBuilder<'_> {
GetSendV1PendingInvitesBuilder {
client: self,
address: address.into(),
page: None,
}
}
#[doc = concat!("Start an additive builder for `", "getTokensV1New", "`.")]
pub fn get_tokens_v1_new_builder(&self) -> GetTokensV1NewBuilder<'_> {
GetTokensV1NewBuilder {
client: self,
limit: None,
offset: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "getTokensV2CategoryInterval", "`."
)]
pub fn get_tokens_v2_category_interval_builder(
&self,
category: GetTokensV2CategoryIntervalCategory,
interval: GetTokensV2CategoryIntervalInterval,
) -> GetTokensV2CategoryIntervalBuilder<'_> {
GetTokensV2CategoryIntervalBuilder {
client: self,
category: category,
interval: interval,
limit: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "getTokensV2VerifyExpressCraftTxn", "`."
)]
pub fn get_tokens_v2_verify_express_craft_txn_builder(
&self,
sender_address: impl Into<String>,
) -> GetTokensV2VerifyExpressCraftTxnBuilder<'_> {
GetTokensV2VerifyExpressCraftTxnBuilder {
client: self,
sender_address: sender_address.into(),
payment_currency: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "getTriggerV1GetTriggerOrders", "`."
)]
pub fn get_trigger_v1_get_trigger_orders_builder(
&self,
user: impl Into<String>,
order_status: GetTriggerV1GetTriggerOrdersOrderStatus,
) -> GetTriggerV1GetTriggerOrdersBuilder<'_> {
GetTriggerV1GetTriggerOrdersBuilder {
client: self,
user: user.into(),
page: None,
include_failed_tx: None,
order_status: order_status,
input_mint: None,
output_mint: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "getTriggerV2OrdersHistory", "`."
)]
pub fn get_trigger_v2_orders_history_builder(&self) -> GetTriggerV2OrdersHistoryBuilder<'_> {
GetTriggerV2OrdersHistoryBuilder {
client: self,
state: None,
mint: None,
limit: None,
offset: None,
sort: None,
dir: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "getTriggerV2OrdersHistoryDca", "`."
)]
pub fn get_trigger_v2_orders_history_dca_builder(
&self,
) -> GetTriggerV2OrdersHistoryDcaBuilder<'_> {
GetTriggerV2OrdersHistoryDcaBuilder {
client: self,
state: None,
mint: None,
limit: None,
offset: None,
sort: None,
dir: None,
}
}
#[doc = concat!("Start an additive builder for `", "getUltraV1Order", "`.")]
pub fn get_ultra_v1_order_builder(
&self,
input_mint: impl Into<String>,
output_mint: impl Into<String>,
amount: impl Into<String>,
) -> GetUltraV1OrderBuilder<'_> {
GetUltraV1OrderBuilder {
client: self,
input_mint: input_mint.into(),
output_mint: output_mint.into(),
amount: amount.into(),
taker: None,
receiver: None,
payer: None,
close_authority: None,
referral_account: None,
referral_fee: None,
exclude_routers: None,
exclude_dexes: None,
}
}
#[doc = concat!("Start an additive builder for `", "listBorrowPositions", "`.")]
pub fn list_borrow_positions_builder(
&self,
users: impl Into<String>,
) -> ListBorrowPositionsBuilder<'_> {
ListBorrowPositionsBuilder {
client: self,
users: users.into(),
market: None,
}
}
#[doc = concat!("Start an additive builder for `", "listBorrowVaults", "`.")]
pub fn list_borrow_vaults_builder(&self) -> ListBorrowVaultsBuilder<'_> {
ListBorrowVaultsBuilder {
client: self,
market: None,
rpc_url: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "patchTriggerV2OrdersPriceOrderId", "`."
)]
pub fn patch_trigger_v2_orders_price_order_id_builder(
&self,
order_id: impl Into<String>,
order_type: PatchTriggerV2OrdersPriceOrderIdRequestOrderType,
) -> PatchTriggerV2OrdersPriceOrderIdBuilder<'_> {
PatchTriggerV2OrdersPriceOrderIdBuilder {
client: self,
order_id: order_id.into(),
request: PatchTriggerV2OrdersPriceOrderIdRequest::new(order_type),
}
}
#[doc = concat!("Start an additive builder for `", "postPredictionV1Execute", "`.")]
pub fn post_prediction_v1_execute_builder(
&self,
signed_transaction: String,
) -> PostPredictionV1ExecuteBuilder<'_> {
PostPredictionV1ExecuteBuilder {
client: self,
request: PredictionExecuteRequest::new(signed_transaction),
}
}
#[doc = concat!("Start an additive builder for `", "postPredictionV1Orders", "`.")]
pub fn post_prediction_v1_orders_builder(
&self,
is_buy: bool,
) -> PostPredictionV1OrdersBuilder<'_> {
PostPredictionV1OrdersBuilder {
client: self,
request: PredictionCreateOrderRequest::new(is_buy),
}
}
#[doc = concat!(
"Start an additive builder for `",
"postPredictionV1PositionsPositionPubkeyClaim", "`."
)]
pub fn post_prediction_v1_positions_position_pubkey_claim_builder(
&self,
position_pubkey: impl Into<String>,
) -> PostPredictionV1PositionsPositionPubkeyClaimBuilder<'_> {
PostPredictionV1PositionsPositionPubkeyClaimBuilder {
client: self,
position_pubkey: position_pubkey.into(),
request: Default::default(),
}
}
#[doc = concat!("Start an additive builder for `", "postSendV1CraftSend", "`.")]
pub fn post_send_v1_craft_send_builder(
&self,
amount: String,
invite_signer: String,
sender: String,
) -> PostSendV1CraftSendBuilder<'_> {
PostSendV1CraftSendBuilder {
client: self,
request: PostSendV1CraftSendRequest::new(amount, invite_signer, sender),
}
}
#[doc = concat!("Start an additive builder for `", "postStudioV1DbcFee", "`.")]
pub fn post_studio_v1_dbc_fee_builder(&self) -> PostStudioV1DbcFeeBuilder<'_> {
PostStudioV1DbcFeeBuilder {
client: self,
request: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "postStudioV1DbcFeeCreateTx", "`."
)]
pub fn post_studio_v1_dbc_fee_create_tx_builder(
&self,
) -> PostStudioV1DbcFeeCreateTxBuilder<'_> {
PostStudioV1DbcFeeCreateTxBuilder {
client: self,
request: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "postStudioV1DbcPoolCreateTx", "`."
)]
pub fn post_studio_v1_dbc_pool_create_tx_builder(
&self,
) -> PostStudioV1DbcPoolCreateTxBuilder<'_> {
PostStudioV1DbcPoolCreateTxBuilder {
client: self,
request: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "postStudioV1DbcPoolSubmit", "`."
)]
pub fn post_studio_v1_dbc_pool_submit_builder(&self) -> PostStudioV1DbcPoolSubmitBuilder<'_> {
PostStudioV1DbcPoolSubmitBuilder {
client: self,
request: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "postTokensV2VerifyExpressExecute", "`."
)]
pub fn post_tokens_v2_verify_express_execute_builder(
&self,
description: String,
request_id: String,
sender_address: String,
token_id: String,
transaction: String,
twitter_handle: String,
) -> PostTokensV2VerifyExpressExecuteBuilder<'_> {
PostTokensV2VerifyExpressExecuteBuilder {
client: self,
request: TokensV2VerificationExpressExecuteBody::new(
description,
request_id,
sender_address,
token_id,
transaction,
twitter_handle,
),
}
}
#[doc = concat!("Start an additive builder for `", "postTriggerV1CancelOrder", "`.")]
pub fn post_trigger_v1_cancel_order_builder(&self) -> PostTriggerV1CancelOrderBuilder<'_> {
PostTriggerV1CancelOrderBuilder {
client: self,
request: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "postTriggerV1CancelOrders", "`."
)]
pub fn post_trigger_v1_cancel_orders_builder(&self) -> PostTriggerV1CancelOrdersBuilder<'_> {
PostTriggerV1CancelOrdersBuilder {
client: self,
request: None,
}
}
#[doc = concat!("Start an additive builder for `", "postTriggerV1CreateOrder", "`.")]
pub fn post_trigger_v1_create_order_builder(&self) -> PostTriggerV1CreateOrderBuilder<'_> {
PostTriggerV1CreateOrderBuilder {
client: self,
request: None,
}
}
#[doc = concat!(
"Start an additive builder for `", "postTriggerV2DepositCraft", "`."
)]
pub fn post_trigger_v2_deposit_craft_builder(
&self,
amount: String,
input_mint: String,
order_type: PostTriggerV2DepositCraftRequestOrderType,
output_mint: String,
user_address: String,
) -> PostTriggerV2DepositCraftBuilder<'_> {
PostTriggerV2DepositCraftBuilder {
client: self,
request: PostTriggerV2DepositCraftRequest::new(
amount,
input_mint,
order_type,
output_mint,
user_address,
),
}
}
#[doc = concat!("Start an additive builder for `", "postTriggerV2OrdersDca", "`.")]
pub fn post_trigger_v2_orders_dca_builder(
&self,
deposit_request_id: String,
deposit_signed_tx: String,
input_amount: String,
input_mint: String,
interval_seconds: f64,
order_count: f64,
output_mint: String,
user_pubkey: String,
) -> PostTriggerV2OrdersDcaBuilder<'_> {
PostTriggerV2OrdersDcaBuilder {
client: self,
request: PostTriggerV2OrdersDcaRequest::new(
deposit_request_id,
deposit_signed_tx,
input_amount,
input_mint,
interval_seconds,
order_count,
output_mint,
user_pubkey,
),
}
}
#[doc = concat!("Start an additive builder for `", "postTriggerV2OrdersPrice", "`.")]
pub fn post_trigger_v2_orders_price_builder(
&self,
deposit_request_id: String,
deposit_signed_tx: String,
expires_at: f64,
input_amount: String,
input_mint: String,
order_type: PostTriggerV2OrdersPriceRequestOrderType,
output_mint: String,
trigger_mint: String,
user_pubkey: String,
) -> PostTriggerV2OrdersPriceBuilder<'_> {
PostTriggerV2OrdersPriceBuilder {
client: self,
request: PostTriggerV2OrdersPriceRequest::new(
deposit_request_id,
deposit_signed_tx,
expires_at,
input_amount,
input_mint,
order_type,
output_mint,
trigger_mint,
user_pubkey,
),
}
}
#[doc = concat!("Start an additive builder for `", "postUltraV1Execute", "`.")]
pub fn post_ultra_v1_execute_builder(&self) -> PostUltraV1ExecuteBuilder<'_> {
PostUltraV1ExecuteBuilder {
client: self,
request: None,
}
}
#[doc = concat!("Start an additive builder for `", "price-withdraw", "`.")]
pub fn price_withdraw_builder(
&self,
input_or_output: RecurringWithdrawal,
order: String,
user: String,
) -> PriceWithdrawBuilder<'_> {
PriceWithdrawBuilder {
client: self,
request: RecurringWithdrawPriceRecurring::new(input_or_output, order, user),
}
}
}