├── .eslintrc.json ├── .github └── ISSUE_TEMPLATE │ ├── BUG_REPORT.yml │ ├── FEATURE_REQUEST.yml │ └── config.yml ├── .gitignore ├── .prettierignore ├── .prettierrc ├── LICENSE ├── README.md ├── SECURITY.md ├── TODO.md ├── jest.config.js ├── package.json ├── packages └── @valapi │ ├── auth │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ ├── __tests__ │ │ │ ├── client.ts │ │ │ └── core.ts │ │ ├── client │ │ │ ├── Auth.ts │ │ │ ├── AuthInstance.ts │ │ │ └── AuthRequest.ts │ │ ├── index.ts │ │ └── utils │ │ │ └── cookie.ts │ ├── tsconfig.json │ └── typedoc.json │ ├── crosshair │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ ├── __tests__ │ │ │ └── crosshair.ts │ │ └── index.ts │ ├── tsconfig.json │ └── typedoc.json │ ├── lib │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ ├── __tests__ │ │ │ ├── region.ts │ │ │ ├── resource.ts │ │ │ ├── util.ts │ │ │ └── version.ts │ │ ├── client │ │ │ ├── ValError.ts │ │ │ └── ValRegion.ts │ │ ├── index.ts │ │ ├── resources │ │ │ ├── CrosshairColor.ts │ │ │ ├── CrosshairHexColor.ts │ │ │ ├── ItemTypeId.ts │ │ │ ├── Locale.ts │ │ │ ├── QueueId.ts │ │ │ └── Region.ts │ │ └── utils │ │ │ ├── ValEncryption.ts │ │ │ └── ValVersion.ts │ ├── tsconfig.json │ └── typedoc.json │ ├── riot-api │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ ├── __tests__ │ │ │ ├── api.ts │ │ │ └── region.ts │ │ ├── client │ │ │ ├── RiotApi.ts │ │ │ ├── RiotApiRegionURL.ts │ │ │ └── RiotApiService.ts │ │ ├── index.ts │ │ └── service │ │ │ ├── AccountV1.ts │ │ │ ├── ContentV1.ts │ │ │ ├── MatchV1.ts │ │ │ ├── RankedV1.ts │ │ │ └── StatusV1.ts │ ├── tsconfig.json │ └── typedoc.json │ ├── valorant-api.com │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ ├── __tests__ │ │ │ └── api.ts │ │ ├── client │ │ │ ├── ValorantApiCom.ts │ │ │ └── ValorantApiComService.ts │ │ ├── index.ts │ │ └── service │ │ │ ├── Agents.ts │ │ │ ├── Buddies.ts │ │ │ ├── Bundles.ts │ │ │ ├── Ceremonies.ts │ │ │ ├── CompetitiveTiers.ts │ │ │ ├── ContentTiers.ts │ │ │ ├── Contracts.ts │ │ │ ├── Currencies.ts │ │ │ ├── Events.ts │ │ │ ├── Gamemodes.ts │ │ │ ├── Gear.ts │ │ │ ├── Internal.ts │ │ │ ├── LevelBorders.ts │ │ │ ├── Maps.ts │ │ │ ├── Missions.ts │ │ │ ├── Objectives.ts │ │ │ ├── PlayerCards.ts │ │ │ ├── PlayerTitles.ts │ │ │ ├── Seasons.ts │ │ │ ├── Sprays.ts │ │ │ ├── Themes.ts │ │ │ ├── Version.ts │ │ │ └── Weapons.ts │ ├── tsconfig.json │ └── typedoc.json │ └── web-client │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ ├── __tests__ │ │ ├── api.ts │ │ └── region.ts │ ├── client │ │ ├── WebClient.ts │ │ ├── WebClientRegionURL.ts │ │ └── WebClientService.ts │ ├── index.ts │ └── service │ │ ├── AccountXP.ts │ │ ├── Configuration.ts │ │ ├── Content.ts │ │ ├── ContractDefinitions.ts │ │ ├── Contracts.ts │ │ ├── CoreGame.ts │ │ ├── DailyTicket.ts │ │ ├── Favorites.ts │ │ ├── Latency.ts │ │ ├── MMR.ts │ │ ├── MassRewards.ts │ │ ├── Match.ts │ │ ├── NameService.ts │ │ ├── Party.ts │ │ ├── Personalization.ts │ │ ├── PreGame.ts │ │ ├── Premier.ts │ │ ├── Restrictions.ts │ │ ├── Session.ts │ │ └── Store.ts │ ├── tsconfig.json │ └── typedoc.json ├── tsconfig.base.json ├── tsconfig.json ├── tsconfig.test.json ├── typedoc.base.json └── typedoc.json /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "env": { 4 | "es6": true, 5 | "es2021": true, 6 | "node": true 7 | }, 8 | "extends": [ 9 | "eslint:recommended", 10 | "plugin:@typescript-eslint/recommended" 11 | ], 12 | "parser": "@typescript-eslint/parser", 13 | "parserOptions": { 14 | "ecmaVersion": "latest", 15 | "sourceType": "module" 16 | }, 17 | "ignorePatterns": [ 18 | "build", 19 | "*.js", 20 | "*.d.ts" 21 | ], 22 | "plugins": [ 23 | "@typescript-eslint" 24 | ], 25 | "rules": { 26 | "@typescript-eslint/no-explicit-any": "off", 27 | "@typescript-eslint/no-namespace": "off", 28 | "@typescript-eslint/no-unused-vars": "warn", 29 | 30 | "no-console": "error", 31 | "no-debugger": "error", 32 | "no-var": "error", 33 | "no-eval": "error", 34 | "no-implied-eval": "error", 35 | "no-new-func": "error", 36 | "no-caller": "error", 37 | "no-delete-var": "error", 38 | "no-invalid-this": "error", 39 | "prefer-arrow-callback": "error", 40 | "prefer-const": "error", 41 | "prefer-template": "error", 42 | 43 | "semi": "warn", 44 | "new-cap": "warn", 45 | "spaced-comment": "warn", 46 | "brace-style": "warn", 47 | "curly": "warn", 48 | "guard-for-in": "warn", 49 | "no-empty-pattern": "warn", 50 | "no-new-wrappers": "warn", 51 | "valid-typeof": "warn" 52 | }, 53 | "settings": { 54 | "allowDefinitionFiles": true 55 | } 56 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/BUG_REPORT.yml: -------------------------------------------------------------------------------- 1 | name: 'Bug Report' 2 | description: What is wrong or needs fixing? 3 | labels: ['bug'] 4 | assignees: [ 'KTNG-3' ] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | - Do not share your personal information (token, username, password) 10 | - Make sure it's an issue 11 | - type: textarea 12 | id: description 13 | attributes: 14 | label: 'Description' 15 | description: 'Explain your problem' 16 | render: Markdown 17 | validations: 18 | required: true 19 | - type: textarea 20 | id: code 21 | attributes: 22 | label: 'Code' 23 | description: 'Example of your code' 24 | render: TypeScript 25 | validations: 26 | required: true 27 | - type: textarea 28 | id: error 29 | attributes: 30 | label: 'Error' 31 | description: 'The error that you get' 32 | validations: 33 | required: false 34 | - type: input 35 | id: platform 36 | attributes: 37 | label: 'Platform' 38 | placeholder: 'e.g. Windows 10, repl.it' 39 | - type: input 40 | id: nodejs 41 | attributes: 42 | label: 'Node.js Version' 43 | description: 'node --version' 44 | placeholder: 'e.g. 18.14.0' 45 | - type: input 46 | id: valapi 47 | attributes: 48 | label: '@valapi Version' 49 | description: 'npm --version @valapi/lib' 50 | placeholder: 'e.g. 1.4.2' 51 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml: -------------------------------------------------------------------------------- 1 | name: 'Feature Request' 2 | description: I need something new 3 | labels: [ enhancement, question ] 4 | assignees: [ 'KTNG-3' ] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | - Do not share your personal information (token, username, password) 10 | - type: textarea 11 | id: description 12 | attributes: 13 | label: 'What do you need?' 14 | description: 'Explain what is your need, is that problem?' 15 | render: Markdown 16 | validations: 17 | required: true 18 | - type: textarea 19 | id: code 20 | attributes: 21 | label: 'Code' 22 | description: 'Example of your code' 23 | render: TypeScript 24 | validations: 25 | required: false 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Discord Server 4 | about: 'Q & A' 5 | url: 'https://discord.gg/pbyWbUYjyt' 6 | - name: 'Documentation' 7 | about: 'Generated Documentation' 8 | url: 'https://valapi.github.io/guide' 9 | - name: 'Guide' 10 | about: 'Basic usage' 11 | url: 'https://valapi.github.io/guide' -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .git/ 2 | 3 | # nodejs 4 | npm-debug.log* 5 | package-lock.json 6 | node_modules/ 7 | 8 | # env 9 | .env 10 | .env.development.local 11 | .env.test.local 12 | .env.production.local 13 | .env.local 14 | 15 | # vscode 16 | .vscode/ 17 | 18 | # log 19 | logs 20 | *.log 21 | npm-debug.log* 22 | 23 | # temp, cache 24 | .npm 25 | .eslintcache 26 | *.tgz 27 | *.tsbuildinfo 28 | 29 | *.cache 30 | cache/ 31 | 32 | *.tmp 33 | *.temp 34 | temp/ 35 | 36 | # project 37 | build/ 38 | docs/ 39 | 40 | # test 41 | test/ 42 | tests/ 43 | 44 | coverage/ -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .git/ 2 | 3 | # nodejs 4 | npm-debug.log* 5 | package.json 6 | 7 | # log 8 | logs 9 | *.log 10 | npm-debug.log* 11 | 12 | # temp, cache 13 | .npm 14 | .eslintcache 15 | *.tgz 16 | *.tsbuildinfo 17 | 18 | # project 19 | LICENSE 20 | 21 | build/ -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 200, 3 | "tabWidth": 4, 4 | "singleQuote": false, 5 | "trailingComma": "none", 6 | "arrowParens": "avoid" 7 | } 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Ing Project 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [githubrepo_image]: https://github.com/valapi/.github/blob/main/128_valapi.png?raw=true 2 | [githubrepo_url]: https://github.com/valapi 3 | [license_image]: https://badgen.net/badge/license/MIT/blue 4 | [license_url]: https://github.com/valapi/.github/blob/main/LICENSE 5 | [github_image]: https://badgen.net/badge/icon/github?icon=github&label 6 | [github_url]: https://github.com/valapi/node-valapi 7 | [discord_image]: https://badgen.net/badge/icon/discord?icon=discord&label 8 | [discord_url]: https://discord.gg/pbyWbUYjyt 9 | 10 |
11 | 12 | # node-valapi 13 | 14 | [![Profile][githubrepo_image]][github_url] 15 | 16 | NodeJS packages that make more easier to use Valorant API 17 | 18 | [![LICENSE][license_image]][license_url] 19 | [![Github][github_image]][github_url] 20 | [![Discord][discord_image]][discord_url] 21 | 22 | Documentation: [valapi.github.io/docs](https://valapi.github.io/docs) 23 | 24 | Guide: [valapi.github.io/guide](https://valapi.github.io/guide) 25 | 26 |
27 | 28 | --- 29 | 30 | > - **node-valapi** isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing Riot Games properties. Riot Games, and all associated properties are trademarks or registered trademarks of Riot Games, Inc. 31 | > - **node-valapi** was created under [Riot Games' "Legal Jibber Jabber"](https://www.riotgames.com/en/legal) policy using assets owned by Riot Games. Riot Games does not endorse or sponsor this project. 32 | > - [MIT License][license_url] 33 | 34 | ## Projects 35 | 36 | - [@valapi/auth](./packages/@valapi/auth) 37 | - [@valapi/crosshair](./packages/@valapi/crosshair) 38 | - [@valapi/lib](./packages/@valapi/lib) 39 | - [@valapi/riot-api](./packages/@valapi/riot-api) 40 | - [@valapi/valorant-api.com](./packages/@valapi/valorant-api.com) 41 | - [@valapi/web-client](./packages/@valapi/web-client) 42 | 43 | ## Release 44 | 45 | ```bash 46 | npm run build 47 | ``` 48 | 49 | ```bash 50 | npm publish --workspaces 51 | ``` 52 | 53 | Delete compiled files *(after build)* 54 | 55 | ```bash 56 | npm run clean 57 | ``` 58 | 59 | ## Testing 60 | 61 | ```bash 62 | npm run test 63 | ``` 64 | 65 | **dotenv** 66 | 67 | Regions: [valapi.github.io/guide/lib/region](https://valapi.github.io/guide/packages/lib/region.html) 68 | 69 | ```dosini 70 | # multi-factor must be "disable" 71 | VAL_REGION="na" 72 | VAL_USER="RiotUsername" 73 | VAL_PASS="Passowrd" 74 | 75 | # https://developer.riotgames.com 76 | VAL_RIOT_API="API_KEY_123" 77 | ``` 78 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security 2 | 3 | ## Reporting a bug 4 | 5 | If you have a security issue please report it to our maintainer 6 | 7 | ## Contact 8 | 9 | - Mail: kawinth.ingproject@gmail.com 10 | - Discord: kawtn_ 11 | - Discord Server: https://discord.gg/pbyWbUYjyt -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | ### Package 2 | 3 | | Name | Progression | 4 | | ---------- | ----------- | 5 | | Rate Limit | Missing | 6 | 7 | **@/crosshair** 8 | 9 | | Type | Name | Progression | 10 | | ----- | ------------ | ----------- | 11 | | Utils | ValCrosshair | Pre-alpha | 12 | 13 | ### Typescript 14 | 15 | **@/web-client** 16 | 17 | | Type | Name | Progression | 18 | | ------- | ------------------- | ----------- | 19 | | Service | AccountXP | Done | 20 | | Service | Config | Done | 21 | | Service | Content | Not Done | 22 | | Service | ContractDefinitions | Not Done | 23 | | Service | Contracts | Not Done | 24 | | Service | CoreGame | Not Done | 25 | | Service | DailyTicket | Done | 26 | | Service | DisplayNameService | Done | 27 | | Service | Favorites | Done | 28 | | Service | Latency | Done | 29 | | Service | MassRewards | Done | 30 | | Service | Match | Not Done | 31 | | Service | MMR | Done | 32 | | Service | Party | Missing | 33 | | Service | Personalization | Not Done | 34 | | Service | PreGame | Not Done | 35 | | Service | Premier | Missing | 36 | | Service | Restrictions | Not Done | 37 | | Service | Session | Done | 38 | | Service | Store | Done | 39 | 40 | ----------- -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('ts-jest').JestConfigWithTsJest} */ 2 | module.exports = { 3 | transform: { 4 | "^.+\\.tsx?$": [ 5 | "ts-jest", 6 | { 7 | tsconfig: "tsconfig.test.json" 8 | }, 9 | ], 10 | }, 11 | testEnvironment: "node", 12 | clearMocks: true, 13 | collectCoverage: true, 14 | coverageDirectory: "coverage", 15 | setupFiles: [ 16 | "dotenv/config" 17 | ], 18 | // 3 minute 19 | testTimeout: 3 * 60 * 1000 20 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "workspaces": [ 3 | "packages/@valapi/auth", 4 | "packages/@valapi/crosshair", 5 | "packages/@valapi/lib", 6 | "packages/@valapi/riot-api", 7 | "packages/@valapi/valorant-api.com", 8 | "packages/@valapi/web-client" 9 | ], 10 | "private": true, 11 | "name": "node-valapi", 12 | "version": "1.0.0", 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/valapi/node-valapi.git" 16 | }, 17 | "author": "ing3kth (https://github.com/KTNG-3)", 18 | "license": "MIT", 19 | "devDependencies": { 20 | "@types/bun": "^1.1.6", 21 | "@types/express": "^4.17.21", 22 | "@types/jest": "^29.5.12", 23 | "@types/node": "^22.1.0", 24 | "@typescript-eslint/eslint-plugin": "^7.7.1", 25 | "@typescript-eslint/parser": "^7.7.1", 26 | "dotenv": "^16.4.5", 27 | "eslint": "^8.57.0", 28 | "express": "^4.19.2", 29 | "jest": "29.7.0", 30 | "prettier": "^3.3.3", 31 | "rimraf": "^5.0.9", 32 | "ts-jest": "^29.2.4", 33 | "ts-node": "^10.9.2", 34 | "typedoc": "^0.26.5", 35 | "typescript": "^5.5.4" 36 | }, 37 | "scripts": { 38 | "test": "jest --detectOpenHandles", 39 | "format": "prettier --config ./.prettierrc --ignore-path ./.prettierignore --write \"packages/**/*\"", 40 | "lint": "npx eslint packages", 41 | "compile": "npx tsc --build tsconfig.json", 42 | "compile:clean": "npm exec --workspaces -- rimraf \"build\" \"tsconfig.tsbuildinfo\"", 43 | "docs": "typedoc", 44 | "docs:clean": "rimraf \"docs\"", 45 | "clean": "npm run compile:clean && npm run docs:clean", 46 | "build": "npm run clean && npm run format && npm run lint && npm run compile" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/@valapi/auth/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 5.0.0-beta.2 2 | 3 | Fix serializer 4 | 5 | ### Typescript 6 | 7 | **Add** 8 | 9 | - `RequestConfig.certificate` 10 | 11 | # 5.0.0-beta.1 12 | 13 | **_[Blocked by Cloudflare #9](https://github.com/valapi/node-valapi/issues/9)_** 14 | 15 | **Add** 16 | 17 | - `AuthRequest.certificate` 18 | - `Auth.captcha()` 19 | - `Auth.multifactor(loginCode)` 20 | 21 | _utils_ 22 | 23 | - `getResponseCookies(response)` 24 | 25 | _static_ 26 | 27 | - `AuthRequest.newUserAgent(build, app?, os?)` 28 | 29 | _packages_ 30 | 31 | - [x] `npmjs/selfsigned` 32 | 33 | **Change** 34 | 35 | - ~~`Auth.login(username, password)`~~ **-->** `Auth.login({ username, password, captcha })` 36 | 37 | ### Typescript 38 | 39 | **Add** 40 | 41 | - `RequestConfig.build` 42 | - `Config.sdk` 43 | - `AuthUserInfo.login_token` 44 | 45 | **Remove** 46 | 47 | - `RequestConfig.userAgent` 48 | 49 | # 5.0.0-beta.0 50 | 51 | **Change** 52 | 53 | - ~~`AuthInstance.fromJSON(user)`~~ 54 | - **-->** `new AuthInstance(user?)` 55 | - **-->** `new Auth({ user })` 56 | 57 | ### Typescript 58 | 59 | **Change** 60 | 61 | - ~~`UserAuthInfo`~~ **-->** `AuthUserInfo` 62 | - ~~`AuthConfig`~~ **-->** `Config` 63 | - ~~`AuthPromiseResponse`~~ **-->** `PromiseResponse` 64 | - ~~`AuthResponse`~~ **-->** `Response` 65 | - ~~`AuthRequestPlatform`~~ **-->** `ClientPlatform` 66 | - ~~`AuthRequestConfig`~~ **-->** `RequestConfig` 67 | 68 | # 5.0.0-alpha.0 69 | 70 | **Add** 71 | 72 | - `AuthRequest` 73 | 74 | **Change** 75 | 76 | - ~~`AuthClient`~~ **-->** `Auth` 77 | - ~~`AuthClient.refresh()`~~ **-->** `Auth.reauthorize()` 78 | - ~~`AuthService.fromUrl(TokenUrl)`~~ **-->** `Auth.uriTokenization(url)` 79 | - ~~`AuthService.fromToken(token)`~~ 80 | - **-->** `Auth.entitlementsTokenization()` 81 | - **-->** `Auth.regionTokenization()` 82 | - ~~`Cookie.authorize()`~~ **-->** `Auth.authorize(ignoreCookie = false)` 83 | - ~~`User.loginform(username, password)`~~ **-->** `Auth.login(username, password)` 84 | - ~~`AuthCore`~~ **-->** `AuthInstance` 85 | - ~~`AuthCore.getSubject(token)`~~ **-->** `AuthInstance.subject` 86 | - ~~`AuthCore.getExpirationDate(token)`~~ **-->** `AuthInstance.expirationDate` 87 | - ~~`AuthCore.authenticationInfo.isMultifactor`~~ **-->** `AuthInstance.isMultifactor` 88 | 89 | **Remove** 90 | 91 | - `AuthClient.verify()` 92 | - `AuthClient.fromCookie()` 93 | - `AuthService` 94 | - `Cookie` 95 | - `Multifactor` 96 | - `User` 97 | - `AuthCore.authenticationInfo` 98 | 99 | _static_ 100 | 101 | - `AuthClient.fromCookie()` 102 | - `AuthClient.fromJSON()` 103 | - `AuthCore.fromJSON()` 104 | - `AuthCore.Default` 105 | - `AuthService.fromJSON()` 106 | 107 | ### Typescript 108 | 109 | **Add** 110 | 111 | - `EntitlementsTokenResponse` 112 | - `RegionTokenResponse` 113 | - `UserTokenParse` 114 | - `AuthPromiseResponse` 115 | - `AuthResponse` 116 | - `AuthRequestConfig` 117 | 118 | **Change** 119 | 120 | - ~~`AuthService.TokenResponse`~~ **-->** `AuthRequestResponse` 121 | - ~~`AuthCore.Json`~~ **-->** `UserAuthInfo` 122 | - ~~`AuthCore.ClientPlatfrom`~~ **-->** `AuthRequestPlatfrom` 123 | - ~~`AuthCore.Config`~~ **-->** `AuthConfig` 124 | 125 | **Remove** 126 | 127 | - `AuthCore.JsonRegion` 128 | - `AuthCore.JsonAuthenticationInfoMessage` 129 | - `AuthCore.JsonAuthenticationInfo` 130 | 131 | # 3.2.1-beta 132 | 133 | **Add** 134 | 135 | - `.userAgent` 136 | 137 | **Change** 138 | 139 | - `.client.version` **-->** `.version` 140 | - `.client.platform` **-->** `.platform` 141 | 142 | # 3.2.0 143 | 144 | **Add** 145 | 146 | - `AuthCore.authenticationInfo` 147 | 148 | **Remove** 149 | 150 | - `AuthCore.isMultifactorAccount` 151 | - `AuthCore.isAuthenticationError` 152 | 153 | ### Typescript 154 | 155 | **Add** 156 | 157 | - `AuthCore.JsonRegion` 158 | - `AuthCore.JsonAuthenticationInfo` 159 | - `AuthCore.JsonAuthenticationInfoMessage` 160 | 161 | # 3.0.0 162 | 163 | **Add** 164 | 165 | - `AuthCore.getExpirationDate()` 166 | - `Cookie.authorize()` 167 | 168 | _static_ 169 | 170 | - `AuthCore.expires_in` 171 | - `AuthCore.token_type` 172 | 173 | **Remove** 174 | 175 | - `AuthCore.build()` 176 | - `Auth` 177 | 178 | **Change** 179 | 180 | - ~~`new AuthService(options)`~~ **-->** `new AuthService(options, data)` 181 | - ~~`Auth.fromToken()`~~ **-->** `AuthService.fromToken()` 182 | - ~~`Auth.fromUrl()`~~ **-->** `AuthService.fromUrl()` 183 | - ~~`Auth.fromResponse()`~~ **-->** `AuthService.fromResponse()` 184 | - ~~`Cookie.reAuthorize()`~~ **-->** `Cookie.reauthorize()` 185 | - ~~`Multifactor.twoFactor()`~~ **-->** `Multifactor.twofactor()` 186 | - ~~`User.loginForm()`~~ **-->** `User.loginform()` 187 | 188 | ### Typescript 189 | 190 | **Remove** 191 | 192 | - `ValError` 193 | - `AuthCore.BuildConfig` 194 | 195 | **Change** 196 | 197 | - ~~`AuthCore.Options`~~ **-->** `AuthCore.Config` 198 | - ~~`Auth.TokenResponse`~~ **-->** `AuthService.TokenResponse` 199 | -------------------------------------------------------------------------------- /packages/@valapi/auth/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022-2024 Ing Project 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/@valapi/auth/README.md: -------------------------------------------------------------------------------- 1 | [githubrepo_image]: https://github.com/valapi/.github/blob/main/128_valapi.png?raw=true 2 | [githubrepo_url]: https://github.com/valapi 3 | [download_image]: https://badgen.net/npm/dt/@valapi/auth?icon=npm 4 | [download_url]: https://www.npmjs.com/package/@valapi/auth 5 | [size_image]: https://packagephobia.com/badge?p=@valapi/auth 6 | [size_url]: https://packagephobia.com/result?p=@valapi/auth 7 | [vulnerabilities_image]: https://snyk.io/test/npm/@valapi/auth/badge.svg 8 | [vulnerabilities_url]: https://snyk.io/test/npm/@valapi/auth 9 | [license_image]: https://badgen.net/badge/license/MIT/blue 10 | [license_url]: https://github.com/valapi/.github/blob/main/LICENSE 11 | [github_image]: https://badgen.net/badge/icon/github?icon=github&label 12 | [github_url]: https://github.com/valapi/node-valapi/tree/master/packages/@valapi/auth 13 | [discord_image]: https://badgen.net/badge/icon/discord?icon=discord&label 14 | [discord_url]: https://discord.gg/pbyWbUYjyt 15 | 16 |
17 | 18 | # Valorant API - Authentication 19 | 20 | [![Profile][githubrepo_image]][github_url] 21 | 22 | Valorant Authentication 23 | 24 | [![Downloads][download_image]][download_url] 25 | [![install size][size_image]][size_url] 26 | [![Known Vulnerabilities][vulnerabilities_image]][vulnerabilities_url] 27 | 28 | [![LICENSE][license_image]][license_url] 29 | [![Github][github_image]][github_url] 30 | [![Discord][discord_image]][discord_url] 31 | 32 | Documentation: [valapi.github.io/docs](https://valapi.github.io/docs) 33 | 34 | Guide: [valapi.github.io/guide](https://valapi.github.io/guide) 35 | 36 |
37 | 38 | --- 39 | 40 | > - **@valapi/auth** isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing Riot Games properties. Riot Games, and all associated properties are trademarks or registered trademarks of Riot Games, Inc. 41 | > - **@valapi/auth** was created under [Riot Games' "Legal Jibber Jabber"](https://www.riotgames.com/en/legal) policy using assets owned by Riot Games. Riot Games does not endorse or sponsor this project. 42 | > - [MIT License][license_url] 43 | 44 | ## Installation 45 | 46 | **NPM:** 47 | 48 | ```bash 49 | npm install @valapi/auth 50 | ``` 51 | 52 | **PNPM:** 53 | 54 | ```bash 55 | pnpm add @valapi/auth 56 | ``` 57 | 58 | ## Guide 59 | 60 | ```typescript 61 | import { Auth } from "@valapi/auth"; 62 | ``` 63 | 64 | ```typescript 65 | const auth = new Auth(); 66 | ``` 67 | 68 | ### Captcha 69 | 70 | _This is only an example function_ 71 | 72 | ```typescript 73 | const data = await auth.captcha(); 74 | 75 | const captchaResponse = await getCaptchaResponse(data); // P1_eyJ... 76 | ``` 77 | 78 | ### Auth 79 | 80 | ```typescript 81 | await auth.login({ 82 | username: "BestUsername", 83 | password: "SuperSecretPassword", 84 | captcha: captchaResponse 85 | }); 86 | ``` 87 | 88 | ```typescript 89 | if (auth.isMultifactor) { 90 | const loginCode = 428793; 91 | 92 | await auth.multifactor(loginCode); 93 | } 94 | ``` 95 | 96 | **Subject** (PlayerUUID) 97 | 98 | ```typescript 99 | const subject = auth.subject; 100 | ``` 101 | 102 | **Serialize** 103 | 104 | ```typescript 105 | const auth = new Auth({ user: oldAuth.toJSON() }); 106 | 107 | if (!auth.isAuthenticated) { 108 | await auth.reauthorize(); 109 | } 110 | ``` 111 | -------------------------------------------------------------------------------- /packages/@valapi/auth/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@valapi/auth", 3 | "version": "5.0.0-beta.2", 4 | "publishConfig": { 5 | "registry": "https://registry.npmjs.org", 6 | "access": "public" 7 | }, 8 | "description": "Valorant API - Authentication", 9 | "keywords": [ 10 | "riot", 11 | "api", 12 | "val", 13 | "valorant", 14 | "authentication", 15 | "multifactor", 16 | "twofactor" 17 | ], 18 | "main": "build/index.js", 19 | "types": "./build/index.d.ts", 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/valapi/node-valapi.git", 23 | "directory": "packages/@valapi/auth" 24 | }, 25 | "author": "ing3kth (https://github.com/KTNG-3)", 26 | "license": "MIT", 27 | "bugs": { 28 | "url": "https://github.com/valapi/node-valapi/issues" 29 | }, 30 | "homepage": "https://valapi.github.io/guide", 31 | "dependencies": { 32 | "@valapi/lib": "5.0.0-beta.2", 33 | "axios": "^1.7.3", 34 | "http-cookie-agent": "^6.0.5", 35 | "selfsigned": "^2.4.1", 36 | "tough-cookie": "^4.1.4" 37 | }, 38 | "devDependencies": { 39 | "@types/tough-cookie": "^4.0.5" 40 | }, 41 | "directories": { 42 | "lib": "build", 43 | "test": "src/__tests__" 44 | }, 45 | "files": [ 46 | "build", 47 | "CHANGELOG.md", 48 | "LICENSE", 49 | "package.json", 50 | "README.md", 51 | "SECURITY.md" 52 | ] 53 | } 54 | -------------------------------------------------------------------------------- /packages/@valapi/auth/src/__tests__/client.ts: -------------------------------------------------------------------------------- 1 | import { env } from "node:process"; 2 | import { randomBytes } from "node:crypto"; 3 | 4 | import type { Region } from "@valapi/lib"; 5 | 6 | import { Auth } from "../index"; 7 | 8 | describe("auth.client", () => { 9 | const auth = new Auth(); 10 | 11 | test("empty_reauth", async () => { 12 | await expect(auth.reauthorize()).rejects.toThrow(); 13 | }); 14 | 15 | test("login", async () => { 16 | await auth.login(env.VAL_USER, env.VAL_PASS); 17 | 18 | expect(auth.isMultifactor).toBe(false); 19 | expect(auth.isAuthenticated).toBe(true); 20 | }); 21 | 22 | test("error", async () => { 23 | const errorAuth = new Auth({ 24 | platform: { 25 | platformChipset: "", 26 | platformOS: "", 27 | platformOSVersion: "", 28 | platformType: "" 29 | }, 30 | version: "" 31 | }); 32 | 33 | await expect(errorAuth.login(randomBytes(10).toString("hex"), randomBytes(15).toString("hex"))).rejects.toThrow(); 34 | }); 35 | 36 | test("region", async () => { 37 | await expect(auth.regionTokenization()).resolves.toBe(env.VAL_REGION); 38 | }); 39 | 40 | test("reauth", async () => { 41 | const cookieAuth = new Auth({ 42 | user: { 43 | ...new Auth().toJSON(), 44 | ...{ 45 | cookie: auth.cookie.toJSON() 46 | } 47 | } 48 | }); 49 | 50 | await cookieAuth.reauthorize(); 51 | 52 | expect(cookieAuth.isMultifactor).toBe(false); 53 | expect(cookieAuth.subject).toBe(auth.subject); 54 | expect(cookieAuth.cookie.serializeSync()).not.toStrictEqual(auth.cookie.serializeSync()); 55 | }); 56 | }); 57 | -------------------------------------------------------------------------------- /packages/@valapi/auth/src/__tests__/core.ts: -------------------------------------------------------------------------------- 1 | import { CookieJar } from "tough-cookie"; 2 | 3 | import { AuthInstance } from "@valapi/auth"; 4 | import type { AuthUserInfo } from "@valapi/auth"; 5 | 6 | describe("auth.core", () => { 7 | const auth = new AuthInstance(); 8 | 9 | test("new", () => { 10 | expect(auth.toJSON()).toMatchObject({ 11 | cookie: new CookieJar().serializeSync(), 12 | isMultifactor: false, 13 | access_token: "", 14 | id_token: "", 15 | session_state: "", 16 | entitlements_token: "" 17 | }); 18 | 19 | expect(auth.subject).toBe(""); 20 | expect(auth.isAuthenticated).toBe(false); 21 | }); 22 | 23 | test("save", () => { 24 | const exportAuth = new AuthInstance(auth.toJSON()); 25 | 26 | expect(exportAuth.toJSON()).toStrictEqual(auth.toJSON()); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /packages/@valapi/auth/src/client/AuthInstance.ts: -------------------------------------------------------------------------------- 1 | import { CookieJar } from "tough-cookie"; 2 | 3 | import { ValEncryption } from "@valapi/lib"; 4 | 5 | export interface AuthUserInfo { 6 | cookie: CookieJar.Serialized; 7 | isMultifactor: boolean; 8 | login_token: string; 9 | access_token: string; 10 | id_token: string; 11 | session_state: string; 12 | entitlements_token: string; 13 | } 14 | 15 | interface UserTokenParse { 16 | sub: string; 17 | exp: number; 18 | } 19 | 20 | export class AuthInstance implements Omit { 21 | public cookie: CookieJar = new CookieJar(); 22 | public isMultifactor: boolean = false; 23 | 24 | public login_token: string = ""; 25 | public access_token: string = ""; 26 | public id_token: string = ""; 27 | public session_state: string = ""; 28 | public entitlements_token: string = ""; 29 | 30 | public subject: string = ""; 31 | public expirationDate: Date = new Date(-1); 32 | 33 | public get isAuthenticated() { 34 | return new Date() < this.expirationDate && Boolean(this.access_token) && Boolean(this.entitlements_token); 35 | } 36 | 37 | public constructor(user?: AuthUserInfo) { 38 | if (!user) { 39 | return; 40 | } 41 | 42 | this.cookie = CookieJar.deserializeSync(user.cookie); 43 | this.isMultifactor = user.isMultifactor; 44 | 45 | this.login_token = user.login_token; 46 | this.access_token = user.access_token; 47 | this.id_token = user.id_token; 48 | this.session_state = user.session_state; 49 | this.entitlements_token = user.entitlements_token; 50 | 51 | this.getTokenInfo(); 52 | } 53 | 54 | protected getTokenInfo() { 55 | if (!this.access_token) { 56 | return; 57 | } 58 | 59 | const parseToken: UserTokenParse = ValEncryption.decryptJson(this.access_token.split(".")[1]); 60 | 61 | this.subject = parseToken.sub; 62 | this.expirationDate = new Date(parseToken.exp * 1000); 63 | } 64 | 65 | public toJSON(): AuthUserInfo { 66 | return { 67 | cookie: this.cookie.serializeSync(), 68 | isMultifactor: this.isMultifactor, 69 | login_token: this.login_token, 70 | access_token: this.access_token, 71 | id_token: this.id_token, 72 | session_state: this.session_state, 73 | entitlements_token: this.entitlements_token 74 | }; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /packages/@valapi/auth/src/client/AuthRequest.ts: -------------------------------------------------------------------------------- 1 | import { createSecureContext, type SecureContextOptions } from "node:tls"; 2 | import type { Agent, AgentOptions } from "node:https"; 3 | 4 | import axios, { AxiosHeaders } from "axios"; 5 | import type { AxiosRequestConfig, AxiosResponse, AxiosInstance } from "axios"; 6 | import { HttpsCookieAgent } from "http-cookie-agent/http"; 7 | import type { CookieAgent, CookieAgentOptions } from "http-cookie-agent/http"; 8 | import type { CookieJar } from "tough-cookie"; 9 | import * as selfsigned from "selfsigned"; 10 | 11 | import { ValEncryption } from "@valapi/lib"; 12 | 13 | export type PromiseResponse = Promise>; 14 | export type Response = AxiosResponse; 15 | 16 | export interface ClientPlatfrom { 17 | platformType: string; 18 | platformOS: string; 19 | platformOSVersion: string; 20 | platformChipset: string; 21 | } 22 | 23 | export interface RequestConfig { 24 | build?: string; 25 | version?: string; 26 | platform?: ClientPlatfrom; 27 | axiosConfig?: AxiosRequestConfig; 28 | agentConfig?: AgentOptions & CookieAgentOptions; 29 | certificate?: selfsigned.GenerateResult; 30 | cookie: CookieJar; 31 | } 32 | 33 | export class AuthRequest { 34 | public readonly certificate: selfsigned.GenerateResult; 35 | public readonly headers: AxiosHeaders; 36 | public readonly agent: CookieAgent; 37 | 38 | readonly defaultAxiosConfig: AxiosRequestConfig; 39 | 40 | constructor(config: RequestConfig) { 41 | const __config = >{ 42 | ...{ 43 | build: "91.0.2.1870.3774", // GET https://valorant-api.com/v1/version["data"]["riotClientBuild"] 44 | version: "release-09.00-shipping-28-2628993", // GET https://valorant-api.com/v1/version["data"]["riotClientVersion"] 45 | platform: { 46 | platformType: "PC", 47 | platformOS: "Windows", 48 | platformOSVersion: "10.0.19043.1.256.64bit", 49 | platformChipset: "Unknown" 50 | }, 51 | axiosConfig: { 52 | withCredentials: true 53 | } 54 | }, 55 | ...config 56 | }; 57 | 58 | this.defaultAxiosConfig = __config.axiosConfig; 59 | 60 | this.certificate = 61 | __config.certificate ?? 62 | selfsigned.generate([], { 63 | days: 30, 64 | pkcs7: true, 65 | clientCertificate: true, 66 | clientCertificateCN: ValEncryption.randomString(16) 67 | }); 68 | 69 | this.headers = new AxiosHeaders() 70 | .setContentType("application/json") 71 | .setAccept("application/json") 72 | .setUserAgent(AuthRequest.newUserAgent(__config.build, "rso-auth")) 73 | .set({ 74 | "X-Riot-ClientVersion": __config.version, 75 | "X-Riot-ClientPlatform": ValEncryption.encryptJson(__config.platform) 76 | }); 77 | 78 | const ctx_options: SecureContextOptions = { 79 | cert: this.certificate.cert, 80 | sigalgs: [ 81 | "ecdsa_secp256r1_sha256", 82 | "rsa_pss_rsae_sha256", 83 | "rsa_pkcs1_sha256", 84 | "ecdsa_secp384r1_sha384", 85 | "rsa_pss_rsae_sha384", 86 | "rsa_pkcs1_sha384", 87 | "rsa_pss_rsae_sha512", 88 | "rsa_pkcs1_sha512", 89 | "rsa_pkcs1_sha1" 90 | ].join(":"), 91 | ciphers: [ 92 | "TLS_AES_128_GCM_SHA256", 93 | "TLS_CHACHA20_POLY1305_SHA256", 94 | "TLS_AES_256_GCM_SHA384", 95 | "TLS_AES_128_CCM_SHA256", 96 | "TLS_AES_128_CCM_8_SHA256", 97 | "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256" 98 | ].join(":"), 99 | honorCipherOrder: true, 100 | key: this.certificate.private, 101 | maxVersion: "TLSv1.3", 102 | minVersion: "TLSv1.2" 103 | }; 104 | 105 | this.agent = new HttpsCookieAgent({ 106 | ...__config.agentConfig, 107 | ...ctx_options, 108 | ...{ 109 | // #TcpSocketConnectOpts 110 | keepAlive: true, 111 | 112 | // #CommonConnectionOptions 113 | requestCert: false, 114 | secureContext: createSecureContext(ctx_options), 115 | rejectUnauthorized: false, 116 | 117 | // #CookieAgentOptions 118 | cookies: { 119 | jar: __config.cookie 120 | } 121 | } 122 | }); 123 | } 124 | 125 | private get axiosConfig(): AxiosRequestConfig { 126 | return { 127 | ...this.defaultAxiosConfig, 128 | ...{ 129 | httpsAgent: this.agent, 130 | headers: { 131 | ...this.defaultAxiosConfig.headers, 132 | ...this.headers.toJSON() 133 | } 134 | } 135 | }; 136 | } 137 | 138 | public static newUserAgent(build: string, app: string = "%s", os: string = "Windows;10;;Professional, x64"): string { 139 | return `RiotClient/${build} ${app} (${os})`; 140 | } 141 | 142 | public create(): AxiosInstance { 143 | return axios.create(this.axiosConfig); 144 | } 145 | 146 | public get(url: string) { 147 | return axios.get(url, this.axiosConfig); 148 | } 149 | 150 | public post(url: string, data: any = {}) { 151 | return axios.post(url, data, this.axiosConfig); 152 | } 153 | 154 | public put(url: string, data: any = {}) { 155 | return axios.put(url, data, this.axiosConfig); 156 | } 157 | 158 | public delete(url: string) { 159 | return axios.delete(url, this.axiosConfig); 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /packages/@valapi/auth/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Auth } from "./client/Auth"; 2 | 3 | export { Auth }; 4 | export type { Config } from "./client/Auth"; 5 | 6 | export { AuthInstance } from "./client/AuthInstance"; 7 | export type { AuthUserInfo } from "./client/AuthInstance"; 8 | 9 | export { AuthRequest } from "./client/AuthRequest"; 10 | export type { PromiseResponse, Response, ClientPlatfrom, RequestConfig } from "./client/AuthRequest"; 11 | 12 | export default Auth; 13 | -------------------------------------------------------------------------------- /packages/@valapi/auth/src/utils/cookie.ts: -------------------------------------------------------------------------------- 1 | import { Cookie } from "tough-cookie"; 2 | 3 | import { Response } from "../client/AuthRequest"; 4 | 5 | // * mainly support bun 6 | export function getResponseCookies(response: Response): Cookie[] { 7 | const header = response.headers["set-cookie"]; 8 | if (!header) { 9 | return []; 10 | } 11 | 12 | const cookies = []; 13 | 14 | for (const string of header) { 15 | const cookie = Cookie.parse(string); 16 | 17 | if (!cookie) { 18 | continue; 19 | } 20 | 21 | cookies.push(cookie); 22 | } 23 | 24 | return cookies; 25 | } 26 | -------------------------------------------------------------------------------- /packages/@valapi/auth/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "./src", 5 | "outDir": "./build", 6 | "paths": { 7 | "@valapi/lib": ["../lib/src"] 8 | } 9 | }, 10 | "references": [ 11 | { 12 | "path": "../lib" 13 | } 14 | ], 15 | "exclude": ["node_modules", "build", "src/__tests__"] 16 | } 17 | -------------------------------------------------------------------------------- /packages/@valapi/auth/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "auth", 3 | "extends": ["../../../typedoc.base.json"], 4 | "entryPoints": ["src/index.ts"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/@valapi/crosshair/CHANGELOG.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/valapi/node-valapi/af9b0d2dc1af29b7e2c15300493fccf3dcaa500b/packages/@valapi/crosshair/CHANGELOG.md -------------------------------------------------------------------------------- /packages/@valapi/crosshair/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Ing Project 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/@valapi/crosshair/README.md: -------------------------------------------------------------------------------- 1 | [githubrepo_image]: https://github.com/valapi/.github/blob/main/128_valapi.png?raw=true 2 | [githubrepo_url]: https://github.com/valapi 3 | [download_image]: https://badgen.net/npm/dt/@valapi/crosshair?icon=npm 4 | [download_url]: https://www.npmjs.com/package/@valapi/crosshair 5 | [size_image]: https://packagephobia.com/badge?p=@valapi/crosshair 6 | [size_url]: https://packagephobia.com/result?p=@valapi/crosshair 7 | [vulnerabilities_image]: https://snyk.io/test/npm/@valapi/crosshair/badge.svg 8 | [vulnerabilities_url]: https://snyk.io/test/npm/@valapi/crosshair 9 | [license_image]: https://badgen.net/badge/license/MIT/blue 10 | [license_url]: https://github.com/valapi/.github/blob/main/LICENSE 11 | [github_image]: https://badgen.net/badge/icon/github?icon=github&label 12 | [github_url]: https://github.com/valapi/node-valapi/tree/master/packages/@valapi/crosshair 13 | [discord_image]: https://badgen.net/badge/icon/discord?icon=discord&label 14 | [discord_url]: https://discord.gg/pbyWbUYjyt 15 | 16 |
17 | 18 | # Valorant API - Crosshair 19 | 20 | [![Profile][githubrepo_image]][github_url] 21 | 22 | Valorant Crosshair Compiler 23 | 24 | [![Downloads][download_image]][download_url] 25 | [![install size][size_image]][size_url] 26 | [![Known Vulnerabilities][vulnerabilities_image]][vulnerabilities_url] 27 | 28 | [![LICENSE][license_image]][license_url] 29 | [![Github][github_image]][github_url] 30 | [![Discord][discord_image]][discord_url] 31 | 32 | Documentation: [valapi.github.io/docs](https://valapi.github.io/docs) 33 | 34 | Guide: [valapi.github.io/guide](https://valapi.github.io/guide) 35 | 36 |
37 | 38 | --- 39 | 40 | > - **@valapi/crosshair** isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing Riot Games properties. Riot Games, and all associated properties are trademarks or registered trademarks of Riot Games, Inc. 41 | > - **@valapi/crosshair** was created under [Riot Games' "Legal Jibber Jabber"](https://www.riotgames.com/en/legal) policy using assets owned by Riot Games. Riot Games does not endorse or sponsor this project. 42 | > - [MIT License][license_url] 43 | 44 | ## Installation 45 | 46 | **NPM:** 47 | 48 | ```bash 49 | npm install @valapi/crosshair 50 | ``` 51 | 52 | **PNPM:** 53 | 54 | ```bash 55 | pnpm add @valapi/crosshair 56 | ``` 57 | -------------------------------------------------------------------------------- /packages/@valapi/crosshair/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@valapi/crosshair", 3 | "version": "5.0.0-beta.2", 4 | "publishConfig": { 5 | "registry": "https://registry.npmjs.org", 6 | "access": "public" 7 | }, 8 | "description": "Valorant API - Crosshair", 9 | "keywords": [ 10 | "riot", 11 | "api", 12 | "val", 13 | "valorant", 14 | "crosshair" 15 | ], 16 | "main": "build/index.js", 17 | "types": "./build/index.d.ts", 18 | "repository": { 19 | "type": "git", 20 | "url": "git+https://github.com/valapi/node-valapi.git", 21 | "directory": "packages/@valapi/crosshair" 22 | }, 23 | "author": "ing3kth (https://github.com/KTNG-3)", 24 | "license": "MIT", 25 | "bugs": { 26 | "url": "https://github.com/valapi/node-valapi/issues" 27 | }, 28 | "homepage": "https://valapi.github.io/guide", 29 | "dependencies": { 30 | "@valapi/lib": "5.0.0-beta.2" 31 | }, 32 | "directories": { 33 | "lib": "build", 34 | "test": "src/__tests__" 35 | }, 36 | "files": [ 37 | "build", 38 | "CHANGELOG.md", 39 | "LICENSE", 40 | "package.json", 41 | "README.md", 42 | "SECURITY.md" 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /packages/@valapi/crosshair/src/__tests__/crosshair.ts: -------------------------------------------------------------------------------- 1 | import { ValCrosshair } from "../index"; 2 | 3 | describe("crosshair", () => { 4 | test("set", () => { 5 | const crosshair: ValCrosshair = new ValCrosshair(); 6 | 7 | let index: Array = []; 8 | 9 | crosshair.find((value, _index) => { 10 | if (value.value.name === "AimDownSights.CopyPrimaryCrosshair") { 11 | index = _index; 12 | return true; 13 | } 14 | 15 | return false; 16 | }); 17 | 18 | expect( 19 | crosshair.map((_value, _index) => { 20 | if (_index.toString() === index.toString()) { 21 | return _value; 22 | } 23 | }) 24 | ).toStrictEqual([ 25 | { 26 | type: "Boolean", 27 | value: { 28 | path: "0.p", 29 | priority: 1, 30 | name: "AimDownSights.CopyPrimaryCrosshair", 31 | data: 1, 32 | default: 1 33 | }, 34 | components: [] 35 | } 36 | ]); 37 | 38 | crosshair.set(index, 0); 39 | 40 | expect(crosshair.find((_value, _index) => _index.toString() === index.toString())).toStrictEqual({ 41 | type: "Boolean", 42 | value: { 43 | path: "0.p", 44 | priority: 1, 45 | name: "AimDownSights.CopyPrimaryCrosshair", 46 | data: 0, 47 | default: 1 48 | }, 49 | components: [] 50 | }); 51 | }); 52 | 53 | test("data", () => { 54 | const crosshair: ValCrosshair = new ValCrosshair(); 55 | 56 | crosshair.import("0;s;1"); 57 | 58 | expect(crosshair.find(value => value.value.path === "0.s")).toStrictEqual({ 59 | type: "Boolean", 60 | value: { 61 | path: "0.s", 62 | priority: 3, 63 | name: "General.Crosshair.UseAdvancedOptions", 64 | data: 1, 65 | default: 0 66 | }, 67 | components: [] 68 | }); 69 | 70 | expect(crosshair.export()).toBe("0;s;1"); 71 | }); 72 | }); 73 | -------------------------------------------------------------------------------- /packages/@valapi/crosshair/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "./src", 5 | "outDir": "./build", 6 | "paths": { 7 | "@valapi/lib": ["../lib/src"] 8 | } 9 | }, 10 | "references": [ 11 | { 12 | "path": "../lib" 13 | } 14 | ], 15 | "exclude": ["node_modules", "build", "src/__tests__"] 16 | } 17 | -------------------------------------------------------------------------------- /packages/@valapi/crosshair/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "crosshair", 3 | "extends": ["../../../typedoc.base.json"], 4 | "entryPoints": ["src/index.ts"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/@valapi/lib/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 5.0.0-beta.1 2 | 3 | **Add** 4 | 5 | _static_ 6 | 7 | - `ValEncryption.randomString(size)` 8 | 9 | # 5.0.0-beta.0 10 | 11 | **Add** 12 | 13 | - `ValVersion` 14 | 15 | **Change** 16 | 17 | - ~~`QueueId.fromName(x)`~~ **-->** `QueueId.fromName(x, newMapID?)` 18 | - ~~`QueueId.fromID(x)`~~ **-->** `QueueId.fromID(x, newMapID?)` 19 | 20 | # 4.0.0 21 | 22 | **Add** 23 | 24 | - `ValEncryption.encryptJson(object)` 25 | - `ValEncryption.decryptJson(object)` 26 | - `CrosshairHexColor` 27 | 28 | **Change** 29 | 30 | - ~~`ValError.fromError`~~ **-->** `ValError.parse` 31 | - ~~`ValBase64`~~ **-->** `ValEncryption` 32 | 33 | - ~~`CrosshairColor.fromColor()`~~ **-->** `CrosshairColor.fromName()` 34 | - ~~`CrosshairColor.fromString()`~~ **-->** `CrosshairColor.fromID()` 35 | - ~~`CrosshairColor.fromColorHex()`~~ **-->** `CrosshairHexColor.fromName()` 36 | - ~~`CrosshairColor.fromStringHex()`~~ **-->** `CrosshairHexColor.fromHex()` 37 | - ~~`ItemTypeId.fromString()`~~ **-->** `ItemTypeId.fromID()` 38 | - ~~`Locale.fromString()`~~ **-->** `Locale.fromID()` 39 | - ~~`QueueId.fromString()`~~ **-->** `QueueId.fromID()` 40 | - ~~`Region.fromString()`~~ **-->** `Region.fromID()` 41 | 42 | **Remove** 43 | 44 | - `CrosshairColor.Data` 45 | - `ItemTypeId.Data` 46 | - `Locale.Data` 47 | - `QueueId.Data` 48 | - `Region.Data` 49 | 50 | ### Typescript 51 | 52 | **Change** 53 | 54 | - ~~`CrosshairColor.Color`~~ **-->** `CrosshairColor.Name` 55 | - ~~`CrosshairColor.Identify`~~ **-->** `CrosshairColor.ID` 56 | - ~~`CrosshairColor.ColorHex`~~ **-->** `CrosshairHexColor.Name` 57 | - ~~`CrosshairColor.IdentifyHex`~~ **-->** `CrosshairHexColor.Hex` 58 | - ~~`ItemTypeId.Identify`~~ **-->** `ItemTypeId.ID` 59 | - ~~`Locale.Identify`~~ **-->** `Locale.ID` 60 | - ~~`QueueId.Identify`~~ **-->** `QueueId.ID` 61 | - ~~`Region.Identify`~~ **-->** `Region.ID` 62 | 63 | # 3.1.0 64 | 65 | **Remove** 66 | 67 | - `ValAxios` 68 | 69 | # 3.0.2 70 | 71 | **Change** 72 | 73 | - ~~`toUft8(text, technique)`~~ **-->** `ValBase64.encrypt(text)` 74 | - ~~`fromUft8(text, technique)`~~ **-->** `ValBase64.decrypt(text)` 75 | 76 | # 3.0.0 77 | 78 | **Remove** 79 | 80 | - `ValRegion.toJSON()` 81 | - `ValRegion.data` 82 | - `ValEvent` 83 | 84 | **Change** 85 | 86 | - ~~`ValRegion.data.id`~~ **-->** `ValRegion.id` 87 | 88 | ### Typescript 89 | 90 | **Remove** 91 | 92 | - `ValAxios.Config` 93 | - `ValAxios.Request` 94 | - `ValAxios.RequestData` 95 | - `ValRegion.JSON` 96 | -------------------------------------------------------------------------------- /packages/@valapi/lib/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022-2024 Ing Project 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/@valapi/lib/README.md: -------------------------------------------------------------------------------- 1 | [githubrepo_image]: https://github.com/valapi/.github/blob/main/128_valapi.png?raw=true 2 | [githubrepo_url]: https://github.com/valapi 3 | [download_image]: https://badgen.net/npm/dt/@valapi/lib?icon=npm 4 | [download_url]: https://www.npmjs.com/package/@valapi/lib 5 | [size_image]: https://packagephobia.com/badge?p=@valapi/lib 6 | [size_url]: https://packagephobia.com/result?p=@valapi/lib 7 | [vulnerabilities_image]: https://snyk.io/test/npm/@valapi/lib/badge.svg 8 | [vulnerabilities_url]: https://snyk.io/test/npm/@valapi/lib 9 | [license_image]: https://badgen.net/badge/license/MIT/blue 10 | [license_url]: https://github.com/valapi/.github/blob/main/LICENSE 11 | [github_image]: https://badgen.net/badge/icon/github?icon=github&label 12 | [github_url]: https://github.com/valapi/node-valapi/tree/master/packages/@valapi/lib 13 | [discord_image]: https://badgen.net/badge/icon/discord?icon=discord&label 14 | [discord_url]: https://discord.gg/pbyWbUYjyt 15 | 16 |
17 | 18 | # Valorant API - Library 19 | 20 | [![Profile][githubrepo_image]][github_url] 21 | 22 | Library of **@valapi** 23 | 24 | [![Downloads][download_image]][download_url] 25 | [![install size][size_image]][size_url] 26 | [![Known Vulnerabilities][vulnerabilities_image]][vulnerabilities_url] 27 | 28 | [![LICENSE][license_image]][license_url] 29 | [![Github][github_image]][github_url] 30 | [![Discord][discord_image]][discord_url] 31 | 32 | Documentation: [valapi.github.io/docs](https://valapi.github.io/docs) 33 | 34 | Guide: [valapi.github.io/guide](https://valapi.github.io/guide) 35 | 36 |
37 | 38 | --- 39 | 40 | > - **@valapi/lib** isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing Riot Games properties. Riot Games, and all associated properties are trademarks or registered trademarks of Riot Games, Inc. 41 | > - **@valapi/lib** was created under [Riot Games' "Legal Jibber Jabber"](https://www.riotgames.com/en/legal) policy using assets owned by Riot Games. Riot Games does not endorse or sponsor this project. 42 | > - [MIT License][license_url] 43 | 44 | ## Installation 45 | 46 | **NPM:** 47 | 48 | ```bash 49 | npm install @valapi/lib 50 | ``` 51 | 52 | **PNPM:** 53 | 54 | ```bash 55 | pnpm add @valapi/lib 56 | ``` 57 | -------------------------------------------------------------------------------- /packages/@valapi/lib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@valapi/lib", 3 | "version": "5.0.0-beta.2", 4 | "publishConfig": { 5 | "registry": "https://registry.npmjs.org", 6 | "access": "public" 7 | }, 8 | "description": "Valorant API - Library", 9 | "keywords": [ 10 | "riot", 11 | "api", 12 | "val", 13 | "valorant" 14 | ], 15 | "main": "build/index.js", 16 | "types": "./build/index.d.ts", 17 | "repository": { 18 | "type": "git", 19 | "url": "git+https://github.com/valapi/node-valapi.git", 20 | "directory": "packages/@valapi/lib" 21 | }, 22 | "author": "ing3kth (https://github.com/KTNG-3)", 23 | "license": "MIT", 24 | "bugs": { 25 | "url": "https://github.com/valapi/node-valapi/issues" 26 | }, 27 | "homepage": "https://valapi.github.io/guide", 28 | "dependencies": { 29 | "tslib": "^2.6.3" 30 | }, 31 | "directories": { 32 | "lib": "build", 33 | "test": "src/__tests__" 34 | }, 35 | "files": [ 36 | "build", 37 | "CHANGELOG.md", 38 | "LICENSE", 39 | "package.json", 40 | "README.md", 41 | "SECURITY.md" 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /packages/@valapi/lib/src/__tests__/region.ts: -------------------------------------------------------------------------------- 1 | import { ValRegion, Region } from "../index"; 2 | 3 | describe("lib.region", () => { 4 | test("latin_america", () => { 5 | const _region = new ValRegion(Region.Default.Latin_America); 6 | 7 | const id = "latam"; 8 | 9 | expect(_region.id).toBe(id); 10 | }); 11 | 12 | test("brazil", () => { 13 | const _region = new ValRegion(Region.Default.Brazil); 14 | 15 | const id = "br"; 16 | 17 | expect(_region.id).toBe(id); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/@valapi/lib/src/__tests__/resource.ts: -------------------------------------------------------------------------------- 1 | import { CrosshairColor, CrosshairHexColor, ItemTypeId, Locale, QueueId, Region } from "../index"; 2 | 3 | describe("lib.resource", () => { 4 | test("crosshair", () => { 5 | expect(CrosshairColor.fromName("White")).toBe("0"); 6 | expect(CrosshairColor.fromID("1")).toBe("Green"); 7 | }); 8 | 9 | test("crosshair_hex", () => { 10 | expect(CrosshairHexColor.fromName("Pink")).toBe("FF00FF"); 11 | expect(CrosshairHexColor.fromHex("00FFFF")).toBe("Cyan"); 12 | }); 13 | 14 | test("item_type", () => { 15 | expect(ItemTypeId.fromName("Agents")).toBe("01bb38e1-da47-4e6a-9b3d-945fe4655707"); 16 | expect(ItemTypeId.fromID("e7c63390-eda7-46e0-bb7a-a6abdacd2433")).toBe("Skins"); 17 | }); 18 | 19 | test("locale", () => { 20 | expect(Locale.fromName("German_Germany")).toBe("de-DE"); 21 | expect(Locale.fromID("zh-TW")).toBe("Chinese_Taiwan"); 22 | }); 23 | 24 | test("queue", () => { 25 | expect(QueueId.fromName("Escalation")).toBe("ggteam"); 26 | expect(QueueId.fromID("onefa")).toBe("Replication"); 27 | }); 28 | 29 | test("queue.newmap", () => { 30 | const newMapID = "abyss"; 31 | 32 | expect(QueueId.fromName("New_Map", newMapID)).toBe(newMapID); 33 | expect(QueueId.fromID(newMapID, newMapID)).toBe("New_Map"); 34 | }); 35 | 36 | test("region", () => { 37 | expect(Region.fromName("Brazil")).toBe("br"); 38 | expect(Region.fromID("pbe")).toBe("Public_Beta_Environment"); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /packages/@valapi/lib/src/__tests__/util.ts: -------------------------------------------------------------------------------- 1 | import { ValEncryption } from "../index"; 2 | 3 | describe("lib.util", () => { 4 | test("encryption", () => { 5 | expect(ValEncryption.decryptJson("eyJ2YWxvcmFudC50cyI6ICJ0aGUgYmVzdCBOb2RlLmpzIGxpYnJhcnkgdG8gdXNpbmcgVmFsb3JhbnQgQVBJIn0=")).toStrictEqual({ 6 | "valorant.ts": "the best Node.js library to using Valorant API" 7 | }); 8 | expect(ValEncryption.encryptJson({ 1: "2kov83v4yj1v8y09", ":)": "18ny9c8ny91c8ny9cn9" })).toBe("eyIxIjoiMmtvdjgzdjR5ajF2OHkwOSIsIjopIjoiMThueTljOG55OTFjOG55OWNuOSJ9"); 9 | 10 | expect(ValEncryption.encrypt("18ny9v2ny9v129ny1v21v8ny9")).toBe("MThueTl2Mm55OXYxMjlueTF2MjF2OG55OQ=="); 11 | expect(ValEncryption.decrypt("MThueTl2Mm55OXYxMjlueTF2MjF2OG55OQ==")).toBe("18ny9v2ny9v129ny1v21v8ny9"); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /packages/@valapi/lib/src/__tests__/version.ts: -------------------------------------------------------------------------------- 1 | import { ValVersion } from "../index"; 2 | 3 | describe("valorant_ts.version", () => { 4 | test("parse", () => { 5 | expect(ValVersion.parse("6.00")).toBe("6.0"); 6 | expect(ValVersion.parse("5.10")).toBe("5.10"); 7 | expect(ValVersion.parse("5.0")).toBe("5.0"); 8 | expect(ValVersion.parse("4.11")).toBe("4.11"); 9 | expect(ValVersion.parse("4.01")).toBe("4.01"); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/@valapi/lib/src/client/ValError.ts: -------------------------------------------------------------------------------- 1 | export class ValError extends Error { 2 | public readonly data: T; 3 | 4 | public constructor(data: ValError) { 5 | super(data.message); 6 | 7 | this.data = data.data; 8 | } 9 | 10 | public static parse(error: Error): ValError { 11 | return new ValError({ 12 | name: error.name, 13 | message: error.message, 14 | stack: error.stack, 15 | data: undefined 16 | }); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/@valapi/lib/src/client/ValRegion.ts: -------------------------------------------------------------------------------- 1 | import * as Region from "../resources/Region"; 2 | 3 | export class ValRegion { 4 | public readonly id: Region.ID; 5 | 6 | /** 7 | * @param region (default: na) 8 | */ 9 | public constructor(region: Region.ID = Region.Default.North_America) { 10 | this.id = "na"; 11 | switch (region) { 12 | case "na": { 13 | break; 14 | } 15 | case "latam": { 16 | this.id = "latam"; 17 | break; 18 | } 19 | case "br": { 20 | this.id = "br"; 21 | break; 22 | } 23 | case "pbe": { 24 | break; 25 | } 26 | case "eu": { 27 | this.id = "eu"; 28 | break; 29 | } 30 | case "kr": { 31 | this.id = "kr"; 32 | break; 33 | } 34 | case "ap": { 35 | this.id = "ap"; 36 | break; 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /packages/@valapi/lib/src/index.ts: -------------------------------------------------------------------------------- 1 | export { ValRegion } from "./client/ValRegion"; 2 | export { ValError } from "./client/ValError"; 3 | 4 | export * as CrosshairColor from "./resources/CrosshairColor"; 5 | export * as CrosshairHexColor from "./resources/CrosshairHexColor"; 6 | export * as ItemTypeId from "./resources/ItemTypeId"; 7 | export * as Locale from "./resources/Locale"; 8 | export * as QueueId from "./resources/QueueId"; 9 | export * as Region from "./resources/Region"; 10 | 11 | export { ValEncryption } from "./utils/ValEncryption"; 12 | export { ValVersion } from "./utils/ValVersion"; 13 | -------------------------------------------------------------------------------- /packages/@valapi/lib/src/resources/CrosshairColor.ts: -------------------------------------------------------------------------------- 1 | import { ValError } from "../client/ValError"; 2 | 3 | export const Default = { 4 | White: "0", 5 | Green: "1", 6 | Yellow_Green: "2", 7 | Green_Yellow: "3", 8 | Yellow: "4", 9 | Cyan: "5", 10 | Pink: "6", 11 | Red: "7", 12 | Custom: "8" 13 | }; 14 | 15 | export type Name = keyof typeof Default; 16 | export type ID = (typeof Default)[Name]; 17 | 18 | export function fromName(x: Name): ID { 19 | return Default[x]; 20 | } 21 | 22 | export function fromID(x: ID): Name { 23 | for (const data of Object.entries(Default)) { 24 | if (data[1] === x) { 25 | return data[0]; 26 | } 27 | } 28 | 29 | throw new ValError({ 30 | name: "Resource_Error", 31 | message: "Resource Not Found", 32 | data: x 33 | }); 34 | } 35 | -------------------------------------------------------------------------------- /packages/@valapi/lib/src/resources/CrosshairHexColor.ts: -------------------------------------------------------------------------------- 1 | import { ValError } from "../client/ValError"; 2 | 3 | export const Default = { 4 | White: "FFFFFF", 5 | Green: "00FF00", 6 | Yellow_Green: "7FFF00", 7 | Green_Yellow: "DFFF00", 8 | Yellow: "FFFF00", 9 | Cyan: "00FFFF", 10 | Pink: "FF00FF", 11 | Red: "FF0000" 12 | }; 13 | 14 | export type Name = keyof typeof Default; 15 | export type Hex = (typeof Default)[Name]; 16 | 17 | export function fromName(x: Name): Hex { 18 | return Default[x]; 19 | } 20 | 21 | export function fromHex(x: Hex): Name { 22 | for (const data of Object.entries(Default)) { 23 | if (data[1] === x) { 24 | return data[0]; 25 | } 26 | } 27 | 28 | throw new ValError({ 29 | name: "Resource_Error", 30 | message: "Resource Not Found", 31 | data: x 32 | }); 33 | } 34 | -------------------------------------------------------------------------------- /packages/@valapi/lib/src/resources/ItemTypeId.ts: -------------------------------------------------------------------------------- 1 | import { ValError } from "../client/ValError"; 2 | 3 | export const Default = { 4 | Agents: "01bb38e1-da47-4e6a-9b3d-945fe4655707", 5 | Contracts: "f85cb6f7-33e5-4dc8-b609-ec7212301948", 6 | Sprays: "d5f120f8-ff8c-4aac-92ea-f2b5acbe9475", 7 | Gun_Buddies: "dd3bf334-87f3-40bd-b043-682a57a8dc3a", 8 | Cards: "3f296c07-64c3-494c-923b-fe692a4fa1bd", 9 | Skins: "e7c63390-eda7-46e0-bb7a-a6abdacd2433", 10 | Skin_Variants: "3ad1b2b2-acdb-4524-852f-954a76ddae0a", 11 | Titles: "de7caa6b-adf7-4588-bbd1-143831e786c6" 12 | }; 13 | 14 | export type Name = keyof typeof Default; 15 | export type ID = (typeof Default)[Name]; 16 | 17 | export function fromName(x: Name): ID { 18 | return Default[x]; 19 | } 20 | 21 | export function fromID(x: ID): Name { 22 | for (const data of Object.entries(Default)) { 23 | if (data[1] === x) { 24 | return data[0]; 25 | } 26 | } 27 | 28 | throw new ValError({ 29 | name: "Resource_Error", 30 | message: "Resource Not Found", 31 | data: x 32 | }); 33 | } 34 | -------------------------------------------------------------------------------- /packages/@valapi/lib/src/resources/Locale.ts: -------------------------------------------------------------------------------- 1 | import { ValError } from "../client/ValError"; 2 | 3 | export const Default = { 4 | Arabic_United_Arab_Emirates: "ar-AE", 5 | German_Germany: "de-DE", 6 | English_United_Kingdom: "en-GB", 7 | English_United_States: "en-US", 8 | Spanish_Spain: "es-ES", 9 | Spanish_Mexico: "es-MX", 10 | French_France: "fr-FR", 11 | Indonesian_Indonesia: "id-ID", 12 | Italian_Italy: "it-IT", 13 | Japanese_Japan: "ja-JP", 14 | Korean_South_Korea: "ko-KR", 15 | Polish_Poland: "pl-PL", 16 | Portuguese_Brazil: "pt-BR", 17 | Russian_Russia: "ru-RU", 18 | Thai_Thailand: "th-TH", 19 | Turkish_Turkey: "tr-TR", 20 | Vietnamese_Vietnam: "vi-VN", 21 | Chinese_China: "zh-CN", 22 | Chinese_Taiwan: "zh-TW" 23 | }; 24 | 25 | export type Name = keyof typeof Default; 26 | export type ID = (typeof Default)[Name]; 27 | 28 | export function fromName(x: Name): ID { 29 | return Default[x]; 30 | } 31 | 32 | export function fromID(x: ID): Name { 33 | for (const data of Object.entries(Default)) { 34 | if (data[1] === x) { 35 | return data[0]; 36 | } 37 | } 38 | 39 | throw new ValError({ 40 | name: "Resource_Error", 41 | message: "Resource Not Found", 42 | data: x 43 | }); 44 | } 45 | -------------------------------------------------------------------------------- /packages/@valapi/lib/src/resources/QueueId.ts: -------------------------------------------------------------------------------- 1 | import { ValError } from "../client/ValError"; 2 | 3 | export const Default = { 4 | Unrated: "unrated", 5 | Competitive: "competitive", 6 | Spikerush: "spikerush", 7 | Deathmatch: "deathmatch", 8 | Escalation: "ggteam", 9 | Replication: "onefa", 10 | Snowball_Fight: "snowball", 11 | Swiftplay: "swiftplay", 12 | Team_Deathmatch: "hurm", 13 | Custom: "", 14 | Custom_Tournament: "tournamentmode", 15 | 16 | New_Map: "newmap" 17 | }; 18 | 19 | export type Name = keyof typeof Default; 20 | export type ID = Exclude<(typeof Default)[Name], (typeof Default)["New_Map"] | "">; 21 | 22 | export function fromName(x: Name, newMapID: string = "abyss"): ID { 23 | if (x === "New_Map") { 24 | return newMapID; 25 | } 26 | 27 | return Default[x]; 28 | } 29 | 30 | export function fromID(x: ID, newMapID: string = "abyss"): Name { 31 | for (const data of Object.entries(Default)) { 32 | if (data[1] === "newmap" && x === newMapID) { 33 | return "New_Map"; 34 | } 35 | 36 | if (data[1] === x) { 37 | return data[0]; 38 | } 39 | } 40 | 41 | throw new ValError({ 42 | name: "Resource_Error", 43 | message: "Resource Not Found", 44 | data: x 45 | }); 46 | } 47 | -------------------------------------------------------------------------------- /packages/@valapi/lib/src/resources/Region.ts: -------------------------------------------------------------------------------- 1 | import { ValError } from "../client/ValError"; 2 | 3 | export const Default = { 4 | North_America: "na", 5 | Latin_America: "latam", 6 | Brazil: "br", 7 | Public_Beta_Environment: "pbe", 8 | Europe: "eu", 9 | Korea: "kr", 10 | Asia_Pacific: "ap" 11 | }; 12 | 13 | export type Name = keyof typeof Default; 14 | export type ID = (typeof Default)[Name]; 15 | 16 | export function fromName(x: Name): ID { 17 | return Default[x]; 18 | } 19 | 20 | export function fromID(x: ID): Name { 21 | for (const data of Object.entries(Default)) { 22 | if (data[1] === x) { 23 | return data[0]; 24 | } 25 | } 26 | 27 | throw new ValError({ 28 | name: "Resource_Error", 29 | message: "Resource Not Found", 30 | data: x 31 | }); 32 | } 33 | -------------------------------------------------------------------------------- /packages/@valapi/lib/src/utils/ValEncryption.ts: -------------------------------------------------------------------------------- 1 | import { Buffer } from "node:buffer"; 2 | import { randomBytes } from "node:crypto"; 3 | 4 | export class ValEncryption { 5 | public static encrypt(text: string): string { 6 | return Buffer.from(text).toString("base64"); 7 | } 8 | 9 | public static encryptJson(object: T): string { 10 | return this.encrypt(JSON.stringify(object)); 11 | } 12 | 13 | public static decrypt(text: string): string { 14 | return Buffer.from(text, "base64").toString(); 15 | } 16 | 17 | public static decryptJson(object: string): T { 18 | return JSON.parse(this.decrypt(object)); 19 | } 20 | 21 | public static randomString(size: number): string { 22 | return randomBytes(size).toString("base64url"); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/@valapi/lib/src/utils/ValVersion.ts: -------------------------------------------------------------------------------- 1 | import { ValError } from "../client/ValError"; 2 | 3 | export class ValVersion { 4 | public static parse(version: string): string { 5 | const splitVersion: Array = version.split("."); 6 | if (splitVersion.length !== 2) { 7 | throw new ValError({ 8 | name: "Version_Error", 9 | message: "Invalid version", 10 | data: version 11 | }); 12 | } 13 | 14 | splitVersion[0] = Number.parseInt(splitVersion[0]).toString(); 15 | 16 | if (splitVersion[1].length === 1) { 17 | splitVersion[1] = `0${splitVersion[1]}`; 18 | } 19 | 20 | if (splitVersion[1] === "00") { 21 | splitVersion[1] = "0"; 22 | } 23 | 24 | return splitVersion.join("."); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/@valapi/lib/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "./src", 5 | "outDir": "./build" 6 | }, 7 | "exclude": ["node_modules", "build", "src/__tests__"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/@valapi/lib/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lib", 3 | "extends": ["../../../typedoc.base.json"], 4 | "entryPoints": ["src/index.ts"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/@valapi/riot-api/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 5.0.0-beta.0 2 | 3 | **Add** 4 | 5 | - `RiotApi.regionURL` 6 | 7 | **Change** 8 | 9 | - ~~`RiotApi.axios`~~ **-->** `RiotApi.request` 10 | - ~~`RiotApiRegion`~~ **-->** `RiotApiRegionURL` 11 | - ~~`RiotApiService.axios`~~ **-->** `RiotApiService.request` 12 | - ~~`RiotApiService.apiRegion`~~ **-->** `RiotApiService.regionURL` 13 | 14 | **Remove** 15 | 16 | - `RiotApi.config` 17 | - `RiotApi.createAt` 18 | - `RiotApi.Default` 19 | 20 | ### Typescript 21 | 22 | **Change** 23 | 24 | - ~~`RiotApi.Config`~~ **-->** `Config` 25 | 26 | # 4.0.0 27 | 28 | **Change** 29 | 30 | - ~~`RiotApiRegion.riotRegion`~~ **-->** `RiotApiRegion.continent` 31 | - ~~`RiotApiRegion.url.api`~~ **-->** `RiotApiRegion.url.continent` 32 | - ~~`RiotApiRegion.url.server`~~ **-->** `RiotApiRegion.url.region` 33 | 34 | ### Typescript 35 | 36 | **Add** 37 | 38 | - `MatchV1.MatchInfoDto` 39 | - `MatchV1.AbilityCastsDto` 40 | - `MatchV1.PlayerStatsDto` 41 | - `MatchV1.PlayerDto` 42 | - `MatchV1.CoachDto` 43 | - `MatchV1.TeamDto` 44 | - `MatchV1.LocationDto` 45 | - `MatchV1.PlayerLocationsDto` 46 | - `MatchV1.FinishingDamageDto` 47 | - `MatchV1.KillDto` 48 | - `MatchV1.DamageDto` 49 | - `MatchV1.EconomyDto` 50 | - `MatchV1.AbilityDto` 51 | - `MatchV1.PlayerRoundStatsDto` 52 | - `MatchV1.RoundResultDto` 53 | - `MatchV1.MatchDto` 54 | - `MatchV1.MatchlistEntryDto` 55 | - `MatchV1.MatchlistDto` 56 | - `MatchV1.RecentMatchesDto` 57 | 58 | # 3.2.0 59 | 60 | **Add** 61 | 62 | - `RiotApi.request()` 63 | 64 | **Remove** 65 | 66 | - `RiotApi.getService()` 67 | 68 | # 3.0.0 69 | 70 | **Add** 71 | 72 | - `RiotApiRegion` 73 | - `RiotApi.getService()` 74 | 75 | ### Typescript 76 | 77 | **Add** 78 | 79 | - `AccountV1.AccountDto` 80 | - `AccountV1.ActiveShardDto` 81 | - `ContentV1.ActDto` 82 | - `ContentV1.ContentItemDto` 83 | - `ContentV1.ContentDto` 84 | - `RankedV1.PlayerDto` 85 | - `RankedV1.LeaderboardDto` 86 | - `StatusV1.ContentDto` 87 | - `StatusV1.UpdateDto` 88 | - `StatusV1.StatusDto` 89 | - `StatusV1.PlatformDataDto` 90 | 91 | **Change** 92 | 93 | - ~~`RiotApi.Options`~~ **-->** `RiotApi.Config` 94 | -------------------------------------------------------------------------------- /packages/@valapi/riot-api/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022-2024 Ing Project 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/@valapi/riot-api/README.md: -------------------------------------------------------------------------------- 1 | [githubrepo_image]: https://github.com/valapi/.github/blob/main/128_valapi.png?raw=true 2 | [githubrepo_url]: https://github.com/valapi 3 | [download_image]: https://badgen.net/npm/dt/@valapi/riot-api?icon=npm 4 | [download_url]: https://www.npmjs.com/package/@valapi/riot-api 5 | [size_image]: https://packagephobia.com/badge?p=@valapi/riot-api 6 | [size_url]: https://packagephobia.com/result?p=@valapi/riot-api 7 | [vulnerabilities_image]: https://snyk.io/test/npm/@valapi/riot-api/badge.svg 8 | [vulnerabilities_url]: https://snyk.io/test/npm/@valapi/riot-api 9 | [license_image]: https://badgen.net/badge/license/MIT/blue 10 | [license_url]: https://github.com/valapi/.github/blob/main/LICENSE 11 | [github_image]: https://badgen.net/badge/icon/github?icon=github&label 12 | [github_url]: https://github.com/valapi/node-valapi/tree/master/packages/@valapi/riot-api 13 | [discord_image]: https://badgen.net/badge/icon/discord?icon=discord&label 14 | [discord_url]: https://discord.gg/pbyWbUYjyt 15 | 16 |
17 | 18 | # Valorant API - Riot API 19 | 20 | [![Profile][githubrepo_image]][github_url] 21 | 22 | Official Api From Riot Games 23 | 24 | [![Downloads][download_image]][download_url] 25 | [![install size][size_image]][size_url] 26 | [![Known Vulnerabilities][vulnerabilities_image]][vulnerabilities_url] 27 | 28 | [![LICENSE][license_image]][license_url] 29 | [![Github][github_image]][github_url] 30 | [![Discord][discord_image]][discord_url] 31 | 32 | Documentation: [valapi.github.io/docs](https://valapi.github.io/docs) 33 | 34 | Guide: [valapi.github.io/guide](https://valapi.github.io/guide) 35 | 36 |
37 | 38 | --- 39 | 40 | > - **@valapi/riot-api** isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing Riot Games properties. Riot Games, and all associated properties are trademarks or registered trademarks of Riot Games, Inc. 41 | > - **@valapi/riot-api** was created under [Riot Games' "Legal Jibber Jabber"](https://www.riotgames.com/en/legal) policy using assets owned by Riot Games. Riot Games does not endorse or sponsor this project. 42 | > - [MIT License][license_url] 43 | 44 | ## Installation 45 | 46 | **NPM:** 47 | 48 | ```bash 49 | npm install @valapi/riot-api 50 | ``` 51 | 52 | **PNPM:** 53 | 54 | ```bash 55 | pnpm add @valapi/riot-api 56 | ``` 57 | 58 | ## Guide 59 | 60 | ```typescript 61 | import { RiotApi } from "@valapi/riot-api"; 62 | ``` 63 | 64 | ```typescript 65 | const client = new RiotApi({ 66 | apiKey: "LoooooongApiKey_123456789", 67 | region: "ap" 68 | }); 69 | ``` 70 | 71 | ### API 72 | 73 | ```typescript 74 | const status = await client.StatusV1.platformData(); 75 | 76 | console.log(status.data); 77 | ``` 78 | 79 | ```typescript 80 | const accountData = await client.AccountV1.byRiotId("PRX f0rsakeN", "Huh"); 81 | 82 | console.log(accountData.data); 83 | ``` 84 | -------------------------------------------------------------------------------- /packages/@valapi/riot-api/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@valapi/riot-api", 3 | "version": "5.0.0-beta.2", 4 | "publishConfig": { 5 | "registry": "https://registry.npmjs.org", 6 | "access": "public" 7 | }, 8 | "description": "Valorant API - Riot API", 9 | "keywords": [ 10 | "riot", 11 | "api", 12 | "val", 13 | "valorant", 14 | "official" 15 | ], 16 | "main": "build/index.js", 17 | "types": "./build/index.d.ts", 18 | "repository": { 19 | "type": "git", 20 | "url": "git+https://github.com/valapi/node-valapi.git", 21 | "directory": "packages/@valapi/riot-api" 22 | }, 23 | "author": "ing3kth (https://github.com/KTNG-3)", 24 | "license": "MIT", 25 | "bugs": { 26 | "url": "https://github.com/valapi/node-valapi/issues" 27 | }, 28 | "homepage": "https://valapi.github.io/guide", 29 | "dependencies": { 30 | "@valapi/lib": "5.0.0-beta.2", 31 | "axios": "^1.7.3" 32 | }, 33 | "directories": { 34 | "lib": "build", 35 | "test": "src/__tests__" 36 | }, 37 | "files": [ 38 | "build", 39 | "CHANGELOG.md", 40 | "LICENSE", 41 | "package.json", 42 | "README.md", 43 | "SECURITY.md" 44 | ] 45 | } 46 | -------------------------------------------------------------------------------- /packages/@valapi/riot-api/src/__tests__/api.ts: -------------------------------------------------------------------------------- 1 | import { env } from "node:process"; 2 | 3 | import { Region, Locale } from "@valapi/lib"; 4 | 5 | import { RiotApi } from "../index"; 6 | 7 | describe("riotapi.api", () => { 8 | const client = new RiotApi({ 9 | apiKey: env.VAL_RIOT_API ? env.VAL_RIOT_API : "", 10 | region: Region.Default.Asia_Pacific 11 | }); 12 | 13 | test("apis", () => { 14 | Promise.all([ 15 | client.AccountV1.byRiotId("ING", "EMPTY"), 16 | client.ContentV1.contents(Locale.Default.English_United_States), 17 | client.RankedV1.leaderboardsByAct("3e47230a-463c-a301-eb7d-67bb60357d4f", 10, 0), 18 | client.StatusV1.platformData() 19 | ]).then(values => { 20 | values.forEach(x => { 21 | expect(x.status === 200).toBe(true); 22 | expect(x.data).not.toMatchObject({ 23 | status: { 24 | message: "Unauthorized", 25 | status_code: 401 26 | } 27 | }); 28 | }); 29 | }); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /packages/@valapi/riot-api/src/__tests__/region.ts: -------------------------------------------------------------------------------- 1 | import { Region } from "@valapi/lib"; 2 | 3 | import { RiotApiRegionURL } from "../index"; 4 | 5 | describe("riotapi.region", () => { 6 | test("public_beta_environment", () => { 7 | const _region = new RiotApiRegionURL(Region.Default.Public_Beta_Environment); 8 | 9 | const id = "na"; 10 | const continent = "pbe1"; 11 | 12 | expect(_region.id).toBe(id); 13 | expect(_region.continent).toBe(continent); 14 | 15 | expect(_region.url).toMatchObject({ 16 | region: `https://${id}.api.riotgames.com`, 17 | continent: `https://${continent}.api.riotgames.com` 18 | }); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/@valapi/riot-api/src/client/RiotApi.ts: -------------------------------------------------------------------------------- 1 | import axios, { AxiosHeaders } from "axios"; 2 | import type { AxiosInstance, CreateAxiosDefaults } from "axios"; 3 | 4 | import type { Region } from "@valapi/lib"; 5 | 6 | import { RiotApiRegionURL } from "./RiotApiRegionURL"; 7 | 8 | import { AccountV1 } from "../service/AccountV1"; 9 | import { ContentV1 } from "../service/ContentV1"; 10 | import { MatchV1 } from "../service/MatchV1"; 11 | import { RankedV1 } from "../service/RankedV1"; 12 | import { StatusV1 } from "../service/StatusV1"; 13 | 14 | export interface Config { 15 | apiKey: string; 16 | region: Region.ID; 17 | axiosConfig?: CreateAxiosDefaults; 18 | } 19 | 20 | /** 21 | * Official Api From Riot Games 22 | */ 23 | export class RiotApi { 24 | public readonly request: AxiosInstance; 25 | public readonly regionURL: RiotApiRegionURL; 26 | 27 | public constructor(config: Config) { 28 | const headers = new AxiosHeaders(); 29 | headers.setContentType("application/json"); 30 | headers.set("X-Riot-Token", config.apiKey); 31 | 32 | this.request = axios.create({ 33 | ...config.axiosConfig, 34 | ...{ 35 | headers: { 36 | ...config.axiosConfig?.headers, 37 | ...headers.toJSON() 38 | } 39 | } 40 | }); 41 | 42 | this.regionURL = new RiotApiRegionURL(config.region); 43 | } 44 | 45 | public get AccountV1(): AccountV1 { 46 | return new AccountV1(this.request, this.regionURL); 47 | } 48 | 49 | public get ContentV1(): ContentV1 { 50 | return new ContentV1(this.request, this.regionURL); 51 | } 52 | 53 | public get MatchV1(): MatchV1 { 54 | return new MatchV1(this.request, this.regionURL); 55 | } 56 | 57 | public get RankedV1(): RankedV1 { 58 | return new RankedV1(this.request, this.regionURL); 59 | } 60 | 61 | public get StatusV1(): StatusV1 { 62 | return new StatusV1(this.request, this.regionURL); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /packages/@valapi/riot-api/src/client/RiotApiRegionURL.ts: -------------------------------------------------------------------------------- 1 | import { ValRegion } from "@valapi/lib"; 2 | import type { Region } from "@valapi/lib"; 3 | 4 | export class RiotApiRegionURL extends ValRegion { 5 | public readonly continent: string; 6 | public readonly url: { 7 | /** 8 | * $.api.riotgames.com 9 | */ 10 | region: string; 11 | /** 12 | * $.api.riotgames.com 13 | */ 14 | continent: string; 15 | /** 16 | * esports.api.riotgames.com 17 | */ 18 | esports: string; 19 | }; 20 | 21 | /** 22 | * @param region (default: na) 23 | */ 24 | public constructor(region?: Region.ID) { 25 | super(region); 26 | 27 | this.continent = "americas"; 28 | switch (region) { 29 | case "na": { 30 | break; 31 | } 32 | case "latam": { 33 | break; 34 | } 35 | case "br": { 36 | break; 37 | } 38 | case "pbe": { 39 | this.continent = "pbe1"; 40 | break; 41 | } 42 | case "eu": { 43 | this.continent = "europe"; 44 | break; 45 | } 46 | case "kr": { 47 | this.continent = "asia"; 48 | break; 49 | } 50 | case "ap": { 51 | this.continent = "asia"; 52 | break; 53 | } 54 | } 55 | 56 | this.url = { 57 | region: `https://${this.id}.api.riotgames.com`, 58 | continent: `https://${this.continent}.api.riotgames.com`, 59 | esports: `https://esports.api.riotgames.com` 60 | }; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /packages/@valapi/riot-api/src/client/RiotApiService.ts: -------------------------------------------------------------------------------- 1 | import type { AxiosInstance } from "axios"; 2 | 3 | import type { RiotApiRegionURL } from "./RiotApiRegionURL"; 4 | 5 | export class RiotApiService { 6 | protected readonly request: AxiosInstance; 7 | protected readonly regionURL: RiotApiRegionURL; 8 | 9 | public constructor(request: AxiosInstance, regionURL: RiotApiRegionURL) { 10 | this.request = request; 11 | this.regionURL = regionURL; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/@valapi/riot-api/src/index.ts: -------------------------------------------------------------------------------- 1 | import { RiotApi } from "./client/RiotApi"; 2 | 3 | export { RiotApi }; 4 | export type { Config } from "./client/RiotApi"; 5 | export { RiotApiRegionURL } from "./client/RiotApiRegionURL"; 6 | export { RiotApiService } from "./client/RiotApiService"; 7 | 8 | export { AccountV1 } from "./service/AccountV1"; 9 | export { ContentV1 } from "./service/ContentV1"; 10 | export { MatchV1 } from "./service/MatchV1"; 11 | export { RankedV1 } from "./service/RankedV1"; 12 | export { StatusV1 } from "./service/StatusV1"; 13 | 14 | export default RiotApi; 15 | -------------------------------------------------------------------------------- /packages/@valapi/riot-api/src/service/AccountV1.ts: -------------------------------------------------------------------------------- 1 | import type { AxiosResponse } from "axios"; 2 | 3 | import { RiotApiService } from "../client/RiotApiService"; 4 | 5 | export namespace AccountV1 { 6 | export interface AccountDto { 7 | puuid: string; 8 | /** 9 | * This field may be excluded from the response if the account doesn't have a gameName. 10 | */ 11 | gameName?: string; 12 | /** 13 | * This field may be excluded from the response if the account doesn't have a tagLine. 14 | */ 15 | tagLine?: string; 16 | 17 | [key: string]: any; 18 | } 19 | 20 | export interface ActiveShardDto { 21 | puuid: string; 22 | game: "val" | "lor"; 23 | activeShard: string; 24 | } 25 | } 26 | 27 | export class AccountV1 extends RiotApiService { 28 | /** 29 | * Get account by puuid 30 | */ 31 | public byPuuid(puuid: string): Promise> { 32 | return this.request.get(`${this.regionURL.url.continent}/riot/account/v1/accounts/by-puuid/${puuid}`); 33 | } 34 | 35 | /** 36 | * Get account by riot id 37 | */ 38 | public byRiotId(gameName: string, tagLine: string): Promise> { 39 | return this.request.get(`${this.regionURL.url.continent}/riot/account/v1/accounts/by-riot-id/${gameName}/${tagLine}`); 40 | } 41 | 42 | /** 43 | * Get active shard for a player 44 | */ 45 | public activeShardsByGameAndPuuid(puuid: string): Promise> { 46 | return this.request.get(`${this.regionURL.url.continent}/riot/account/v1/active-shards/by-game/val/by-puuid/${puuid}`); 47 | } 48 | 49 | /** 50 | * ! This API service is required your project to be registered by Riot Games. 51 | * 52 | * Get account by access token 53 | * @param authorization (Header Parameters) 54 | */ 55 | public byAccessToken(authorization: string): Promise> { 56 | return this.request.get(`${this.regionURL.url.continent}/riot/account/v1/accounts/me`, { 57 | headers: { 58 | Authorization: authorization 59 | } 60 | }); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /packages/@valapi/riot-api/src/service/ContentV1.ts: -------------------------------------------------------------------------------- 1 | import type { AxiosResponse } from "axios"; 2 | 3 | import type { Locale } from "@valapi/lib"; 4 | 5 | import { RiotApiService } from "../client/RiotApiService"; 6 | 7 | export namespace ContentV1 { 8 | export interface ActDto { 9 | name: string; 10 | /** 11 | * This field is excluded from the response when a locale is set 12 | */ 13 | localizedNames?: Record; 14 | id: string; 15 | isActive: boolean; 16 | 17 | [key: string]: any; 18 | } 19 | 20 | export interface ContentItemDto { 21 | name: string; 22 | /** 23 | * This field is excluded from the response when a locale is set 24 | */ 25 | localizedNames?: Record; 26 | id: string; 27 | assetName: string; 28 | /** 29 | * This field is only included for maps and game modes. These values are used in the match response. 30 | */ 31 | assetPath?: string; 32 | 33 | [key: string]: any; 34 | } 35 | 36 | export interface ContentDto { 37 | version: string; 38 | characters: Array; 39 | maps: Array; 40 | chromas: Array; 41 | skins: Array; 42 | skinLevels: Array; 43 | equips: Array; 44 | gameModes: Array; 45 | sprays: Array; 46 | sprayLevels: Array; 47 | charms: Array; 48 | charmLevels: Array; 49 | playerCards: Array; 50 | playerTitles: Array; 51 | acts: Array; 52 | 53 | [key: string]: any; 54 | } 55 | } 56 | 57 | export class ContentV1 extends RiotApiService { 58 | /** 59 | * Get content optionally filtered by locale 60 | * @param locale (default: en-US) 61 | */ 62 | public contents(locale: Locale.ID = "en-US"): Promise> { 63 | return this.request.get(`${this.regionURL.url.region}/val/content/v1/contents?locale=${locale}`); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /packages/@valapi/riot-api/src/service/RankedV1.ts: -------------------------------------------------------------------------------- 1 | import type { AxiosResponse } from "axios"; 2 | 3 | import { RiotApiService } from "../client/RiotApiService"; 4 | 5 | export namespace RankedV1 { 6 | export interface PlayerDto { 7 | /** 8 | * This field may be omitted if the player has been anonymized. 9 | */ 10 | puuid?: string; 11 | /** 12 | * This field may be omitted if the player has been anonymized. 13 | */ 14 | gameName?: string; 15 | /** 16 | * This field may be omitted if the player has been anonymized. 17 | */ 18 | tagLine?: string; 19 | leaderboardRank: number; 20 | rankedRating: number; 21 | numberOfWins: number; 22 | 23 | [key: string]: any; 24 | } 25 | 26 | export interface LeaderboardDto { 27 | /** 28 | * The shard for the given leaderboard. 29 | */ 30 | shard: string; 31 | /** 32 | * The act id for the given leaderboard. Act ids can be found using the val-content API. 33 | */ 34 | actId: string; 35 | /** 36 | * The total number of players in the leaderboard. 37 | */ 38 | totalPlayers: number; 39 | players: Array; 40 | 41 | [key: string]: any; 42 | } 43 | } 44 | 45 | export class RankedV1 extends RiotApiService { 46 | /** 47 | * Get leaderboard for the competitive queue 48 | * @param size (default: 200) 49 | * @param startIndex (default: 0) 50 | */ 51 | public leaderboardsByAct(actId: string, size: number = 200, startIndex: number = 0): Promise> { 52 | return this.request.get(`${this.regionURL.url.region}/val/ranked/v1/leaderboards/by-act/${actId}?size=${size}&startIndex=${startIndex}`); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /packages/@valapi/riot-api/src/service/StatusV1.ts: -------------------------------------------------------------------------------- 1 | import type { AxiosResponse } from "axios"; 2 | 3 | import { RiotApiService } from "../client/RiotApiService"; 4 | 5 | export namespace StatusV1 { 6 | export interface ContentDto { 7 | locale: string; 8 | content: string; 9 | 10 | [key: string]: any; 11 | } 12 | 13 | export interface UpdateDto { 14 | id: number; 15 | author: string; 16 | publish: boolean; 17 | /** 18 | * (Legal values: riotclient, riotstatus, game) 19 | */ 20 | publish_locations: Array; 21 | translations: Array; 22 | created_at: string; 23 | updated_at: string; 24 | 25 | [key: string]: any; 26 | } 27 | 28 | export interface StatusDto { 29 | id: number; 30 | /** 31 | * (Legal values: scheduled, in_progress, complete) 32 | */ 33 | maintenance_status: string; 34 | /** 35 | * (Legal values: info, warning, critical) 36 | */ 37 | incident_severity: string; 38 | titles: Array; 39 | updates: Array; 40 | created_at: string; 41 | archive_at: string; 42 | updated_at: string; 43 | /** 44 | * (Legal values: windows, macos, android, ios, ps4, xbone, switch) 45 | */ 46 | platforms: Array; 47 | 48 | [key: string]: any; 49 | } 50 | 51 | export interface PlatformDataDto { 52 | id: string; 53 | name: string; 54 | locales: Array; 55 | maintenances: Array; 56 | incidents: Array; 57 | 58 | [key: string]: any; 59 | } 60 | } 61 | 62 | export class StatusV1 extends RiotApiService { 63 | /** 64 | * Get VALORANT status for the given platform. 65 | */ 66 | public platformData(): Promise> { 67 | return this.request.get(`${this.regionURL.url.region}/val/status/v1/platform-data`); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /packages/@valapi/riot-api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "./src", 5 | "outDir": "./build", 6 | "paths": { 7 | "@valapi/lib": ["../lib/src"] 8 | } 9 | }, 10 | "references": [ 11 | { 12 | "path": "../lib" 13 | } 14 | ], 15 | "exclude": ["node_modules", "build", "src/__tests__"] 16 | } 17 | -------------------------------------------------------------------------------- /packages/@valapi/riot-api/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "riot-api", 3 | "extends": ["../../../typedoc.base.json"], 4 | "entryPoints": ["src/index.ts"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 5.0.0-beta.1 2 | 3 | **Add** 4 | 5 | _service_ 6 | 7 | - `Internal.uuid()` 8 | - `Internal.riotClientVersion()` 9 | 10 | # 5.0.0-beta.0 11 | 12 | **Change** 13 | 14 | - ~~`ValorantApiCom.axios`~~ **-->** `ValorantApiCom.request` 15 | - ~~`ValorantApiComService.axios`~~ **-->** `ValorantApiComService.request` 16 | 17 | **Remove** 18 | 19 | - `ValorantApiCom.Default` 20 | - `ValorantApiCom.config` 21 | 22 | ### Typescript 23 | 24 | **Change** 25 | 26 | - ~~`ValorantApiCom.Language`~~ **-->** `Language` 27 | - ~~`ValorantApiCom.Config`~~ **-->** `Config` 28 | - ~~`ValorantApiComService.MultipleLanguage`~~ **-->** `AllLanguageResponse` 29 | - ~~`ValorantApiComService.Languages`~~ **-->** `LanguageResponse` 30 | - ~~`ValorantApiComService.Response`~~ **-->** `Response` 31 | 32 | **Remove** 33 | 34 | - `ValorantApiComService.SingleLanguage` 35 | - `ValorantApiComService.BaseResponse` 36 | 37 | # 4.0.0 38 | 39 | **Change** 40 | 41 | - ~~`Agents.get(isPlayableCharacter?)`~~ **-->** `Agents.get(isPlayableCharacter = true)` 42 | 43 | # 3.2.1 44 | 45 | ### Typescript 46 | 47 | **Add** 48 | 49 | - `ValorantApiComService` 50 | 51 | **Remove** 52 | 53 | - `ValorantApiCom.Response` 54 | 55 | # 3.2.0 56 | 57 | **Add** 58 | 59 | - `ValorantApiCom.request()` 60 | 61 | **Remove** 62 | 63 | - `ValorantApiCom.getService()` 64 | 65 | # 3.0.0 66 | 67 | **Add** 68 | 69 | - `ValorantApiCom.getService()` 70 | 71 | _service_ 72 | 73 | - `Missions` 74 | - `Objectives` 75 | 76 | ### Typescript 77 | 78 | **Change** 79 | 80 | - ~~`ValorantApiCom.Options`~~ **-->** `ValorantApiCom.Config` 81 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022-2024 Ing Project 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/README.md: -------------------------------------------------------------------------------- 1 | [githubrepo_image]: https://github.com/valapi/.github/blob/main/128_valapi.png?raw=true 2 | [githubrepo_url]: https://github.com/valapi 3 | [download_image]: https://badgen.net/npm/dt/@valapi/valorant-api.com?icon=npm 4 | [download_url]: https://www.npmjs.com/package/@valapi/valorant-api.com 5 | [size_image]: https://packagephobia.com/badge?p=@valapi/valorant-api.com 6 | [size_url]: https://packagephobia.com/result?p=@valapi/valorant-api.com 7 | [vulnerabilities_image]: https://snyk.io/test/npm/@valapi/valorant-api.com/badge.svg 8 | [vulnerabilities_url]: https://snyk.io/test/npm/@valapi/valorant-api.com 9 | [license_image]: https://badgen.net/badge/license/MIT/blue 10 | [license_url]: https://github.com/valapi/.github/blob/main/LICENSE 11 | [github_image]: https://badgen.net/badge/icon/github?icon=github&label 12 | [github_url]: https://github.com/valapi/node-valapi/tree/master/packages/@valapi/valorant-api.com 13 | [discord_image]: https://badgen.net/badge/icon/discord?icon=discord&label 14 | [discord_url]: https://discord.gg/pbyWbUYjyt 15 | 16 |
17 | 18 | # Valorant API - valorant-api.com 19 | 20 | [![Profile][githubrepo_image]][githubrepo_url] 21 | 22 | **Third-Party API** by Officer 23 | 24 | [![Downloads][download_image]][download_url] 25 | [![install size][size_image]][size_url] 26 | [![Known Vulnerabilities][vulnerabilities_image]][vulnerabilities_url] 27 | 28 | [![LICENSE][license_image]][license_url] 29 | [![Github][github_image]][github_url] 30 | [![Discord][discord_image]][discord_url] 31 | 32 | Documentation: [valapi.github.io/docs](https://valapi.github.io/docs) 33 | 34 | Guide: [valapi.github.io/guide](https://valapi.github.io/guide) 35 | 36 |
37 | 38 | --- 39 | 40 | > - **@valapi/valorant-api.com** isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing Riot Games properties. Riot Games, and all associated properties are trademarks or registered trademarks of Riot Games, Inc. 41 | > - **@valapi/valorant-api.com** was created under [Riot Games' "Legal Jibber Jabber"](https://www.riotgames.com/en/legal) policy using assets owned by Riot Games. Riot Games does not endorse or sponsor this project. 42 | > - [MIT License][license_url] 43 | 44 | ## Installation 45 | 46 | **NPM:** 47 | 48 | ```bash 49 | npm install @valapi/valorant-api.com 50 | ``` 51 | 52 | **PNPM:** 53 | 54 | ```bash 55 | pnpm add @valapi/valorant-api.com 56 | ``` 57 | 58 | ## Guide 59 | 60 | ```typescript 61 | import { ValorantApiCom } from "@valapi/valorant-api.com"; 62 | ``` 63 | 64 | ```typescript 65 | const client = new ValorantApiCom({ 66 | language: "en-US" 67 | }); 68 | ``` 69 | 70 | ### API 71 | 72 | ```typescript 73 | const versions = await client.Versions.get(); 74 | 75 | console.log(versions.data); 76 | ``` 77 | 78 | ```typescript 79 | const mapUuid = "7eaecc1b-4337-bbf6-6ab9-04b8f06b3319"; /* Ascent */ 80 | const map = await client.Maps.getByUuid(mapUuid); 81 | 82 | console.log(events.data); 83 | ``` 84 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@valapi/valorant-api.com", 3 | "version": "5.0.0-beta.2", 4 | "publishConfig": { 5 | "registry": "https://registry.npmjs.org", 6 | "access": "public" 7 | }, 8 | "description": "Valorant API - valorant-api.com", 9 | "keywords": [ 10 | "riot", 11 | "api", 12 | "val", 13 | "valorant", 14 | "valorant-api.com" 15 | ], 16 | "main": "build/index.js", 17 | "types": "./build/index.d.ts", 18 | "repository": { 19 | "type": "git", 20 | "url": "git+https://github.com/valapi/node-valapi.git", 21 | "directory": "packages/@valapi/valorant-api.com" 22 | }, 23 | "author": "ing3kth (https://github.com/KTNG-3)", 24 | "license": "MIT", 25 | "bugs": { 26 | "url": "https://github.com/valapi/node-valapi/issues" 27 | }, 28 | "homepage": "https://valapi.github.io/guide", 29 | "dependencies": { 30 | "@valapi/lib": "5.0.0-beta.2", 31 | "axios": "^1.7.3" 32 | }, 33 | "directories": { 34 | "lib": "build", 35 | "test": "src/__tests__" 36 | }, 37 | "files": [ 38 | "build", 39 | "CHANGELOG.md", 40 | "LICENSE", 41 | "package.json", 42 | "README.md", 43 | "SECURITY.md" 44 | ] 45 | } 46 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/__tests__/api.ts: -------------------------------------------------------------------------------- 1 | import { Locale } from "@valapi/lib"; 2 | import { ValorantApiCom } from "../index"; 3 | 4 | describe("valapicom.api", () => { 5 | const client = new ValorantApiCom({ 6 | language: Locale.Default.Thai_Thailand, 7 | responseOptions: { 8 | ignore_null: true 9 | } 10 | }); 11 | 12 | test("apis", () => { 13 | Promise.all([ 14 | client.Agents.get(), 15 | client.Buddies.get(), 16 | client.Buddies.getLevels(), 17 | client.Bundles.get(), 18 | client.Ceremonies.get(), 19 | client.CompetitiveTiers.get(), 20 | client.ContentTiers.get(), 21 | client.Contracts.get(), 22 | client.Currencies.get(), 23 | client.Events.get(), 24 | client.Gamemodes.get(), 25 | client.Gamemodes.getEquippables(), 26 | client.Gear.get(), 27 | client.Internal.riotClientVersion(), 28 | client.LevelBorders.get(), 29 | client.Maps.get(), 30 | client.Missions.get(), 31 | client.Objectives.get(), 32 | client.PlayerCards.get(), 33 | client.PlayerTitles.get(), 34 | client.Seasons.get(), 35 | client.Seasons.getCompetitiveSeasons(), 36 | client.Sprays.get(), 37 | client.Sprays.getLevels(), 38 | client.Themes.get(), 39 | client.Version.get(), 40 | client.Weapons.get(), 41 | client.Weapons.getSkins() 42 | ]).then(values => { 43 | values.forEach(x => { 44 | expect(x.status === 200).toBe(true); 45 | expect(x.data.data).not.toBe([]); 46 | expect(x.data.data).not.toContain([undefined]); 47 | }); 48 | }); 49 | }); 50 | }); 51 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/client/ValorantApiCom.ts: -------------------------------------------------------------------------------- 1 | import axios, { AxiosHeaders } from "axios"; 2 | import type { AxiosInstance, CreateAxiosDefaults } from "axios"; 3 | 4 | import { Locale } from "@valapi/lib"; 5 | 6 | import { Agents } from "../service/Agents"; 7 | import { Buddies } from "../service/Buddies"; 8 | import { Bundles } from "../service/Bundles"; 9 | import { Ceremonies } from "../service/Ceremonies"; 10 | import { CompetitiveTiers } from "../service/CompetitiveTiers"; 11 | import { ContentTiers } from "../service/ContentTiers"; 12 | import { Contracts } from "../service/Contracts"; 13 | import { Currencies } from "../service/Currencies"; 14 | import { Events } from "../service/Events"; 15 | import { Gamemodes } from "../service/Gamemodes"; 16 | import { Gear } from "../service/Gear"; 17 | import { Internal } from "../service/Internal"; 18 | import { LevelBorders } from "../service/LevelBorders"; 19 | import { Maps } from "../service/Maps"; 20 | import { Missions } from "../service/Missions"; 21 | import { Objectives } from "../service/Objectives"; 22 | import { PlayerCards } from "../service/PlayerCards"; 23 | import { PlayerTitles } from "../service/PlayerTitles"; 24 | import { Seasons } from "../service/Seasons"; 25 | import { Sprays } from "../service/Sprays"; 26 | import { Themes } from "../service/Themes"; 27 | import { Version } from "../service/Version"; 28 | import { Weapons } from "../service/Weapons"; 29 | 30 | export type Language = Exclude | "all"; 31 | 32 | export interface Config { 33 | language?: L; 34 | axiosConfig?: CreateAxiosDefaults; 35 | responseOptions?: { 36 | /** 37 | * Delete properties that have a `null` value 38 | */ 39 | ignore_null?: boolean; 40 | }; 41 | } 42 | 43 | /** 44 | * Third-Party API by Officer 45 | * 46 | * https://valorant-api.com 47 | */ 48 | export class ValorantApiCom { 49 | protected readonly request: AxiosInstance; 50 | 51 | public constructor(config: Config = {}) { 52 | const headers = new AxiosHeaders(); 53 | headers.setContentType("application/json"); 54 | 55 | this.request = axios.create({ 56 | ...config.axiosConfig, 57 | ...{ 58 | baseURL: "https://valorant-api.com", 59 | headers: { 60 | ...config.axiosConfig?.headers, 61 | ...headers.toJSON() 62 | }, 63 | params: { 64 | ...config.axiosConfig?.params, 65 | ...{ 66 | language: config.language, 67 | responseOptions: config.responseOptions 68 | ? Object.entries(config.responseOptions) 69 | .filter(x => x[1]) 70 | .map(x => x[0]) 71 | .join(" ") 72 | : undefined 73 | } 74 | } 75 | } 76 | }); 77 | } 78 | 79 | public get Agents(): Agents { 80 | return new Agents(this.request); 81 | } 82 | 83 | public get Buddies(): Buddies { 84 | return new Buddies(this.request); 85 | } 86 | 87 | public get Bundles(): Bundles { 88 | return new Bundles(this.request); 89 | } 90 | 91 | public get Ceremonies(): Ceremonies { 92 | return new Ceremonies(this.request); 93 | } 94 | 95 | public get CompetitiveTiers(): CompetitiveTiers { 96 | return new CompetitiveTiers(this.request); 97 | } 98 | 99 | public get ContentTiers(): ContentTiers { 100 | return new ContentTiers(this.request); 101 | } 102 | 103 | public get Contracts(): Contracts { 104 | return new Contracts(this.request); 105 | } 106 | 107 | public get Currencies(): Currencies { 108 | return new Currencies(this.request); 109 | } 110 | 111 | public get Events(): Events { 112 | return new Events(this.request); 113 | } 114 | 115 | public get Gamemodes(): Gamemodes { 116 | return new Gamemodes(this.request); 117 | } 118 | 119 | public get Gear(): Gear { 120 | return new Gear(this.request); 121 | } 122 | 123 | public get Internal(): Internal { 124 | return new Internal(this.request); 125 | } 126 | 127 | public get LevelBorders(): LevelBorders { 128 | return new LevelBorders(this.request); 129 | } 130 | 131 | public get Maps(): Maps { 132 | return new Maps(this.request); 133 | } 134 | 135 | public get Missions(): Missions { 136 | return new Missions(this.request); 137 | } 138 | 139 | public get Objectives(): Objectives { 140 | return new Objectives(this.request); 141 | } 142 | 143 | public get PlayerCards(): PlayerCards { 144 | return new PlayerCards(this.request); 145 | } 146 | 147 | public get PlayerTitles(): PlayerTitles { 148 | return new PlayerTitles(this.request); 149 | } 150 | 151 | public get Seasons(): Seasons { 152 | return new Seasons(this.request); 153 | } 154 | 155 | public get Sprays(): Sprays { 156 | return new Sprays(this.request); 157 | } 158 | 159 | public get Themes(): Themes { 160 | return new Themes(this.request); 161 | } 162 | 163 | public get Version(): Version { 164 | return new Version(this.request); 165 | } 166 | 167 | public get Weapons(): Weapons { 168 | return new Weapons(this.request); 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/client/ValorantApiComService.ts: -------------------------------------------------------------------------------- 1 | import type { AxiosInstance, AxiosResponse } from "axios"; 2 | 3 | import type { Language } from "./ValorantApiCom"; 4 | 5 | export type AllLanguageResponse = Record, T>; 6 | export type LanguageResponse = L extends "all" ? AllLanguageResponse : T; 7 | 8 | export type Response = Promise< 9 | AxiosResponse<{ 10 | status: number; 11 | data?: T; 12 | error?: string; 13 | }> 14 | >; 15 | 16 | export class ValorantApiComService { 17 | protected readonly request: AxiosInstance; 18 | 19 | public constructor(request: AxiosInstance) { 20 | this.request = request; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/index.ts: -------------------------------------------------------------------------------- 1 | import { ValorantApiCom } from "./client/ValorantApiCom"; 2 | 3 | export { ValorantApiCom }; 4 | export type { Language, Config } from "./client/ValorantApiCom"; 5 | export { ValorantApiComService } from "./client/ValorantApiComService"; 6 | export type { AllLanguageResponse, LanguageResponse, Response } from "./client/ValorantApiComService"; 7 | 8 | export { Agents } from "./service/Agents"; 9 | export { Buddies } from "./service/Buddies"; 10 | export { Bundles } from "./service/Bundles"; 11 | export { Ceremonies } from "./service/Ceremonies"; 12 | export { CompetitiveTiers } from "./service/CompetitiveTiers"; 13 | export { ContentTiers } from "./service/ContentTiers"; 14 | export { Contracts } from "./service/Contracts"; 15 | export { Currencies } from "./service/Currencies"; 16 | export { Events } from "./service/Events"; 17 | export { Gamemodes } from "./service/Gamemodes"; 18 | export { Gear } from "./service/Gear"; 19 | export { Internal } from "./service/Internal"; 20 | export { LevelBorders } from "./service/LevelBorders"; 21 | export { Maps } from "./service/Maps"; 22 | export { Missions } from "./service/Missions"; 23 | export { Objectives } from "./service/Objectives"; 24 | export { PlayerCards } from "./service/PlayerCards"; 25 | export { PlayerTitles } from "./service/PlayerTitles"; 26 | export { Seasons } from "./service/Seasons"; 27 | export { Sprays } from "./service/Sprays"; 28 | export { Themes } from "./service/Themes"; 29 | export { Version } from "./service/Version"; 30 | export { Weapons } from "./service/Weapons"; 31 | 32 | export default ValorantApiCom; 33 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Agents.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace Agents { 6 | export interface Agents { 7 | uuid: string; 8 | displayName: LanguageResponse; 9 | description: LanguageResponse; 10 | developerName: string; 11 | characterTags: LanguageResponse, L>; 12 | displayIcon: string; 13 | displayIconSmall: string; 14 | bustPortrait: string; 15 | fullPortrait: string; 16 | fullPortraitV2: string; 17 | killfeedPortrait: string; 18 | background: string; 19 | backgroundGradientColors: Array; 20 | assetPath: string; 21 | isFullPortraitRightFacing: boolean; 22 | isPlayableCharacter: boolean; 23 | isAvailableForTest: boolean; 24 | isBaseContent: boolean; 25 | role: { 26 | uuid: string; 27 | displayName: LanguageResponse; 28 | description: LanguageResponse; 29 | displayIcon: string; 30 | assetPath: string; 31 | }; 32 | recruitmentData: { 33 | counterId: string; 34 | milestoneId: string; 35 | milestoneThreshold: number; 36 | useLevelVpCostOverride: boolean; 37 | levelVpCostOverride: number; 38 | startDate: string | Date; 39 | endDate: string | Date; 40 | }; 41 | abilities: Array<{ 42 | slot: string; 43 | displayName: LanguageResponse; 44 | description: LanguageResponse; 45 | displayIcon: string; 46 | }>; 47 | voiceLines: { 48 | minDuration: number; 49 | maxDuration: number; 50 | mediaList: Array<{ 51 | id: number; 52 | wwise: string; 53 | wave: string; 54 | }>; 55 | }; 56 | } 57 | } 58 | 59 | export class Agents extends ValorantApiComService { 60 | public get(isPlayableCharacter: boolean = true): Response[]> { 61 | return this.request.get(`/v1/agents`, { 62 | params: { 63 | isPlayableCharacter: isPlayableCharacter 64 | } 65 | }); 66 | } 67 | 68 | public getByUuid(uuid: string): Response> { 69 | return this.request.get(`/v1/agents/${uuid}`); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Buddies.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace Buddies { 6 | export interface BuddyLevels { 7 | uuid: string; 8 | charmLevel: number; 9 | hideIfNotOwned: boolean; 10 | displayName: LanguageResponse; 11 | displayIcon: string; 12 | assetPath: string; 13 | } 14 | 15 | export interface Buddies { 16 | uuid: string; 17 | displayName: LanguageResponse; 18 | isHiddenIfNotOwned: boolean; 19 | themeUuid: string; 20 | displayIcon: string; 21 | assetPath: string; 22 | levels: Array>; 23 | } 24 | } 25 | 26 | export class Buddies extends ValorantApiComService { 27 | public get(): Response[]> { 28 | return this.request.get(`/v1/buddies`); 29 | } 30 | 31 | public getLevels(): Response[]> { 32 | return this.request.get(`/v1/buddies/levels`); 33 | } 34 | 35 | public getByUuid(uuid: string): Response> { 36 | return this.request.get(`/v1/buddies/${uuid}`); 37 | } 38 | 39 | public getLevelByUuid(uuid: string): Response> { 40 | return this.request.get(`/v1/buddies/levels/${uuid}`); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Bundles.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace Bundles { 6 | export interface Bundles { 7 | uuid: string; 8 | displayName: LanguageResponse; 9 | displayNameSubText: LanguageResponse; 10 | description: LanguageResponse; 11 | extraDescription: LanguageResponse; 12 | promoDescription: LanguageResponse; 13 | useAdditionalContext: boolean; 14 | displayIcon: string; 15 | displayIcon2: string; 16 | logoIcon: string; 17 | verticalPromoImage: string; 18 | assetPath: string; 19 | } 20 | } 21 | 22 | export class Bundles extends ValorantApiComService { 23 | public get(): Response[]> { 24 | return this.request.get(`/v1/bundles`); 25 | } 26 | 27 | public getByUuid(uuid: string): Response> { 28 | return this.request.get(`/v1/bundles/${uuid}`); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Ceremonies.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace Ceremonies { 6 | export interface Ceremonies { 7 | uuid: string; 8 | displayName: LanguageResponse; 9 | assetPath: string; 10 | } 11 | } 12 | 13 | export class Ceremonies extends ValorantApiComService { 14 | public get(): Response[]> { 15 | return this.request.get(`/v1/ceremonies`); 16 | } 17 | 18 | public getByUuid(uuid: string): Response> { 19 | return this.request.get(`/v1/ceremonies/${uuid}`); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/CompetitiveTiers.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace CompetitiveTiers { 6 | export interface CompetitiveTiers { 7 | uuid: string; 8 | assetObjectName: string; 9 | tiers: Array<{ 10 | tier: number; 11 | tierName: LanguageResponse; 12 | division: string; 13 | divisionName: LanguageResponse; 14 | color: string; 15 | backgroundColor: string; 16 | smallIcon: string; 17 | largeIcon: string; 18 | rankTriangleDownIcon: string; 19 | rankTriangleUpIcon: string; 20 | }>; 21 | assetPath: string; 22 | } 23 | } 24 | 25 | export class CompetitiveTiers extends ValorantApiComService { 26 | public get(): Response[]> { 27 | return this.request.get(`/v1/competitivetiers`); 28 | } 29 | 30 | public getByUuid(uuid: string): Response> { 31 | return this.request.get(`/v1/competitivetiers/${uuid}`); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/ContentTiers.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace ContentTiers { 6 | export interface ContentTiers { 7 | uuid: string; 8 | displayName: LanguageResponse; 9 | devName: string; 10 | rank: number; 11 | juiceValue: number; 12 | juiceCost: number; 13 | highlightColor: string; 14 | displayIcon: string; 15 | assetPath: string; 16 | } 17 | } 18 | 19 | export class ContentTiers extends ValorantApiComService { 20 | public get(): Response[]> { 21 | return this.request.get(`/v1/contenttiers`); 22 | } 23 | 24 | public getByUuid(uuid: string): Response> { 25 | return this.request.get(`/v1/contenttiers/${uuid}`); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Contracts.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace Contracts { 6 | export interface Contracts { 7 | uuid: string; 8 | displayName: LanguageResponse; 9 | displayIcon: string; 10 | shipIt: boolean; 11 | useLevelVPCostOverride: boolean; 12 | levelVPCostOverride: number; 13 | freeRewardScheduleUuid: string; 14 | content: { 15 | relationType: string; 16 | relationUuid: string; 17 | chapters: Array<{ 18 | isEpilogue: boolean; 19 | levels: Array<{ 20 | reward: { 21 | type: string; 22 | uuid: string; 23 | amount: number; 24 | isHighlighted: boolean; 25 | }; 26 | xp: number; 27 | vpCost: number; 28 | isPurchasableWithVP: boolean; 29 | doughCost: number; 30 | isPurchasableWithDough: boolean; 31 | }>; 32 | freeRewards: Array<{ 33 | type: string; 34 | uuid: string; 35 | amount: number; 36 | isHighlighted: boolean; 37 | }>; 38 | }>; 39 | premiumRewardScheduleUuid: string; 40 | premiumVPCost: number; 41 | }; 42 | assetPath: string; 43 | } 44 | } 45 | 46 | export class Contracts extends ValorantApiComService { 47 | public get(): Response[]> { 48 | return this.request.get(`/v1/contracts`); 49 | } 50 | 51 | public getByUuid(uuid: string): Response> { 52 | return this.request.get(`/v1/contracts/${uuid}`); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Currencies.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace Currencies { 6 | export interface Currencies { 7 | uuid: string; 8 | displayName: LanguageResponse; 9 | displayNameSingular: LanguageResponse; 10 | displayIcon: string; 11 | largeIcon: string; 12 | assetPath: string; 13 | } 14 | } 15 | 16 | export class Currencies extends ValorantApiComService { 17 | public get(): Response[]> { 18 | return this.request.get(`/v1/currencies`); 19 | } 20 | 21 | public getByUuid(uuid: string): Response> { 22 | return this.request.get(`/v1/currencies/${uuid}`); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Events.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace Events { 6 | export interface Events { 7 | uuid: string; 8 | displayName: LanguageResponse; 9 | shortDisplayName: LanguageResponse; 10 | startTime: string | Date; 11 | endTime: string | Date; 12 | assetPath: string; 13 | } 14 | } 15 | 16 | export class Events extends ValorantApiComService { 17 | public get(): Response[]> { 18 | return this.request.get(`/v1/events`); 19 | } 20 | 21 | public getByUuid(uuid: string): Response> { 22 | return this.request.get(`/v1/events/${uuid}`); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Gamemodes.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace Gamemodes { 6 | export interface Gamemodes { 7 | uuid: string; 8 | displayName: LanguageResponse; 9 | duration: LanguageResponse; 10 | economyType: string; 11 | allowsMatchTimeouts: boolean; 12 | isTeamVoiceAllowed: boolean; 13 | isMinimapHidden: boolean; 14 | orbCount: number; 15 | /** 16 | * `-1` means no data was available 17 | */ 18 | roundsPerHalf: number; 19 | teamRoles: Array; 20 | gameFeatureOverrides: Array<{ 21 | featureName: string; 22 | state: boolean; 23 | }>; 24 | gameRuleBoolOverrides: Array<{ 25 | ruleName: string; 26 | state: boolean; 27 | }>; 28 | displayIcon: string; 29 | listViewIconTall: string; 30 | assetPath: string; 31 | } 32 | 33 | export interface GamemodeEquippables { 34 | uuid: string; 35 | displayName: LanguageResponse; 36 | category: string; 37 | displayIcon: string; 38 | killStreamIcon: string; 39 | assetPath: string; 40 | } 41 | } 42 | 43 | export class Gamemodes extends ValorantApiComService { 44 | public get(): Response[]> { 45 | return this.request.get(`/v1/gamemodes`); 46 | } 47 | 48 | public getEquippables(): Response[]> { 49 | return this.request.get(`/v1/gamemodes/equippables`); 50 | } 51 | 52 | public getByUuid(uuid: string): Response> { 53 | return this.request.get(`/v1/gamemodes/${uuid}`); 54 | } 55 | 56 | public getEquippableByUuid(uuid: string): Response> { 57 | return this.request.get(`/v1/gamemodes/equippables/${uuid}`); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Gear.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace Gear { 6 | export interface Gear { 7 | uuid: string; 8 | displayName: LanguageResponse; 9 | description: LanguageResponse; 10 | displayIcon: string; 11 | assetPath: string; 12 | shopData: { 13 | cost: number; 14 | category: string; 15 | shopOrderPriority: number; 16 | categoryText: LanguageResponse; 17 | gridPosition: { 18 | row: number; 19 | column: number; 20 | }; 21 | canBeTrashed: boolean; 22 | image: string; 23 | newImage: string; 24 | newImage2: string; 25 | assetPath: string; 26 | }; 27 | } 28 | } 29 | 30 | export class Gear extends ValorantApiComService { 31 | public get(): Response[]> { 32 | return this.request.get(`/v1/gear`); 33 | } 34 | 35 | public getByUuid(uuid: string): Response> { 36 | return this.request.get(`/v1/gear/${uuid}`); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Internal.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace Internal { 6 | /** 7 | * ! unknown from website 8 | */ 9 | 10 | export interface UUID { 11 | uuid: string; 12 | type: string; 13 | displayName: LanguageResponse; 14 | } 15 | 16 | export interface RiotClientVersion { 17 | manifestFileName: string; 18 | userAgentVersion: string; 19 | riotClientFoundationInfo: { 20 | VS_FIXEDFILEINFO: { 21 | FileVersion: string; 22 | ProductVersion: string; 23 | FileFlagsMask: string; 24 | FileFlags: `${number}`; 25 | FileOS: string; 26 | FileType: string; 27 | FileSubtype: string; 28 | }; 29 | StringTable: { 30 | Language: `${number}`; 31 | CodePage: `${number}`; 32 | FileDescription: string; 33 | FileVersion: string; 34 | InternalName: string; 35 | OriginalFilename: string; 36 | ProductName: string; 37 | ProductVersion: string; 38 | CompanyName: string; 39 | LegalCopyright: string; 40 | }; 41 | Translation: { 42 | Language: `${number}`; 43 | CodePage: `${number}`; 44 | }; 45 | }; 46 | riotGamesApiInfo: { 47 | VS_FIXEDFILEINFO: { 48 | FileVersion: string; 49 | ProductVersion: string; 50 | FileFlagsMask: string; 51 | FileFlags: string; 52 | FileOS: string; 53 | FileType: string; 54 | FileSubtype: string; 55 | }; 56 | StringTable: { 57 | Language: `${number}`; 58 | CodePage: `${number}`; 59 | FileDescription: string; 60 | FileVersion: string; 61 | InternalName: string; 62 | OriginalFilename: string; 63 | ProductName: string; 64 | ProductVersion: string; 65 | CompanyName: string; 66 | LegalCopyright: string; 67 | }; 68 | Translation: { 69 | Language: `${number}`; 70 | CodePage: `${number}`; 71 | }; 72 | }; 73 | } 74 | } 75 | 76 | export class Internal extends ValorantApiComService { 77 | public uuid(): Response[]> { 78 | return this.request.get(`/internal/uuids`); 79 | } 80 | 81 | public riotClientVersion(): Response { 82 | return this.request.get(`/internal/ritoclientversion`); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/LevelBorders.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace LevelBorders { 6 | export interface LevelBorders { 7 | uuid: string; 8 | displayName: LanguageResponse; 9 | startingLevel: number; 10 | levelNumberAppearance: string; 11 | smallPlayerCardAppearance: string; 12 | assetPath: string; 13 | } 14 | } 15 | 16 | export class LevelBorders extends ValorantApiComService { 17 | public get(): Response[]> { 18 | return this.request.get(`/v1/levelborders`); 19 | } 20 | 21 | public getByUuid(uuid: string): Response> { 22 | return this.request.get(`/v1/levelborders/${uuid}`); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Maps.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace Maps { 6 | export interface Maps { 7 | uuid: string; 8 | displayName: LanguageResponse; 9 | narrativeDescription: LanguageResponse; 10 | tacticalDescription: LanguageResponse; 11 | coordinates: LanguageResponse; 12 | displayIcon: string; 13 | listViewIcon: string; 14 | listViewIconTall: string; 15 | splash: string; 16 | stylizedBackgroundImage: string; 17 | premierBackgroundImage: string; 18 | assetPath: string; 19 | mapUrl: string; 20 | xMultiplier: number; 21 | yMultiplier: number; 22 | xScalarToAdd: number; 23 | yScalarToAdd: number; 24 | callouts: Array<{ 25 | regionName: LanguageResponse; 26 | superRegionName: LanguageResponse; 27 | location: { 28 | x: number; 29 | y: number; 30 | }; 31 | }>; 32 | } 33 | } 34 | 35 | export class Maps extends ValorantApiComService { 36 | public get(): Response[]> { 37 | return this.request.get(`/v1/maps`); 38 | } 39 | 40 | public getByUuid(uuid: string): Response> { 41 | return this.request.get(`/v1/maps/${uuid}`); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Missions.ts: -------------------------------------------------------------------------------- 1 | import { ValorantApiComService } from "../client/ValorantApiComService"; 2 | import type { Response } from "../client/ValorantApiComService"; 3 | 4 | export namespace Missions { 5 | /** 6 | * ! unknown from website 7 | */ 8 | 9 | export interface Missions { 10 | uuid: string; 11 | displayName: string; 12 | title: string; 13 | type: string; 14 | xpGrant: number; 15 | progressToComplete: number; 16 | activationDate: string | Date; 17 | expirationDate: string | Date; 18 | tags: Array; 19 | objectives: Array<{ 20 | objectiveUuid: string; 21 | value: number; 22 | }>; 23 | assetPath: string; 24 | } 25 | } 26 | 27 | export class Missions extends ValorantApiComService { 28 | public get(): Response { 29 | return this.request.get(`/v1/missions`); 30 | } 31 | 32 | public getByUuid(uuid: string): Response { 33 | return this.request.get(`/v1/missions/${uuid}`); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Objectives.ts: -------------------------------------------------------------------------------- 1 | import { ValorantApiComService } from "../client/ValorantApiComService"; 2 | import type { Response } from "../client/ValorantApiComService"; 3 | 4 | export namespace Objectives { 5 | /** 6 | * ! unknown from website 7 | */ 8 | 9 | export interface Objectives { 10 | uuid: string; 11 | directive: string; 12 | assetPath: string; 13 | } 14 | } 15 | 16 | export class Objectives extends ValorantApiComService { 17 | public get(): Response { 18 | return this.request.get(`/v1/objectives`); 19 | } 20 | 21 | public getByUuid(uuid: string): Response { 22 | return this.request.get(`/v1/objectives/${uuid}`); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/PlayerCards.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace PlayerCards { 6 | export interface PlayerCards { 7 | uuid: string; 8 | displayName: LanguageResponse; 9 | isHiddenIfNotOwned: boolean; 10 | themeUuid: string; 11 | displayIcon: string; 12 | smallArt: string; 13 | wideArt: string; 14 | largeArt: string; 15 | assetPath: string; 16 | } 17 | } 18 | 19 | export class PlayerCards extends ValorantApiComService { 20 | public get(): Response[]> { 21 | return this.request.get(`/v1/playercards`); 22 | } 23 | 24 | public getByUuid(uuid: string): Response> { 25 | return this.request.get(`/v1/playercards/${uuid}`); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/PlayerTitles.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace PlayerTitles { 6 | export interface PlayerTitles { 7 | uuid: string; 8 | displayName: LanguageResponse; 9 | titleText: LanguageResponse; 10 | isHiddenIfNotOwned: boolean; 11 | assetPath: string; 12 | } 13 | } 14 | 15 | export class PlayerTitles extends ValorantApiComService { 16 | public get(): Response[]> { 17 | return this.request.get(`/v1/playertitles`); 18 | } 19 | 20 | public getByUuid(uuid: string): Response> { 21 | return this.request.get(`/v1/playertitles/${uuid}`); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Seasons.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace Seasons { 6 | export interface Seasons { 7 | uuid: string; 8 | displayName: LanguageResponse; 9 | type: string; 10 | startTime: string | Date; 11 | endTime: string | Date; 12 | parentUuid: string; 13 | assetPath: string; 14 | } 15 | 16 | export interface CompetitiveSeasons { 17 | uuid: string; 18 | startTime: string | Date; 19 | endTime: string | Date; 20 | seasonUuid: string; 21 | competitiveTiersUuid: string; 22 | borders: Array<{ 23 | uuid: string; 24 | level: number; 25 | winsRequired: number; 26 | displayIcon: string; 27 | smallIcon: string; 28 | assetPath: string; 29 | }>; 30 | assetPath: string; 31 | } 32 | } 33 | 34 | export class Seasons extends ValorantApiComService { 35 | public get(): Response[]> { 36 | return this.request.get(`/v1/seasons`); 37 | } 38 | 39 | public getCompetitiveSeasons(): Response { 40 | return this.request.get(`/v1/seasons/competitive`); 41 | } 42 | 43 | public getByUuid(uuid: string): Response> { 44 | return this.request.get(`/v1/seasons/${uuid}`); 45 | } 46 | 47 | public getCompetitiveSeasonByUuid(uuid: string): Response { 48 | return this.request.get(`/v1/seasons/competitive/${uuid}`); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Sprays.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace Sprays { 6 | export interface SprayLevels { 7 | uuid: string; 8 | sprayLevel: number; 9 | displayName: LanguageResponse; 10 | displayIcon: string; 11 | assetPath: string; 12 | } 13 | 14 | export interface Sprays { 15 | uuid: string; 16 | displayName: LanguageResponse; 17 | category: string; 18 | themeUuid: string; 19 | isNullSpray: boolean; 20 | hideIfNotOwned: boolean; 21 | displayIcon: string; 22 | fullIcon: string; 23 | fullTransparentIcon: string; 24 | animationPng: string; 25 | animationGif: string; 26 | assetPath: string; 27 | levels: Array>; 28 | } 29 | } 30 | 31 | export class Sprays extends ValorantApiComService { 32 | public get(): Response[]> { 33 | return this.request.get(`/v1/sprays`); 34 | } 35 | 36 | public getLevels(): Response[]> { 37 | return this.request.get(`/v1/sprays/levels`); 38 | } 39 | 40 | public getByUuid(uuid: string): Response> { 41 | return this.request.get(`/v1/sprays/${uuid}`); 42 | } 43 | 44 | public getLevelByUuid(uuid: string): Response> { 45 | return this.request.get(`/v1/sprays/levels/${uuid}`); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Themes.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace Themes { 6 | export interface Themes { 7 | uuid: string; 8 | displayName: LanguageResponse; 9 | displayIcon: string; 10 | storeFeaturedImage: string; 11 | assetPath: string; 12 | } 13 | } 14 | 15 | export class Themes extends ValorantApiComService { 16 | public get(): Response[]> { 17 | return this.request.get(`/v1/themes`); 18 | } 19 | 20 | public getByUuid(uuid: string): Response> { 21 | return this.request.get(`/v1/themes/${uuid}`); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Version.ts: -------------------------------------------------------------------------------- 1 | import { ValorantApiComService } from "../client/ValorantApiComService"; 2 | import type { Response } from "../client/ValorantApiComService"; 3 | 4 | export namespace Version { 5 | export interface Version { 6 | manifestId: string; 7 | branch: string; 8 | version: string; 9 | buildVersion: string; 10 | engineVersion: string; 11 | riotClientVersion: string; 12 | riotClientBuild: string; 13 | buildDate: string | Date; 14 | } 15 | } 16 | 17 | export class Version extends ValorantApiComService { 18 | public get(): Response { 19 | return this.request.get(`/v1/version`); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/src/service/Weapons.ts: -------------------------------------------------------------------------------- 1 | import type { Language } from "../client/ValorantApiCom"; 2 | import { ValorantApiComService } from "../client/ValorantApiComService"; 3 | import type { LanguageResponse, Response } from "../client/ValorantApiComService"; 4 | 5 | export namespace Weapons { 6 | export interface WeaponSkinChromas { 7 | uuid: string; 8 | displayName: LanguageResponse; 9 | displayIcon: string; 10 | fullRender: string; 11 | swatch: string; 12 | streamedVideo: string; 13 | assetPath: string; 14 | } 15 | 16 | export interface WeaponSkinLevels { 17 | uuid: string; 18 | displayName: LanguageResponse; 19 | levelItem: string; 20 | displayIcon: string; 21 | streamedVideo: string; 22 | assetPath: string; 23 | } 24 | 25 | export interface WeaponSkins { 26 | uuid: string; 27 | displayName: LanguageResponse; 28 | themeUuid: string; 29 | contentTierUuid: string; 30 | displayIcon: string; 31 | wallpaper: string; 32 | assetPath: string; 33 | chromas: Array>; 34 | levels: Array>; 35 | } 36 | 37 | export interface Weapons { 38 | uuid: string; 39 | displayName: LanguageResponse; 40 | category: string; 41 | defaultSkinUuid: string; 42 | displayIcon: string; 43 | killStreamIcon: string; 44 | assetPath: string; 45 | weaponStats: { 46 | fireRate: number; 47 | magazineSize: number; 48 | runSpeedMultiplier: number; 49 | equipTimeSeconds: number; 50 | reloadTimeSeconds: number; 51 | firstBulletAccuracy: number; 52 | shotgunPelletCount: number; 53 | wallPenetration: string; 54 | feature: string; 55 | fireMode: string; 56 | altFireType: string; 57 | adsStats: { 58 | zoomMultiplier: number; 59 | fireRate: number; 60 | runSpeedMultiplier: number; 61 | burstCount: number; 62 | firstBulletAccuracy: number; 63 | }; 64 | altShotgunStats: { 65 | shotgunPelletCount: number; 66 | burstRate: number; 67 | }; 68 | airBurstStats: { 69 | shotgunPelletCount: number; 70 | burstDistance: number; 71 | }; 72 | damageRanges: Array<{ 73 | rangeStartMeters: number; 74 | rangeEndMeters: number; 75 | headDamage: number; 76 | bodyDamage: number; 77 | legDamage: number; 78 | }>; 79 | }; 80 | shopData: { 81 | cost: number; 82 | category: string; 83 | shopOrderPriority: number; 84 | categoryText: LanguageResponse; 85 | gridPosition: { 86 | row: number; 87 | column: number; 88 | }; 89 | canBeTrashed: boolean; 90 | image: string; 91 | newImage: string; 92 | newImage2: string; 93 | assetPath: string; 94 | }; 95 | skins: Array>; 96 | } 97 | } 98 | 99 | export class Weapons extends ValorantApiComService { 100 | public get(): Response[]> { 101 | return this.request.get(`/v1/weapons`); 102 | } 103 | 104 | public getSkins(): Response[]> { 105 | return this.request.get(`/v1/weapons/skins`); 106 | } 107 | 108 | public getSkinChromas(): Response[]> { 109 | return this.request.get(`/v1/weapons/skinchromas`); 110 | } 111 | 112 | public getSkinLevels(): Response[]> { 113 | return this.request.get(`/v1/weapons/skinlevels`); 114 | } 115 | 116 | public getByUuid(uuid: string): Response> { 117 | return this.request.get(`/v1/weapons/${uuid}`); 118 | } 119 | 120 | public getSkinByUuid(uuid: string): Response> { 121 | return this.request.get(`/v1/weapons/skins/${uuid}`); 122 | } 123 | 124 | public getSkinChromaByUuid(uuid: string): Response> { 125 | return this.request.get(`/v1/weapons/skinchromas/${uuid}`); 126 | } 127 | 128 | public getSkinLevelByUuid(uuid: string): Response> { 129 | return this.request.get(`/v1/weapons/skinlevels/${uuid}`); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "./src", 5 | "outDir": "./build", 6 | "paths": { 7 | "@valapi/lib": ["../lib/src"] 8 | } 9 | }, 10 | "references": [ 11 | { 12 | "path": "../lib" 13 | } 14 | ], 15 | "exclude": ["node_modules", "build", "src/__tests__"] 16 | } 17 | -------------------------------------------------------------------------------- /packages/@valapi/valorant-api.com/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "valorant-api.com", 3 | "extends": ["../../../typedoc.base.json"], 4 | "entryPoints": ["src/index.ts"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 5.0.0-beta.0 2 | 3 | **Add** 4 | 5 | - `WebClient.regionURL` 6 | 7 | **Change** 8 | 9 | - ~~`WebClient.axios`~~ **-->** `WebClient.request` 10 | - ~~`WebClientRegion`~~ **-->** `WebClientRegionURL` 11 | - ~~`WebClientService.axios`~~ **-->** `WebClientService.request` 12 | - ~~`WebClientService.apiRegion`~~ **-->** `WebClientService.regionURL` 13 | - ~~`Config`~~ **-->** `Configuration` 14 | 15 | _refactor_ 16 | 17 | - `WebClient`~~`extends AuthClient`~~ **-->** `new WebClient({ user: Auth.toJSON() })` 18 | 19 | **Remove** 20 | 21 | - `WebClient.toUserJSON()` 22 | - `WebClient.fromUserJSON()` 23 | - `WebClient.request` 24 | 25 | _static_ 26 | 27 | - `WebClient.fromUserJSON()` 28 | - `WebClient.fromCookie()` 29 | - `WebClient.fromJSON()` 30 | 31 | ### Typescript 32 | 33 | **Add** 34 | 35 | - `Config` 36 | 37 | **Change** 38 | 39 | - ~~`WebClient.UserInfo`~~ **-->** `UserInfoResponse` 40 | 41 | **Remove** 42 | 43 | - `WebClient.UserJson` 44 | 45 | # 4.0.0 46 | 47 | _endpoints_ 48 | 49 | **Add** 50 | 51 | - `Party.PartyCode.create(partyId)` 52 | - `Party.PartyCode.delete(partyId)` 53 | - `Party.PartyCode.join(partyCode)` 54 | 55 | **Change** 56 | 57 | - ~~`Config.fetchConfig`~~ **-->** `Config.get` 58 | - ~~`Content.fetchContent`~~ **-->** `Content.get` 59 | - ~~`ContractDefinitions.fetchActiveStory`~~ **-->** `ContractDefinitions.getActiveStory` 60 | - ~~`ContractDefinitions.fetch`~~ **-->** `ContractDefinitions.get` 61 | - ~~`ContractDefinitions.fetchItemProgression`~~ **-->** `ContractDefinitions.getItemProgression` 62 | - ~~`Contracts.fetch`~~ **-->** `Contracts.get` 63 | - ~~`Contracts.unlockItemProgress`~~ **-->** `Contracts.unlockItemProgression` 64 | - ~~`MMR.fetchPlayer`~~ **-->** `MMR.getPlayer` 65 | - ~~`MMR.fetchLeaderboard`~~ **-->** `MMR.getLeaderboard` 66 | - ~~`MMR.fetchCompetitiveUpdates`~~ **-->** `MMR.getCompetitiveUpdates` 67 | - ~~`DisplayNameService.fetchPlayers`~~ **-->** `NameService.getPlayer` 68 | - ~~`Party.fetchPlayer`~~ **-->** `Party.Player.get` 69 | - ~~`Party.removePlayer`~~ **-->** `Party.Player.remove` 70 | - ~~`Party.joinParty`~~ **-->** `Party.Player.joinParty` 71 | - ~~`Party.leaveParty`~~ **-->** `Party.Player.leaveParty` 72 | - ~~`Party.setMemberReady`~~ **-->** `Party.Player.setReady` 73 | - ~~`Party.fetchParty`~~ **-->** `Party.get` 74 | - ~~`Party.leaveFromParty`~~ **-->** `Party.Player.leaveFromParty` 75 | - ~~`Party.makeIntoCustomGame`~~ **-->** `Party.CustomGame.makeInto` 76 | - ~~`Party.changeQueue`~~ **-->** `Party.MatchMaking.changeQueue` 77 | - ~~`Party.makeDefault`~~ **-->** `Party.MatchMaking.makeDefaultQueue` 78 | - ~~`Party.startCustomGame`~~ **-->** `Party.CustomGame.start` 79 | - ~~`Party.startSoloExperience`~~ **-->** `Party.MatchMaking.startSoloExperience` 80 | - ~~`Party.setCustomGameSettings`~~ **-->** `Party.CustomGame.changeSettings` 81 | - ~~`Party.changeTeamInCustomGame`~~ **-->** `Party.CustomGame.changeTeam` 82 | - ~~`Party.enterMatchmakingQueue`~~ **-->** `Party.MatchMaking.start` 83 | - ~~`Party.leaveMatchmakingQueue`~~ **-->** `Partyy.MatchMaking.leave` 84 | - ~~`Party.setBalance`~~ **-->** `Party.CustomGame.setBalance` 85 | - ~~`Party.fetchCustomGameConfigs`~~ **-->** `Party.CustomGame.getConfig` 86 | - ~~`Party.transferOwner`~~ **-->** `Party.Player.transferOwner` 87 | - ~~`Personalization.playerLoadoutUpdate`~~ **-->** `Personalization.changePlayerLoadout` 88 | - ~~`Store.getStorefront`~~ **-->** `Store.StoreFront.get` 89 | - ~~`Store.revealNightMarketOffers`~~ **-->** `Store.StoreFront.revealNightMarketOffers` 90 | - ~~`Store.getAgent`~~ **-->** `Store.StoreFront.getAgent` 91 | 92 | ### Typescript 93 | 94 | **Add** 95 | 96 | - `WebClient.UserInfo` 97 | - `Party.CustomGame.Member` 98 | - `Party.CustomGame.Config` 99 | 100 | **Change** 101 | 102 | - ~~`Party.CustomGameSettings`~~ **-->** `Party.CustomGame.Settings` 103 | - ~~`Party.CustomGameTeam`~~ **-->** `Party.CustomGame.Team` 104 | 105 | # 3.2.0 106 | 107 | **Add** 108 | 109 | - `WebClient.request` 110 | 111 | _endpoints_ 112 | 113 | - `Store.getAgent()` 114 | - `DailyTicket.get(subject)` 115 | - `DailyTicket.renew(subject)` 116 | 117 | **Remove** 118 | 119 | - `WebClient.getService()` 120 | 121 | # 3.0.0 122 | 123 | **Add** 124 | 125 | - `WebClientRegion` 126 | - `WebClient.getService()` 127 | - `WebClient.toUserJSON()` 128 | - `WebClient.fromUserJSON()` 129 | 130 | _static_ 131 | 132 | - `WebClient.fromUserJSON()` 133 | 134 | _in development_ 135 | 136 | - `WebClient.getUserSettings()` 137 | - `WebClient.updateUserSettings(data)` 138 | 139 | **Change** 140 | 141 | - ~~`Personalization.playerLoadoutUpdate(subject)`~~ **-->** `Personalization.playerLoadoutUpdate(subject, loadout)` 142 | 143 | ### Typescript 144 | 145 | **Add** 146 | 147 | > types for all services 148 | 149 | - `WebClient.UserJson` 150 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022-2024 Ing Project 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/README.md: -------------------------------------------------------------------------------- 1 | [githubrepo_image]: https://github.com/valapi/.github/blob/main/128_valapi.png?raw=true 2 | [githubrepo_url]: https://github.com/valapi 3 | [download_image]: https://badgen.net/npm/dt/@valapi/web-client?icon=npm 4 | [download_url]: https://www.npmjs.com/package/@valapi/web-client 5 | [size_image]: https://packagephobia.com/badge?p=@valapi/web-client 6 | [size_url]: https://packagephobia.com/result?p=@valapi/web-client 7 | [vulnerabilities_image]: https://snyk.io/test/npm/@valapi/web-client/badge.svg 8 | [vulnerabilities_url]: https://snyk.io/test/npm/@valapi/web-client 9 | [license_image]: https://badgen.net/badge/license/MIT/blue 10 | [license_url]: https://github.com/valapi/.github/blob/main/LICENSE 11 | [github_image]: https://badgen.net/badge/icon/github?icon=github&label 12 | [github_url]: https://github.com/valapi/node-valapi/tree/master/packages/@valapi/web-client 13 | [discord_image]: https://badgen.net/badge/icon/discord?icon=discord&label 14 | [discord_url]: https://discord.gg/pbyWbUYjyt 15 | 16 |
17 | 18 | # Valorant API - Web Client 19 | 20 | [![Profile][githubrepo_image]][github_url] 21 | 22 | Web API 23 | 24 | [![Downloads][download_image]][download_url] 25 | [![install size][size_image]][size_url] 26 | [![Known Vulnerabilities][vulnerabilities_image]][vulnerabilities_url] 27 | 28 | [![LICENSE][license_image]][license_url] 29 | [![Github][github_image]][github_url] 30 | [![Discord][discord_image]][discord_url] 31 | 32 | Documentation: [valapi.github.io/docs](https://valapi.github.io/docs) 33 | 34 | Guide: [valapi.github.io/guide](https://valapi.github.io/guide) 35 | 36 |
37 | 38 | --- 39 | 40 | > - **@valapi/web-client** isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing Riot Games properties. Riot Games, and all associated properties are trademarks or registered trademarks of Riot Games, Inc. 41 | > - **@valapi/web-client** was created under [Riot Games' "Legal Jibber Jabber"](https://www.riotgames.com/en/legal) policy using assets owned by Riot Games. Riot Games does not endorse or sponsor this project. 42 | > - [MIT License][license_url] 43 | 44 | ## Installation 45 | 46 | **NPM:** 47 | 48 | ```bash 49 | npm install @valapi/web-client 50 | ``` 51 | 52 | **PNPM:** 53 | 54 | ```bash 55 | pnpm add @valapi/web-client 56 | ``` 57 | 58 | ## Guide 59 | 60 | ```typescript 61 | import { WebClient } from "@valapi/web-client"; 62 | ``` 63 | 64 | ```typescript 65 | const client = new WebClient({ 66 | user: auth.toJSON(), 67 | region: await auth.regionTokenization() 68 | }); 69 | ``` 70 | 71 | ### API 72 | 73 | ```typescript 74 | const userInfo = await client.getUserInfo(); 75 | 76 | console.log(userInfo.data); 77 | ``` 78 | 79 | ```typescript 80 | const mapId = "match-id-1234567890"; 81 | const matchDetails = await client.Match.fetchMatchDetails(mapId); 82 | 83 | console.log(matchDetails.data); 84 | ``` 85 | 86 | ```typescript 87 | const wallet = await client.Store.getWallet(subject); 88 | 89 | console.log(wallet.data); 90 | ``` 91 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@valapi/web-client", 3 | "version": "5.0.0-beta.2", 4 | "publishConfig": { 5 | "registry": "https://registry.npmjs.org", 6 | "access": "public" 7 | }, 8 | "description": "Valorant API - Web Client", 9 | "keywords": [ 10 | "riot", 11 | "api", 12 | "val", 13 | "valorant", 14 | "web", 15 | "in-game" 16 | ], 17 | "main": "build/index.js", 18 | "types": "./build/index.d.ts", 19 | "repository": { 20 | "type": "git", 21 | "url": "git+https://github.com/valapi/node-valapi.git", 22 | "directory": "packages/@valapi/web-client" 23 | }, 24 | "author": "ing3kth (https://github.com/KTNG-3)", 25 | "license": "MIT", 26 | "bugs": { 27 | "url": "https://github.com/valapi/node-valapi/issues" 28 | }, 29 | "homepage": "https://valapi.github.io/guide", 30 | "dependencies": { 31 | "@valapi/auth": "5.0.0-beta.2", 32 | "@valapi/lib": "5.0.0-beta.2" 33 | }, 34 | "directories": { 35 | "lib": "build", 36 | "test": "src/__tests__" 37 | }, 38 | "files": [ 39 | "build", 40 | "CHANGELOG.md", 41 | "LICENSE", 42 | "package.json", 43 | "README.md", 44 | "SECURITY.md" 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/__tests__/api.ts: -------------------------------------------------------------------------------- 1 | import { env } from "node:process"; 2 | 3 | import type { Region } from "@valapi/lib"; 4 | import { Auth } from "@valapi/auth"; 5 | 6 | import { WebClient } from "../index"; 7 | 8 | describe("webclient.api", () => { 9 | const auth = new Auth(); 10 | 11 | it("apis", async () => { 12 | await auth.login(env.VAL_USER, env.VAL_PASS); 13 | 14 | const client = new WebClient({ 15 | user: auth.toJSON(), 16 | region: env.VAL_REGION 17 | }); 18 | 19 | Promise.all([ 20 | client.getUserInfo(), 21 | client.AccountXP.getPlayer(auth.subject), 22 | client.ContractDefinitions.getItemProgression(), 23 | client.NameService.getPlayer(auth.subject), 24 | client.Favorites.get(auth.subject), 25 | client.MassRewards.reconcilePlayer(auth.subject), 26 | client.Match.fetchMatchHistory(auth.subject), 27 | client.Personalization.getPlayerLoadout(auth.subject), 28 | client.Store.getOffers() 29 | ]).then(values => { 30 | values.forEach(element => { 31 | expect(element.status === 200).toBe(true); 32 | }); 33 | }); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/__tests__/region.ts: -------------------------------------------------------------------------------- 1 | import { Region } from "@valapi/lib"; 2 | 3 | import { WebClientRegionURL } from "../index"; 4 | 5 | describe("webclient.region", () => { 6 | test("korea", () => { 7 | const _region = new WebClientRegionURL(Region.Default.Korea); 8 | 9 | const id = "kr"; 10 | const shard = "kr"; 11 | 12 | expect(_region.id).toBe(id); 13 | expect(_region.shard).toBe(shard); 14 | 15 | expect(_region.url).toMatchObject({ 16 | playerData: `https://pd.${shard}.a.pvp.net`, 17 | partyService: `https://glz-${id}-1.${shard}.a.pvp.net`, 18 | sharedData: `https://shared.${shard}.a.pvp.net` 19 | }); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/client/WebClientRegionURL.ts: -------------------------------------------------------------------------------- 1 | import { ValRegion } from "@valapi/lib"; 2 | import type { Region } from "@valapi/lib"; 3 | 4 | export class WebClientRegionURL extends ValRegion { 5 | public readonly shard: Region.ID; 6 | public readonly url: { 7 | /** 8 | * pd.$.a.pvp.net 9 | */ 10 | playerData: string; 11 | /** 12 | * glz-$-1.$.a.pvp.net 13 | */ 14 | partyService: string; 15 | /** 16 | * shared.$.a.pvp.net 17 | */ 18 | sharedData: string; 19 | }; 20 | 21 | /** 22 | * @param region (default: na) 23 | */ 24 | public constructor(region?: Region.ID) { 25 | super(region); 26 | 27 | this.shard = "na"; 28 | switch (region) { 29 | case "na": { 30 | break; 31 | } 32 | case "latam": { 33 | break; 34 | } 35 | case "br": { 36 | break; 37 | } 38 | case "pbe": { 39 | this.shard = "pbe"; 40 | break; 41 | } 42 | case "eu": { 43 | this.shard = "eu"; 44 | break; 45 | } 46 | case "kr": { 47 | this.shard = "kr"; 48 | break; 49 | } 50 | case "ap": { 51 | this.shard = "ap"; 52 | break; 53 | } 54 | } 55 | 56 | this.url = { 57 | playerData: `https://pd.${this.shard}.a.pvp.net`, 58 | partyService: `https://glz-${this.id}-1.${this.shard}.a.pvp.net`, 59 | sharedData: `https://shared.${this.shard}.a.pvp.net` 60 | }; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/client/WebClientService.ts: -------------------------------------------------------------------------------- 1 | import type { AxiosInstance } from "axios"; 2 | 3 | import type { WebClientRegionURL } from "./WebClientRegionURL"; 4 | 5 | export class WebClientService { 6 | protected readonly request: AxiosInstance; 7 | protected readonly regionURL: WebClientRegionURL; 8 | 9 | public constructor(request: AxiosInstance, regionURL: WebClientRegionURL) { 10 | this.request = request; 11 | this.regionURL = regionURL; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/index.ts: -------------------------------------------------------------------------------- 1 | import { WebClient } from "./client/WebClient"; 2 | 3 | export { WebClient }; 4 | export type { Config, UserInfoResponse } from "./client/WebClient"; 5 | export { WebClientRegionURL } from "./client/WebClientRegionURL"; 6 | export { WebClientService } from "./client/WebClientService"; 7 | 8 | export { AccountXP } from "./service/AccountXP"; 9 | export { Configuration } from "./service/Configuration"; 10 | export { Content } from "./service/Content"; 11 | export { ContractDefinitions } from "./service/ContractDefinitions"; 12 | export { Contracts } from "./service/Contracts"; 13 | export { CoreGame } from "./service/CoreGame"; 14 | export { DailyTicket } from "./service/DailyTicket"; 15 | export { Favorites } from "./service/Favorites"; 16 | export { Latency } from "./service/Latency"; 17 | export { MassRewards } from "./service/MassRewards"; 18 | export { Match } from "./service/Match"; 19 | export { MMR } from "./service/MMR"; 20 | export { NameService } from "./service/NameService"; 21 | export { Party, MatchMaking, Player, CustomGame, PartyCode } from "./service/Party"; 22 | export { Personalization } from "./service/Personalization"; 23 | export { PreGame } from "./service/PreGame"; 24 | export { Premier } from "./service/Premier"; 25 | export { Restrictions } from "./service/Restrictions"; 26 | export { Session } from "./service/Session"; 27 | export { Store, StoreFront } from "./service/Store"; 28 | 29 | export default WebClient; 30 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/AccountXP.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseResponse } from "@valapi/auth"; 2 | 3 | import { WebClientService } from "../client/WebClientService"; 4 | 5 | export namespace AccountXP { 6 | export interface Level { 7 | Level: number; 8 | XP: number; 9 | } 10 | 11 | export interface Player { 12 | Version: number; 13 | Subject: string; 14 | Progress: AccountXP.Level; 15 | History: Array<{ 16 | ID: string; 17 | MatchStart: Date; 18 | StartProgress: AccountXP.Level; 19 | EndProgress: AccountXP.Level; 20 | XPDelta: number; 21 | XPSources: Array<{ 22 | ID: string; 23 | Amount: number; 24 | }>; 25 | XPMultipliers: Array<{ 26 | ID: string; 27 | Value: string; 28 | }>; 29 | }>; 30 | LastTimeGrantedFirstWin: Date; 31 | NextTimeFirstWinAvailable: Date; 32 | } 33 | } 34 | 35 | export class AccountXP extends WebClientService { 36 | public getPlayer(subject: string): PromiseResponse { 37 | return this.request.get(`${this.regionURL.url.playerData}/account-xp/v1/players/${subject}`); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/Configuration.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseResponse } from "@valapi/auth"; 2 | 3 | import { WebClientService } from "../client/WebClientService"; 4 | 5 | export namespace Configuration { 6 | export interface Config { 7 | LastApplication: Date; 8 | Collapsed: Record; // * unknown 9 | } 10 | } 11 | 12 | export class Configuration extends WebClientService { 13 | public get(): PromiseResponse { 14 | return this.request.get(`${this.regionURL.url.sharedData}/v1/config/${this.regionURL.id}`); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/Content.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseResponse } from "@valapi/auth"; 2 | 3 | import { WebClientService } from "../client/WebClientService"; 4 | 5 | export namespace Content { 6 | export interface ContentElements { 7 | ID: string; 8 | Name: string; 9 | StartTime: Date; 10 | EndTime: Date; 11 | IsActive: boolean; 12 | } 13 | 14 | export interface ContentElementsType extends ContentElements { 15 | Type: string; 16 | } 17 | 18 | export interface Content { 19 | DisabledID: Array; // * unknown 20 | Seasons: Array; 21 | Events: Array; 22 | } 23 | } 24 | 25 | export class Content extends WebClientService { 26 | public get(): PromiseResponse { 27 | return this.request.get(`${this.regionURL.url.sharedData}/content-service/v3/content`); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/ContractDefinitions.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseResponse } from "@valapi/auth"; 2 | 3 | import { WebClientService } from "../client/WebClientService"; 4 | 5 | export namespace ContractDefinitions { 6 | export interface Item { 7 | ItemTypeID: string; 8 | ItemID: string; 9 | } 10 | 11 | export interface ItemAmount extends ContractDefinitions.Item { 12 | Amount: number; 13 | } 14 | 15 | export interface ItemProgression { 16 | Definitions: Array<{ 17 | ID: string; 18 | Item: ContractDefinitions.Item; 19 | RequiredEntitlement: ContractDefinitions.Item; 20 | ProgressionSchedule: { 21 | Name: string; 22 | ProgressionCurrencyID: string; 23 | ProgressionDeltaPerLevel: Array; 24 | }; 25 | RewardSchedule: { 26 | ID: string; 27 | Name: string; 28 | Prerequisites: { 29 | RequiredEntitlements: Array; 30 | }; 31 | RewardsPerLevel: Array<{ 32 | EntitlementRewards: Array; 33 | WalletRewards: any; // * unknown 34 | CounterRewards: any; // * unknown 35 | }>; 36 | }; 37 | Sidegrades: Array<{ 38 | SidegradeID: string; 39 | Options: Array<{ 40 | OptionID: string; 41 | Cost: { 42 | WalletCosts: Array<{ 43 | CurrencyID: string; 44 | AmountToDeduct: number; 45 | }>; 46 | }; 47 | Rewards: Array; 48 | }>; 49 | Prerequisites: { 50 | RequiredEntitlements: Array; 51 | }; 52 | }>; 53 | }>; 54 | } 55 | } 56 | 57 | export class ContractDefinitions extends WebClientService { 58 | /** 59 | * @deprecated Please, Contact us if you find out how its works 60 | */ 61 | public getActiveStory(): PromiseResponse { 62 | return this.request.get(`${this.regionURL.url.playerData}/contract-definitions/v2/definitions/story`); 63 | } 64 | 65 | /** 66 | * @deprecated Please, Contact us if you find out how its works 67 | */ 68 | public get(): PromiseResponse { 69 | return this.request.get(`${this.regionURL.url.playerData}/contract-definitions/v2/definitions`); 70 | } 71 | 72 | // ItemProgressionDefinitionsV2 73 | 74 | public getItemProgression(): PromiseResponse { 75 | return this.request.get(`${this.regionURL.url.playerData}/contract-definitions/v3/item-upgrades`); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/Contracts.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseResponse } from "@valapi/auth"; 2 | 3 | import { WebClientService } from "../client/WebClientService"; 4 | 5 | export namespace Contracts { 6 | export interface Contracts { 7 | Version: number; 8 | Subject: string; 9 | Contracts: Array<{ 10 | ContractDefinitionID: string; 11 | ContractProgression: { 12 | TotalProgressionEarned: number; 13 | TotalProgressionEarnedVersion: number; 14 | HighestRewardedLevel: Record< 15 | string, 16 | { 17 | Amount: number; 18 | Version: number; 19 | } 20 | >; 21 | }; 22 | ProgressionLevelReached: number; 23 | ProgressionTowardsNextLevel: number; 24 | }>; 25 | ProcessedMatches: Array<{ 26 | ID: string; 27 | StartTime: number; 28 | XPGrants: { 29 | GamePlayed: number; 30 | GameWon: number; 31 | RoundPlayed: number; 32 | RoundWon: number; 33 | Missions: Record; 34 | Modifier: { 35 | Value: number; 36 | BaseMultiplierValue: number; 37 | Modifiers: Array<{ 38 | Value: number; 39 | Name: string; 40 | BaseOnly: boolean; 41 | }>; 42 | }; 43 | NumAFKRounds: number; 44 | }; 45 | DoughGrants?: { 46 | GamePlayed: number; 47 | RoundPlayed: number; 48 | RoundWon: number; 49 | }; 50 | RewardGrants: Record< 51 | string, 52 | { 53 | EntitlementRewards: Array<{ 54 | ItemTypeID: string; 55 | ItemID: string; 56 | Amount: number; 57 | }>; 58 | WalletRewards: Array<{ 59 | CurrencyID: string; 60 | Amount: 10; 61 | }>; 62 | CounterRewards: any; // * unknown 63 | } 64 | >; 65 | MissionDeltas: Record< 66 | string, 67 | { 68 | ID: string; 69 | Objectives: Record; 70 | ObjectiveDeltas: Record< 71 | string, 72 | { 73 | ID: string; 74 | ProgressBefore: number; 75 | ProgressAfter: number; 76 | } 77 | >; 78 | } 79 | >; 80 | ContractDeltas: Record< 81 | string, 82 | { 83 | ID: string; 84 | TotalXPBefore: number; 85 | TotalXPAfter: number; 86 | } 87 | >; 88 | RecruitmentProgressUpdate?: { 89 | GroupID: string; 90 | ProgressBefore: number; 91 | ProgressAfter: number; 92 | MilestoneThreshold: number; 93 | }; 94 | CouldProgressMissions: boolean; 95 | MatchSummary: { 96 | RoundsTotal: number; 97 | RoundsWon: number; 98 | }; 99 | }>; 100 | ActiveSpecialContract: string; 101 | Missions: Array<{ 102 | ID: string; 103 | Objectives: Record; 104 | Complete: boolean; 105 | ExpirationTime: Date; 106 | }>; 107 | MissionMetadata: { 108 | NPECompleted: boolean; 109 | WeeklyCheckpoint: string; 110 | WeeklyRefillTime?: string; 111 | }; 112 | } 113 | } 114 | 115 | export class Contracts extends WebClientService { 116 | public get(subject: string): PromiseResponse { 117 | return this.request.get(`${this.regionURL.url.playerData}/contracts/v1/contracts/${subject}`); 118 | } 119 | 120 | public activate(subject: string, contractId: string): PromiseResponse { 121 | return this.request.post(`${this.regionURL.url.playerData}/contracts/v1/contracts/${subject}/special/${contractId}`); 122 | } 123 | 124 | /** 125 | * @deprecated Please, Contact us if you find out how its works 126 | */ 127 | public unlockItemProgression(subject: string, definitionId: string): PromiseResponse { 128 | return this.request.post(`${this.regionURL.url.playerData}/contracts/v2/item-upgrades/${definitionId}/${subject}`); 129 | } 130 | 131 | /** 132 | * @deprecated Please, Contact us if you find out how its works 133 | */ 134 | public unlockContractProgression(subject: string, contractId: string): PromiseResponse { 135 | return this.request.post(`${this.regionURL.url.playerData}/contracts/v1/contracts/${subject}/contracts/${contractId}/unlock`); 136 | } 137 | 138 | /** 139 | * @deprecated Please, Contact us if you find out how its works 140 | */ 141 | public unlockItemSidegrade(subject: string, definitionId: string, sidegradeId: string, optionId: string): PromiseResponse { 142 | return this.request.post(`${this.regionURL.url.playerData}/contracts/v1/item-upgrades/${definitionId}/sidegrades/${sidegradeId}/options/${optionId}/${subject}`); 143 | } 144 | 145 | /** 146 | * @deprecated Please, Contact us if you find out how its works 147 | */ 148 | public upgrade(subject: string, contractId: string): PromiseResponse { 149 | return this.request.post(`${this.regionURL.url.playerData}/contracts/v1/contracts/${subject}/special/${contractId}/upgrade`); 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/CoreGame.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseResponse } from "@valapi/auth"; 2 | 3 | import { WebClientService } from "../client/WebClientService"; 4 | 5 | export namespace CoreGame { 6 | export interface Player { 7 | Subject: string; 8 | MatchID: string; 9 | Version: number; 10 | } 11 | 12 | export interface Match { 13 | MatchID: string; 14 | Version: number; 15 | State: string; 16 | MapID: string; 17 | ModeID: string; 18 | ProvisioningFlow: string; 19 | GamePodID: string; 20 | AllMUCName: string; 21 | TeamMUCName: string; 22 | TeamVoiceID: string; 23 | TeamMatchToken: string; 24 | IsReconnectable: boolean; 25 | ConnectionDetails: { 26 | GameServerHosts: Array; 27 | GameServerHost: string; 28 | GameServerPort: number; 29 | GameServerObfuscatedIP: number; 30 | GameClientHash: number; 31 | PlayerKey: string; 32 | }; 33 | PostGameDetails: { 34 | Start: Date; 35 | Players: Array<{ 36 | Subject: string; 37 | }>; 38 | }; 39 | Players: Array<{ 40 | Subject: string; 41 | TeamID: string; 42 | CharacterID: string; 43 | PlayerIdentity: { 44 | Subject: string; 45 | PlayerCardID: string; 46 | PlayerTitleID: string; 47 | AccountLevel: number; 48 | PreferredLevelBorderID: string; 49 | Incognito: boolean; 50 | HideAccountLevel: boolean; 51 | }; 52 | SeasonalBadgeInfo: { 53 | SeasonID: string; 54 | NumberOfWins: number; 55 | WinsByTier: any; // * unknown 56 | Rank: number; 57 | LeaderboardRank: number; 58 | }; 59 | IsCoach: boolean; 60 | IsAssociated: boolean; 61 | }>; 62 | MatchmakingData: { 63 | QueueID: string; 64 | IsRanked: boolean; 65 | }; 66 | } 67 | 68 | export interface Loadout { 69 | Loadouts: Array<{ 70 | CharacterID: string; 71 | Loadout: { 72 | Subject: string; 73 | Sprays: { 74 | SpraySelections: Array<{ 75 | SocketID: string; 76 | SprayID: string; 77 | LevelID: string; 78 | }>; 79 | }; 80 | Expressions: { 81 | AESSelections: Array<{ 82 | SocketID: string; 83 | AssetID: string; 84 | TypeID: string; 85 | }>; 86 | }; 87 | Items: Record< 88 | string, 89 | { 90 | ID: string; 91 | TypeID: string; 92 | Sockets: Record< 93 | string, 94 | { 95 | ID: string; 96 | Item: { 97 | ID: string; 98 | TypeID: string; 99 | }; 100 | } 101 | >; 102 | } 103 | >; 104 | }; 105 | }>; 106 | } 107 | } 108 | 109 | /** 110 | * Current Game 111 | */ 112 | export class CoreGame extends WebClientService { 113 | public fetchPlayer(subject: string): PromiseResponse { 114 | return this.request.get(`${this.regionURL.url.partyService}/core-game/v1/players/${subject}`); 115 | } 116 | 117 | public fetchMatch(matchId: string): PromiseResponse { 118 | return this.request.get(`${this.regionURL.url.partyService}/core-game/v1/matches/${matchId}`); 119 | } 120 | 121 | public fetchMatchLoadouts(matchId: string): PromiseResponse { 122 | return this.request.get(`${this.regionURL.url.partyService}/core-game/v1/matches/${matchId}/loadouts`); 123 | } 124 | 125 | /** 126 | * ! Careful to use, Riot will immediately shut down your Project. 127 | */ 128 | public disassociatePlayer(subject: string, matchId: string): PromiseResponse { 129 | return this.request.post(`${this.regionURL.url.partyService}/core-game/v1/players/${subject}/disassociate/${matchId}`); 130 | } 131 | 132 | /** 133 | * @deprecated Please, Contact us if you find out how its works 134 | */ 135 | public fetchAllChatMUCToken(matchId: string): PromiseResponse { 136 | return this.request.get(`${this.regionURL.url.partyService}/core-game/v1/matches/${matchId}/allchatmuctoken`); 137 | } 138 | 139 | /** 140 | * @deprecated Please, Contact us if you find out how its works 141 | */ 142 | public fetchTeamChatMUCToken(matchId: string): PromiseResponse { 143 | return this.request.get(`${this.regionURL.url.partyService}/core-game/v1/matches/${matchId}/teamchatmuctoken`); 144 | } 145 | 146 | /** 147 | * @deprecated Please, Contact us if you find out how its works 148 | */ 149 | public fetchVoiceToken(matchId: string): PromiseResponse { 150 | return this.request.get(`${this.regionURL.url.partyService}/core-game/v1/matches/${matchId}/teamvoicetoken`); 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/DailyTicket.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseResponse } from "@valapi/auth"; 2 | 3 | import { WebClientService } from "../client/WebClientService"; 4 | 5 | export namespace DailyTicket { 6 | export interface DailyTicket { 7 | Version: number; 8 | DailyRewards: { 9 | RemainingLifetimeSeconds: number; 10 | BonusMilestonesPending: number; 11 | Milestones: Array<{ 12 | Progress: number; 13 | BonusApplied: boolean; 14 | }>; 15 | }; 16 | ProcessedMatches: Array<{ 17 | ID: string; 18 | ProgressBefore: number; 19 | ProgressAfter: number; 20 | XP: number; 21 | SoftCurrency: number; 22 | WasPenalized: boolean; 23 | BonusesApplied: number; 24 | DailyBonusState: [boolean, boolean, boolean, boolean]; 25 | }>; 26 | } 27 | } 28 | 29 | export class DailyTicket extends WebClientService { 30 | public get(subject: string): PromiseResponse { 31 | return this.request.get(`${this.regionURL.url.playerData}/daily-ticket/v1/${subject}`); 32 | } 33 | 34 | public renew(subject: string): PromiseResponse { 35 | return this.request.post(`${this.regionURL.url.playerData}/daily-ticket/v1/${subject}/renew`); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/Favorites.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseResponse } from "@valapi/auth"; 2 | 3 | import { WebClientService } from "../client/WebClientService"; 4 | 5 | export namespace Favorites { 6 | export interface Favorite { 7 | Subject: string; 8 | FavoritedContent: Record< 9 | string, 10 | { 11 | FavoriteID: string; 12 | ItemID: string; 13 | } 14 | >; 15 | } 16 | } 17 | 18 | export class Favorites extends WebClientService { 19 | public get(subject: string): PromiseResponse { 20 | return this.request.get(`${this.regionURL.url.playerData}/favorites/v1/players/${subject}/favorites`); 21 | } 22 | 23 | public add(subject: string, itemId: string): PromiseResponse { 24 | return this.request.post(`${this.regionURL.url.playerData}/favorites/v1/players/${subject}/favorites`, { 25 | ItemID: itemId 26 | }); 27 | } 28 | 29 | public remove(subject: string, itemId: string): PromiseResponse { 30 | return this.request.delete(`${this.regionURL.url.playerData}/favorites/v1/players/${subject}/favorites/${itemId}`); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/Latency.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseResponse } from "@valapi/auth"; 2 | 3 | import { WebClientService } from "../client/WebClientService"; 4 | 5 | export class Latency extends WebClientService { 6 | public fetchStats(): PromiseResponse { 7 | return this.request.post(`${this.regionURL.url.sharedData}/latency/v1/ingestMulti`); 8 | } 9 | 10 | public fetchStat(): PromiseResponse { 11 | return this.request.post(`${this.regionURL.url.sharedData}/latency/v1/ingest`); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/MMR.ts: -------------------------------------------------------------------------------- 1 | import type { QueueId } from "@valapi/lib"; 2 | import type { PromiseResponse } from "@valapi/auth"; 3 | 4 | import { WebClientService } from "../client/WebClientService"; 5 | 6 | export namespace MMR { 7 | export interface PlayerSeasonalInfo { 8 | SeasonID: string; 9 | NumberOfWins: number; 10 | NumberOfWinsWithPlacements: number; 11 | NumberOfGames: number; 12 | Rank: number; 13 | CapstoneWins: number; 14 | LeaderboardRank: number; 15 | CompetitiveTier: number; 16 | RankedRating: number; 17 | WinsByTier: Record<`${number}`, number>; 18 | GamesNeededForRating: number; 19 | TotalWinsNeededForRank: number; 20 | } 21 | 22 | export interface QueueSkill { 23 | TotalGamesNeededForRating: number; 24 | TotalGamesNeededForLeaderboard: number; 25 | CurrentSeasonGamesNeededForRating: number; 26 | SeasonalInfoBySeasonID: Record; 27 | } 28 | 29 | export interface Player { 30 | Version: number; 31 | Subject: string; 32 | NewPlayerExperienceFinished: boolean; 33 | QueueSkills: Record; 34 | LatestCompetitiveUpdate: { 35 | MatchID: string; 36 | MapID: string; 37 | SeasonID: string; 38 | MatchStartTime: number; 39 | TierAfterUpdate: number; 40 | TierBeforeUpdate: number; 41 | RankedRatingAfterUpdate: number; 42 | RankedRatingBeforeUpdate: number; 43 | RankedRatingEarned: number; 44 | RankedRatingPerformanceBonus: number; 45 | CompetitiveMovement: string; 46 | AFKPenalty: number; 47 | }; 48 | IsLeaderboardAnonymized: boolean; 49 | IsActRankBadgeHidden: boolean; 50 | } 51 | 52 | export interface Leaderboard { 53 | Deployment: string; 54 | QueueID: string; 55 | SeasonID: string; 56 | Players: Array<{ 57 | PlayerCardID: string; 58 | TitleID: string; 59 | IsBanned: boolean; 60 | IsAnonymized: boolean; 61 | puuid: string; 62 | gameName: string; 63 | tagLine: string; 64 | leaderboardRank: number; 65 | rankedRating: number; 66 | numberOfWins: number; 67 | competitiveTier: number; 68 | }>; 69 | totalPlayers: number; 70 | immortalStartingPage: number; 71 | immortalStartingIndex: number; 72 | topTierRRThreshold: number; 73 | tierDetails: Record< 74 | `${number}`, 75 | { 76 | rankedRatingThreshold: number; 77 | startingPage: number; 78 | startingIndex: number; 79 | } 80 | >; 81 | startIndex: number; 82 | query: string; 83 | } 84 | 85 | export interface CompetitiveUpdates { 86 | Version: number; 87 | Subject: string; 88 | Matches: Array<{ 89 | MatchID: string; 90 | MapID: string; 91 | SeasonID: string; 92 | MatchStartTime: number; 93 | TierAfterUpdate: number; 94 | TierBeforeUpdate: number; 95 | RankedRatingAfterUpdate: number; 96 | RankedRatingBeforeUpdate: number; 97 | RankedRatingEarned: number; 98 | RankedRatingPerformanceBonus: number; 99 | CompetitiveMovement: string; 100 | AFKPenalty: number; 101 | }>; 102 | } 103 | } 104 | 105 | /** 106 | * Match Making Rating 107 | */ 108 | export class MMR extends WebClientService { 109 | public getPlayer(subject: string): PromiseResponse { 110 | return this.request.get(`${this.regionURL.url.playerData}/mmr/v1/players/${subject}`); 111 | } 112 | 113 | public hideActRankBadge(subject: string): PromiseResponse { 114 | return this.request.post(`${this.regionURL.url.playerData}/mmr/v1/players/${subject}/hideactrankbadge`); 115 | } 116 | 117 | /** 118 | * @param startIndex (default: 0) 119 | * @param size (default: 510) 120 | */ 121 | public getLeaderboard(seasonId: string, startIndex: number = 0, size: number = 510, serachUsername?: string): PromiseResponse { 122 | let _url = `${this.regionURL.url.playerData}/mmr/v1/leaderboards/affinity/${this.regionURL.id}/queue/competitive/season/${seasonId}?startIndex=${startIndex}&size=${size}`; 123 | 124 | if (serachUsername) { 125 | _url += `&query=${serachUsername}`; 126 | } 127 | 128 | return this.request.get(_url); 129 | } 130 | 131 | /** 132 | * @param startIndex (default: 0) 133 | * @param endIndex (default: 10) 134 | */ 135 | public getCompetitiveUpdates(subject: string, queueId?: QueueId.ID, startIndex: number = 0, endIndex: number = 10): PromiseResponse { 136 | let _url = `${this.regionURL.url.playerData}/mmr/v1/players/${subject}/competitiveupdates?startIndex=${startIndex}&endIndex=${endIndex}`; 137 | 138 | if (queueId) { 139 | _url += `&queue=${queueId}`; 140 | } 141 | 142 | return this.request.get(_url); 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/MassRewards.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseResponse } from "@valapi/auth"; 2 | 3 | import { WebClientService } from "../client/WebClientService"; 4 | 5 | export namespace MassRewards { 6 | export interface PlayerReconcile { 7 | Version: number; 8 | Subject: string; 9 | Ceremonies: Array<{ 10 | Type: string; 11 | SourceID: string; 12 | Rewards: Array<{ 13 | Type: string; 14 | ItemTypeID: string; 15 | ItemID: string; 16 | Count: number; 17 | CurrencyID: string; 18 | CurrencyCount: number; 19 | ContractID: string; 20 | XPAmount: number; 21 | }>; 22 | }>; 23 | } 24 | } 25 | 26 | export class MassRewards extends WebClientService { 27 | public reconcilePlayer(subject: string): PromiseResponse { 28 | return this.request.post(`${this.regionURL.url.playerData}/mass-rewards/v1/players/${subject}/reconcile`); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/NameService.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseResponse } from "@valapi/auth"; 2 | 3 | import { WebClientService } from "../client/WebClientService"; 4 | 5 | export namespace NameService { 6 | export type Player = Array<{ 7 | DisplayName: string; 8 | Subject: string; 9 | GameName: string; 10 | TagLine: string; 11 | }>; 12 | } 13 | 14 | export class NameService extends WebClientService { 15 | public getPlayer(subject: string): PromiseResponse { 16 | return this.request.put(`${this.regionURL.url.playerData}/name-service/v2/players`, [`${subject}`]); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/Personalization.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseResponse } from "@valapi/auth"; 2 | 3 | import { WebClientService } from "../client/WebClientService"; 4 | 5 | export namespace Personalization { 6 | export interface LoadoutGun { 7 | ID: string; 8 | SkinID: string; 9 | SkinLevelID: string; 10 | ChromaID: string; 11 | Attachments: Array; // * unknown 12 | } 13 | 14 | export interface LoadoutGunWithCharm extends Personalization.LoadoutGun { 15 | CharmInstanceID: string; 16 | CharmID: string; 17 | CharmLevelID: string; 18 | } 19 | 20 | export interface Loadout { 21 | Subject: string; 22 | Version: number; 23 | Guns: Array; 24 | Sprays: Array<{ 25 | EquipSlotID: string; 26 | SprayID: string; 27 | SprayLevelID: any; // * unknown 28 | }>; 29 | Identity: { 30 | PlayerCardID: string; 31 | PlayerTitleID: string; 32 | AccountLevel: number; 33 | PreferredLevelBorderID: string; 34 | HideAccountLevel: boolean; 35 | }; 36 | Incognito: boolean; 37 | } 38 | } 39 | 40 | export class Personalization extends WebClientService { 41 | public getPlayerLoadout(subject: string): PromiseResponse> { 42 | return this.request.get(`${this.regionURL.url.playerData}/personalization/v2/players/${subject}/playerloadout`); 43 | } 44 | 45 | public changePlayerLoadout(subject: string, loadout: Omit): PromiseResponse { 46 | return this.request.put(`${this.regionURL.url.playerData}/personalization/v2/players/${subject}/playerloadout`, loadout); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/PreGame.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseResponse } from "@valapi/auth"; 2 | 3 | import { WebClientService } from "../client/WebClientService"; 4 | 5 | export namespace PreGame { 6 | export interface Player { 7 | Subject: string; 8 | MatchID: string; 9 | Version: number; 10 | } 11 | 12 | export interface PlayerInfo { 13 | Subject: string; 14 | CharacterID: string; 15 | CharacterSelectionState: string; 16 | PregamePlayerState: string; 17 | CompetitiveTier: number; 18 | PlayerIdentity: { 19 | Subject: string; 20 | PlayerCardID: string; 21 | PlayerTitleID: string; 22 | AccountLevel: number; 23 | PreferredLevelBorderID: string; 24 | Incognito: boolean; 25 | HideAccountLevel: boolean; 26 | }; 27 | SeasonalBadgeInfo: { 28 | SeasonID: string; 29 | NumberOfWins: number; 30 | WinsByTier: any; // * unknown 31 | Rank: number; 32 | LeaderboardRank: number; 33 | }; 34 | IsCaptain: boolean; 35 | } 36 | 37 | export interface Team { 38 | TeamID: string; 39 | Players: Array; 40 | } 41 | 42 | export interface Match { 43 | ID: string; 44 | Version: number; 45 | Teams: Array; 46 | AllyTeam: PreGame.Team; 47 | EnemyTeam: any; // * unknown 48 | ObserverSubjects: Array; // * unknown 49 | MatchCoaches: Array; // * unknown 50 | EnemyTeamSize: number; 51 | EnemyTeamLockCount: number; 52 | PregameState: string; 53 | LastUpdated: Date; 54 | MapID: string; 55 | MapSelectPool: Array; // * unknown 56 | BannedMapIDs: Array; // * unknown 57 | CastedVotes: any; // * unknown 58 | MapSelectSteps: Array; // * unknown 59 | MapSelectStep: number; 60 | Team1: string; 61 | GamePodID: string; 62 | Mode: string; 63 | VoiceSessionID: string; 64 | MUCName: string; 65 | TeamMatchToken: string; 66 | QueueID: string; 67 | ProvisioningFlowID: string; 68 | IsRanked: boolean; 69 | PhaseTimeRemainingNS: number; 70 | StepTimeRemainingNS: number; 71 | altModesFlagADA: boolean; 72 | TournamentMetadata: any; // * unknown 73 | RosterMetadata: any; // * unknown 74 | } 75 | 76 | export interface Loadout { 77 | Loadouts: [ 78 | { 79 | Subject: string; 80 | Sprays: { 81 | SpraySelections: Array<{ 82 | SocketID: string; 83 | SprayID: string; 84 | LevelID: string; 85 | }>; 86 | }; 87 | Expressions: { 88 | AESSelections: Array<{ 89 | SocketID: string; 90 | AssetID: string; 91 | TypeID: string; 92 | }>; 93 | }; 94 | Items: Record< 95 | string, 96 | { 97 | ID: string; 98 | TypeID: string; 99 | Sockets: Record< 100 | string, 101 | { 102 | ID: string; 103 | Item: { 104 | ID: string; 105 | TypeID: string; 106 | }; 107 | } 108 | >; 109 | } 110 | >; 111 | } 112 | ]; 113 | LoadoutsValid: boolean; 114 | } 115 | } 116 | 117 | export class PreGame extends WebClientService { 118 | public getPlayer(subject: string): PromiseResponse { 119 | return this.request.get(`${this.regionURL.url.partyService}/pregame/v1/players/${subject}`); 120 | } 121 | 122 | public getMatch(matchId: string): PromiseResponse { 123 | return this.request.get(`${this.regionURL.url.partyService}/pregame/v1/matches/${matchId}`); 124 | } 125 | 126 | public getMatchLoadouts(matchId: string): PromiseResponse { 127 | return this.request.get(`${this.regionURL.url.partyService}/pregame/v1/matches/${matchId}/loadouts`); 128 | } 129 | 130 | /** 131 | * ! Careful to use, Riot will immediately shut down your Project. 132 | */ 133 | public selectCharacter(matchId: string, agentId: string): PromiseResponse { 134 | return this.request.post(`${this.regionURL.url.partyService}/pregame/v1/matches/${matchId}/select/${agentId}`); 135 | } 136 | 137 | /** 138 | * ! Careful to use, Riot will immediately shut down your Project. 139 | */ 140 | public lockCharacter(matchId: string, agentId: string): PromiseResponse { 141 | return this.request.post(`${this.regionURL.url.partyService}/pregame/v1/matches/${matchId}/lock/${agentId}`); 142 | } 143 | 144 | /** 145 | * @deprecated Please, Contact us if you find out how its works 146 | */ 147 | public fetchVoiceToken(matchId: string): PromiseResponse { 148 | return this.request.get(`${this.regionURL.url.partyService}/pregame/v1/matches/${matchId}/voicetoken`); 149 | } 150 | 151 | /** 152 | * @deprecated Please, Contact us if you find out how its works 153 | */ 154 | public fetchChatToken(matchId: string): PromiseResponse { 155 | return this.request.get(`${this.regionURL.url.partyService}/pregame/v1/matches/${matchId}/chattoken`); 156 | } 157 | 158 | /** 159 | * ! Careful to use, Riot will immediately shut down your Project. 160 | */ 161 | public quitMatch(matchId: string): PromiseResponse { 162 | return this.request.post(`${this.regionURL.url.partyService}/pregame/v1/matches/${matchId}/quit`); 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/Premier.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseResponse } from "@valapi/auth"; 2 | 3 | import { WebClientService } from "../client/WebClientService"; 4 | 5 | export namespace Premier { 6 | export interface Seasons { 7 | PremierSeasons: Array; // * unknown 8 | } 9 | 10 | export interface Conferences { 11 | PremierConferences: Array; // * unknown 12 | } 13 | 14 | export interface Player { 15 | puuid: string; 16 | rosterId: string; 17 | invites: Array; // * unknown 18 | version: number; 19 | createdAt: number; 20 | updatedAt: number; 21 | } 22 | 23 | export interface RosterCustomization { 24 | /** 25 | * Icon ID 26 | */ 27 | icon: string; 28 | /** 29 | * 0.000000 <= number <= 1.000000 30 | */ 31 | primaryColor: `(R=${number},G=${number},B=${number},A=${number})`; 32 | /** 33 | * 0.000000 <= number <= 1.000000 34 | */ 35 | secondaryColor: `(R=${number},G=${number},B=${number},A=${number})`; 36 | /** 37 | * 0.000000 <= number <= 1.000000 38 | */ 39 | tertiaryColor: `(R=${number},G=${number},B=${number},A=${number})`; 40 | } 41 | } 42 | 43 | export class Premier extends WebClientService { 44 | /** 45 | * @deprecated Please, Contact us if you find out how its works 46 | */ 47 | public getEligibility(): PromiseResponse { 48 | return this.request.get(`${this.regionURL.url.playerData}/premier/v1/player/eligibility`); 49 | } 50 | 51 | public getPremierConferences(): PromiseResponse { 52 | return this.request.get(`${this.regionURL.url.playerData}/premier/v1/affinities/${this.regionURL.id}/conferences`); 53 | } 54 | 55 | public fetchPremierSeasons(): PromiseResponse { 56 | return this.request.get(`${this.regionURL.url.playerData}/premier/v1/affinities/${this.regionURL.id}/premier-seasons`); 57 | } 58 | 59 | /** 60 | * @deprecated Please, Contact us if you find out how its works 61 | */ 62 | public getActivePremierSeason(): PromiseResponse { 63 | return this.request.get(`${this.regionURL.url.playerData}/premier/v1/affinities/${this.regionURL.id}/premier-seasons/active`); 64 | } 65 | 66 | /** 67 | * @deprecated Please, Contact us if you find out how its works 68 | */ 69 | public getMUCToken(realm: string, rosterId: string): PromiseResponse { 70 | return this.request.get(`${this.regionURL.url.playerData}/premier/v1/rsp/rosters/v1/${realm}/roster/${rosterId}/muctoken`); 71 | } 72 | 73 | public getPlayer(subject: string): PromiseResponse { 74 | return this.request.get(`${this.regionURL.url.playerData}/premier/v2/players/${subject}`); 75 | } 76 | 77 | /** 78 | * @deprecated Please, Contact us if you find out how its works 79 | */ 80 | public GetRosterV1(rosterId: string): PromiseResponse { 81 | return this.request.get(`${this.regionURL.url.playerData}/premier/v1/rosters/${rosterId}`); 82 | } 83 | 84 | /** 85 | * @deprecated Please, Contact us if you find out how its works 86 | */ 87 | public GetRosterV2(rosterId: string): PromiseResponse { 88 | return this.request.get(`${this.regionURL.url.playerData}/premier/v2/rosters/${rosterId}`); 89 | } 90 | 91 | /** 92 | * @deprecated Please, Contact us if you find out how its works 93 | */ 94 | public getRosterByProxy(realm: string, rosterId: string): PromiseResponse { 95 | return this.request.get(`${this.regionURL.url.playerData}/premier/v1/rsp/rosters/v1/${realm}/roster/${rosterId}`); 96 | } 97 | 98 | /** 99 | * @deprecated Please, Contact us if you find out how its works 100 | */ 101 | public setPremierRosterCustomization(rosterId: string, rosterCustomization: Premier.RosterCustomization): PromiseResponse { 102 | return this.request.put(`${this.regionURL.url.playerData}/premier/v1/rosters/${rosterId}/customization`, rosterCustomization); 103 | } 104 | 105 | /** 106 | * @deprecated Please, Contact us if you find out how its works 107 | */ 108 | public deleteRosterByProxy(realm: string, rosterId: string): PromiseResponse { 109 | return this.request.delete(`${this.regionURL.url.playerData}/premier/v1/rsp/rosters/v1/${realm}/roster/${rosterId}`); 110 | } 111 | 112 | /** 113 | * @deprecated Please, Contact us if you find out how its works 114 | */ 115 | public rosterEnroll(rosterId: string, conferenceId: string): PromiseResponse { 116 | return this.request.put(`${this.regionURL.url.playerData}/premier/v1/rosters/${rosterId}/enroll`, { 117 | id: conferenceId 118 | }); 119 | } 120 | 121 | /** 122 | * @deprecated Please, Contact us if you find out how its works 123 | */ 124 | public createInvite(rosterId: string, subject: string): PromiseResponse { 125 | return this.request.post(`${this.regionURL.url.playerData}/premier/v2/rosters/${rosterId}/invites/${subject}`); 126 | } 127 | 128 | /** 129 | * @deprecated Please, Contact us if you find out how its works 130 | */ 131 | public getPremierRosterMatchHistory(rosterId: string): PromiseResponse { 132 | return this.request.get(`${this.regionURL.url.playerData}/premier/v1/rosters/${rosterId}/matchhistory`); 133 | } 134 | 135 | /** 136 | * @deprecated Please, Contact us if you find out how its works 137 | */ 138 | public acceptInvite(rosterId: string, subject: string): PromiseResponse { 139 | return this.request.post(`${this.regionURL.url.playerData}/premier/v2/rosters/${rosterId}/invites/${subject}/accept`); 140 | } 141 | 142 | /** 143 | * @deprecated Please, Contact us if you find out how its works 144 | */ 145 | public makePremierGame(partyId: string): PromiseResponse { 146 | return this.request.post(`${this.regionURL.url.partyService}/parties/v1/parties/${partyId}/makePremierGame`, {}); 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/Restrictions.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseResponse } from "@valapi/auth"; 2 | 3 | import { WebClientService } from "../client/WebClientService"; 4 | 5 | export namespace Restrictions { 6 | export interface Player { 7 | Subject: string; 8 | Penalties: Array<{ 9 | ID: string; 10 | IssuingGameStartUnixMillis: number; 11 | Expiry: Date; 12 | GamesRemaining: number; 13 | ApplyToAllPlatforms: boolean; 14 | ApplyToPlatforms: Array; 15 | ForgivenessIneligible: boolean; 16 | DelayedPenaltyEffect: any; // * unknown 17 | GameBanEffect: any; // * unknown 18 | QueueDelayEffect: { 19 | DurationSeconds: number; 20 | StartTime: Date; 21 | }; 22 | QueueRestrictionEffect: any; // * unknown 23 | RankedRatingPenaltyEffect: any; // * unknown 24 | RiotRestrictionEffect: any; // * unknown 25 | RMSNotifyEffect: any; // * unknown 26 | WarningEffect: { 27 | WarningType: string; 28 | WarningTier: number; 29 | }; 30 | XPMultiplierEffect: any; // * unknown 31 | }>; 32 | Version: number; 33 | } 34 | 35 | export interface ReportToken { 36 | Token: string; 37 | } 38 | } 39 | 40 | export class Restrictions extends WebClientService { 41 | public fetchPlayerReportToken(matchId: string, offenderSubject: string): PromiseResponse { 42 | return this.request.get(`${this.regionURL.url.playerData}/restrictions/v1/playerReportToken/${matchId}/${offenderSubject}`); 43 | } 44 | 45 | public fetchPlayerRestrictions(): PromiseResponse { 46 | return this.request.get(`${this.regionURL.url.playerData}/restrictions/v3/penalties`); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/Session.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseResponse, ClientPlatfrom } from "@valapi/auth"; 2 | 3 | import { WebClientService } from "../client/WebClientService"; 4 | 5 | export namespace Session { 6 | export interface Session { 7 | subject: string; 8 | cxnState: string; 9 | clientID: string; 10 | clientVersion: string; 11 | loopState: string; 12 | loopStateMetadata: string; 13 | version: number; 14 | lastHeartbeatTime: Date; 15 | expiredTime: Date; 16 | heartbeatIntervalMillis: number; 17 | playtimeNotification: string; 18 | playtimeMinutes: number; 19 | isRestricted: boolean; 20 | userinfoValidTime: Date; 21 | restrictionType: string; 22 | clientPlatformInfo: ClientPlatfrom; 23 | connectionTime: Date; 24 | shouldForceInvalidate: boolean; 25 | } 26 | 27 | export interface Reconnect { 28 | reconnect: boolean; 29 | } 30 | } 31 | 32 | export class Session extends WebClientService { 33 | /** 34 | * @deprecated Please, Contact us if you find out how its works 35 | */ 36 | public connect(subject: string): PromiseResponse { 37 | return this.request.post(`${this.regionURL.url.partyService}/session/v2/sessions/${subject}/connect`); 38 | } 39 | 40 | /** 41 | * @deprecated Please, Contact us if you find out how its works 42 | */ 43 | public heartbeat(subject: string): PromiseResponse { 44 | return this.request.post(`${this.regionURL.url.partyService}/session/v1/sessions/${subject}/heartbeat`); 45 | } 46 | 47 | /** 48 | * @deprecated Please, Contact us if you find out how its works 49 | */ 50 | public disconnect(subject: string): PromiseResponse { 51 | return this.request.post(`${this.regionURL.url.partyService}/session/v1/sessions/${subject}/disconnect`); 52 | } 53 | 54 | public get(subject: string): PromiseResponse { 55 | return this.request.get(`${this.regionURL.url.partyService}/session/v1/sessions/${subject}`); 56 | } 57 | 58 | /** 59 | * ! Careful to use, Riot will immediately shut down your Project. 60 | */ 61 | public reconnect(subject: string): PromiseResponse { 62 | return this.request.get(`${this.regionURL.url.partyService}/session/v1/sessions/${subject}/reconnect`); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/src/service/Store.ts: -------------------------------------------------------------------------------- 1 | import type { ItemTypeId } from "@valapi/lib"; 2 | import type { PromiseResponse } from "@valapi/auth"; 3 | 4 | import { WebClientService } from "../client/WebClientService"; 5 | 6 | export namespace Store { 7 | export type Currency = Record; 8 | 9 | export interface Wallet { 10 | Balances: Store.Currency; 11 | CurrencyLimits: Record< 12 | string, 13 | { 14 | Limits: Record< 15 | string, 16 | { 17 | amount: number; 18 | limitType: string; 19 | } 20 | >; 21 | } 22 | >; 23 | } 24 | 25 | export interface Offer { 26 | OfferID: string; 27 | IsDirectPurchase: boolean; 28 | StartDate: Date; 29 | Cost: Store.Currency; 30 | Rewards: Array<{ 31 | ItemTypeID: string; 32 | ItemID: string; 33 | Quantity: number; 34 | }>; 35 | } 36 | 37 | export type UpgradeCurrencyOffers = Array<{ 38 | OfferID: string; 39 | StorefrontItemID: string; 40 | Offer: Store.Offer; 41 | DiscountedPercent: number; 42 | }>; 43 | 44 | export interface Bundle { 45 | ID: string; 46 | DataAssetID: string; 47 | CurrencyID: string; 48 | Items: Array<{ 49 | Item: { 50 | ItemTypeID: string; 51 | ItemID: string; 52 | Amount: number; 53 | }; 54 | BasePrice: number; 55 | CurrencyID: string; 56 | DiscountPercent: number; 57 | DiscountedPrice: number; 58 | IsPromoItem: boolean; 59 | }>; 60 | ItemOffers: Array<{ 61 | BundleItemOfferID: string; 62 | Offer: Store.Offer; 63 | DiscountPercent: number; 64 | DiscountedCost: Store.Currency; 65 | }>; 66 | TotalBaseCost: Store.Currency; 67 | TotalDiscountedCost: Store.Currency; 68 | TotalDiscountPercent: number; 69 | DurationRemainingInSeconds: number; 70 | WholesaleOnly: boolean; 71 | } 72 | 73 | export interface Storefront { 74 | FeaturedBundle: { 75 | Bundle: Store.Bundle; 76 | Bundles: Array; 77 | BundleRemainingDurationInSeconds: number; 78 | }; 79 | SkinsPanelLayout: { 80 | SingleItemOffers: Array; 81 | SingleItemStoreOffers: Array; 82 | SingleItemOffersRemainingDurationInSeconds: number; 83 | }; 84 | UpgradeCurrencyStore: { 85 | UpgradeCurrencyOffers: Store.UpgradeCurrencyOffers; 86 | }; 87 | BonusStore?: { 88 | BonusStoreOffers: Array<{ 89 | BonusOfferID: string; 90 | Offer: Store.Offer; 91 | DiscountPercent: number; 92 | DiscountCosts: Store.Currency; 93 | IsSeen: boolean; 94 | }>; 95 | BonusStoreRemainingDurationInSeconds: number; 96 | }; 97 | AccessoryStore: { 98 | AccessoryStoreOffers: Array<{ 99 | Offer: Store.Offer; 100 | ContractID: string; 101 | }>; 102 | AccessoryStoreRemainingDurationInSeconds: number; 103 | StorefrontID: string; 104 | }; 105 | } 106 | 107 | export interface Offers { 108 | Offers: Array; 109 | UpgradeCurrencyOffers: Store.UpgradeCurrencyOffers; 110 | } 111 | 112 | export interface Entitlements { 113 | ItemTypeID: string; 114 | Entitlements: Array<{ 115 | TypeID: string; 116 | ItemID: string; 117 | }>; 118 | } 119 | 120 | export interface EntitlementsWithInstance extends Omit { 121 | Entitlements: Array<{ 122 | TypeID: string; 123 | ItemID: string; 124 | InstanceID: string; 125 | }>; 126 | } 127 | 128 | export interface Agent { 129 | AgentStore: { 130 | AgentStoreOffers: Array<{ 131 | AgentID: string; 132 | StoreOffers: Array; 133 | }>; 134 | FeaturedAgent: string; 135 | }; 136 | } 137 | } 138 | 139 | export class Store extends WebClientService { 140 | public getWallet(subject: string): PromiseResponse { 141 | return this.request.get(`${this.regionURL.url.playerData}/store/v1/wallet/${subject}`); 142 | } 143 | 144 | public getOffers(): PromiseResponse { 145 | return this.request.get(`${this.regionURL.url.playerData}/store/v1/offers/`); 146 | } 147 | 148 | public getEntitlements(subject: string, itemTypeId: "dd3bf334-87f3-40bd-b043-682a57a8dc3a"): PromiseResponse; 149 | public getEntitlements(subject: string, itemTypeId: ItemTypeId.ID): PromiseResponse; 150 | public getEntitlements(subject: string, itemTypeId: string): PromiseResponse { 151 | return this.request.get(`${this.regionURL.url.playerData}/store/v1/entitlements/${subject}/${itemTypeId}`); 152 | } 153 | 154 | public get StoreFront(): StoreFront { 155 | return new StoreFront(this.request, this.regionURL); 156 | } 157 | } 158 | 159 | export class StoreFront extends WebClientService { 160 | public get(subject: string): PromiseResponse { 161 | return this.request.get(`${this.regionURL.url.playerData}/store/v2/storefront/${subject}`); 162 | } 163 | 164 | public getAgent(): PromiseResponse { 165 | return this.request.get(`${this.regionURL.url.playerData}/store/v1/storefronts/agent`); 166 | } 167 | 168 | /** 169 | * @deprecated Please, Contact us if you find out how its works 170 | */ 171 | public revealNightMarketOffers(subject: string): PromiseResponse { 172 | return this.request.post(`${this.regionURL.url.playerData}/store/v2/storefront/${subject}/nightmarket/offers`); 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "./src", 5 | "outDir": "./build", 6 | "paths": { 7 | "@valapi/auth": ["../auth/src"], 8 | "@valapi/lib": ["../lib/src"] 9 | } 10 | }, 11 | "references": [ 12 | { 13 | "path": "../auth" 14 | }, 15 | { 16 | "path": "../lib" 17 | } 18 | ], 19 | "exclude": ["node_modules", "build", "src/__tests__"] 20 | } 21 | -------------------------------------------------------------------------------- /packages/@valapi/web-client/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "web-client", 3 | "extends": ["../../../typedoc.base.json"], 4 | "entryPoints": ["src/index.ts"] 5 | } 6 | -------------------------------------------------------------------------------- /tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "target": "es2016", 5 | "module": "commonjs", 6 | "moduleResolution": "node", 7 | "resolveJsonModule": true, 8 | "allowJs": true, 9 | "checkJs": true, 10 | "declaration": true, 11 | "importHelpers": true, 12 | "isolatedModules": true, 13 | "esModuleInterop": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "strict": true, 16 | "noUnusedLocals": true, 17 | "noUnusedParameters": true, 18 | "noImplicitReturns": true, 19 | "skipLibCheck": true 20 | }, 21 | "exclude": ["node_modules", "build", "__tests__"] 22 | } 23 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "references": [ 3 | { 4 | "path": "./packages/@valapi/auth" 5 | }, 6 | { 7 | "path": "./packages/@valapi/crosshair" 8 | }, 9 | { 10 | "path": "./packages/@valapi/lib" 11 | }, 12 | { 13 | "path": "./packages/@valapi/riot-api" 14 | }, 15 | { 16 | "path": "./packages/@valapi/valorant-api.com" 17 | }, 18 | { 19 | "path": "./packages/@valapi/web-client" 20 | } 21 | ], 22 | "files": [] 23 | } -------------------------------------------------------------------------------- /tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "target": "es2022", 5 | "lib": [ "es2022", "es2022.error", "es2021.promise" ], 6 | "module": "commonjs", 7 | "moduleResolution": "node", 8 | "resolveJsonModule": true, 9 | "allowJs": true, 10 | "declaration": true, 11 | "importHelpers": true, 12 | "strict": true, 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /typedoc.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://typedoc.org/schema.json", 3 | "readme": "none", 4 | "includeVersion": true 5 | } -------------------------------------------------------------------------------- /typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "npmjs/@valapi", 3 | "entryPoints": ["packages/@valapi/*"], 4 | "entryPointStrategy": "packages", 5 | "cleanOutputDir": true, 6 | "out": "./docs", 7 | "jsDocCompatibility": true, 8 | "includeVersion": false 9 | } --------------------------------------------------------------------------------