Class StitchRequest.Builder
- java.lang.Object
-
- com.mongodb.stitch.core.internal.net.StitchRequest.Builder
-
- Direct Known Subclasses:
StitchAuthRequest.Builder,StitchDocRequest.Builder
- Enclosing class:
- StitchRequest
public static class StitchRequest.Builder extends Object
A builder that can buildStitchRequests.
-
-
Constructor Summary
Constructors Constructor Description Builder()Constructs a new builder.
-
Method Summary
Modifier and Type Method Description StitchRequestbuild()Builds, validates, and returns theStitchRequest.byte[]getBody()Returns a copy of the body that will be sent along with the request.Map<String,String>getHeaders()Returns the headers that will be included in the request.MethodgetMethod()Returns the HTTP method of the request.StringgetPath()Returns the Stitch API path of the request.LonggetTimeout()Returns the number of milliseconds that the underlying transport should spend on an HTTP round trip before failing with an error.StitchRequest.BuilderwithBody(byte[] body)Sets a copy of the body that will be sent along with the request.StitchRequest.BuilderwithHeaders(Map<String,String> headers)Sets the headers that will be included in the request.StitchRequest.BuilderwithMethod(Method method)Sets the HTTP method of the request.StitchRequest.BuilderwithPath(String path)Sets the Stitch API path of the request.StitchRequest.BuilderwithTimeout(Long timeout)Sets the number of milliseconds that the underlying transport should spend on an HTTP round trip before failing with an error.
-
-
-
Method Detail
-
withMethod
public StitchRequest.Builder withMethod(Method method)
Sets the HTTP method of the request.- Parameters:
method- the HTTP method of the request.- Returns:
- the builder.
-
withPath
public StitchRequest.Builder withPath(String path)
Sets the Stitch API path of the request.- Parameters:
path- the Stitch API path of the request.- Returns:
- the builder.
-
withTimeout
public StitchRequest.Builder withTimeout(Long timeout)
Sets the number of milliseconds that the underlying transport should spend on an HTTP round trip before failing with an error. If not configured, a default should override it before the request is transformed into a plain HTTP request.- Parameters:
timeout- the number of milliseconds that the underlying transport should spend on an HTTP round trip before failing with an error.- Returns:
- the builder.
-
withHeaders
public StitchRequest.Builder withHeaders(Map<String,String> headers)
Sets the headers that will be included in the request.- Parameters:
headers- the headers that will be included in the request.- Returns:
- the builder.
-
withBody
public StitchRequest.Builder withBody(byte[] body)
Sets a copy of the body that will be sent along with the request.- Parameters:
body- a copy of the body that will be sent along with the request.- Returns:
- the builder.
-
getMethod
public Method getMethod()
Returns the HTTP method of the request.- Returns:
- the HTTP method of the request.
-
getPath
public String getPath()
Returns the Stitch API path of the request.- Returns:
- the Stitch API path of the request.
-
getTimeout
public Long getTimeout()
Returns the number of milliseconds that the underlying transport should spend on an HTTP round trip before failing with an error. If not configured, a default should override it before the request is transformed into a plain HTTP request.- Returns:
- the number of milliseconds that the underlying transport should spend on an HTTP round trip before failing with an error.
-
getHeaders
public Map<String,String> getHeaders()
Returns the headers that will be included in the request.- Returns:
- the headers that will be included in the request.
-
getBody
public byte[] getBody()
Returns a copy of the body that will be sent along with the request.- Returns:
- a copy of the body that will be sent along with the request.
-
build
public StitchRequest build()
Builds, validates, and returns theStitchRequest.- Returns:
- the built the
StitchRequest.
-
-