Class JSONRequest

java.lang.Object
io.github.emcw.utils.http.JSONRequest

public class JSONRequest extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final okhttp3.MediaType
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static @Nullable com.google.gson.JsonElement
    sendGet(@NotNull String url)
    Send GET request and get a JSON response back.
    static @Nullable com.google.gson.JsonElement
    sendPost(@NotNull String url, String body)
    Send POST request with a body and get a JSON response back.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • contentType

      public static final okhttp3.MediaType contentType
  • Constructor Details

    • JSONRequest

      public JSONRequest()
  • Method Details

    • sendGet

      @Nullable public static @Nullable com.google.gson.JsonElement sendGet(@NotNull @NotNull String url)
      Send GET request and get a JSON response back.
    • sendPost

      @Nullable public static @Nullable com.google.gson.JsonElement sendPost(@NotNull @NotNull String url, String body)
      Send POST request with a body and get a JSON response back.