fixes for flattened json

This commit is contained in:
Owen LeJeune
2022-09-16 10:10:42 -04:00
parent b1e2902581
commit 2f5b197a81
8 changed files with 19 additions and 17 deletions

View File

@@ -1,9 +1,10 @@
package com.owenlejeune.mydex.api.pokeapi.v2.model.machine package com.owenlejeune.mydex.api.pokeapi.v2.model.machine
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
import com.owenlejeune.mydex.api.Flatten
import com.owenlejeune.mydex.api.pokeapi.v2.model.misc.NameAndUrl import com.owenlejeune.mydex.api.pokeapi.v2.model.misc.NameAndUrl
class MachineDetails( class MachineDetails(
@SerializedName("machine.url") val machineUrl: String, @Flatten("machine.url") val machineUrl: String,
@SerializedName("version_group") val versionGroup: NameAndUrl @SerializedName("version_group") val versionGroup: NameAndUrl
) )

View File

@@ -1,6 +1,7 @@
package com.owenlejeune.mydex.api.pokeapi.v2.model.move package com.owenlejeune.mydex.api.pokeapi.v2.model.move
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
import com.owenlejeune.mydex.api.Flatten
import com.owenlejeune.mydex.api.pokeapi.v2.model.machine.MachineDetails import com.owenlejeune.mydex.api.pokeapi.v2.model.machine.MachineDetails
import com.owenlejeune.mydex.api.pokeapi.v2.model.misc.NameAndUrl import com.owenlejeune.mydex.api.pokeapi.v2.model.misc.NameAndUrl
import com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon.ability.EffectChange import com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon.ability.EffectChange
@@ -16,7 +17,7 @@ class Move (
@SerializedName("pp") val pp: Int, @SerializedName("pp") val pp: Int,
@SerializedName("priority") val priority: Int, @SerializedName("priority") val priority: Int,
@SerializedName("contest_combos") val contestCombos: ContestCombos, @SerializedName("contest_combos") val contestCombos: ContestCombos,
@SerializedName("contest_effect.url") val contestEffectUrl: String, @Flatten("contest_effect.url") val contestEffectUrl: String,
@SerializedName("contest_type") val contestType: NameAndUrl, @SerializedName("contest_type") val contestType: NameAndUrl,
@SerializedName("damage_class") val damageClass: NameAndUrl, @SerializedName("damage_class") val damageClass: NameAndUrl,
@SerializedName("effect_chance") val effectChance: Int, @SerializedName("effect_chance") val effectChance: Int,
@@ -27,7 +28,7 @@ class Move (
@SerializedName("learned_by_pokemon") val learnedByPokemon: List<NameAndUrl>, @SerializedName("learned_by_pokemon") val learnedByPokemon: List<NameAndUrl>,
@SerializedName("machines") val machines: List<MachineDetails>, @SerializedName("machines") val machines: List<MachineDetails>,
@SerializedName("meta") val meta: MoveMeta, @SerializedName("meta") val meta: MoveMeta,
@SerializedName("super_contest_effect.url") val superContestEffectUrl: String, @Flatten("super_contest_effect.url") val superContestEffectUrl: String,
@SerializedName("target") val target: NameAndUrl, @SerializedName("target") val target: NameAndUrl,
@SerializedName("type") val type: NameAndUrl @SerializedName("type") val type: NameAndUrl
) )

View File

@@ -1,10 +1,10 @@
package com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon package com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
import com.owenlejeune.mydex.api.pokeapi.v2.model.misc.NameAndUrl
class PokemonAbility( class PokemonAbility(
@SerializedName("is_hidden") val isHidden: Boolean, @SerializedName("is_hidden") val isHidden: Boolean,
@SerializedName("slot") val slot: Int, @SerializedName("slot") val slot: Int,
@SerializedName("ability.name") val name: String, @SerializedName("ability") val ability: NameAndUrl
@SerializedName("ability.url") val url: String
) )

View File

@@ -1,10 +1,10 @@
package com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon package com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
import com.owenlejeune.mydex.api.pokeapi.v2.model.misc.NameAndUrl
import com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon.move.MoveVersionGroupDetails import com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon.move.MoveVersionGroupDetails
class PokemonMove( class PokemonMove(
@SerializedName("move.name") val name: String, @SerializedName("move") val move: NameAndUrl,
@SerializedName("move.url") val url: String,
@SerializedName("version_group_details") val versionGroupDetails: List<MoveVersionGroupDetails> @SerializedName("version_group_details") val versionGroupDetails: List<MoveVersionGroupDetails>
) )

