ServerAPI/src/main/java/xyz/etztech/serverapi/web
Etzelia 3be98c7de6 Chat API (#7)
Chat API

Signed-off-by: Etzelia <etzelia@hotmail.com>

Reviewed-on: https://git.etztech.xyz/Minecraft/ServerAPI/pulls/7
Reviewed-by: ZeroHD <joey@ahines.net>
2020-11-09 04:55:43 +01:00
..
api Chat API (#7) 2020-11-09 04:55:43 +01:00
GraphQL.java Chat API (#7) 2020-11-09 04:55:43 +01:00
IProvider.java Chat API (#7) 2020-11-09 04:55:43 +01:00
README.md Change QueryAPI to PingAPI and add PluginAPI (#4) 2020-08-12 02:43:42 +02:00
Web.java Chat API (#7) 2020-11-09 04:55:43 +01:00

README.md

Adding a new endpoint

  1. Create a new <endpoint>API class in api.
    • Make sure to correctly add the appropriate JSON and GraphQL annotations.
      Look at other classes for examples.
    • NOTE: If anything returned could be null, make sure to instead provide an appropriate zero-value property, otherwise GraphQL will choke.
      See PluginAPI::new for an example.
  2. Add a method to return the needed data to IProvider.
  3. Add a new REST endpoint to the Web::start method.
  4. Add a new GraphQL method to GraphQL
    • Make sure to correctly add the appropriate GraphQL annotation.
  5. Modify both ServerAPI and MockProvider to fulfill the IProvider interface.

Testing

ServerRunner should start up the API using MockProvider.

If possible, a real test on a running Minecraft server would ideal!