api is changed

This commit is contained in:
병준 박 2022-08-19 10:14:06 +00:00
parent e87060a940
commit 9d0f9f1f34
6 changed files with 50 additions and 20 deletions

View File

@ -66,7 +66,14 @@ impl Api {
}); });
} }
Ok(models::ListGamesResponse { games: r.games }) if let Some(games) = r.games {
Ok(models::ListGamesResponse { games })
} else {
Err(Error {
code: r.code,
msg: r.msg,
})
}
} }
Err(e) => Err(Error { Err(e) => Err(Error {
code: -1, code: -1,

View File

@ -21,7 +21,7 @@ pub struct ListGamesRequest {
pub struct _ListGamesResponse { pub struct _ListGamesResponse {
pub code: i64, pub code: i64,
pub msg: Option<String>, pub msg: Option<String>,
pub games: Vec<Game>, pub games: Option<Vec<Game>>,
} }
#[derive(Debug)] #[derive(Debug)]

View File

@ -66,12 +66,21 @@ impl Api {
}); });
} }
Ok(models::GetBalanceForUserResponse { if let (Some(balance), Some(balance_bota), Some(balance_sum), Some(companies)) =
balance: r.balance, (r.balance, r.balance_bota, r.balance_sum, r.companies)
balance_bota: r.balance_bota, {
balance_sum: r.balance_sum, Ok(models::GetBalanceForUserResponse {
companies: r.companies, balance,
}) balance_bota,
balance_sum,
companies,
})
} else {
Err(Error {
code: r.code,
msg: r.msg,
})
}
} }
Err(e) => Err(Error { Err(e) => Err(Error {
code: -1, code: -1,
@ -122,10 +131,17 @@ impl Api {
}); });
} }
Ok(models::GetBalanceForPartnerResponse { if let (Some(balance), Some(balance_bota)) = (r.balance, r.balance_bota) {
balance: r.balance, Ok(models::GetBalanceForPartnerResponse {
balance_bota: r.balance_bota, balance,
}) balance_bota,
})
} else {
Err(Error {
code: r.code,
msg: r.msg,
})
}
} }
Err(e) => Err(Error { Err(e) => Err(Error {
code: -1, code: -1,

View File

@ -8,12 +8,12 @@ pub struct GetBalanceForUserRequest {
pub struct _GetBalanceForUserResponse { pub struct _GetBalanceForUserResponse {
pub code: i64, pub code: i64,
pub msg: Option<String>, pub msg: Option<String>,
pub balance: i64, pub balance: Option<i64>,
#[serde(rename = "balanceBota")] #[serde(rename = "balanceBota")]
pub balance_bota: i64, pub balance_bota: Option<i64>,
#[serde(rename = "balanceSum")] #[serde(rename = "balanceSum")]
pub balance_sum: i64, pub balance_sum: Option<i64>,
pub companies: i64, pub companies: Option<i64>,
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
@ -32,9 +32,9 @@ pub struct GetBalanceForPartnerRequest {}
pub struct _GetBalanceForPartnerResponse { pub struct _GetBalanceForPartnerResponse {
pub code: i64, pub code: i64,
pub msg: Option<String>, pub msg: Option<String>,
pub balance: i64, pub balance: Option<i64>,
#[serde(rename = "balanceBota")] #[serde(rename = "balanceBota")]
pub balance_bota: i64, pub balance_bota: Option<i64>,
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]

View File

@ -60,7 +60,14 @@ impl Api {
}); });
} }
Ok(models::ListVendorsResponse { vendors: r.vendors }) if let Some(vendors) = r.vendors {
Ok(models::ListVendorsResponse { vendors })
} else {
Err(Error {
code: r.code,
msg: r.msg,
})
}
} }
Err(e) => Err(Error { Err(e) => Err(Error {
code: -1, code: -1,

View File

@ -20,7 +20,7 @@ pub struct ListVendorsRequest {}
pub struct _ListVendorsResponse { pub struct _ListVendorsResponse {
pub code: i64, pub code: i64,
pub msg: Option<String>, pub msg: Option<String>,
pub vendors: Vec<Vendor>, pub vendors: Option<Vec<Vendor>>,
} }
#[derive(Debug)] #[derive(Debug)]