# User Frequent Heroes

> `GET /api/user/heroes/frequent`: User endpoint of the Rone Arena API.

**Deprecated:** still answers, but will not receive further work. Prefer another endpoint.

**Sign-in required:** send `Authorization: Bearer <jwt>`. Get the JWT from `POST /api/user/auth/send-vc` then `POST /api/user/auth/login`.

Retrieve the authenticated player's frequent heroes information using a valid JWT. Supports query parameters for season filtering, pagination, and localization. Requires an Authorization header with the JWT from login.

Headers:
- **Authorization**: `Bearer <jwt>` (JWT obtained during login).

Query parameters:
- **sid**: Season ID for filtering frequent heroes (must be a valid season ID from `/api/user/season`).
- **limit**: Maximum number of heroes to retrieve (minimum: 1).
- **last_cursor**: Cursor for pagination. Use the value from `pageInfo.nextCursor` in the current response. If `pageInfo.hasNext` is `false` or `pageInfo.nextCursor` is empty, there is no next page.
- **lang**: Language code for localized content (default: `en`).

The response includes frequent hero usage details:
- **hid**: Hero ID.
- **tc**: Total Count (number of matches played with this hero).
- **wc**: Win Count (number of matches won with this hero).
- **bs**: Battle Score (average performance rating, `bs/100`).
- **mr**: Match Rating (accumulated rating points).
- **mrp**: Match Rating Percentage (rating contribution relative to overall performance).
- **hid_e**: Hero entity metadata:
    - **id**: Hero ID.
    - **n**: Hero name.
    - **ix**: Hero image URL.
    - **i2x**: Large hero image URL.
- **p**: Power score (weighted performance index for ranking frequent heroes, also called `MMR`).

Pagination example:
    First request: `/api/user/heroes/frequent?sid=37&limit=5&lang=en` → response includes `pageInfo.nextCursor = 11`.
    Second request: `/api/user/heroes/frequent?sid=37&limit=5&last_cursor=11&lang=en` → retrieves the next page, using `pageInfo.nextCursor` from the current response.
    Stop pagination when `pageInfo.hasNext = false` or `pageInfo.nextCursor` is empty.

The response also includes pagination metadata:
- **pageInfo.nextCursor**: Cursor value for the next page.
- **pageInfo.hasNext**: Boolean flag indicating if more results are available.
- **pageInfo.count**: Number of results returned in the current page.

This endpoint is useful for:
- Analyzing which heroes a player uses most often.
- Tracking win rates and performance scores.
- Comparing hero usage across different seasons.

## Request

`GET https://arena.rone.dev/api/user/heroes/frequent`

### Parameters

| Name | In | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| `sid` | query | integer | yes |  | The season ID for filtering frequent heroes. |
| `limit` | query | integer | no | `5` | The maximum number of frequent heroes to retrieve. Range: 1... |
| `last_cursor` | query | string | no |  | Pagination cursor from `pageInfo.nextCursor` of the current response. |
| `lang` | query | string | no | `en` | Language code for localized content. One of: `en`, `id`, `ru`, `es`, `pt`, `tr`, `ar`, `de`, `fr`, `it`, `ja`, `ko`, `th`, `vi`, `zh-CN`, `zh-TW`, `km`. |

### Example

```bash
curl -X GET 'https://arena.rone.dev/api/user/heroes/frequent?sid=<sid>' \
  -H 'Authorization: Bearer <jwt>'
```

## Example response

```json
{
  "code": 0,
  "message": "Success",
  "traceID": "6b098c3c683f977217a91bb6c630e7be",
  "data": {
    "pageInfo": {
      "nextCursor": "",
      "hasNext": true,
      "count": 0
    },
    "result": [
      {
        "hid": 17,
        "tc": 8,
        "wc": 7,
        "bs": 844.875,
        "mr": 6626,
        "mrp": 0.6188,
        "hid_e": {
          "id": 17,
          "n": "Fanny",
          "ix": "https://wsrv.nl/?url=https%3A%2F%2Fakmweb.youngjoygame.com%2Fweb%2Fsvnres%2Fimg%2Fmlbb%2Fcommunity%2F100_ae8ca46da01da69619a6c03dc7069921.png",
          "i2x": "https://wsrv.nl/?url=https%3A%2F%2Fakmweb.youngjoygame.com%2Fweb%2Fsvnres%2Ffile%2Fmlbb%2Fhomepage%2F100_74fabc6c0d5db065fbb836b6879f36ca.jpg"
        },
        "p": 1460
      }
    ]
  }
}
```

## Links

- Try it in the playground: https://arena.rone.dev/web/user/heroes/frequent
- User endpoints: https://arena.rone.dev/web/user.md
- OpenAPI schema: https://arena.rone.dev/api/openapi.json
