title | language_tabs | language_clients | toc_footers | includes | search | highlight_theme | headingLevel | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Matchmaking service v0.0.1 |
|
|
true |
darkula |
2 |
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 machmatking
Base URLs:
License: Apache 2.0
- HTTP Authentication, scheme: bearer
Everything related to a match
Code samples
# You can also use wget
curl -X GET http://127.0.0.1:3334/matchs \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('http://127.0.0.1:3334/matchs',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
GET /matchs
Get all matches
Example responses
200 Response
[
"string"
]
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
Status Code 200
Array of matches id
Name | Type | Required | Restrictions | Description |
---|
Code samples
# You can also use wget
curl -X PUT http://127.0.0.1:3334/matchs \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const inputBody = '{
"opponentId": 0,
"deck": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('http://127.0.0.1:3334/matchs',
{
method: 'PUT',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
PUT /matchs
Create a match
Body parameter
{
"opponentId": 0,
"deck": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | CreateMatchDto | false | Match to create |
Example responses
200 Response
{
"id": 0,
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z",
"authorPokemons": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"opponentPokemons": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"authorId": 0,
"opponentId": 0,
"status": "waitingInvite",
"winnerId": null
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | MatchDto |
400 | Bad Request | An error caused by the client | Inline |
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 |
Code samples
# You can also use wget
curl -X GET http://127.0.0.1:3334/matchs/{id} \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('http://127.0.0.1:3334/matchs/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
GET /matchs/{id}
Get a match by id
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | integer | true | Id of the match |
Example responses
200 Response
{
"id": 0,
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z",
"authorPokemons": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"opponentPokemons": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"authorId": 0,
"opponentId": 0,
"status": "waitingInvite",
"winnerId": null
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | MatchDto |
Code samples
# You can also use wget
curl -X GET http://127.0.0.1:3334/matchs/invitation \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('http://127.0.0.1:3334/matchs/invitation',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
GET /matchs/invitation
Get all matches that are waiting for an invitation for the connected player
Example responses
200 Response
[
{
"id": 0,
"authorId": "string"
}
]
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
Status Code 200
Array of awaiting matches
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» id | integer | true | none | The id of the match |
» authorId | string | false | none | The id of the player opponent |
Code samples
# You can also use wget
curl -X POST http://127.0.0.1:3334/matchs/{id}/join \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const inputBody = '[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('http://127.0.0.1:3334/matchs/{id}/join',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /matchs/{id}/join
Join a match
Body parameter
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | integer | true | Id of the match |
body | body | DeckDto | false | Deck |
Example responses
200 Response
{
"id": 0,
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z",
"authorPokemons": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"opponentPokemons": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"authorId": 0,
"opponentId": 0,
"status": "waitingInvite",
"winnerId": null
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | MatchDto |
400 | Bad Request | An error caused by the client | Inline |
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 |
For internal communication
Code samples
# You can also use wget
curl -X POST http://127.0.0.1:3334/internal/matches/{id}/close \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
const inputBody = '{
"winnerId": 0
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('http://127.0.0.1:3334/internal/matches/{id}/close',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /internal/matches/{id}/close
Close a match
Body parameter
{
"winnerId": 0
}
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | integer | true | Id of the match |
body | body | any | false | Post match winner and close it |
Example responses
200 Response
{
"id": 0,
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z",
"authorPokemons": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"opponentPokemons": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"authorId": 0,
"opponentId": 0,
"status": "waitingInvite",
"winnerId": null
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | MatchDto |
400 | Bad Request | An error caused by the client | Inline |
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 |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
Deck of the player
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [PokemonID] | false | none | Deck of the player |
{
"opponentId": 0,
"deck": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
opponentId | integer | true | none | Id of the opponent |
deck | [PokemonID] | false | none | Deck of the player |
{
"id": 0,
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z",
"authorPokemons": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"opponentPokemons": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"authorId": 0,
"opponentId": 0,
"status": "waitingInvite",
"winnerId": null
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer | true | none | The id of the match |
createdAt | string(date-time) | true | none | The date of the creation |
updatedAt | string(date-time) | true | none | The date of the last update |
authorPokemons | [integer] | true | none | The pokemons ids of the author |
opponentPokemons | [integer] | false | none | The pokemons ids of the opponent |
authorId | integer | true | none | The id of the author |
opponentId | integer | true | none | The id of the opponent |
status | string | true | none | The status of the match |
winnerId | integer | false | none | The id of the winner. If the winner is a draw, the winnerId is null and the match status is set to finished |
Property | Value |
---|---|
status | waitingInvite |
status | started |
status | finished |
0
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | integer | false | none | none |
{
"code": 0,
"message": "Internal error"
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
code | integer(int32) | true | none | Error code |
message | string | true | none | Error message |