| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425 |
- <?php
- /**
- * @var mixed[] $API API help structure.
- */
- $API = [
- "version" => 2,
- "category" => [
- [ // BEGIN CATEGORY Units
- "name" => "Units",
- "command" => [
- [ // BEGIN COMMAND Units
- "name" => "units",
- "method" => [
- [
- "id" => "GET",
- "url" => "/units/",
- "description" => "Retrieves units.",
- "parameters" => [
- [
- "key" => "page",
- "via" => "request",
- "type" => "int",
- "description" => "Page to fetch. Deaults to 1.",
- "optional" => true
- ],
- [
- "key" => "per_page",
- "via" => "request",
- "type" => "int",
- "description" => "number of results per page. Defaults to 30, maximum is 100.",
- "optional" => true
- ],
- [
- "key" => "name",
- "via" => "request",
- "type" => "string",
- "description" => "Filter units with this in their name. Case insensitive.",
- "optional" => true
- ]
- ],
- "responses" => [
- [
- "status" => "200",
- "message" => "Success.",
- "description" => null,
- "example" => null,
- ],
- ]
- ],
- [
- "id" => "GET",
- "url" => "/units/{id}/",
- "description" => "Retrieves a unit info.",
- "parameters" => [
- [
- "key" => "{id}",
- "via" => "query",
- "type" => "string",
- "description" => "Unit ID.",
- "optional" => false
- ],
- ],
- "responses" => [
- [
- "status" => "200",
- "message" => "Success.",
- "description" => null,
- "example" => null,
- ],
- [
- "status" => "404",
- "message" => "Unit not found.",
- "description" => "The requested unit does not exist.",
- "example" => null
- ]
- ]
- ],
- ],
- ] // END COMMAND profile
- ]
- ], // END CATEGORY Units
- [ // BEGIN CATEGORY Profile
- "name" => "Profile",
- "command" => [
- [ // BEGIN COMMAND UploadProfile
- "name" => "profile",
- "method" => [
- [
- "id" => "GET",
- "url" => "/profile/{id}/",
- "description" => "Retrieves player profile.",
- "parameters" => [
- [
- "key" => "{id}",
- "via" => "query",
- "type" => "string",
- "description" => "Player ID or name.",
- "optional" => false
- ],
- [
- "key" => "key",
- "via" => "body",
- "type" => "string",
- "description" => "API key. Required for private profiles.",
- "optional" => true
- ]
- ],
- "responses" => [
- [
- "status" => "200",
- "message" => "Success.",
- "description" => null,
- "example" => json_encode('{"username":"IValentin","level":50,"public":"1"}', JSON_PRETTY_PRINT),
- ],
- [
- "status" => "403",
- "message" => "A list of profiles cant be retrieved. Please specify a profile ID or player name.",
- "description" => "No player ID or name has been supplied. A full list of profiles is not available.",
- "example" => null
- ],
- [
- "status" => "403",
- "message" => "The profile is not public.",
- "description" => "The requestd player profile is private, and the API key has not been sent or it's invalid.",
- "example" => null
- ],
- [
- "status" => "404",
- "message" => "Player not found.",
- "description" => "The requestd player is not registered in SWDB.",
- "example" => null
- ]
- ]
- ],
- [
- "id" => "POST",
- "url" => "/profile/{id}/",
- "description" => "Creates a new player profile.",
- "parameters" => [
- [
- "key" => "{id}",
- "via" => "query",
- "type" => "string",
- "description" => "Player ID.",
- "optional" => false
- ],
- [
- "key" => "email",
- "via" => "body",
- "type" => "string",
- "description" => "User email. Must be a valid address.",
- "optional" => false
- ],
- [
- "key" => "password",
- "via" => "body",
- "type" => "string",
- "description" => "New user password.",
- "optional" => false
- ],
- [
- "key" => "name",
- "via" => "body",
- "type" => "string",
- "description" => "New username. If not supplied, it will default to 'player_[id]'. Will be overriden on the next PUT request.",
- "optional" => true
- ],
- [
- "key" => "public",
- "via" => "body",
- "type" => "int",
- "description" => "1 to make the profile public, 0 to keep it private. Default to 0.",
- "optional" => true
- ],
- ],
- "responses" => [
- [
- "status" => "201",
- "message" => "Created.",
- "description" => null,
- "example" => json_encode('{"username":"IValentin","email":example@example.com,"api_key":"0123456789012345","public":"0"}', JSON_PRETTY_PRINT),
- ],
- [
- "status" => "400",
- "message" => "User ID not received.",
- "description" => "The ID of the player to create is not in the query.",
- "example" => null
- ],
- [
- "status" => "400",
- "message" => "User email not received.",
- "description" => "The email of the player to create has not ben passed in the request.",
- "example" => null
- ],
- [
- "status" => "400",
- "message" => "Invalid email.",
- "description" => "The 'mail' parameter must be a valid email address.",
- "example" => null
- ],
- [
- "status" => "400",
- "message" => "User password not received.",
- "description" => "The password of the player to create has not ben passed in the request.",
- "example" => null
- ],
- [
- "status" => "400",
- "message" => "Existing user.",
- "description" => "A player with the same ID is already registered in SWDB.",
- "example" => null
- ]
- ]
- ],
- [
- "id" => "PUT",
- "url" => "/profile/{id}/",
- "description" => "Updates a player profile with data received from the game.",
- "parameters" => [
- [
- "key" => "{id}",
- "via" => "query",
- "type" => "string",
- "description" => "Player ID.",
- "optional" => false
- ],
- [
- "key" => "key",
- "via" => "body",
- "type" => "string",
- "description" => "API key.",
- "optional" => false
- ],
- [
- "key" => "response",
- "via" => "body",
- "type" => "string",
- "description" => "JSON received from game server on HubUserLogin command.",
- "optional" => false
- ]
- ],
- "responses" => [
- [
- "status" => "204",
- "message" => "Profile imported.",
- "description" => null,
- "example" => null,
- ],
- [
- "status" => "400",
- "message" => "API key not received.",
- "description" => "No API key was suplied in the request.",
- "example" => null
- ],
- [
- "status" => "400",
- "message" => "No data received.",
- "description" => "Game JSON response not received from request",
- "example" => null
- ],
- [
- "status" => "400",
- "message" => "Data is no valid JSON.",
- "description" => "The parameter 'response' contains information, but it's not valid JSON data.",
- "example" => null
- ],
- [
- "status" => "401",
- "message" => "Invalid credentials",
- "description" => "The API key is not valid for the profile being updated.",
- "example" => null
- ]
- ]
- ],
- [
- "id" => "DELETE",
- "url" => "/profile/{id}/",
- "description" => "Deletes a player profile.",
- "parameters" => [
- [
- "key" => "{id}",
- "via" => "query",
- "type" => "string",
- "description" => "Player ID.",
- "optional" => false
- ],
- [
- "key" => "key",
- "via" => "body",
- "type" => "string",
- "description" => "API key.",
- "optional" => false
- ]
- ],
- "responses" => [
- [
- "status" => "204",
- "message" => "Profile deleted.",
- "description" => null,
- "example" => null,
- ],
- [
- "status" => "400",
- "message" => "User ID not received.",
- "description" => "The ID of the player to create is not in the query.",
- "example" => null
- ],
- [
- "status" => "400",
- "message" => "API key not received.",
- "description" => "No API key was suplied in the request.",
- "example" => null
- ],
- [
- "status" => "401",
- "message" => "Invalid credentials",
- "description" => "The API key is not valid for the profile being updated.",
- "example" => null
- ]
- ]
- ],
- ],
- ] // END COMMAND profile
- ]
- ], // END CATEGORY Profile
- [ // BEGIN CATEGORY Run
- "name" => "Run",
- "command" => [
- [ // BEGIN COMMAND run
- "name" => "run",
- "method" => [
- [
- "id" => "POST",
- "url" => "/run/",
- "description" => "Logs a game run using JSON files intercepted from the game.",
- "parameters" => [
- [
- "key" => "key",
- "via" => "body",
- "type" => "string",
- "description" => "API key.",
- "optional" => false
- ],
- [
- "key" => "result_response",
- "via" => "body",
- "type" => "string",
- "description" => "JSON received from game server on run result.",
- "optional" => false
- ],
- [
- "key" => "result_request",
- "via" => "body",
- "type" => "string",
- "description" => "JSON sent to game server on run result. Required for commands: BattleDungeonResult_V2, BattleDimensionHoleDungeonResult_v2",
- "optional" => true
- ],
- [
- "key" => "start_response",
- "via" => "body",
- "type" => "string",
- "description" => "JSON received from game server on run start. Required for commands: BattleRiftOfWorldsRaidResult, BattleScenarioResult",
- "optional" => true
- ],
- [
- "key" => "start_request",
- "via" => "body",
- "type" => "string",
- "description" => "JSON sent to game server on run start. Required for commands: ",
- "optional" => true
- ],
- ],
- "responses" => [
- [
- "status" => "201",
- "message" => "Created.",
- "description" => null,
- "example" => null,
- ],
- [
- "status" => "400",
- "message" => "API key not received.",
- "description" => "No API key was suplied in the request.",
- "example" => null
- ],
- [
- "status" => "400",
- "message" => "No result response data received.",
- "description" => "JSON received from game server on run result wast receiven on the request.",
- "example" => null
- ],
- [
- "status" => "400",
- "message" => "Result response data is no valid JSON.",
- "description" => "The parameter 'result_response' contains information, but it's not valid JSON data.",
- "example" => null
- ],
- [
- "status" => "401",
- "message" => "Invalid credentials",
- "description" => "The API key is not valid for the profile being updated.",
- "example" => null
- ],
- [
- "status" => "405",
- "message" => "Command not implemented.",
- "description" => "The command referenced in the JSON file is not implemented.",
- "example" => null
- ],
- [
- "status" => "409",
- "message" => "Run already in database.",
- "description" => "The run is already in the database for the user.",
- "example" => null
- ]
- ]
- ],
- ],
- ] // END COMMAND Run
- ]
- ], // END CATEGORY Run
- ],
- ];
- ?>
|