api is changed
This commit is contained in:
parent
e87060a940
commit
9d0f9f1f34
|
@ -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 {
|
||||
code: -1,
|
||||
|
|
|
@ -21,7 +21,7 @@ pub struct ListGamesRequest {
|
|||
pub struct _ListGamesResponse {
|
||||
pub code: i64,
|
||||
pub msg: Option<String>,
|
||||
pub games: Vec<Game>,
|
||||
pub games: Option<Vec<Game>>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -66,12 +66,21 @@ impl Api {
|
|||
});
|
||||
}
|
||||
|
||||
Ok(models::GetBalanceForUserResponse {
|
||||
balance: r.balance,
|
||||
balance_bota: r.balance_bota,
|
||||
balance_sum: r.balance_sum,
|
||||
companies: r.companies,
|
||||
})
|
||||
if let (Some(balance), Some(balance_bota), Some(balance_sum), Some(companies)) =
|
||||
(r.balance, r.balance_bota, r.balance_sum, r.companies)
|
||||
{
|
||||
Ok(models::GetBalanceForUserResponse {
|
||||
balance,
|
||||
balance_bota,
|
||||
balance_sum,
|
||||
companies,
|
||||
})
|
||||
} else {
|
||||
Err(Error {
|
||||
code: r.code,
|
||||
msg: r.msg,
|
||||
})
|
||||
}
|
||||
}
|
||||
Err(e) => Err(Error {
|
||||
code: -1,
|
||||
|
@ -122,10 +131,17 @@ impl Api {
|
|||
});
|
||||
}
|
||||
|
||||
Ok(models::GetBalanceForPartnerResponse {
|
||||
balance: r.balance,
|
||||
balance_bota: r.balance_bota,
|
||||
})
|
||||
if let (Some(balance), Some(balance_bota)) = (r.balance, r.balance_bota) {
|
||||
Ok(models::GetBalanceForPartnerResponse {
|
||||
balance,
|
||||
balance_bota,
|
||||
})
|
||||
} else {
|
||||
Err(Error {
|
||||
code: r.code,
|
||||
msg: r.msg,
|
||||
})
|
||||
}
|
||||
}
|
||||
Err(e) => Err(Error {
|
||||
code: -1,
|
||||
|
|
|
@ -8,12 +8,12 @@ pub struct GetBalanceForUserRequest {
|
|||
pub struct _GetBalanceForUserResponse {
|
||||
pub code: i64,
|
||||
pub msg: Option<String>,
|
||||
pub balance: i64,
|
||||
pub balance: Option<i64>,
|
||||
#[serde(rename = "balanceBota")]
|
||||
pub balance_bota: i64,
|
||||
pub balance_bota: Option<i64>,
|
||||
#[serde(rename = "balanceSum")]
|
||||
pub balance_sum: i64,
|
||||
pub companies: i64,
|
||||
pub balance_sum: Option<i64>,
|
||||
pub companies: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
@ -32,9 +32,9 @@ pub struct GetBalanceForPartnerRequest {}
|
|||
pub struct _GetBalanceForPartnerResponse {
|
||||
pub code: i64,
|
||||
pub msg: Option<String>,
|
||||
pub balance: i64,
|
||||
pub balance: Option<i64>,
|
||||
#[serde(rename = "balanceBota")]
|
||||
pub balance_bota: i64,
|
||||
pub balance_bota: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
|
9
src/api/vendor/api.rs
vendored
9
src/api/vendor/api.rs
vendored
|
@ -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 {
|
||||
code: -1,
|
||||
|
|
2
src/api/vendor/models.rs
vendored
2
src/api/vendor/models.rs
vendored
|
@ -20,7 +20,7 @@ pub struct ListVendorsRequest {}
|
|||
pub struct _ListVendorsResponse {
|
||||
pub code: i64,
|
||||
pub msg: Option<String>,
|
||||
pub vendors: Vec<Vendor>,
|
||||
pub vendors: Option<Vec<Vendor>>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
Loading…
Reference in New Issue
Block a user