Skip to content

Latest commit

 

History

History
909 lines (671 loc) · 15.6 KB

round.md

File metadata and controls

909 lines (671 loc) · 15.6 KB
title language_tabs language_clients toc_footers includes search highlight_theme headingLevel
Round service v0.0.1
shell
Shell
javascript
JavaScript
shell
javascript
true
darkula
2

Round 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.

To manage rounds in a match

Base URLs:

License: Apache 2.0

Authentication

  • HTTP Authentication, scheme: bearer

Default

getApi

Code samples

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

fetch('http://127.0.0.1:3335/api',
{
  method: 'GET',

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

GET /api

Check is the api is up

Example responses

200 Response

{
  "message": "string"
}

Responses

Status Meaning Description Schema
200 OK successful operation Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» message string false none none
This operation does not require authentication

pokemon

Pokemon infos

getPokemons

Code samples

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

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

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

GET /pokemons

Get the list of existing pokemons

Example responses

200 Response

[
  {
    "id": 0,
    "name": "string",
    "types": [
      {
        "id": 0,
        "name": "string",
        "faiblesses": [
          "string"
        ],
        "resistances": [
          "string"
        ]
      }
    ]
  }
]

Responses

Status Meaning Description Schema
200 OK The list of pokemons Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [Pokemon] false none [A POKEMON :o]
» Pokemon Pokemon false none A POKEMON :o
»» id integer(int64) false none Pokemon's id
»» name string false none Pokemon's name
»» types [TypePokemon] false none List of the types for this pokemon
»»» TypePokemon TypePokemon false none A POKEMON TYPE :o
»»»» id integer(int64) false none id of the type
»»»» name string false none label of the type
»»»» faiblesses [string] false none list of weakness for a type
»»»» resistances [string] false none list of weakness for a type
This operation does not require authentication

getPokemonById

Code samples

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

fetch('http://127.0.0.1:3335/pokemons/{id}',
{
  method: 'GET',

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

GET /pokemons/{id}

Get the pokemon for a given id

Parameters

Name In Type Required Description
id path integer true Pokemon ID

Example responses

200 Response

{
  "id": 0,
  "name": "string",
  "types": [
    {
      "id": 0,
      "name": "string",
      "faiblesses": [
        "string"
      ],
      "resistances": [
        "string"
      ]
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK The pokemon for a given id Pokemon
This operation does not require authentication

getPokemonByName

Code samples

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

fetch('http://127.0.0.1:3335/pokemons/name/{name}',
{
  method: 'GET',

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

GET /pokemons/name/{name}

Get the pokemon for a given name

Parameters

Name In Type Required Description
name path string true Pokemon name

Example responses

200 Response

{
  "id": 0,
  "name": "string",
  "types": [
    {
      "id": 0,
      "name": "string",
      "faiblesses": [
        "string"
      ],
      "resistances": [
        "string"
      ]
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK The pokemon for a given name Pokemon
This operation does not require authentication

getTypes

Code samples

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

fetch('http://127.0.0.1:3335/types',
{
  method: 'GET',

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

GET /types

Get the list of existing types

Example responses

200 Response

[
  {
    "id": 0,
    "name": "string",
    "faiblesses": [
      "string"
    ],
    "resistances": [
      "string"
    ]
  }
]

Responses

Status Meaning Description Schema
200 OK The list of types Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [TypePokemon] false none [A POKEMON TYPE :o]
» TypePokemon TypePokemon false none A POKEMON TYPE :o
»» id integer(int64) false none id of the type
»» name string false none label of the type
»» faiblesses [string] false none list of weakness for a type
»» resistances [string] false none list of weakness for a type
This operation does not require authentication

getTypeById

Code samples

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

fetch('http://127.0.0.1:3335/types/{id}',
{
  method: 'GET',

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

GET /types/{id}

Get the type for a given id

Parameters

Name In Type Required Description
id path integer true type ID

Example responses

200 Response

{
  "id": 0,
  "name": "string",
  "faiblesses": [
    "string"
  ],
  "resistances": [
    "string"
  ]
}

Responses

Status Meaning Description Schema
200 OK The type for a given id TypePokemon
This operation does not require authentication

getTypeByName

Code samples

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

fetch('http://127.0.0.1:3335/types/name/{name}',
{
  method: 'GET',

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

GET /types/name/{name}

Get the type for a given name

Parameters

Name In Type Required Description
name path string true type name

Example responses

200 Response

{
  "id": 0,
  "name": "string",
  "faiblesses": [
    "string"
  ],
  "resistances": [
    "string"
  ]
}

Responses

Status Meaning Description Schema
200 OK The type for a given name TypePokemon
This operation does not require authentication

round

rounds infos

getRoundsResultById

Code samples

# You can also use wget
curl -X GET http://127.0.0.1:3335/round/{id1}/{id2} \
  -H 'Accept: application/json'
const headers = {
  'Accept':'application/json'
};

fetch('http://127.0.0.1:3335/round/{id1}/{id2}',
{
  method: 'GET',

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

GET /round/{id1}/{id2}

Get the result of a round for two given pokemon ids

Parameters

Name In Type Required Description
id1 path string true pokemon1 id
id2 path string true pokemon2 id

Example responses

200 Response

{
  "id": 0,
  "name": "string",
  "types": [
    {
      "id": 0,
      "name": "string",
      "faiblesses": [
        "string"
      ],
      "resistances": [
        "string"
      ]
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK The winning pokemon Pokemon
This operation does not require authentication

getRoundsResultByName

Code samples

# You can also use wget
curl -X GET http://127.0.0.1:3335/round/name/{name1}/{name2} \
  -H 'Accept: application/json'
const headers = {
  'Accept':'application/json'
};

fetch('http://127.0.0.1:3335/round/name/{name1}/{name2}',
{
  method: 'GET',

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

GET /round/name/{name1}/{name2}

Get the result of a round for two given pokemon names

Parameters

Name In Type Required Description
name1 path string true pokemon1 name
name2 path string true pokemon2 name

Example responses

200 Response

{
  "id": 0,
  "name": "string",
  "types": [
    {
      "id": 0,
      "name": "string",
      "faiblesses": [
        "string"
      ],
      "resistances": [
        "string"
      ]
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK The winning pokemon Pokemon
This operation does not require authentication

playRound

Code samples

# You can also use wget
curl -X PUT http://127.0.0.1:3335/match \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'
const inputBody = '{
  "idMatch": 0,
  "idxPokemonDeck": 0
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

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

PUT /match

Play the round for a given user and a given match

Body parameter

{
  "idMatch": 0,
  "idxPokemonDeck": 0
}

Parameters

Name In Type Required Description
body body object false none

Example responses

200 Response

{
  "roundWinner": 0,
  "pokemonWinner": 0,
  "roundLooser": 0,
  "pokemonLooser": 0,
  "roundIndex": 9
}

Responses

Status Meaning Description Schema
200 OK The winning pokemon RoundResultDto
408 Request Timeout Timeout the other player didn't responded within the allowed delay None
To perform this operation, you must be authenticated by means of one of the following methods: bearerAuth

Schemas

Pokemon

{
  "id": 0,
  "name": "string",
  "types": [
    {
      "id": 0,
      "name": "string",
      "faiblesses": [
        "string"
      ],
      "resistances": [
        "string"
      ]
    }
  ]
}

Pokemon

Properties

Name Type Required Restrictions Description
id integer(int64) false none Pokemon's id
name string false none Pokemon's name
types [TypePokemon] false none List of the types for this pokemon

TypePokemon

{
  "id": 0,
  "name": "string",
  "faiblesses": [
    "string"
  ],
  "resistances": [
    "string"
  ]
}

TypePokemon

Properties

Name Type Required Restrictions Description
id integer(int64) false none id of the type
name string false none label of the type
faiblesses [string] false none list of weakness for a type
resistances [string] false none list of weakness for a type

RoundResultDto

{
  "roundWinner": 0,
  "pokemonWinner": 0,
  "roundLooser": 0,
  "pokemonLooser": 0,
  "roundIndex": 9
}

RoundResultDto

Properties

Name Type Required Restrictions Description
roundWinner integer true none the id of the winner
pokemonWinner integer true none the pokeApi id of the winner's pokemon
roundLooser integer true none the id of the looser
pokemonLooser integer true none the pokeApi id of the looser's pokemon
roundIndex integer true none the index of the round