public class RequestBuilder
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
RequestBuilder |
body(okhttp3.RequestBody body)
Sets the body.
|
RequestBuilder |
bodyContent(java.lang.String content,
java.lang.String contentType)
Sets the string content to the request (used with POST/PUT).
|
RequestBuilder |
bodyJson(com.google.gson.JsonObject json)
Adds a JSON content to the request (used with POST/PUT).
|
okhttp3.Request |
build()
Builds the.
|
static okhttp3.HttpUrl |
constructHttpUrl(java.lang.String endPoint,
java.lang.String[] pathSegments)
Creates a properly encoded HttpUrl object with no path parameters.
|
static okhttp3.HttpUrl |
constructHttpUrl(java.lang.String endPoint,
java.lang.String[] pathSegments,
java.lang.String[] pathParameters)
Creates a properly encoded HttpUrl object with path parameters.
|
static RequestBuilder |
delete(okhttp3.HttpUrl url)
The DELETE method requests that the origin server delete the resource identified by the Request-URI.
|
RequestBuilder |
form(java.lang.Object... args)
Adds form parameters.
|
static RequestBuilder |
get(okhttp3.HttpUrl url)
The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI.
|
RequestBuilder |
header(java.lang.Object... args)
Adds header parameters.
|
static RequestBuilder |
post(okhttp3.HttpUrl url)
The POST request method is designed to request that a web server accept the data enclosed in the request message's
body for storage.
|
static RequestBuilder |
put(okhttp3.HttpUrl url)
The PUT method requests that the enclosed entity be stored under the supplied Request-URI.
|
RequestBuilder |
query(java.lang.Object... args)
Adds query parameters.
|
java.lang.String |
toString() |
public static RequestBuilder delete(okhttp3.HttpUrl url)
url
- the URLpublic static RequestBuilder get(okhttp3.HttpUrl url)
url
- the URLpublic static RequestBuilder post(okhttp3.HttpUrl url)
url
- the URLpublic static RequestBuilder put(okhttp3.HttpUrl url)
url
- the URLpublic static okhttp3.HttpUrl constructHttpUrl(java.lang.String endPoint, java.lang.String[] pathSegments)
endPoint
- the API end pointpathSegments
- the path segments for a specific API callpublic static okhttp3.HttpUrl constructHttpUrl(java.lang.String endPoint, java.lang.String[] pathSegments, java.lang.String[] pathParameters)
endPoint
- the API end pointpathSegments
- the path segments for a specific API callpathParameters
- the path parameters for a specific API callpublic okhttp3.Request build()
public java.lang.String toString()
toString
in class java.lang.Object
public RequestBuilder body(okhttp3.RequestBody body)
body
- the bodypublic RequestBuilder bodyContent(java.lang.String content, java.lang.String contentType)
RequestBody
encoded with UTF-8content
- the content to POST/PUTcontentType
- the HTTP contentType to use.public RequestBuilder bodyJson(com.google.gson.JsonObject json)
RequestBody
encoded with UTF-8 and use "application/json"
as Content-Typejson
- the JsonObject jsonpublic RequestBuilder form(java.lang.Object... args)
args
- a list of name-value form parameterspublic RequestBuilder header(java.lang.Object... args)
args
- a list of name-value headerspublic RequestBuilder query(java.lang.Object... args)
args
- a list of name-value query parameters