Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDragon Helpers + CDragon + blahblahblah #54

Open
cnguy opened this issue Aug 30, 2018 · 5 comments
Open

DDragon Helpers + CDragon + blahblahblah #54

cnguy opened this issue Aug 30, 2018 · 5 comments

Comments

@cnguy
Copy link
Owner

cnguy commented Aug 30, 2018

In light of my lack of static compatibility to prevent breaking code, I'll be working also on a few things over the next few days to help out everyone, and be working on things early (pushed ChampionRotation yesterday) and so I have much more time to think about releases. I'll admit that sometimes I don't prioritize certain new things because I don't have to use them (I didn't use static endpoints for example. My app pretty much just uses matchlist+challenger league+master league+literally saved copies of static data). However, I do want kayn to be easy-to-use and have a lot of examples, docs, and copy-pastable code, + good defaults so...

  • My static endpoints are already broken, and I'm sure users either swapped libraries, swapped to DDragon, etcetc. So, they will be removed eventually as it's too late anyways... But:
    • CDragon will be added
    • DDragon helpers will be added
  • Types will be addressed
  • A ton of more ES5 callback examples and ES6+ async/await examples will be added. These examples will be based on real code used by others or myself (Update Examples #46). I added an example early on how to use the new ChampionRotation endpoints and then convert it into the correct DDragon champion objects, for example.
  • Improve docs so it's easier to refer to examples and endpoint APIs, coverage pic (low priority obviously), tests (these tests are simple to make, low priority)

One example of a DDragon helper is:
For example, DDragon.Champion.get(266) =>

await DDragon.Champion.get(266) // If cache is enabled, DDragon.Champion.list is cached
/*
{
	"version": "6.24.1",
	"id": "Aatrox",
	"key": "266",
	"name": "Aatrox",
	"title": "the Darkin Blade",
	"blurb": "Aatrox is a legendary warrior, one of only five that remain of an ancient race known as the Darkin. He wields his massive blade with grace and poise, slicing through legions in a style that is hypnotic to behold. With each foe felled, Aatrox's ...",
	"info": {
		"attack": 8,
		"defense": 4,
		"magic": 3,
		"difficulty": 4
	},
	"image": {
		"full": "Aatrox.png",
		"sprite": "champion0.png",
		"group": "champion",
		"x": 0,
		"y": 0,
		"w": 48,
		"h": 48
	},
	"tags": [
		"Fighter",
		"Tank"
	],
	"partype": "BloodWell",
	"stats": {
		"hp": 537.8,
		"hpperlevel": 85,
		"mp": 105.6,
		"mpperlevel": 45,
		"movespeed": 345,
		"armor": 24.384,
		"armorperlevel": 3.8,
		"spellblock": 32.1,
		"spellblockperlevel": 1.25,
		"attackrange": 150,
		"hpregen": 6.59,
		"hpregenperlevel": 0.5,
		"mpregen": 0,
		"mpregenperlevel": 0,
		"crit": 0,
		"critperlevel": 0,
		"attackdamage": 60.376,
		"attackdamageperlevel": 3.2,
		"attackspeedoffset": -0.04,
		"attackspeedperlevel": 3
	}
}
*/
@cnguy cnguy changed the title DDragon Helpers + CDragon DDragon Helpers + CDragon + blahblahblah Aug 30, 2018
cnguy added a commit that referenced this issue Sep 6, 2018
@cnguy
Copy link
Owner Author

cnguy commented Sep 14, 2018

In v0.8.21:

DDragon.Champion.getDataById(championName: string)
DDragon.Champion.getDataByIdWithParentAsId(championName: string)
DDragon.Champion.listDataById()
DDragon.Champion.listDataByIdWithParentAsId()
DDragon.Champion.listFullDataById()
DDragon.Champion.listFullDataByIdWithParentAsId()

@cnguy
Copy link
Owner Author

cnguy commented Sep 14, 2018

Currently experimenting with an optional version where the version, for each endpoint, is derived from whatever version map (Realm.list) is currently cached, or from your default region.

@cnguy
Copy link
Owner Author

cnguy commented Sep 23, 2018

v0.8.22 Adding a manual version() call to DDragon requests for data (champion.json, item.json, etc) is now optional. It works off either your default region, or a manual region() call passed to the request.

Default region

const kayn = Kayn()({ region: 'euw' })
const europeanList = await kayn.DDragon.Champion.list()

Manual region call

For the current request, it overrides the default region.

const kayn = Kayn()({ region: 'na' })
const europeanList = await kayn.DDragon.Champion.list().region('euw')

@raitono
Copy link
Contributor

raitono commented Aug 2, 2019

@cnguy I've run into an issue related to the above optional version() call for DDragon requests. The runes reforged endpoint errors out because the realms endpoint doesn't have a version for it. I've tracked it down to the error handling around the version, would you like me to include the information here or open a new issue for it?

@cnguy
Copy link
Owner Author

cnguy commented Aug 13, 2019

I'll make an issue, since this one is kinda feature-packed as well as old.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants