Comments (6)
README (similar) example of what you want in the second case
const config = {
options: {
champListData: 'all'
},
region: REGIONS.KOREA
}
k.Static.champions(config)
.then(data => console.log(data))
.catch(error => console.error(error))
Your first example
Note that for options, my object-based functions always take in an options
parameter. Which means you have to do:
const options = {
champData: 'all'
}
k.Static.champions({
id: champId, options
})
Your second example
Firstly, for a list of champions the proper parameter is champListData
, while for a single champion it is champData
(what you want here).
Secondly, you're wrapping the config in another dictionary, which means you end up with an extra layer of brackets:
{ // extra brackets because of { config }
{
options: {
champData: 'all' // should be champListData
}
}
}
Remove the brackets around config
, and convert champListData -> champData and it'll work.
Alternatives
If you'd like, you can use the methods that are more 'normal', which are documented here.
from kayn.
still without the informations of ListData
from kayn.
For getting the list of champions, it has to be champListData
like in Riot's Docs (or my README). Yours is named champData
(which is for getting a static champion by id) in the options
.
const config = {
options: {
champListData: 'all'
},
region: REGIONS.BRAZIL
}
k.Static.champions(config)
.then(data => console.log(data))
.catch(error => console.error(error))
from kayn.
holy, I am feeling stupid now
sorry haha, it's works 👍
from kayn.
@lucasbordini
Not your fault. I'm going to clarify how it works in the README; I removed the old explanation when I migrated my documentation to the Wiki.
In addition, I just noticed I had the wrong example in the documentation. Sorry, I thought I fixed it (in case if this was the example you used; it's the same code).
from kayn.
I also realized that I misread your code (sorry) when I posted my first answer. I'm editing that answer so it's correct, although it seems we have solved the issue.
from kayn.
Related Issues (20)
- Grab Spell by his id/key
- Match-V5 Support HOT 1
- /typings/index.d.ts(293,1): error TS1046: A 'declare' modifier is required for a top level declaration in a .d.ts file. HOT 3
- v0.9.4 rate limiter may be broken HOT 2
- summoner/v3 endpoint returning forbidden HOT 2
- positional rank endpoints HOT 1
- Positional Rank Endpoints HOT 1
- Positional Ranking Deprecation HOT 2
- Does Kayn respect custom rate limit? HOT 2
- Minor unnecessary import in index.d.ts HOT 5
- Current games issue HOT 9
- RunesReforged Optional Versions HOT 3
- Current LeaguePositions issue HOT 1
- Make the API host configurable HOT 3
- Very slow requests ? HOT 4
- v0.10.1 release doesn't include a prebuilt dist/ directory HOT 2
- RunesReforged bug HOT 2
- Error: Can't resolve 'fs' in 'D:\Programmierung\my-app\node_modules\dotenv\lib' HOT 9
- TFT Ratelimit (Research)
- trying to use diffrent region the default that was placed in the kayn configuration
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kayn.