View File

@@ -1,17 +1,18 @@
package com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon package com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
import com.owenlejeune.mydex.api.Flatten
import com.owenlejeune.mydex.api.pokeapi.v2.model.game.PokedexNumber import com.owenlejeune.mydex.api.pokeapi.v2.model.game.PokedexNumber
import com.owenlejeune.mydex.api.pokeapi.v2.model.location.PalParkEncounter import com.owenlejeune.mydex.api.pokeapi.v2.model.location.PalParkEncounter
import com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon.ability.FlavorTextEntry
import com.owenlejeune.mydex.api.pokeapi.v2.model.misc.* import com.owenlejeune.mydex.api.pokeapi.v2.model.misc.*
import com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon.ability.FlavorTextEntry
class PokemonSpecies( class PokemonSpecies(
@SerializedName("base_happiness") val baseHappiness: Int, @SerializedName("base_happiness") val baseHappiness: Int,
@SerializedName("capture_rate") val captureRate: Int, @SerializedName("capture_rate") val captureRate: Int,
@SerializedName("color") val color: NameAndUrl, @SerializedName("color") val color: NameAndUrl,
@SerializedName("egg_groups") val eggGroups: List<NameAndUrl>, @SerializedName("egg_groups") val eggGroups: List<NameAndUrl>,
@SerializedName("evolution_change.url") val evolutionChangeUrl: String, @Flatten("evolution_chain.url") val evolutionChainUrl: String,
@SerializedName("flavor_text_entries") val flavorTextEntries: List<FlavorTextEntry>, @SerializedName("flavor_text_entries") val flavorTextEntries: List<FlavorTextEntry>,
@SerializedName("form_descriptions") val formDescriptions: List<Description>, @SerializedName("form_descriptions") val formDescriptions: List<Description>,
@SerializedName("forms_switchable") val formsSwitchable: Boolean, @SerializedName("forms_switchable") val formsSwitchable: Boolean,

View File

@@ -1,10 +1,10 @@
package com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon.ability package com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon.ability
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
import com.owenlejeune.mydex.api.pokeapi.v2.model.misc.NameAndUrl
class AbilityPokemon( class AbilityPokemon(
@SerializedName("slot") val slot: Int, @SerializedName("slot") val slot: Int,
@SerializedName("is_hidden") val isHidden: Boolean, @SerializedName("is_hidden") val isHidden: Boolean,
@SerializedName("pokemon.name") val name: String, @SerializedName("pokemon") val name: NameAndUrl,
@SerializedName("pokemon.url") val url: String
) )

View File

@@ -2,11 +2,11 @@ package com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon.characteristic
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
import com.owenlejeune.mydex.api.pokeapi.v2.model.misc.Description import com.owenlejeune.mydex.api.pokeapi.v2.model.misc.Description
import com.owenlejeune.mydex.api.pokeapi.v2.model.misc.NameAndUrl
class Characteristic( class Characteristic(
@SerializedName("id") val id: Int, @SerializedName("id") val id: Int,
@SerializedName("highest_stat.name") val highestStat: String, @SerializedName("highest_stat") val highestStat: NameAndUrl,
@SerializedName("highest_stat.url") val highestStatUrl: String,
@SerializedName("possible_values") val possibleValues: List<Int>, @SerializedName("possible_values") val possibleValues: List<Int>,
@SerializedName("gene_modulo") val geneModulo: Int, @SerializedName("gene_modulo") val geneModulo: Int,
@SerializedName("descriptions") val descriptions: List<Description> @SerializedName("descriptions") val descriptions: List<Description>

View File

@@ -1,11 +1,10 @@
package com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon.move package com.owenlejeune.mydex.api.pokeapi.v2.model.pokemon.move
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
import com.owenlejeune.mydex.api.pokeapi.v2.model.misc.NameAndUrl
class MoveVersionGroupDetails( class MoveVersionGroupDetails(
@SerializedName("level_learned_at") val levelLearnedAt: Int, @SerializedName("level_learned_at") val levelLearnedAt: Int,
@SerializedName("move_learn_method.name") val moveLearnMethod: String, @SerializedName("move_learn_method") val moveLearnMethod: NameAndUrl,
@SerializedName("move_learn_method.url") val moveLearnMethodUrl: String, @SerializedName("version_group") val versionGroup: NameAndUrl,
@SerializedName("version_group.name") val versionGroup: String,
@SerializedName("version_group.url") val versionGroupUrl: String
) )