Package me.lucko.luckperms.common.http
Class BytebinClient
java.lang.Object
me.lucko.luckperms.common.http.AbstractHttpClient
me.lucko.luckperms.common.http.BytebinClient
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class me.lucko.luckperms.common.http.AbstractHttpClient
JSON_TYPE, okHttp -
Constructor Summary
ConstructorsConstructorDescriptionBytebinClient(okhttp3.OkHttpClient okHttpClient, String url, String userAgent) Creates a new bytebin instance -
Method Summary
Modifier and TypeMethodDescriptioncom.google.gson.JsonElementgetJsonContent(String id) GETs json content from bytebingetUrl()okhttp3.ResponsemakeHttpRequest(okhttp3.Request request) postContent(byte[] buf, okhttp3.MediaType contentType) postContent(byte[] buf, okhttp3.MediaType contentType, String userAgentExtra) POSTs GZIP compressed content to bytebin.
-
Constructor Details
-
BytebinClient
Creates a new bytebin instance- Parameters:
url- the bytebin urluserAgent- the client user agent string
-
-
Method Details
-
getUrl
-
getUserAgent
-
makeHttpRequest
public okhttp3.Response makeHttpRequest(okhttp3.Request request) throws IOException, UnsuccessfulRequestException - Overrides:
makeHttpRequestin classAbstractHttpClient- Throws:
IOExceptionUnsuccessfulRequestException
-
postContent
public BytebinClient.Content postContent(byte[] buf, okhttp3.MediaType contentType, String userAgentExtra) throws IOException, UnsuccessfulRequestException POSTs GZIP compressed content to bytebin.- Parameters:
buf- the compressed contentcontentType- the type of the contentuserAgentExtra- extra string to append to the user agent- Returns:
- the key of the resultant content
- Throws:
IOException- if an error occursUnsuccessfulRequestException
-
postContent
public BytebinClient.Content postContent(byte[] buf, okhttp3.MediaType contentType) throws IOException, UnsuccessfulRequestException -
getJsonContent
public com.google.gson.JsonElement getJsonContent(String id) throws IOException, UnsuccessfulRequestException GETs json content from bytebin- Parameters:
id- the id of the content- Returns:
- the data
- Throws:
IOException- if an error occursUnsuccessfulRequestException
-