Package top.focess.qq.api.util.network
Class NetworkHandler
- java.lang.Object
-
- top.focess.qq.api.util.network.NetworkHandler
-
public class NetworkHandler extends Object
This is a network util class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNetworkHandler.RequestTypeRepresents a request-type
-
Constructor Summary
Constructors Constructor Description NetworkHandler(@NonNull Plugin plugin)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpResponseget(String url, Map<String,Object> data, Map<String,String> header)Send a GET http-requestPlugingetPlugin()HttpResponsepost(String url, Map<String,Object> data, Map<String,String> header, okhttp3.MediaType mediaType)Send a POST http-requestHttpResponseput(String url, Map<String,Object> data, Map<String,String> header, okhttp3.MediaType mediaType)Send a PUT http-requestHttpResponserequest(String url, Map<String,Object> data, Map<String,String> header, okhttp3.MediaType mediaType, NetworkHandler.RequestType requestType)Send a http-requestHttpResponserequest(String url, Map<String,Object> data, NetworkHandler.RequestType requestType)Send a http-requestHttpResponserequest(String url, NetworkHandler.RequestType requestType)Send a http-request
-
-
-
Constructor Detail
-
NetworkHandler
public NetworkHandler(@NonNull Plugin plugin)
-
-
Method Detail
-
request
public HttpResponse request(String url, Map<String,Object> data, NetworkHandler.RequestType requestType)
Send a http-request- Parameters:
url- the request urldata- the request datarequestType- the request type- Returns:
- the response of this request
-
request
public HttpResponse request(String url, NetworkHandler.RequestType requestType)
Send a http-request- Parameters:
url- the request urlrequestType- the request type- Returns:
- the response of this request
- See Also:
request(String, Map, RequestType)
-
request
public HttpResponse request(String url, Map<String,Object> data, Map<String,String> header, okhttp3.MediaType mediaType, NetworkHandler.RequestType requestType)
Send a http-request- Parameters:
url- the request urldata- the request dataheader- the request headermediaType- the request acceptable typerequestType- the request type- Returns:
- the response of this request
-
put
public HttpResponse put(String url, Map<String,Object> data, Map<String,String> header, @NotNull okhttp3.MediaType mediaType)
Send a PUT http-request- Parameters:
url- the request urldata- the request dataheader- the request headermediaType- the request acceptable type- Returns:
- the response of this request
-
post
public HttpResponse post(String url, Map<String,Object> data, Map<String,String> header, @NotNull okhttp3.MediaType mediaType)
Send a POST http-request- Parameters:
url- the request urldata- the request dataheader- the request headermediaType- the request acceptable type- Returns:
- the response of this request
-
get
public HttpResponse get(String url, @NotNull Map<String,Object> data, Map<String,String> header)
Send a GET http-request- Parameters:
url- the request urldata- the request dataheader- the request header- Returns:
- the response of this request
-
getPlugin
public Plugin getPlugin()
-
-