Make player name optional
This commit is contained in:
parent
98f140afff
commit
326da19523
|
@ -27,7 +27,7 @@ struct Player {
|
||||||
// Unwrapping
|
// Unwrapping
|
||||||
|
|
||||||
pub struct PlayerInfoResponse {
|
pub struct PlayerInfoResponse {
|
||||||
pub name: String,
|
pub name: Option<String>,
|
||||||
pub prefix: Option<String>,
|
pub prefix: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ impl QueryUnwrap<PlayerInfoVars> for PlayerInfo {
|
||||||
fn unwrap_response(response: GraphQlResponse<PlayerInfo>) -> Option<PlayerInfoResponse> {
|
fn unwrap_response(response: GraphQlResponse<PlayerInfo>) -> Option<PlayerInfoResponse> {
|
||||||
let player = response.data?.player?;
|
let player = response.data?.player?;
|
||||||
Some(PlayerInfoResponse {
|
Some(PlayerInfoResponse {
|
||||||
name: player.gamer_tag?,
|
name: player.gamer_tag,
|
||||||
prefix: player.prefix.filter(|pr| !pr.is_empty()),
|
prefix: player.prefix.filter(|pr| !pr.is_empty()),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue