> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thenewscc.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Ranking de Leitores (Legacy)

> Obtém o ranking dos leitores com maiores streaks

<Warning>
  Esta é uma rota legacy mantida para compatibilidade. Para novos desenvolvimentos, use as novas rotas de ranking:

  * [Ranking Global](/api-reference/streaks/ranking-global)
  * [Ranking com Posição](/api-reference/streaks/ranking-with-position)
  * [Grupos de Amigos](/api-reference/streaks/ranking-overview)
</Warning>

## Descrição

Obtém o ranking dos leitores com maiores streaks, com opção de destacar a posição de um usuário específico.

## Query Parameters

<ParamField query="email" type="string">
  Email do usuário para destacar sua posição no ranking
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Indica se a operação foi bem-sucedida
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="ranking" type="array">
      Lista dos top leitores

      <Expandable title="reader object">
        <ResponseField name="position" type="number">
          Posição no ranking
        </ResponseField>

        <ResponseField name="email" type="string">
          Email do leitor (parcialmente ocultado)
        </ResponseField>

        <ResponseField name="currentStreak" type="number">
          Streak atual
        </ResponseField>

        <ResponseField name="maxStreak" type="number">
          Maior streak alcançado
        </ResponseField>

        <ResponseField name="isCurrentUser" type="boolean">
          Indica se é o usuário consultado
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="userPosition" type="object">
      Informações específicas do usuário consultado (se email fornecido)

      <Expandable title="properties">
        <ResponseField name="position" type="number">
          Posição do usuário no ranking geral
        </ResponseField>

        <ResponseField name="totalReaders" type="number">
          Total de leitores no ranking
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash theme={null}
  curl --request GET \
    --url 'https://backend.testeswaffle.org/streaks/ranking?email=leitor@exemplo.com'
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "success": true,
    "data": {
      "ranking": [
        {
          "position": 1,
          "email": "top***@***.com",
          "currentStreak": 365,
          "maxStreak": 365,
          "isCurrentUser": false
        },
        {
          "position": 2,
          "email": "sec***@***.com",
          "currentStreak": 180,
          "maxStreak": 200,
          "isCurrentUser": false
        },
        {
          "position": 3,
          "email": "lei***@exemplo.com",
          "currentStreak": 150,
          "maxStreak": 150,
          "isCurrentUser": true
        }
      ],
      "userPosition": {
        "position": 3,
        "totalReaders": 5432
      }
    }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /streaks/ranking
openapi: 3.1.0
info:
  title: Streaks API
  description: API para gerenciamento de streaks e gamificação de leitura do the news
  version: 1.0.0
servers:
  - url: https://backend.testeswaffle.org
security:
  - bearerAuth: []
paths:
  /streaks/ranking:
    get:
      tags:
        - Streaks
      summary: Ranking de Leitores
      description: Obtém o ranking dos leitores com maiores streaks
      parameters:
        - name: email
          in: query
          schema:
            type: string
            format: email
          description: Email do usuário para destacar sua posição
      responses:
        '200':
          description: Ranking obtido com sucesso
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      ranking:
                        type: array
                        items:
                          type: object
                          properties:
                            position:
                              type: number
                            email:
                              type: string
                            currentStreak:
                              type: number
                            maxStreak:
                              type: number
                            isCurrentUser:
                              type: boolean
                      userPosition:
                        type: object
                        properties:
                          position:
                            type: number
                          totalReaders:
                            type: number
      security: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````