|
1 | 1 | # Content API
|
2 | 2 |
|
3 |
| -*To provide the Data we are using the [valorant-api.com](https://valorant-api.com)* |
| 3 | +_This is an API wrapper for the_ [_valorant-api.com_](https://valorant-api.com) _API_ |
| 4 | + |
| 5 | +#### Getting Started: |
| 6 | + |
| 7 | +First you need to import the Content module and the Language Module. This is how it works: |
| 8 | + |
| 9 | +```javascript |
| 10 | +const { Content, Languages } = require("@liamcottle/valorant.js"); |
| 11 | +``` |
| 12 | + |
| 13 | +Next, you need to create an Content instance. Here you have the possibility to choose the Language in which the data will be delivered. By deafult the language is set to English. Here is a list of all available languages: |
| 14 | + |
| 15 | +| **Languages** | |
| 16 | +| :-----------------: | |
| 17 | +| German | |
| 18 | +| English | |
| 19 | +| Spanish_Spain | |
| 20 | +| Spanish_Mexico | |
| 21 | +| French | |
| 22 | +| Indonesian | |
| 23 | +| Italien | |
| 24 | +| Japanese | |
| 25 | +| Korean | |
| 26 | +| Polish | |
| 27 | +| Portuguese_Brazil | |
| 28 | +| Russian | |
| 29 | +| Thai | |
| 30 | +| Turkish | |
| 31 | +| Vietnamese | |
| 32 | +| Chinese_Simplified | |
| 33 | +| Chinese_Traditional | |
| 34 | + |
| 35 | +```js |
| 36 | +const content = new ContentAPI(languages.English); |
| 37 | +``` |
| 38 | + |
| 39 | +After you have created the ContentAPI instance you can start fetching data. For this you can either use _async/await_ or _.then_ this works as follows: |
| 40 | +**Async/Await:** |
| 41 | + |
| 42 | +```js |
| 43 | +//Send a request to get all agents |
| 44 | +const data = await content.getAgents(); |
| 45 | +//Log the received data in the console |
| 46 | +console.log(data); |
| 47 | +``` |
| 48 | + |
| 49 | +**.then** |
| 50 | + |
| 51 | +```js |
| 52 | +content.getAgents().then((data) => { |
| 53 | + //log data |
| 54 | + console.log(data); |
| 55 | +}); |
| 56 | +``` |
| 57 | + |
| 58 | +Here is a example on how to get the Daily Store of a Player and then get the Asset Data using the ContentAPI and the [ClientAPI](https://github.com/liamcottle/valorant.js#readme) this Package provides. |
| 59 | + |
| 60 | +```js |
| 61 | +//import modules |
| 62 | +const { API, Content, languages, Regions } = require("@liamcottle/valorant.js"); |
| 63 | + |
| 64 | +//initiate the API and the Content Module |
| 65 | +const client = new API(Regions.EU); |
| 66 | +const content = new Content(languages.English); |
| 67 | + |
| 68 | +//authorize using the ClientAPI |
| 69 | +client.authorize("username", "password").then(() => { |
| 70 | + client.getPlayerStoreFront(client.user_id).then(async (response) => { |
| 71 | + //get assets for the first Skin in the Store |
| 72 | + const item1 = await content.getWeaponSkinLevelbyUuid( |
| 73 | + response.data.SkinsPanelLayout.SingleItemOffers[0] |
| 74 | + ); |
| 75 | + }); |
| 76 | + //log item |
| 77 | + console.log(item1); |
| 78 | +}); |
| 79 | +``` |
| 80 | + |
| 81 | +Here is a list of all available Endpoints for the ContentAPI: |
| 82 | + |
| 83 | +- **[Agents](https://dash.valorant-api.com/endpoints/agents)** |
| 84 | + - getAgents() |
| 85 | + - getAgentsbyUuid(_uuid_) |
| 86 | +- **[Buddies](https://dash.valorant-api.com/endpoints/buddies)** |
| 87 | + - getBuddies() |
| 88 | + - getBuddyLevels() |
| 89 | + - getBuddybyUuid(_uuid_) |
| 90 | + - getBuddyLevelbyUuid(_uuid_) |
| 91 | +- **[Bundles](https://dash.valorant-api.com/endpoints/bundles)** |
| 92 | + - getBundles() |
| 93 | + - getBundlebyUuid(_uuid_) |
| 94 | +- **[Ceremonies](https://dash.valorant-api.com/endpoints/ceremonies)** |
| 95 | + - getCeremonies() |
| 96 | + - getCeremonybyUuid(_uuid_) |
| 97 | +- **[Competitive Tiers](https://dash.valorant-api.com/endpoints/competitivetiers)** |
| 98 | + - getCompetitiveTiers() |
| 99 | + - getCompetitiveTierbyUuid(_uuid_) |
| 100 | +- **[Content Tiers](https://dash.valorant-api.com/endpoints/contenttiers)** |
| 101 | + - getContentTiers() |
| 102 | + - getContentTierbyUuid(_uuid_) |
| 103 | +- **[Contracts](https://dash.valorant-api.com/endpoints/contracts)** |
| 104 | + - getContracts() |
| 105 | + - getContractbyUuid(_uuid_) |
| 106 | +- **[Currencies](https://dash.valorant-api.com/endpoints/currencies)** |
| 107 | + - getCurrencies() |
| 108 | + - getCurrencybyUuid(_uuid_) |
| 109 | +- **[Events](https://dash.valorant-api.com/endpoints/events)** |
| 110 | + - getEvents() |
| 111 | + - getEventbyUuid(_uuid_) |
| 112 | +- **[Gamemodes](https://dash.valorant-api.com/endpoints/gamemodes)** |
| 113 | + - getGamemodes() |
| 114 | + - getGamemodeEquippables() |
| 115 | + - getGamemodebyUuid(_uuid_) |
| 116 | + - getGamemodeEquippablebyUuid(_uuid_) |
| 117 | +- **[Gear](https://dash.valorant-api.com/endpoints/gear)** |
| 118 | + - getGear() |
| 119 | + - getGearbyUuid(_uuid_) |
| 120 | +- **[Maps](https://dash.valorant-api.com/endpoints/maps)** |
| 121 | + - getMaps() |
| 122 | + - getMapbyUuid(_uuid_) |
| 123 | +- **[Player Cards](https://dash.valorant-api.com/endpoints/playercards)** |
| 124 | + - getPlayerCards() |
| 125 | + - getPlayerCardbyUuid(_uuid_) |
| 126 | +- **[Player Titles](https://dash.valorant-api.com/endpoints/playertitles)** |
| 127 | + - getPlayerTitles() |
| 128 | + - getPlayerTitlebyUuid(_uuid_) |
| 129 | +- **[Seasons](https://dash.valorant-api.com/endpoints/seasons)** |
| 130 | + - getSeasons() |
| 131 | + - getCompetitiveSeasons() |
| 132 | + - getSeasonbyUuid(_uuid_) |
| 133 | + - getCompetitiveSeasonbyUuid(_uuid_) |
| 134 | +- **[Sprays](https://dash.valorant-api.com/endpoints/sprays)** |
| 135 | + - getSprays() |
| 136 | + - getSpraybyUuid(_uuid_) |
| 137 | +- **[Themes](https://dash.valorant-api.com/endpoints/themes)** |
| 138 | + - getThemes() |
| 139 | + - getThemebyUuid(_uuid_) |
| 140 | +- **[Weapons](https://dash.valorant-api.com/endpoints/weapons)** |
| 141 | + - getWeapons() |
| 142 | + - getWeaponSkins() |
| 143 | + - getWeaponSkinChromas() |
| 144 | + - get WeaponSkinLevels() |
| 145 | + - getWeaponbyUuid(_uuid_) |
| 146 | + - getWeaponSkinbyUuid(_uuid_) |
| 147 | + - getWeaponSkinChromabyUuid(_uuid_) |
| 148 | + - getWeaponSkinLevelbyUuid(_uuid_) |
| 149 | + |
| 150 | +_If you have any Issue or Suggestion please open an Issue on the [Github Repository](https://github.com/liamcottle/valorant.js) or join the [Discord Server](https://discord.gg/HUFEkChRpP)_ |
0 commit comments