Skip to content

Commit

Permalink
1.3.0: add support new endpoits and data => 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
kravetsone committed Feb 10, 2023
1 parent 8ed7918 commit 7e05f7f
Show file tree
Hide file tree
Showing 25 changed files with 56,850 additions and 55,805 deletions.
94 changes: 78 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

## 📦 Download

- **usage `npm`**
```shell
npm i enkanetwork
```
- **usage `Yarn`**
```shell
yarn add enkanetwork
```
- **usage `npm`**
```shell
npm i enkanetwork
```
- **usage `Yarn`**
```shell
yarn add enkanetwork
```

# 🛠️ Usage

Expand All @@ -44,7 +44,7 @@ const enka = new EnkaNetwork({ language: "EN", caching: true });
| caching | - | boolean | Cache responses? Default is `true` | - |
| userAgent | - | string or boolean | Disable or change the header `User-Agent`. (`false` for disable) | - |

## Fetch user by uid from the game (response is [FetchUserUID](#fetchuseruid))
## Fetch user with characters by uid from the game (response is [FetchUserUID](#fetchuseruid))

```js
const user = await enka.fetchUser(700832641, "RU");
Expand All @@ -55,17 +55,42 @@ const user = await enka.fetchUser(700832641, "RU");
| UID | - | number | `UID` from the game | + |
| language | - | number | The language to be used in the localization of names (characters, artifacts, etc.). Default is [EnkaNetwork.language](#🛠️-usage) | - |

## Fetch playerInfo by uid from the game (response is [FetchPlayerInfo](#fetchplayerinfo))

```js
const user = await enka.fetchPlayerInfo(700832641, "RU");
```

| Key | In API | Type | Description | Required? |
| -------- | ------ | ------ | -------------------------------------------------------------------------------------------------------------------------------- | --------- |
| UID | - | number | `UID` from the game | + |
| language | - | number | The language to be used in the localization of names (characters, artifacts, etc.). Default is [EnkaNetwork.language](#🛠️-usage) | - |

## Or fetch user by enka profile tag (response is [FetchUserProfile](#fetchuserprofile))

```js
const user = await enka.fetchProfile("kaito", "RU");
const user = await enka.fetchProfile("Algoinde", "RU");
```

| Key | In API | Type | Description | Required? |
| ----------- | ------ | ------ | -------------------------------------------------------------------------------------------------------------------------------- | --------- |
| Profile tag | - | number | Enka patreon `profile tag` from the [site EnkaNetwork](https://enka.network/) | + |
| Profile tag | - | string | Enka patreon `profile tag` from the [site EnkaNetwork](https://enka.network/) | + |
| language | - | number | The language to be used in the localization of names (characters, artifacts, etc.). Default is [EnkaNetwork.language](#🛠️-usage) | - |

## Or fetch user by enka profile tag (response is [FetchUserProfile](#fetchuserprofile) or array of [FetchUserProfile](#fetchuserprofile))

```js
const accounts = await enka.fetchProfileAccounts("Algoinde", "RU");
//or
const account = await enka.fetchProfileAccount("Algoinde", "4Wjv2e", "RU");
```

| Key | In API | Type | Description | Required? |
| ---------------- | ------ | ------ | -------------------------------------------------------------------------------------------------------------------------------- | --------- |
| Profile username | - | string | Enka `profile username` from the [site EnkaNetwork](https://enka.network/) | + |
| Account hash | - | string | Enka `account hash` from an account on the [site EnkaNetwork](https://enka.network/) (only for `fetchProfileAccount`) | +- |
| language | - | number | The language to be used in the localization of names (characters, artifacts, etc.). Default is [EnkaNetwork.language](#🛠️-usage) | - |

# ⚙ Response structure

## FetchUserUID
Expand All @@ -76,13 +101,35 @@ const user = await enka.fetchProfile("kaito", "RU");
| characters | avatarInfoList | array | See [Characters](#characters) |
| ttl | ttl | number | Cache lifetime in milliseconds |

## FetchPlayerInfo

| Key | In API | Type | Description |
| ------ | ---------- | ------ | ------------------------------ |
| player | playerInfo | object | See [Player](#player) |
| owner | owner | object | See [Owner](#owner) |
| ttl | ttl | number | Cache lifetime in milliseconds |

## FetchUserProfile

| Key | In API | Type | Description |
| ----------- | ------- | ------- | ---------------------------- |
| profile | profile | boolean | User fetched by profile tag? |
| accounts | hoyos | array | See [Accounts](#accounts) |
| enkaProfile | user | object | See [EnkaProfile](#accounts) |
| Key | In API | Type | Description |
| ----------- | -------------------- | ------ | ---------------------------- |
| username | username | string | Profile username |
| bio | profile.bio | string | Profile bio |
| level | profile.level | number | Profile patreon level |
| signupState | profile.signup_state | number | Profile username is verifed? |
| imageUrl | profile.image_url | string | Profile url of image |

## FetchProfileAccount

| Key | In API | Type | Description |
| --------- | ----------- | ------- | --------------------- |
| uidPublic | uid_public | boolean | Uid is public? |
| public | public | boolean | Profile is public? |
| verified | verified | boolean | Profile is verifed? |
| player | player_info | object | See [Player](#player) |
| hash | hash | string | Account |
| region | region | string | Profile url of image |
| order | order | number | Profile url of image |

## FetchAccounts[]

Expand Down Expand Up @@ -110,6 +157,21 @@ const user = await enka.fetchProfile("kaito", "RU");
| signupState | profile.signup_state | integer | Enka profile sign up state |
| imageUrl | profile.image_url | string | Url of enka profile picture |

## Owner

| Key | In API | Type | Description |
| -------- | -------- | ------ | ----------------------- |
| hash | hash | string | Enka profile hash |
| username | username | string | Enka profile username |
| profile | profile | object | See [Profile](#profile) |

## Profile

| Key | In API | Type | Description |
| ----------- | -------------------- | ------- | --------------------------- |
| signupState | profile.signup_state | integer | Enka profile sign up state |
| imageUrl | profile.image_url | string | Url of enka profile picture |

## Player

| Key | In API | Type | Description |
Expand Down
42 changes: 40 additions & 2 deletions assets/data/characters.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"skills": [
10024,
10018,
10013,
10019
],
"talents": [
Expand Down Expand Up @@ -775,7 +774,6 @@
"skills": [
10411,
10412,
10413,
10415
],
"talents": [
Expand Down Expand Up @@ -1466,5 +1464,45 @@
765,
766
]
},
"10000077": {
"nameTextMapHash": 1732418482,
"iconName": "UI_AvatarIcon_Yaoyao",
"sideIconName": "UI_AvatarIcon_Side_Yaoyao",
"qualityType": "QUALITY_PURPLE",
"costElemType": "Grass",
"skills": [
10771,
10772,
10775
],
"talents": [
771,
772,
773,
774,
775,
776
]
},
"10000078": {
"nameTextMapHash": 4002157418,
"iconName": "UI_AvatarIcon_Alhatham",
"sideIconName": "UI_AvatarIcon_Side_Alhatham",
"qualityType": "QUALITY_ORANGE",
"costElemType": "Grass",
"skills": [
10781,
10782,
10785
],
"talents": [
781,
782,
783,
784,
785,
786
]
}
}
48 changes: 48 additions & 0 deletions assets/data/conselations.json → assets/data/constellations.json
Original file line number Diff line number Diff line change
Expand Up @@ -1534,5 +1534,53 @@
"766": {
"nameTextMapHash": 1813996249,
"icon": "UI_Talent_S_Faruzan_04"
},
"771": {
"nameTextMapHash": 2088049169,
"icon": "UI_Talent_S_Yaoyao_01"
},
"772": {
"nameTextMapHash": 1185801489,
"icon": "UI_Talent_S_Yaoyao_02"
},
"773": {
"nameTextMapHash": 1513031537,
"icon": "UI_Talent_U_Yaoyao_01"
},
"774": {
"nameTextMapHash": 2674638561,
"icon": "UI_Talent_S_Yaoyao_03"
},
"775": {
"nameTextMapHash": 738869801,
"icon": "UI_Talent_U_Yaoyao_02"
},
"776": {
"nameTextMapHash": 4046679753,
"icon": "UI_Talent_S_Yaoyao_04"
},
"781": {
"nameTextMapHash": 1459644873,
"icon": "UI_Talent_S_Alhatham_02"
},
"782": {
"nameTextMapHash": 3637950009,
"icon": "UI_Talent_S_Alhatham_01"
},
"783": {
"nameTextMapHash": 2621846313,
"icon": "UI_Talent_U_Alhatham_01"
},
"784": {
"nameTextMapHash": 1055939881,
"icon": "UI_Talent_S_Alhatham_03"
},
"785": {
"nameTextMapHash": 3387153385,
"icon": "UI_Talent_U_Alhatham_02"
},
"786": {
"nameTextMapHash": 540494281,
"icon": "UI_Talent_S_Alhatham_04"
}
}
62 changes: 62 additions & 0 deletions assets/data/costumes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"200301": {
"iconName": "UI_AvatarIcon_QinCostumeSea",
"sideIconName": "UI_AvatarIcon_Side_QinCostumeSea",
"nameTextMapHash": 1504245738
},
"201401": {
"iconName": "UI_AvatarIcon_BarbaraCostumeSummertime",
"sideIconName": "UI_AvatarIcon_Side_BarbaraCostumeSummertime",
"nameTextMapHash": 4121525482
},
"202701": {
"iconName": "UI_AvatarIcon_NingguangCostumeFloral",
"sideIconName": "UI_AvatarIcon_Side_NingguangCostumeFloral",
"nameTextMapHash": 2572106930
},
"204201": {
"iconName": "UI_AvatarIcon_KeqingCostumeFeather",
"sideIconName": "UI_AvatarIcon_Side_KeqingCostumeFeather",
"nameTextMapHash": 1613857666
},
"200302": {
"iconName": "UI_AvatarIcon_QinCostumeWic",
"sideIconName": "UI_AvatarIcon_Side_QinCostumeWic",
"nameTextMapHash": 2691230306
},
"202101": {
"iconName": "UI_AvatarIcon_AmborCostumeWic",
"sideIconName": "UI_AvatarIcon_Side_AmborCostumeWic",
"nameTextMapHash": 4237698530
},
"204101": {
"iconName": "UI_AvatarIcon_MonaCostumeWic",
"sideIconName": "UI_AvatarIcon_Side_MonaCostumeWic",
"nameTextMapHash": 1860400666
},
"204501": {
"iconName": "UI_AvatarIcon_RosariaCostumeWic",
"sideIconName": "UI_AvatarIcon_Side_RosariaCostumeWic",
"nameTextMapHash": 2412226586
},
"201601": {
"iconName": "UI_AvatarIcon_DilucCostumeFlamme",
"sideIconName": "UI_AvatarIcon_Side_DilucCostumeFlamme",
"nameTextMapHash": 1332852170
},
"203101": {
"iconName": "UI_AvatarIcon_FischlCostumeHighness",
"sideIconName": "UI_AvatarIcon_Side_FischlCostumeHighness",
"nameTextMapHash": 3162794298
},
"200201": {
"iconName": "UI_AvatarIcon_AyakaCostumeFruhling",
"sideIconName": "UI_AvatarIcon_Side_AyakaCostumeFruhling",
"nameTextMapHash": 2768521498
},
"200601": {
"iconName": "UI_AvatarIcon_LisaCostumeStudentin",
"sideIconName": "UI_AvatarIcon_Side_LisaCostumeStudentin",
"nameTextMapHash": 2255412906
}
}
50 changes: 50 additions & 0 deletions assets/data/namecards.json
Original file line number Diff line number Diff line change
Expand Up @@ -1418,5 +1418,55 @@
],
"rankLevel": 4,
"materialType": "MATERIAL_NAMECARD"
},
"210147": {
"nameTextMapHash": 2958088124,
"icon": "UI_NameCardIcon_Alhatham",
"picPath": [
"UI_NameCardPic_Alhatham_Alpha",
"UI_NameCardPic_Alhatham_P"
],
"rankLevel": 4,
"materialType": "MATERIAL_NAMECARD"
},
"210148": {
"nameTextMapHash": 2049099756,
"icon": "UI_NameCardIcon_Yaoyao",
"picPath": [
"UI_NameCardPic_Yaoyao_Alpha",
"UI_NameCardPic_Yaoyao_P"
],
"rankLevel": 4,
"materialType": "MATERIAL_NAMECARD"
},
"210149": {
"nameTextMapHash": 3236464132,
"icon": "UI_NameCardIcon_Cadillac",
"picPath": [
"UI_NameCardPic_Cadillac_Alpha",
"UI_NameCardPic_Cadillac_P"
],
"rankLevel": 4,
"materialType": "MATERIAL_NAMECARD"
},
"210150": {
"nameTextMapHash": 2673900508,
"icon": "UI_NameCardIcon_Bp21",
"picPath": [
"UI_NameCardPic_Bp21_P_Alpha",
"UI_NameCardPic_Bp21_P"
],
"rankLevel": 4,
"materialType": "MATERIAL_NAMECARD"
},
"210151": {
"nameTextMapHash": 3778817588,
"icon": "UI_NameCardIcon_Xm3",
"picPath": [
"UI_NameCardPic_Xm3_Alpha",
"UI_NameCardPic_Xm3_P"
],
"rankLevel": 4,
"materialType": "MATERIAL_NAMECARD"
}
}
Loading

0 comments on commit 7e05f7f

Please sign in to comment.