mirror of
https://github.com/PokeAPI/pokeapi
synced 2025-02-16 12:38:25 +00:00
still need to re-organize v2 docs and work on doc navigation
This commit is contained in:
parent
66370dad44
commit
b1302233aa
17 changed files with 1433 additions and 758 deletions
|
@ -8,28 +8,6 @@
|
|||
url('/static/pokemon/fonts/lato-regular/lato-regular.svg#svgFontName') format('svg');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Lato';
|
||||
font-weight: 300;
|
||||
src: url('/static/pokemon/fonts/lato-regular/lato-light.eot');
|
||||
src: url('/static/pokemon/fonts/lato-regular/lato-light.eot?#iefix') format('embedded-opentype'),
|
||||
url('/static/pokemon/fonts/lato-regular/lato-light.woff2') format('woff2'),
|
||||
url('/static/pokemon/fonts/lato-regular/lato-light.woff') format('woff'),
|
||||
url('/static/pokemon/fonts/lato-regular/lato-light.ttf') format('truetype'),
|
||||
url('/static/pokemon/fonts/lato-regular/lato-light.svg#svgFontName') format('svg');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Lato';
|
||||
font-weight: 900;
|
||||
src: url('/static/pokemon/fonts/lato-regular/lato-black.eot');
|
||||
src: url('/static/pokemon/fonts/lato-regular/lato-black.eot?#iefix') format('embedded-opentype'),
|
||||
url('/static/pokemon/fonts/lato-regular/lato-black.woff2') format('woff2'),
|
||||
url('/static/pokemon/fonts/lato-regular/lato-black.woff') format('woff'),
|
||||
url('/static/pokemon/fonts/lato-regular/lato-black.ttf') format('truetype'),
|
||||
url('/static/pokemon/fonts/lato-regular/lato-black.svg#svgFontName') format('svg');
|
||||
}
|
||||
|
||||
html { padding-top: 50px; }
|
||||
|
||||
body, h1, h2, h3, h4, h5, h6, p {
|
||||
|
@ -48,7 +26,7 @@ h2 { margin-bottom: 10px; }
|
|||
|
||||
a { color: #1b95e0; }
|
||||
|
||||
p, pre, table {
|
||||
p, pre, table, ul {
|
||||
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
@ -62,7 +40,6 @@ hr {
|
|||
border-width: 1px;
|
||||
border-color: #CCC;
|
||||
margin: 8px 0;
|
||||
/*height: 1px;*/
|
||||
}
|
||||
|
||||
.center-block {
|
||||
|
@ -259,7 +236,20 @@ pre {
|
|||
* DOCS
|
||||
*/
|
||||
|
||||
#docs h1:first-of-type, #docs table:first-of-type {
|
||||
#docs .header {
|
||||
|
||||
padding-top: 80px;
|
||||
}
|
||||
|
||||
#docs .nav-group.stick {
|
||||
|
||||
position: fixed;
|
||||
top: 65px;
|
||||
}
|
||||
|
||||
|
||||
/*#docs table:first-of-type*/
|
||||
#docs h1#pokeapi-v2-api-reference {
|
||||
|
||||
display: none;
|
||||
}
|
||||
|
@ -289,8 +279,8 @@ pre {
|
|||
|
||||
#docs h2, #docs h4, #docs #resourcename {
|
||||
|
||||
margin-top: -50px;
|
||||
padding-top: 50px;
|
||||
margin-top: -65px;
|
||||
padding-top: 65px;
|
||||
}
|
||||
|
||||
#docs h3 {
|
||||
|
@ -303,14 +293,25 @@ pre {
|
|||
display: none;
|
||||
}
|
||||
|
||||
#docs ul {
|
||||
#docs .side-nav ul {
|
||||
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#docs ul.version-select li {
|
||||
#docs .side-nav hr {
|
||||
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
#docs .side-nav ul.version-select {
|
||||
|
||||
-webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.2);
|
||||
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
#docs .side-nav ul.version-select li {
|
||||
|
||||
display: inline-block;
|
||||
float: left;
|
||||
|
@ -331,6 +332,13 @@ pre {
|
|||
color: #FFF;
|
||||
}
|
||||
|
||||
#docs pre {
|
||||
|
||||
min-height: 280px;
|
||||
max-height: 280px;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
#docs pre:before {
|
||||
|
||||
font-size: 12px;
|
||||
|
|
|
@ -26,13 +26,13 @@ urlpatterns = [
|
|||
|
||||
url(r'^$', 'config.views.home'),
|
||||
|
||||
url(r'^docs/$',
|
||||
TemplateView.as_view(template_name='docs.html'),
|
||||
url(r'^docsv1/$',
|
||||
TemplateView.as_view(template_name='docsv1.html'),
|
||||
name="documentation"
|
||||
),
|
||||
|
||||
url(r'^docs2/$',
|
||||
TemplateView.as_view(template_name='docs2.html'),
|
||||
url(r'^docsv2/$',
|
||||
TemplateView.as_view(template_name='docsv2.html'),
|
||||
name="documentation_v2"
|
||||
),
|
||||
|
||||
|
|
151
config/views.py
151
config/views.py
|
@ -37,7 +37,7 @@ def _total_site_data():
|
|||
# )
|
||||
|
||||
|
||||
# v2
|
||||
# v2 Sorry for the brute force. Theres probably a better way to do this.
|
||||
data = dict (
|
||||
abilities=Ability.objects.count(),
|
||||
abilitie_names=AbilityName.objects.count(),
|
||||
|
@ -45,25 +45,20 @@ def _total_site_data():
|
|||
abilities_flavor_texts=AbilityFlavorText.objects.count(),
|
||||
abilities_changes=AbilityChange.objects.count(),
|
||||
abilities_change_effect_texts=AbilityChangeEffectText.objects.count(),
|
||||
|
||||
berries=Berry.objects.count(),
|
||||
berry_flavors=BerryFlavor.objects.count(),
|
||||
berry_firmnesses=BerryFirmness.objects.count(),
|
||||
berry_firmness_names=BerryFirmnessName.objects.count(),
|
||||
|
||||
characteristic=Characteristic.objects.count(),
|
||||
characteristics=Characteristic.objects.count(),
|
||||
characteristic_descriptions=CharacteristicDescription.objects.count(),
|
||||
|
||||
contest_combos=ContestCombo.objects.count(),
|
||||
contest_types=ContestType.objects.count(),
|
||||
contest_type_names=ContestTypeName.objects.count(),
|
||||
contest_effects=ContestEffect.objects.count(),
|
||||
contest_effect_texts=ContestEffectEffectText.objects.count(),
|
||||
contest_effect_flavor_texts=ContestEffectFlavorText.objects.count(),
|
||||
|
||||
egg_groups=EggGroup.objects.count(),
|
||||
egg_group_names=EggGroupName.objects.count(),
|
||||
|
||||
encounter_methods=EncounterMethod.objects.count(),
|
||||
encounter_method_names=EncounterMethodName.objects.count(),
|
||||
encounter_conditions=EncounterCondition.objects.count(),
|
||||
|
@ -73,51 +68,38 @@ def _total_site_data():
|
|||
encounter_condition_value_maps=EncounterConditionValueMap.objects.count(),
|
||||
encounter_slots=EncounterSlot.objects.count(),
|
||||
encounters=Encounter.objects.count(),
|
||||
|
||||
evolution_chain=EvolutionChain.objects.count(),
|
||||
evolution_trigger=EvolutionTrigger.objects.count(),
|
||||
evolution_chains=EvolutionChain.objects.count(),
|
||||
evolution_triggers=EvolutionTrigger.objects.count(),
|
||||
evolution_trigger_names=EvolutionTriggerName.objects.count(),
|
||||
|
||||
experiences=Experience.objects.count(),
|
||||
|
||||
generations=Generation.objects.count(),
|
||||
generation_names=GenerationName.objects.count(),
|
||||
gender=Gender.objects.count(),
|
||||
|
||||
growth_rate=GrowthRate.objects.count(),
|
||||
genders=Gender.objects.count(),
|
||||
growth_rates=GrowthRate.objects.count(),
|
||||
growth_rate_descriptions=GrowthRateDescription.objects.count(),
|
||||
|
||||
items=Item.objects.count(),
|
||||
item_names=ItemName.objects.count(),
|
||||
item_effect_texts=ItemEffectText.objects.count(),
|
||||
item_categories=ItemCategory.objects.count(),
|
||||
item_category_names=ItemCategoryName.objects.count(),
|
||||
|
||||
item_attributes=ItemAttribute.objects.count(),
|
||||
item_attribute_maps=ItemAttributeMap.objects.count(),
|
||||
item_attribute_descriptions=ItemAttributeDescription.objects.count(),
|
||||
item_flavor_texts=ItemFlavorText.objects.count(),
|
||||
|
||||
item_fling_effects=ItemFlingEffect.objects.count(),
|
||||
item_fling_effect_effect_texts=ItemFlingEffectEffectText.objects.count(),
|
||||
|
||||
|
||||
item_pockets=ItemPocket.objects.count(),
|
||||
item_pocket_names=ItemPocketName.objects.count(),
|
||||
item_game_indexes=ItemGameIndex.objects.count(),
|
||||
|
||||
languages=Language.objects.count(),
|
||||
language_names=LanguageName.objects.count(),
|
||||
|
||||
locations=Location.objects.count(),
|
||||
location_game_indexes=LocationGameIndex.objects.count(),
|
||||
location_names=LocationName.objects.count(),
|
||||
location_areas=LocationArea.objects.count(),
|
||||
location_area_names=LocationAreaName.objects.count(),
|
||||
location_area_encounter_rates=LocationAreaEncounterRate.objects.count(),
|
||||
|
||||
machines=Machine.objects.count(),
|
||||
|
||||
moves=Move.objects.count(),
|
||||
move_names=MoveName.objects.count(),
|
||||
move_changes=MoveChange.objects.count(),
|
||||
|
@ -143,30 +125,115 @@ def _total_site_data():
|
|||
move_targets=MoveTarget.objects.count(),
|
||||
move_target_descriptions=MoveTargetDescription.objects.count(),
|
||||
move_state_changes=MoveMetaStatChange.objects.count(),
|
||||
|
||||
natures=Nature.objects.count(),
|
||||
nature_names=NatureName.objects.count(),
|
||||
nature_pokeathlon_stats=NaturePokeathlonStat.objects.count(),
|
||||
nature_battle_style_preference=NatureBattleStylePreference.objects.count(),
|
||||
pal_park_areas=PalParkArea.objects.count(),
|
||||
pokedexes=Pokedex.objects.count(),
|
||||
pokemon=Pokemon.objects.count(),
|
||||
pokemon_colors=PokemonColor.objects.count(),
|
||||
pokemon_forms=PokemonForm.objects.count(),
|
||||
pokemon_habitats=PokemonHabitat.objects.count(),
|
||||
pokemon_shapes=PokemonShape.objects.count(),
|
||||
pokemon_species=PokemonSpecies.objects.count(),
|
||||
pal_park_area_names=PalParkAreaName.objects.count(),
|
||||
pal_parks=PalPark.objects.count(),
|
||||
pokeathlon_stat_names=PokeathlonStatName.objects.count(),
|
||||
pokeathlon_stats=PokeathlonStat.objects.count(),
|
||||
region=Region.objects.count(),
|
||||
stat=Stat.objects.count(),
|
||||
pokedexes=PokedexVersionGroup.objects.count(),
|
||||
pokedex_descriptions=PokedexDescription.objects.count(),
|
||||
pokedex_version_groups=PokedexVersionGroup.objects.count(),
|
||||
pokemon=Pokemon.objects.count(),
|
||||
pokemon_abilities=PokemonAbility.objects.count(),
|
||||
pokemon_colors=PokemonColor.objects.count(),
|
||||
pokemon_names=PokemonColorName.objects.count(),
|
||||
pokemon_dex_numbers=PokemonDexNumber.objects.count(),
|
||||
pokemon_egg_groups=PokemonEggGroup.objects.count(),
|
||||
pokemon_evolutions=PokemonEvolution.objects.count(),
|
||||
pokemon_forms=PokemonForm.objects.count(),
|
||||
pokemon_form_names=PokemonFormName.objects.count(),
|
||||
pokemon_form_generations=PokemonFormGeneration.objects.count(),
|
||||
pokemon_game_indices=PokemonGameIndex.objects.count(),
|
||||
pokemon_habitats=PokemonHabitat.objects.count(),
|
||||
pokemon_habitat_names=PokemonHabitatName.objects.count(),
|
||||
pokemon_items=PokemonItem.objects.count(),
|
||||
pokemon_moves=PokemonMove.objects.count(),
|
||||
pokemon_shapes=PokemonShape.objects.count(),
|
||||
pokemon_shape_names=PokemonShapeName.objects.count(),
|
||||
pokemon_species=PokemonSpecies.objects.count(),
|
||||
pokemon_species_names=PokemonSpeciesName.objects.count(),
|
||||
pokemon_descriptions=PokemonSpeciesDescription.objects.count(),
|
||||
pokemon_flavor_texts=PokemonSpeciesFlavorText.objects.count(),
|
||||
pokemon_stat=PokemonStat.objects.count(),
|
||||
pokemon_type=PokemonType.objects.count(),
|
||||
regions=Region.objects.count(),
|
||||
region_names=RegionName.objects.count(),
|
||||
stats=Stat.objects.count(),
|
||||
stat_names=StatName.objects.count(),
|
||||
super_contest_effects=SuperContestEffect.objects.count(),
|
||||
super_contest_combos=SuperContestCombo.objects.count(),
|
||||
super_contest_effect_flavor_texts=SuperContestEffectFlavorText.objects.count(),
|
||||
types=Type.objects.count(),
|
||||
type_names=TypeName.objects.count(),
|
||||
type_game_indices=TypeGameIndex.objects.count(),
|
||||
type_efficacy=TypeEfficacy.objects.count(),
|
||||
versions=Version.objects.count(),
|
||||
version_groups=VersionGroup.objects.count()
|
||||
version_names=VersionName.objects.count(),
|
||||
version_groups=VersionGroup.objects.count(),
|
||||
version_group_move_learn_methods=VersionGroupMoveLearnMethod.objects.count(),
|
||||
version_group_regions=VersionGroupRegion.objects.count(),
|
||||
)
|
||||
|
||||
t = 0
|
||||
lines = 0
|
||||
for i in data.iteritems():
|
||||
t += i[1]
|
||||
lines += i[1]
|
||||
|
||||
data['total_items'] = t
|
||||
resources = 0
|
||||
resources += data['abilities'];
|
||||
resources += data['berries'];
|
||||
resources += data['berry_flavors'];
|
||||
resources += data['berry_firmnesses'];
|
||||
resources += data['characteristics'];
|
||||
resources += data['contest_types'];
|
||||
resources += data['contest_effects'];
|
||||
resources += data['egg_groups'];
|
||||
resources += data['encounter_methods'];
|
||||
resources += data['encounter_conditions'];
|
||||
resources += data['encounter_condition_values'];
|
||||
resources += data['evolution_chains'];
|
||||
resources += data['evolution_triggers'];
|
||||
resources += data['generations'];
|
||||
resources += data['genders'];
|
||||
resources += data['growth_rates'];
|
||||
resources += data['items'];
|
||||
resources += data['item_attributes'];
|
||||
resources += data['item_categories'];
|
||||
resources += data['item_fling_effects'];
|
||||
resources += data['item_pockets'];
|
||||
resources += data['languages'];
|
||||
resources += data['locations'];
|
||||
resources += data['location_areas'];
|
||||
resources += data['moves'];
|
||||
resources += data['move_ailments'];
|
||||
resources += data['move_categories'];
|
||||
resources += data['move_battle_styles'];
|
||||
resources += data['move_damage_classes'];
|
||||
resources += data['move_learn_methods'];
|
||||
resources += data['move_targets'];
|
||||
resources += data['natures'];
|
||||
resources += data['pal_park_areas'];
|
||||
resources += data['pokedexes'];
|
||||
resources += data['pokemon'];
|
||||
resources += data['pokemon_colors'];
|
||||
resources += data['pokemon_forms'];
|
||||
resources += data['pokemon_habitats'];
|
||||
resources += data['pokemon_shapes'];
|
||||
resources += data['pokemon_species'];
|
||||
resources += data['pokeathlon_stats'];
|
||||
resources += data['regions'];
|
||||
resources += data['stats'];
|
||||
resources += data['super_contest_effects'];
|
||||
resources += data['types'];
|
||||
resources += data['versions'];
|
||||
resources += data['version_groups'];
|
||||
|
||||
|
||||
data['total_lines'] = lines
|
||||
data['total_resources'] = resources
|
||||
|
||||
return data
|
||||
|
||||
|
@ -184,15 +251,17 @@ def about(request):
|
|||
site_data = _total_site_data()
|
||||
|
||||
total_views = ResourceView.objects.total_count()
|
||||
total_v1_views = ResourceView.objects.total_count(version=1)
|
||||
total_v2_views = ResourceView.objects.total_count(version=2)
|
||||
|
||||
# average_day = int(round(total_views / ResourceView.objects.count()))
|
||||
|
||||
average_day = 0;
|
||||
average_day = int(round(total_views / ResourceView.objects.count()))
|
||||
|
||||
return render_to_response(
|
||||
'about.html',
|
||||
{
|
||||
'total': total_views,
|
||||
'total_v1': total_v1_views,
|
||||
'total_v2': total_v2_views,
|
||||
'average_day': average_day,
|
||||
'site_data': site_data,
|
||||
},
|
||||
|
|
25
hits/migrations/0002_resourceviewv2.py
Normal file
25
hits/migrations/0002_resourceviewv2.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('hits', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ResourceViewV2',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('count', models.IntegerField(default=0, max_length=1000)),
|
||||
('date', models.DateField(auto_now=True)),
|
||||
],
|
||||
options={
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
]
|
17
hits/migrations/0003_delete_resourceviewv2.py
Normal file
17
hits/migrations/0003_delete_resourceviewv2.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('hits', '0002_resourceviewv2'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.DeleteModel(
|
||||
name='ResourceViewV2',
|
||||
),
|
||||
]
|
20
hits/migrations/0004_resourceview_version.py
Normal file
20
hits/migrations/0004_resourceview_version.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('hits', '0003_delete_resourceviewv2'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='resourceview',
|
||||
name='version',
|
||||
field=models.IntegerField(default=0, max_length=1000),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
20
hits/migrations/0005_auto_20160107_0231.py
Normal file
20
hits/migrations/0005_auto_20160107_0231.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('hits', '0004_resourceview_version'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='resourceview',
|
||||
name='version',
|
||||
field=models.IntegerField(default=1, max_length=1),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
|
@ -5,20 +5,28 @@ from datetime import date, timedelta
|
|||
|
||||
class ViewManager(models.Manager):
|
||||
|
||||
def increment_view_count(self):
|
||||
def increment_view_count(self, version):
|
||||
|
||||
view, _ = ResourceView.objects.get_or_create(
|
||||
version=version,
|
||||
date=date.today()
|
||||
)
|
||||
|
||||
view.count = view.count + 1
|
||||
|
||||
print view
|
||||
|
||||
view.save()
|
||||
|
||||
def total_count(self):
|
||||
def total_count(self, version=0):
|
||||
|
||||
if version:
|
||||
objects = ResourceView.objects.filter(version=version)
|
||||
else:
|
||||
objects = ResourceView.objects.all()
|
||||
|
||||
t = 0
|
||||
for v in ResourceView.objects.all():
|
||||
for v in objects:
|
||||
t += v.count
|
||||
|
||||
return t
|
||||
|
@ -32,5 +40,6 @@ class ResourceView(models.Model):
|
|||
return str(self.date) + ' - ' + str(self.count)
|
||||
|
||||
count = models.IntegerField(max_length=1000, default=0)
|
||||
|
||||
version = models.IntegerField(max_length=1, default=1)
|
||||
date = models.DateField(auto_now=True)
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class PokemonResource(ModelResource):
|
|||
return lst
|
||||
|
||||
def dehydrate(self, bundle):
|
||||
ResourceView.objects.increment_view_count()
|
||||
ResourceView.objects.increment_view_count(version=1)
|
||||
bundle.data['name'] = bundle.obj.name.capitalize()
|
||||
bundle.data['abilities'] = bundle.obj.ability_list
|
||||
bundle.data['types'] = bundle.obj.type_list
|
||||
|
@ -93,7 +93,7 @@ class TypeResource(ModelResource):
|
|||
cache = SimpleCache(timeout=360)
|
||||
|
||||
def dehydrate(self, bundle):
|
||||
ResourceView.objects.increment_view_count()
|
||||
ResourceView.objects.increment_view_count(version=1)
|
||||
bundle.data['name'] = bundle.obj.name.capitalize()
|
||||
bundle.data['weakness'] = bundle.obj.weaknesses
|
||||
bundle.data['resistance'] = bundle.obj.resistances
|
||||
|
@ -113,7 +113,7 @@ class AbilityResource(ModelResource):
|
|||
cache = SimpleCache(timeout=360)
|
||||
|
||||
def dehydrate(self, bundle):
|
||||
ResourceView.objects.increment_view_count()
|
||||
ResourceView.objects.increment_view_count(version=1)
|
||||
bundle.data['name'] = bundle.obj.name.capitalize()
|
||||
bundle.data['description'] = unicode(bundle.obj.description)
|
||||
return bundle
|
||||
|
@ -129,7 +129,7 @@ class GameResource(ModelResource):
|
|||
cache = SimpleCache(timeout=360)
|
||||
|
||||
def dehydrate(self, bundle):
|
||||
ResourceView.objects.increment_view_count()
|
||||
ResourceView.objects.increment_view_count(version=1)
|
||||
bundle.data['name'] = bundle.obj.name.capitalize()
|
||||
return bundle
|
||||
|
||||
|
@ -144,7 +144,7 @@ class SpriteResource(ModelResource):
|
|||
cache = SimpleCache(timeout=360)
|
||||
|
||||
def dehydrate(self, bundle):
|
||||
ResourceView.objects.increment_view_count()
|
||||
ResourceView.objects.increment_view_count(version=1)
|
||||
bundle.data['name'] = bundle.obj.name.capitalize()
|
||||
bundle.data['pokemon'] = bundle.obj.pokemon
|
||||
return bundle
|
||||
|
@ -160,7 +160,7 @@ class DescriptionResource(ModelResource):
|
|||
cache = SimpleCache(timeout=360)
|
||||
|
||||
def dehydrate(self, bundle):
|
||||
ResourceView.objects.increment_view_count()
|
||||
ResourceView.objects.increment_view_count(version=1)
|
||||
bundle.data['name'] = bundle.obj.name.capitalize()
|
||||
bundle.data['games'] = bundle.obj.n_game
|
||||
bundle.data['pokemon'] = bundle.obj.pokemon
|
||||
|
@ -177,7 +177,7 @@ class EggResource(ModelResource):
|
|||
cache = SimpleCache(timeout=360)
|
||||
|
||||
def dehydrate(self, bundle):
|
||||
ResourceView.objects.increment_view_count()
|
||||
ResourceView.objects.increment_view_count(version=1)
|
||||
bundle.data['name'] = bundle.obj.name.capitalize()
|
||||
bundle.data['pokemon'] = bundle.obj.pokemon
|
||||
return bundle
|
||||
|
@ -193,6 +193,6 @@ class MoveResource(ModelResource):
|
|||
cache = SimpleCache(timeout=360)
|
||||
|
||||
def dehydrate(self, bundle):
|
||||
ResourceView.objects.increment_view_count()
|
||||
ResourceView.objects.increment_view_count(version=1)
|
||||
bundle.data['name'] = bundle.obj.name.capitalize()
|
||||
return bundle
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.shortcuts import get_object_or_404
|
|||
from .models import *
|
||||
from .serializers import *
|
||||
import re
|
||||
from hits.models import ResourceView
|
||||
|
||||
|
||||
###########################
|
||||
|
@ -50,8 +51,14 @@ class NameOrIdRetrieval():
|
|||
|
||||
return resp
|
||||
|
||||
class IncrementingReadOnlyModelViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
|
||||
class PokeapiCommonViewset(ListOrDetailSerialRelation, NameOrIdRetrieval, viewsets.ReadOnlyModelViewSet):
|
||||
def retrieve(self, request, *args, **kwargs):
|
||||
ResourceView.objects.increment_view_count(version=2)
|
||||
return super(IncrementingReadOnlyModelViewSet, self).retrieve(self, request, *args, **kwargs)
|
||||
|
||||
|
||||
class PokeapiCommonViewset(ListOrDetailSerialRelation, NameOrIdRetrieval, IncrementingReadOnlyModelViewSet):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -219,20 +226,13 @@ class LocationResource(PokeapiCommonViewset):
|
|||
list_serializer_class = LocationSummarySerializer
|
||||
|
||||
|
||||
class LocationAreaResource(ListOrDetailSerialRelation, viewsets.ReadOnlyModelViewSet):
|
||||
class LocationAreaResource(ListOrDetailSerialRelation, IncrementingReadOnlyModelViewSet):
|
||||
|
||||
queryset = LocationArea.objects.all()
|
||||
serializer_class = LocationAreaDetailSerializer
|
||||
list_serializer_class = LocationAreaSummarySerializer
|
||||
|
||||
|
||||
# class MachineResource(PokeapiCommonViewset):
|
||||
|
||||
# queryset = Machine.objects.all()
|
||||
# serializer_class = MachineDetailSerializer
|
||||
# list_serializer_class = MachineSummarySerializer
|
||||
|
||||
|
||||
class MoveResource(PokeapiCommonViewset):
|
||||
|
||||
queryset = Move.objects.all()
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<ul class="nav navbar-nav">
|
||||
<li><a href="/">Home</a></li>
|
||||
<li class="active"><a href="#">About</a></li>
|
||||
<li><a href="/docs/">Documentation</a></li>
|
||||
<li><a href="/docsv2/">Documentation</a></li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
|
@ -44,7 +44,7 @@
|
|||
</p>
|
||||
<div class="well">
|
||||
<p>
|
||||
This website provides a RESTful API interface to <b>{{ site_data.total_items|intcomma }}</b> objects
|
||||
This website provides a RESTful API interface to <b>{{ site_data.total_resources|intcomma }}</b> highly detailed objects built from <b>{{ site_data.total_lines|intcomma }}</b> lines of data
|
||||
related to <a href="https://en.wikipedia.org/wiki/Pokemon">Pokémon</a>. We specifically cover the video game franchise, though we'd like to cover the card game too. Using this website you can consume information on Pokémon, their moves, abilities, types, egg groups and much much more.
|
||||
</p>
|
||||
</div>
|
||||
|
@ -92,22 +92,22 @@
|
|||
</p>
|
||||
<div class="well">
|
||||
<p>
|
||||
I'm glad you asked because we've got an impressive amount of data!
|
||||
We're glad you asked because we've got an impressive amount of data!
|
||||
</p>
|
||||
<p>
|
||||
We currently have <b>{{ site_data.total_items|intcomma }}</b> individual items in our database:
|
||||
</p>
|
||||
<ul>
|
||||
<li>{{ site_data.pokemon }} Pokémon</li>
|
||||
<li>{{ site_data.moves }} Moves</li>
|
||||
<li>{{site_data.move_pokes|intcomma }} Pokémon<->move links</li>
|
||||
<li>{{ site_data.abilities }} Abilities</li>
|
||||
<li>{{ site_data.types }} Types</li>
|
||||
<li>{{ site_data.egg_groups }} Egg groups</li>
|
||||
<li>{{ site_data.descriptions }} Descriptions</li>
|
||||
<li>{{ site_data.sprites }} Sprites</li>
|
||||
<li>{{ site_data.games }} Games</li>
|
||||
<li>{{ site_data.versions }} Versions </li>
|
||||
<li>{{ site_data.items }} Items</li>
|
||||
<li>{{ site_data.pokedexes }} Pokedexes</li>
|
||||
<li>{{ site_data.pokemon }} Pokémon (includes various forms)</li>
|
||||
</ul>
|
||||
<p>And that's just scratching the surface!</p>
|
||||
<p class="lead">The server has processed <b>{{ total|intcomma }}</b> api calls at an average of <b>{{ average_day|intcomma }}</b> calls per day.</p>
|
||||
</div>
|
||||
<p class="lead">
|
||||
|
@ -115,7 +115,7 @@
|
|||
</p>
|
||||
<div class="well">
|
||||
<p>
|
||||
I know! Feel free to contribute to open issues on <a href="https://github.com/phalt/pokeapi/">GitHub</a>.
|
||||
We know! Feel free to contribute to open issues on <a href="https://github.com/phalt/pokeapi/">GitHub</a>.
|
||||
</p>
|
||||
</div>
|
||||
<p class="lead">
|
||||
|
@ -124,21 +124,26 @@
|
|||
<div class="well">
|
||||
<p>
|
||||
Pokémon V1 was created by <a href="">Paul Hallett</a> as a weekend project but it quickly became more than a weekend's
|
||||
worth of work. In December of 2014 Paul went open source with the project to begin work on V2.
|
||||
Enter <a href="">Zane Adickes</a>. Zane thought the original project was a fantastic idea and wanted to help it grow.
|
||||
With direction from Paul, Zane created the V2 api using an exact mirror of <a href="">Veekun's</a> data
|
||||
from their <a href="">pokedex</a> project. That's not to say there hasn't been any help from others. Don't shy away
|
||||
from jumping in and helping the project in any way you can!
|
||||
<br>
|
||||
Contributors:
|
||||
worth of work. In <a href="http://phalt.co/if-you-have-data-they-will-consume-it/" target="none">December of 2014</a> Paul deprecated V1 in favor of working on V2.
|
||||
This is where <a href="http://github.com/zaneadix">Zane Adickes</a> jumped in. Zane thought the original project was a fantastic idea and wanted to help it grow.
|
||||
With direction from Paul, Zane created the V2 api using an exact mirror of <a href="">Veekun's</a> data related to the main series of games.
|
||||
</p>
|
||||
<p>
|
||||
I gathered the information on this site from various resources:
|
||||
This is not to say there hasn't been any help from others. Don't shy away from jumping in and helping the project in any way you can. We're sure there are plenty of ways we can improve the api that haven't been thought of yet!
|
||||
<br><br>
|
||||
Contributors:
|
||||
</p>
|
||||
</div>
|
||||
<p class="lead">
|
||||
Whered you get all of this data?
|
||||
</p>
|
||||
<div class="well">
|
||||
<p>
|
||||
We gathered the information on this site from various resources:
|
||||
</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/veekun">Veekun</a> had a huge bunch of CSV's that
|
||||
I used to build most of the data on the site.</li>
|
||||
<li><a href="http://bulbapedia.bulbagarden.net/wiki/Main_Page">Bulbapedia</a> has a tonne of extra information that proved useful when designing the data model.</li>
|
||||
<li><a href="https://github.com/veekun" target="none">Veekun</a> has a fantastic <a href="http://veekun.com/dex" target="none">Pokedex</a> which is also an open source <a href="https://github.com/veekun/pokedex" target="none">project</a> containing a ton of csv data. We used this to flesh out the database that powers Pokeapi.</li>
|
||||
<li><a href="http://bulbapedia.bulbagarden.net/wiki/Main_Page" target="none">Bulbapedia</a> has a tonne of extra information that proved useful when designing models and documenting resources.</li>
|
||||
</ul>
|
||||
<p>
|
||||
I'd also like to thank:
|
||||
|
@ -152,12 +157,11 @@
|
|||
</p>
|
||||
<div class="well">
|
||||
<p>
|
||||
The website framework is <a href="http://djangoproject.com">Django</a>,
|
||||
a super awesome framework built around <a hre="http://python.org">Python</a>.<br />
|
||||
We use a <a href="www.postgresql.org">Postgres</a> database to store all our data.<br />
|
||||
We use <a href="http://django-tastypie.readthedocs.org/en/latest/">Django-tastypie</a> to expose our data through a RESTful API.<br />
|
||||
We're hosted on <a href="https://www.digitalocean.com/?refcode=eab2fea41bc6
|
||||
">DigitalOcean</a> servers, click the link to help keep the site running!.
|
||||
The website framework is <a href="http://djangoproject.com" target="none">Django</a>,
|
||||
a super awesome framework built around <a hre="http://python.org" target="none">Python</a>.<br />
|
||||
We use a <a href="www.postgresql.org" target="none">Postgres</a> database to store all our data.<br />
|
||||
We use <a href="http://www.django-rest-framework.org/" target="none">Django REST Framework</a> to expose our data through a RESTful API.<br />
|
||||
We're hosted on <a href="https://www.digitalocean.com/?refcode=eab2fea41bc6" target="none">DigitalOcean</a> servers, click the link to help keep the site running!.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,540 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block mainbody %}
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="navbar-brand">
|
||||
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://pokeapi.co" data-text="Pokéapi - the Pokémon RESTful API " data-via="phalt_" data-related="phalt_">Tweet</a>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse navbar-right">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/about/">About</a></li>
|
||||
<li class="active"><a href="#">Documentation</a></li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container bs-docs">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
<div class="header col-md-8">
|
||||
<h1>Pokéapi Documentation</h1>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
</div><!-- /.header row -->
|
||||
<div class="row pad_top">
|
||||
<div class="col-md-3">
|
||||
<div class="affix visible-md visible-lg" data-spy="affix" data-offset="200" style="position: fixed">
|
||||
<ul class="nav">
|
||||
<li><a href="#info">Information</a></li>
|
||||
<li><a href="#wrap">Wrappers</a></li>
|
||||
<li><a href="#pokedex">Pokedex</a></li>
|
||||
<li><a href="#pokemon">Pokemon</a></li>
|
||||
<li><a href="#types">Types</a></li>
|
||||
<li><a href="#moves">Moves</a></li>
|
||||
<li><a href="#abilities">Abilities</a></li>
|
||||
<li><a href="#eggs">Egg groups</a></li>
|
||||
<li><a href="#description">Descriptions</a></li>
|
||||
<li><a href="#sprites">Sprites</a></li>
|
||||
<li><a href="#game">Games</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div id="info" style="padding-top:30px"></div>
|
||||
<hr>
|
||||
<h1>Information</h1>
|
||||
<p class="lead">Please take note when using this API:</p>
|
||||
<ul>
|
||||
<li>This is a <b>consumption-only</b> API - only the HTTP GET method is available on resources.</li>
|
||||
<li><b>No authentication</b> is required to access this API. All resources are fully open and available.</li>
|
||||
<ul>
|
||||
<li>There is, however, a daily rate limit of 300 requests <b>per resource</b> per IP address. So a single IP address can call the <i>bulbasaur</i> resource 300 times a day. Not 300 requests across the entire dataset! This is to stop our database from falling over under heavy load.</li>
|
||||
</ul>
|
||||
<li>If you are going to be regularly using the API, I recommend caching data on your service.</li>
|
||||
<ul>
|
||||
<li>Luckily, we provide <b>modified/created datetime stamps</b> on every single resource so you can check for updates (and thus make your caching efficient).</li>
|
||||
</ul>
|
||||
</ul>
|
||||
<div id="wrap" style="padding-top:30px"></div>
|
||||
<hr>
|
||||
<h1>Wrappers</h1>
|
||||
<p class="lead">Wrappers for these languages have been made:</p>
|
||||
<ul>
|
||||
<li><b>Python</b> - <a href="http://github.com/phalt/pykemon">Pykemon</a> by Paul Hallett.</li>
|
||||
<li><b>.NET</b> - <a href="https://github.com/PoroCYon/PokeApi.NET">PokeAPI.NET</a> by PoroCYon.</li>
|
||||
<li><b>Racket</b> - <a href="https://github.com/scottlindeman/racketmon">Racketmon</a> by Scott Lindeman.</li>
|
||||
<li><b>Java</b> - <a href="https://github.com/mickeyjk/PokeJava">PokeJava</a> by Mickeyjk.</li>
|
||||
<li><b>Ruby</b> - <a href='https://github.com/baweaver/pokegem'>Pokegem</a> by Brandon Weaver.</li>
|
||||
<li><b>Node</b> - <a href='https://github.com/TheIronDeveloper/pokeapi-node-wrapper'>PokeApi Node Wrapper</a> by Tyler Stark.</li>
|
||||
</ul>
|
||||
<p>Written a wrapper? Let us know and we'll add it to the list here.</p>
|
||||
<div id="pokedex" style="padding-top:30px"></div>
|
||||
<hr>
|
||||
<h1>Pokedex</h1>
|
||||
<p>A Pokedex returns the names and resource_uri for all pokemon</p>
|
||||
<p class="lead"> GET pokedex/1/</p>
|
||||
<p>Note: This is a special resource call. Always call <b>/api/v1/pokedex/1/</b>.</p>
|
||||
<h4>Example request</h4>
|
||||
<pre>GET http://pokeapi.co/api/v1/pokedex/1/</pre>
|
||||
<p>Result:</p>
|
||||
<pre class="pre-scrollable">
|
||||
{
|
||||
"created": "2013-11-09T15:14:48.957604",
|
||||
"modified": "2013-11-09T15:14:48.957565",
|
||||
"name": "national",
|
||||
"pokemon": [
|
||||
{
|
||||
"name": "pidgeotto",
|
||||
"resource_uri": "api/v1/pokemon/17/"
|
||||
},
|
||||
...
|
||||
]
|
||||
}
|
||||
</pre>
|
||||
<p>Fields:</p>
|
||||
<ul>
|
||||
<li><b>name</b> - the pokedex name e.g. <i>National</i>.</li>
|
||||
<li><b>resource_uri</b> - the uri of this resource.</li>
|
||||
<li><b>created</b> - the creation date of the resource.</li>
|
||||
<li><b>modified</b> - the last time this resource was modified.</li>
|
||||
<li><b>pokemon</b> - a big list of pokemon within this pokedex.</li>
|
||||
</ul>
|
||||
<div id="pokemon" style="padding-top:30px"></div>
|
||||
<hr>
|
||||
<h1>Pokemon</h1>
|
||||
<p>A Pokemon resource represent a single Pokémon</p>
|
||||
<p class="lead"> GET pokemon/</p>
|
||||
<p class="lead"> GET pokemon/ID/ </p>
|
||||
<p>Note: the ID for Pokémon is special. Use the <b>National pokédex</b> number as the ID to return the desired resource.</p>
|
||||
<h4>Example request</h4>
|
||||
<pre>GET http://pokeapi.co/api/v1/pokemon/1/</pre>
|
||||
<p>Result:</p>
|
||||
<pre class="pre-scrollable">
|
||||
{
|
||||
"abilities": [
|
||||
{
|
||||
"name": "overgrow",
|
||||
"resource_uri": "/api/v1/ability/1/"
|
||||
},
|
||||
{
|
||||
"name": "chlorophyll",
|
||||
"resource_uri": "/api/v1/ability/2/"
|
||||
}
|
||||
],
|
||||
"attack": 49,
|
||||
"catch_rate": 45,
|
||||
"created": "2013-11-02T12:08:25.745455",
|
||||
"defense": 49,
|
||||
"egg_cycles": 21,
|
||||
"egg_groups": [
|
||||
{
|
||||
"name": "Monster",
|
||||
"resource_uri": "/api/v1/egg/1/"
|
||||
},
|
||||
{
|
||||
"name": "Grass",
|
||||
"resource_uri": "/api/v1/egg/8/"
|
||||
}
|
||||
],
|
||||
"ev_yield": "1 Sp Atk",
|
||||
"evolutions": {
|
||||
"level": 16,
|
||||
"method": "level up",
|
||||
"resource_uri": "/api/v1/pokemon/2/",
|
||||
"to": "Ivysaur"
|
||||
},
|
||||
"exp": 64,
|
||||
"growth_rate": "ms",
|
||||
"happiness": 70,
|
||||
"height": "2'4",
|
||||
"hp": 45,
|
||||
"male_female_ratio": "87.5/12.5",
|
||||
"modified": "2013-11-02T13:28:04.914889",
|
||||
"moves": [
|
||||
{
|
||||
"learn_type": "other",
|
||||
"name": "Tackle",
|
||||
"resource_uri": "/api/v1/move/1/"
|
||||
},
|
||||
{
|
||||
"learn_type": "other",
|
||||
"name": "Growl",
|
||||
"resource_uri": "/api/v1/move/2/"
|
||||
},
|
||||
{
|
||||
"learn_type": "level up",
|
||||
"level": 10,
|
||||
"name": "Vine whip",
|
||||
"resource_uri": "/api/v1/move/3/"
|
||||
}
|
||||
],
|
||||
"name": "Bulbasaur",
|
||||
"national_id": 1,
|
||||
"resource_uri": "/api/v1/pokemon/4/",
|
||||
"sp_atk": 65,
|
||||
"sp_def": 65,
|
||||
"species": "seed pokemon",
|
||||
"speed": 45,
|
||||
"total": 318,
|
||||
"types": [
|
||||
{
|
||||
"name": "grass",
|
||||
"resource_uri": "/api/v1/type/5/"
|
||||
},
|
||||
{
|
||||
"name": "poison",
|
||||
"resource_uri": "/api/v1/type/8/"
|
||||
}
|
||||
],
|
||||
"weight": "15.2lbs"
|
||||
}
|
||||
</pre>
|
||||
<p>Fields:</p>
|
||||
<ul>
|
||||
<li><b>name</b> - the resource name e.g. <i>Bulbasaur</i>.</li>
|
||||
<li><b>national_id</b> - the id of the resource, this is the <b>National pokedex</b> number of the pokemon.</li>
|
||||
<li><b>resource_uri</b> - the uri of this resource.</li>
|
||||
<li><b>created</b> - the creation date of the resource.</li>
|
||||
<li><b>modified</b> - the last time this resource was modified.</li>
|
||||
<li><b>abilities</b> - the abilities this pokemon can have.</li>
|
||||
<li><b>egg_groups</b> - the egg groups this pokemon is in.</li>
|
||||
<li><b>evolutions</b> - the evolutions this pokemon can evolve into.</li>
|
||||
<li><b>descriptions</b> - the pokedex descriptions this pokemon has.</li>
|
||||
<li><b>moves</b> - the moves this pokemon can learn.</li>
|
||||
<li><b>types</b> - the types this pokemon is.</li>
|
||||
<li><b>catch_rate</b> - this pokemon's catch rate.</li>
|
||||
<li><b>species</b></li>
|
||||
<li><b>hp</b></li>
|
||||
<li><b>attack</b></li>
|
||||
<li><b>defense</b></li>
|
||||
<li><b>sp_atk</b></li>
|
||||
<li><b>sp_def</b></li>
|
||||
<li><b>speed</b></li>
|
||||
<li><b>total</b> - the total of the above attributes.</li>
|
||||
<li><b>egg_cycles</b> - number of egg cycles needed.</li>
|
||||
<li><b>ev_yield</b> - the ev yield for this pokemon.</li>
|
||||
<li><b>exp</b> - the exp yield from this pokemon.</li>
|
||||
<li><b>growth_rate</b> - the growth rate of this pokemon.</li>
|
||||
<li><b>height</b></li>
|
||||
<li><b>weight</b></li>
|
||||
<li><b>happiness</b> - base happiness for this pokemon.</li>
|
||||
<li><b>male_femal_ratio</b> - in the format M / F</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<div id="types" style="padding-top:30px"></div>
|
||||
<h1>Type</h1>
|
||||
<p>A Type resource represent a single Pokémon type</p>
|
||||
<p class="lead"> GET type/</p>
|
||||
<p class="lead"> GET type/ID/ </p>
|
||||
<h4>Example request</h4>
|
||||
<pre>GET http://pokeapi.co/api/v1/type/1/</pre>
|
||||
<p>Result:</p>
|
||||
<pre class="pre-scrollable">
|
||||
{
|
||||
"created": "2013-11-02T12:09:07.305733",
|
||||
"id": 3,
|
||||
"ineffective": [
|
||||
{
|
||||
"name": "fire",
|
||||
"resource_uri": "/api/v1/type/2/"
|
||||
},
|
||||
{
|
||||
"name": "ice",
|
||||
"resource_uri": "/api/v1/type/6/"
|
||||
},
|
||||
{
|
||||
"name": "steel",
|
||||
"resource_uri": "/api/v1/type/17/"
|
||||
},
|
||||
{
|
||||
"name": "water",
|
||||
"resource_uri": "/api/v1/type/3/"
|
||||
}
|
||||
],
|
||||
"modified": "2013-11-02T13:14:44.369331",
|
||||
"name": "Water",
|
||||
"no_effect": [],
|
||||
"resistance": [
|
||||
{
|
||||
"name": "fire",
|
||||
"resource_uri": "/api/v1/type/2/"
|
||||
},
|
||||
{
|
||||
"name": "ice",
|
||||
"resource_uri": "/api/v1/type/6/"
|
||||
},
|
||||
{
|
||||
"name": "steel",
|
||||
"resource_uri": "/api/v1/type/17/"
|
||||
},
|
||||
{
|
||||
"name": "water",
|
||||
"resource_uri": "/api/v1/type/3/"
|
||||
}
|
||||
],
|
||||
"resource_uri": "/api/v1/type/3/",
|
||||
"super_effective": [
|
||||
{
|
||||
"name": "fire",
|
||||
"resource_uri": "/api/v1/type/2/"
|
||||
},
|
||||
{
|
||||
"name": "ground",
|
||||
"resource_uri": "/api/v1/type/9/"
|
||||
},
|
||||
{
|
||||
"name": "rock",
|
||||
"resource_uri": "/api/v1/type/13/"
|
||||
}
|
||||
],
|
||||
"weakness": [
|
||||
{
|
||||
"name": "electric",
|
||||
"resource_uri": "/api/v1/type/4/"
|
||||
},
|
||||
{
|
||||
"name": "grass",
|
||||
"resource_uri": "/api/v1/type/5/"
|
||||
}
|
||||
]
|
||||
}
|
||||
</pre>
|
||||
<p>Fields:</p>
|
||||
<ul>
|
||||
<li><b>name</b> - the resource name e.g. <i>Water</i>.</li>
|
||||
<li><b>id</b> - the id of the resource.</li>
|
||||
<li><b>resource_uri</b> - the uri of this resource.</li>
|
||||
<li><b>created</b> - the creation date of the resource.</li>
|
||||
<li><b>modified</b> - the last time this resource was modified.</li>
|
||||
<li><b>ineffective</b> - the types this type is ineffective against.</li>
|
||||
<li><b>no_effect</b> - the types this type has no effect against.</li>
|
||||
<li><b>resistance</b> - the types this type is resistant to.</li>
|
||||
<li><b>super_effective</b> - the types this type is super effective against.</li>
|
||||
<li><b>weakness</b> - the types this type is weak to.</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<div id="moves" style="padding-top:30px"></div>
|
||||
<h1>Move</h1>
|
||||
<p>A Move resource represent a single move</p>
|
||||
<p class="lead"> GET move/</p>
|
||||
<p class="lead"> GET move/ID/ </p>
|
||||
<h4>Example request</h4>
|
||||
<pre>GET http://pokeapi.co/api/v1/move/1/</pre>
|
||||
<p>Result:</p>
|
||||
<pre class="pre-scrollable">
|
||||
{
|
||||
"accuracy": 100,
|
||||
"category": "physical",
|
||||
"created": "2013-11-02T12:37:05.266762",
|
||||
"description": "A physical attack in which the user charges and slams into the target with its whole body.",
|
||||
"id": 1,
|
||||
"modified": "2013-11-03T11:51:57.009696",
|
||||
"name": "Tackle",
|
||||
"power": 50,
|
||||
"pp": 35,
|
||||
"resource_uri": "/api/v1/move/1/"
|
||||
}
|
||||
</pre>
|
||||
<p>Fields:</p>
|
||||
<ul>
|
||||
<li><b>name</b> - the resource name e.g. <i>Water</i>.</li>
|
||||
<li><b>id</b> - the id of the resource.</li>
|
||||
<li><b>resource_uri</b> - the uri of this resource.</li>
|
||||
<li><b>created</b> - the creation date of the resource.</li>
|
||||
<li><b>modified</b> - the last time this resource was modified.</li>
|
||||
<li><b>description</b> - a description of the move.</li>
|
||||
<li><b>power</b> - the power of the move.</li>
|
||||
<li><b>accuracy</b> - the accuracy of the move.</li>
|
||||
<li><b>category</b> - the category of the move.</li>
|
||||
<li><b>pp</b> - the pp points of the move.</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<div id="abilities" style="padding-top:30px"></div>
|
||||
<h1>Ability</h1>
|
||||
<p>An Ability resource represent a single Pokémon ability</p>
|
||||
<p class="lead"> GET ability/</p>
|
||||
<p class="lead"> GET ability/ID/ </p>
|
||||
<h4>Example request</h4>
|
||||
<pre>GET http://pokeapi.co/api/v1/ability/1/</pre>
|
||||
<p>Result:</p>
|
||||
<pre class="pre-scrollable">
|
||||
{
|
||||
"created": "2013-11-02T12:21:28.166682",
|
||||
"description": "When a Pokmon with Overgrow uses a Grass-type move, the power will increase by 1.5x if the user has less than or equal to 1/3 of its maximum HP remaining.",
|
||||
"id": 1,
|
||||
"modified": "2013-11-02T13:27:06.591413",
|
||||
"name": "Overgrow",
|
||||
"resource_uri": "/api/v1/ability/1/"
|
||||
}
|
||||
</pre>
|
||||
<p>Fields:</p>
|
||||
<ul>
|
||||
<li><b>name</b> - the resource name e.g. <i>Overgrow</i>.</li>
|
||||
<li><b>id</b> - the id of the resource.</li>
|
||||
<li><b>resource_uri</b> - the uri of this resource.</li>
|
||||
<li><b>created</b> - the creation date of the resource.</li>
|
||||
<li><b>modified</b> - the last time this resource was modified.</li>
|
||||
<li><b>description</b> - the description of this ability</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<div id="eggs" style="padding-top:30px"></div>
|
||||
<h1>Egg group</h1>
|
||||
<p>An Egg group resource represent a single Pokémon egg group</p>
|
||||
<p class="lead"> GET egg/</p>
|
||||
<p class="lead"> GET egg/ID/ </p>
|
||||
<h4>Example request</h4>
|
||||
<pre>GET http://pokeapi.co/api/v1/egg/1/</pre>
|
||||
<p>Result:</p>
|
||||
<pre class="pre-scrollable">
|
||||
{
|
||||
"created": "2013-11-02T12:24:55.532023",
|
||||
"id": 1,
|
||||
"modified": "2013-11-02T12:24:55.531989",
|
||||
"name": "Monster",
|
||||
"pokemon": [
|
||||
{
|
||||
"name": "Ivysaur",
|
||||
"resource_uri": "/api/v1/pokemon/2/"
|
||||
},
|
||||
{
|
||||
"name": "Bulbasaur",
|
||||
"resource_uri": "/api/v1/pokemon/1/"
|
||||
}
|
||||
],
|
||||
"resource_uri": "/api/v1/egg/1/"
|
||||
}
|
||||
</pre>
|
||||
<p>Fields:</p>
|
||||
<ul>
|
||||
<li><b>name</b> - the resource name e.g. <i>Monster</i>.</li>
|
||||
<li><b>id</b> - the id of the resource.</li>
|
||||
<li><b>resource_uri</b> - the uri of this resource.</li>
|
||||
<li><b>created</b> - the creation date of the resource.</li>
|
||||
<li><b>modified</b> - the last time this resource was modified.</li>
|
||||
<li><b>pokemon</b> - a list of all the pokemon in that egg group.</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<div id="description" style="padding-top:30px"></div>
|
||||
<h1>Description</h1>
|
||||
<p>A Description resource represent a single Pokémon pokédex description</p>
|
||||
<p class="lead"> GET description/</p>
|
||||
<p class="lead"> GET description/ID/ </p>
|
||||
<h4>Example request</h4>
|
||||
<pre>GET http://pokeapi.co/api/v1/description/2/</pre>
|
||||
<p>Result:</p>
|
||||
<pre class="pre-scrollable">
|
||||
{
|
||||
created: '2013-12-24T17:14:38.281429',
|
||||
description: 'A strange seed was planted on its back at birth. The plant sprouts and grows with this POKMON.',
|
||||
games: [{
|
||||
name: 'red(JPN)',
|
||||
resource_uri: '/api/v1/game/1/'
|
||||
}, {
|
||||
name: 'green(JPN)',
|
||||
resource_uri: '/api/v1/game/2/'
|
||||
}],
|
||||
id: 2,
|
||||
modified: '2014-01-18T14:29:53.118541',
|
||||
name: 'Bulbasaur_gen_1',
|
||||
pokemon: {
|
||||
name: 'bulbasaur',
|
||||
resource_uri: '/api/v1/pokemon/1/'
|
||||
},
|
||||
resource_uri: '/api/v1/description/2/'
|
||||
}
|
||||
</pre>
|
||||
<p>Fields:</p>
|
||||
<ul>
|
||||
<li><b>name</b> - the resource name.</li>
|
||||
<li><b>id</b> - the id of the resource.</li>
|
||||
<li><b>resource_uri</b> - the uri of this resource.</li>
|
||||
<li><b>created</b> - the creation date of the resource.</li>
|
||||
<li><b>modified</b> - the last time this resource was modified.</li>
|
||||
<li><b>games</b> - a list of games this description is in.</li>
|
||||
<li><b>pokemon</b> - the pokemon this sprite is for.</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<div id="sprites" style="padding-top:30px"></div>
|
||||
<h1>Sprite</h1>
|
||||
<p>A Sprite resource represent a single Pokémon Sprite</p>
|
||||
<p class="lead"> GET sprite/</p>
|
||||
<p class="lead"> GET sprite/ID/ </p>
|
||||
<h4>Example request</h4>
|
||||
<pre>GET http://pokeapi.co/api/v1/sprite/1/</pre>
|
||||
<p>Result:</p>
|
||||
<pre class="pre-scrollable">
|
||||
{
|
||||
"created": "2013-11-02T12:34:19.113143",
|
||||
"id": 1,
|
||||
"image": "/media/img/1383395659.12.png",
|
||||
"modified": "2013-11-02T12:34:19.113053",
|
||||
"name": "Bulbasaur_blue_red",
|
||||
"pokemon": {
|
||||
"name": "bulbasaur",
|
||||
"resource_uri": "/api/v1/pokemon/1/"
|
||||
},
|
||||
"resource_uri": "/api/v1/sprite/1/"
|
||||
}
|
||||
</pre>
|
||||
<p>Fields:</p>
|
||||
<ul>
|
||||
<li><b>name</b> - the resource name.</li>
|
||||
<li><b>id</b> - the id of the resource.</li>
|
||||
<li><b>resource_uri</b> - the uri of this resource.</li>
|
||||
<li><b>created</b> - the creation date of the resource.</li>
|
||||
<li><b>modified</b> - the last time this resource was modified.</li>
|
||||
<li><b>pokemon</b> - the pokemon this sprite is for.</li>
|
||||
<li><b>image</b> - the uri for the sprite image</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<div id="game" style="padding-top:30px"></div>
|
||||
<h1>Game</h1>
|
||||
<p>A Game resource represent a single Pokémon game</p>
|
||||
<p class="lead"> GET game/</p>
|
||||
<p class="lead"> GET game/ID/ </p>
|
||||
<h4>Example request</h4>
|
||||
<pre>GET http://pokeapi.co/api/v1/game/1/</pre>
|
||||
<p>Result:</p>
|
||||
<pre class="pre-scrollable">
|
||||
{
|
||||
"created": "2013-11-02T12:11:41.755402",
|
||||
"generation": 1,
|
||||
"id": 1,
|
||||
"modified": "2013-11-02T12:12:47.378286",
|
||||
"name": "Pokemon red (JPN)",
|
||||
"release_year": 1996,
|
||||
"resource_uri": "/api/v1/game/1/"
|
||||
}
|
||||
</pre>
|
||||
<p>Fields:</p>
|
||||
<ul>
|
||||
<li><b>name</b> - the resource name e.g. <i>Pokemon red</i>.</li>
|
||||
<li><b>id</b> - the id of the resource.</li>
|
||||
<li><b>resource_uri</b> - the uri of this resource.</li>
|
||||
<li><b>created</b> - the creation date of the resource.</li>
|
||||
<li><b>modified</b> - the last time this resource was modified.</li>
|
||||
<li><b>release_year</b> - the year the game was released</li>
|
||||
<li><b>generation</b> - the generation this game belongs to.</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div><!--row-->
|
||||
|
||||
</div><!-- /.container -->
|
||||
|
||||
{% endblock %}
|
|
@ -1,96 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
{% load markdown_deux_tags %}
|
||||
|
||||
{% block mainbody %}
|
||||
|
||||
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="navbar-brand">
|
||||
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://pokeapi.co" data-text="Pokéapi - the Pokémon RESTful API " data-via="phalt_" data-related="phalt_">Tweet</a>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse navbar-right">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/about/">About</a></li>
|
||||
<li class="active"><a href="#">Documentation</a></li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
|
||||
<h1>Pokeapi Version 2 API Documentation</h1>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="docs" class="container">
|
||||
|
||||
<div class="row pad_top">
|
||||
|
||||
<div class="col-md-2">
|
||||
|
||||
<ul class="version-select">
|
||||
|
||||
<li><a href="">V1</a></li>
|
||||
<li class="active"><a href="">V2</a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
<ul class="side-nav hidden-sm">
|
||||
|
||||
<li><a href="">Information</a></li>
|
||||
<li><a href="">Wrappers</a></li>
|
||||
|
||||
<hr>
|
||||
|
||||
<li><a href="">Resource Lists</a></li>
|
||||
|
||||
<hr>
|
||||
|
||||
<li><a href="">Berries</a></li>
|
||||
<li>Contests</li>
|
||||
<li>Encounters</li>
|
||||
<li>Evolution</li>
|
||||
<li>Games</li>
|
||||
<li><a href="">Items</a></li>
|
||||
<li><a href="#languages">Language</a></li>
|
||||
<li><a href="">Locations</a></li>
|
||||
<li><a href="">Moves</a></li>
|
||||
<li><a href="#pokedexes">Pokedexes</a></li>
|
||||
<li><a href="">Pokemon</a></li>
|
||||
|
||||
<hr>
|
||||
|
||||
<li><a href="#common-models">Common Models</a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-10">
|
||||
|
||||
{% markdown %}
|
||||
|
||||
{% include "docs.md" %}
|
||||
|
||||
{% endmarkdown %}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
1007
templates/docsv1.html
Normal file
1007
templates/docsv1.html
Normal file
File diff suppressed because it is too large
Load diff
132
templates/docsv2.html
Normal file
132
templates/docsv2.html
Normal file
|
@ -0,0 +1,132 @@
|
|||
{% extends "base.html" %}
|
||||
{% load markdown_deux_tags %}
|
||||
|
||||
{% block mainbody %}
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="navbar-brand">
|
||||
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://pokeapi.co" data-text="Pokéapi - the Pokémon RESTful API " data-via="phalt_" data-related="phalt_">Tweet</a>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse navbar-right">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/about/">About</a></li>
|
||||
<li class="active"><a href="#">Documentation</a></li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section id="docs">
|
||||
|
||||
<div class="header">
|
||||
|
||||
<h1>Pokeapi V2 Documentation</h1>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="row pad_top">
|
||||
|
||||
<div class="side-nav col-md-2">
|
||||
|
||||
<div class="nav-group">
|
||||
|
||||
<ul class="version-select">
|
||||
|
||||
<li><a href="/docsv1/">V1</a></li>
|
||||
<li class="active"><a href="#">V2</a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
<ul class="hidden-sm">
|
||||
|
||||
<li><a href="">Information</a></li>
|
||||
<li><a href="">Wrappers</a></li>
|
||||
|
||||
<hr>
|
||||
|
||||
<li><a href="">Resource Lists</a></li>
|
||||
|
||||
<hr>
|
||||
|
||||
<li><a href="">Berries</a></li>
|
||||
<li>Contests</li>
|
||||
<li>Encounters</li>
|
||||
<li>Evolution</li>
|
||||
<li>Games</li>
|
||||
<li><a href="">Items</a></li>
|
||||
<li><a href="#languages">Language</a></li>
|
||||
<li><a href="">Locations</a></li>
|
||||
<li><a href="">Moves</a></li>
|
||||
<li><a href="#pokedexes">Pokedexes</a></li>
|
||||
<li><a href="">Pokemon</a></li>
|
||||
|
||||
<hr>
|
||||
|
||||
<li><a href="#common-models">Common Models</a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-10">
|
||||
|
||||
{% markdown %}
|
||||
|
||||
{% include "docsv2.md" %}
|
||||
|
||||
{% endmarkdown %}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<script>
|
||||
|
||||
var sticky = $('.nav-group');
|
||||
var offset = sticky.offset();
|
||||
var sideNav = $('.side-nav');
|
||||
var doc = $(document);
|
||||
|
||||
function checkSticky () {
|
||||
|
||||
if (doc.scrollTop() >= (offset.top - 65)) {
|
||||
|
||||
sticky.addClass('stick');
|
||||
sticky.css({ width: sideNav.width() });
|
||||
|
||||
} else {
|
||||
|
||||
sticky.removeClass('stick');
|
||||
sticky.css({ width: '' });
|
||||
}
|
||||
}
|
||||
|
||||
doc.scroll(function () {
|
||||
|
||||
checkSticky();
|
||||
});
|
||||
|
||||
checkSticky();
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -22,7 +22,7 @@
|
|||
<ul class="nav navbar-nav">
|
||||
<li class="active"><a href="#">Home</a></li>
|
||||
<li><a href="/about/">About</a></li>
|
||||
<li><a href="/docs/">Documentation</a></li>
|
||||
<li><a href="/docsv2/">Documentation</a></li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue