Skip to content

Latest commit

 

History

History
554 lines (467 loc) · 8.86 KB

V1.md

File metadata and controls

554 lines (467 loc) · 8.86 KB

First version :)


Character

Domain class

String name nullable: false
Weapon primaryWeapon nullable: true
Weapon secondaryWeapon nullable: true
Vocation vocation nullable: true
Helmet helmet nullable: true
Armor armor nullable: true
Pants pants nullable: true
Gloves gloves nullable: true
Shoes shoes nullable: true


Endpoints

URL : /character/index Method GET

GET example: restapi.com/character/index

Response example

[ 
   { 
      "id":1,
      "armor":{ 
         "id":6,
         "defence":40.0,
         "name":"Gold Armor"
      },
      "secondaryWeapon":null,
      "primaryWeapon":null,
      "shoes":null,
      "vocation":{ 
         "enumType":"rpg.api.Vocation",
         "name":"WARRIOR"
      },
      "name":"Kammradt",
      "gloves":null,
      "pants":{ 
         "id":9,
         "defence":40.0,
         "name":"Fancy"
      },
      "helmet":{ 
         "id":3,
         "defence":20.0,
         "name":"Gold Helmet"
      }
   },
   { 
      "id":2,
      "armor":null,
      "secondaryWeapon":null,
      "primaryWeapon":null,
      "shoes":{ 
         "id":15,
         "defence":13.0,
         "name":"Magic Shoes"
      },
      "vocation":{ 
         "enumType":"rpg.api.Vocation",
         "name":"MAGE"
      },
      "name":"Alves",
      "gloves":{ 
         "id":12,
         "defence":10.0,
         "name":"Fancy"
      },
      "pants":null,
      "helmet":null
   }
]

URL : /character/show/:id Method GET

GET example : restapi.com/character/show/1

Response example

{ 
   "id":1,
   "armor":{ 
      "id":6,
      "defence":40.0,
      "name":"Gold Armor"
   },
   "secondaryWeapon":null,
   "primaryWeapon":null,
   "shoes":null,
   "vocation":{ 
      "enumType":"rpg.api.Vocation",
      "name":"WARRIOR"
   },
   "name":"Kammradt",
   "gloves":null,
   "pants":{ 
      "id":9,
      "defence":40.0,
      "name":"Fancy"
   },
   "helmet":{ 
      "id":3,
      "defence":20.0,
      "name":"Gold Helmet"
   }
}

URL : /character/save Method POST

POST example

{ 
   "armor":{ 
      "id":6,
      "defence":40,
      "name":"Gold Armor"
   },
   "secondaryWeapon":{ 
      "id":3,
      "defence":40,
      "name":"Wood aaaa",
      "isTwoHanded":false,
      "damage":0
   },
   "primaryWeapon":{ 
      "id":3,
      "defence":40,
      "name":"Wood aaaa",
      "isTwoHanded":false,
      "damage":0
   },
   "shoes":null,
   "vocation":"WARRIOR",
   "name":"Kammradt",
   "gloves":null,
   "pants":{ 
      "id":9,
      "defence":40,
      "name":"Fancy"
   },
   "helmet":{ 
      "id":3,
      "defence":20,
      "name":"Gold Helmet"
   }
}

Response example

{ 
   "id":3,
   "armor":{ 
      "id":6
   },
   "secondaryWeapon":{ 
      "id":3
   },
   "primaryWeapon":{ 
      "id":3
   },
   "vocation":"WARRIOR",
   "name":"Kammradt",
   "pants":{ 
      "id":9
   },
   "helmet":{ 
      "id":3
   }
}

URL : /character/update Method PUT

PUT example

{
    "id": 3,
    "armor": {
        "id": 6,
        "defence": 40,
        "name": "Gold Armor"
    },
    "secondaryWeapon": null,
    "primaryWeapon": {
		"id": 4,
		"defence": 40,
		"name": "Wood Shield",
		"isTwoHanded": true,
		"damage": 0
	},
    "shoes": {
		"id": 15,
		"defence": 13,
		"name": "Magic Shoes"
	},
    "vocation": {
        "enumType": "rpg.api.Vocation",
        "name": "WARRIOR"
    },
    "name": "New boy",
    "gloves": null,
    "pants": null,
    "helmet": null
}

Response example

{
    "id": 3,
    "armor": {
        "id": 6
    },
    "primaryWeapon": {
        "id": 4
    },
    "shoes": {
        "id": 15
    },
    "vocation": "WARRIOR",
    "name": "New boy"
}

URL : /character/delete/:id Method DELETE

DELETE example

restapi.com/character/delete/3

Response example

Status: 204 No Content


URL : /character/vocation Method GET

GET example

restapi.com/character/vocation

Response example

{
    "vocations": [
        "WARRIOR",
        "MAGE",
        "PALADIN"
    ]
}

Equipments

Domain class

All equipments (Helmet, Armor, Pants, Gloves, Shoes) inherit from Equipament

String name nullable: false
Float defence nullable: false


Endpoints

URL : /:equipamentName/index Method GET

GET example: restapi.com/armor/index

Response example

[
    {
        "id": 4,
        "defence": 10,
        "name": "Leather Armor"
    },
    {
        "id": 5,
        "defence": 20,
        "name": "Iron Armor"
    },
    {
        "id": 6,
        "defence": 40,
        "name": "Gold Armor"
    }
]

URL : /:equipamentName/show/:id Method GET

GET example : restapi.com/gloves/show/10

Response example

{
    "id": 10,
    "defence": 2,
    "name": "Assassin Gloves"
}

Weapons

Domain class

String name nullable: false
Float damage nullable: true
Float defence nullable: true
Boolean isTwoHanded nullable: true


Endpoints

URL : /weapon/index Method GET

GET example: restapi.com/weapon/index

Response example

[
    {
        "id": 1,
        "defence": 0,
        "name": "Sword",
        "isTwoHanded": false,
        "damage": 0
    },
    {
        "id": 2,
        "defence": 0,
        "name": "Long Sword",
        "isTwoHanded": false,
        "damage": 30
    },
    {
        "id": 3,
        "defence": 10,
        "name": "Fight Club",
        "isTwoHanded": true,
        "damage": 20
    },
    {
        "id": 4,
        "defence": 40,
        "name": "Wood Shield",
        "isTwoHanded": true,
        "damage": 0
    }
]

URL : /weapon/show/:id Method GET

GET example : restapi.com/weapon/show/3

Response example

{
    "id": 3,
    "defence": 10,
    "name": "Fight Club",
    "isTwoHanded": true,
    "damage": 20
}

Battle

Endpoints

URL : /battle/calculate/:characterId Method GET

GET example: restapi.com/battle/calculate/1

Response example

{ 
   "character":{ 
      "id":1,
      "armor":{ 
         "id":6
      },
      "secondaryWeapon":null,
      "primaryWeapon":null,
      "shoes":null,
      "vocation":{ 
         "enumType":"rpg.api.Vocation",
         "name":"WARRIOR"
      },
      "name":"Kammradt",
      "gloves":null,
      "pants":{ 
         "id":9
      },
      "helmet":{ 
         "id":3
      }
   },
   "damage":0,
   "defence":100,
   "power":120
}

URL : /battle/fight Method POST

POST example

{ 
   "ids": [1, 2]
}

Response example

{
    "winner": {
        "character": {
            "id": 1,
            "armor": {
                "id": 6
            },
            "secondaryWeapon": null,
            "primaryWeapon": null,
            "shoes": null,
            "vocation": {
                "enumType": "rpg.api.Vocation",
                "name": "WARRIOR"
            },
            "name": "Kammradt",
            "gloves": null,
            "pants": {
                "id": 9
            },
            "helmet": {
                "id": 3
            }
        },
        "damage": 0,
        "defence": 100,
        "power": 120
    },
    "ranking": [
        {
            "character": {
                "id": 1,
                "armor": {
                    "id": 6
                },
                "secondaryWeapon": null,
                "primaryWeapon": null,
                "shoes": null,
                "vocation": {
                    "enumType": "rpg.api.Vocation",
                    "name": "WARRIOR"
                },
                "name": "Kammradt",
                "gloves": null,
                "pants": {
                    "id": 9
                },
                "helmet": {
                    "id": 3
                }
            },
            "damage": 0,
            "defence": 100,
            "power": 120
        },
        {
            "character": {
                "id": 2,
                "armor": null,
                "secondaryWeapon": null,
                "primaryWeapon": null,
                "shoes": {
                    "id": 15
                },
                "vocation": {
                    "enumType": "rpg.api.Vocation",
                    "name": "MAGE"
                },
                "name": "Alves",
                "gloves": {
                    "id": 12
                },
                "pants": null,
                "helmet": null
            },
            "damage": 0,
            "defence": 23,
            "power": 25.3
        }
    ]
}