Skip to content

Latest commit

 

History

History
554 lines (399 loc) · 10.8 KB

stats.md

File metadata and controls

554 lines (399 loc) · 10.8 KB
title language_tabs language_clients toc_footers includes search highlight_theme headingLevel
Stats service v0.0.1
shell
Shell
javascript
JavaScript
shell
javascript
true
darkula
2

Stats service v0.0.1

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Because we need statistics

Base URLs:

License: Apache 2.0

pokemon

Pokemon stats

getNumberOfRoundsByPokemon

Code samples

# You can also use wget
curl -X GET http://127.0.0.1:3337/pokemons/{id}/number-of-rounds \
  -H 'Accept: application/json'
const headers = {
  'Accept':'application/json'
};

fetch('http://127.0.0.1:3337/pokemons/{id}/number-of-rounds',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /pokemons/{id}/number-of-rounds

Number of rounds for a specific pokemon

Returns the number of rounds for a specific pokemon

Parameters

Name In Type Required Description
id path PokemonID true Pokemon ID

Example responses

200 Response

{
  "id": 0,
  "numberOfRounds": 0
}

Responses

Status Meaning Description Schema
200 OK successful operation Inline
400 Bad Request An error caused by the client Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» id integer(int64) false none Pokemon's id used in the request
» numberOfRounds integer(int64) false none Number of rounds for this pokemon

Status Code 400

Name Type Required Restrictions Description
anonymous [AppError] false none none
» code integer(int32) true none Error code
» message string true none Error message
This operation does not require authentication

getNumberOfVictoriesByPokemon

Code samples

# You can also use wget
curl -X GET http://127.0.0.1:3337/pokemons/{id}/number-of-victories \
  -H 'Accept: application/json'
const headers = {
  'Accept':'application/json'
};

fetch('http://127.0.0.1:3337/pokemons/{id}/number-of-victories',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /pokemons/{id}/number-of-victories

Number of victories for a specific pokemon

Returns the number of victories for a specific pokemon

Parameters

Name In Type Required Description
id path PokemonID true Pokemon ID

Example responses

200 Response

{
  "id": 0,
  "numberOfVictories": 0
}

Responses

Status Meaning Description Schema
200 OK successful operation Inline
400 Bad Request An error caused by the client Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» id integer(int64) false none Pokemon's id used in the request
» numberOfVictories integer(int64) false none Number of victories for this pokemon

Status Code 400

Name Type Required Restrictions Description
anonymous [AppError] false none none
» code integer(int32) true none Error code
» message string true none Error message
This operation does not require authentication

getPokemonsWithNumberOfRounds

Code samples

# You can also use wget
curl -X GET http://127.0.0.1:3337/pokemons/rounds \
  -H 'Accept: application/json'
const headers = {
  'Accept':'application/json'
};

fetch('http://127.0.0.1:3337/pokemons/rounds',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /pokemons/rounds

List of pokemons with their number of rounds

Returns the list of pokemons with their number of rounds

Example responses

200 Response

[
  {
    "id": 0,
    "numberOfRounds": 0
  }
]

Responses

Status Meaning Description Schema
200 OK successful operation ArrayOfPokemons
This operation does not require authentication

round

Rounds stats

getRoundsAdayLast30Days

Code samples

# You can also use wget
curl -X GET http://127.0.0.1:3337/rounds/count-a-day-last-30-days \
  -H 'Accept: application/json'
const headers = {
  'Accept':'application/json'
};

fetch('http://127.0.0.1:3337/rounds/count-a-day-last-30-days',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /rounds/count-a-day-last-30-days

Number of rounds a day for the last 30 days. 1 round per player play. It means that's the double of rounds played

Example responses

200 Response

[
  {
    "date": "2019-08-24",
    "numberOfRounds": 0
  }
]

Responses

Status Meaning Description Schema
200 OK successful operation ArrayOfRounds
This operation does not require authentication

stats

uploadStatRow

Code samples

# You can also use wget
curl -X PUT http://127.0.0.1:3337/stats \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'
const inputBody = '{
  "idPokemon": 0,
  "dateMatch": "2019-08-24T14:15:22Z",
  "victory": true,
  "idMatch": 0,
  "team": 1
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};

fetch('http://127.0.0.1:3337/stats',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

PUT /stats

Upload stats

Upload stats

Body parameter

{
  "idPokemon": 0,
  "dateMatch": "2019-08-24T14:15:22Z",
  "victory": true,
  "idMatch": 0,
  "team": 1
}

Parameters

Name In Type Required Description
body body StatsDto false Stats to upload

Example responses

200 Response

{
  "idPokemon": 0,
  "dateMatch": "2019-08-24T14:15:22Z",
  "victory": true,
  "idMatch": 0,
  "team": 1
}

Responses

Status Meaning Description Schema
200 OK successful operation StatsDto
400 Bad Request An error caused by the client Inline

Response Schema

Status Code 400

Name Type Required Restrictions Description
anonymous [AppError] false none none
» code integer(int32) true none Error code
» message string true none Error message
This operation does not require authentication

Schemas

StatsDto

{
  "idPokemon": 0,
  "dateMatch": "2019-08-24T14:15:22Z",
  "victory": true,
  "idMatch": 0,
  "team": 1
}

Properties

Name Type Required Restrictions Description
idPokemon integer(int64) true none Pokemon's id
dateMatch string(date-time) true none Date of the round
victory boolean true none Victory (if true) or defeat
idMatch integer(int64) true none Round's id
team integer true none Team of the pokemon

ArrayOfRounds

[
  {
    "date": "2019-08-24",
    "numberOfRounds": 0
  }
]

Array Of Rounds Stats

Properties

Name Type Required Restrictions Description
Array Of Rounds Stats [object] false none Array of rounds
date string(date) true none Date of the aggregated day
numberOfRounds integer(number) true none Number of rounds for this day

ArrayOfPokemons

[
  {
    "id": 0,
    "numberOfRounds": 0
  }
]

Array Of Pokemons Stats

Properties

Name Type Required Restrictions Description
Array Of Pokemons Stats [object] false none Array of pokemons
id integer(int64) true none Pokemon's id
numberOfRounds integer(int64) true none Number of rounds for this pokemon

PokemonID

0

Properties

Name Type Required Restrictions Description
anonymous integer false none none

AppError

{
  "code": 0,
  "message": "Internal error"
}

Properties

Name Type Required Restrictions Description
code integer(int32) true none Error code
message string true none Error message