Package org.azd.http
Interface ClientRequest.Builder
- All Known Implementing Classes:
ClientRequestBuilder
- Enclosing class:
ClientRequest
public static interface ClientRequest.Builder
Api requests builder.
Call ClientRequest.builder(AccessTokenCredential) for requests that require authentication with access token or
ClientRequest.builder() for requests that doesn't require authentication to create the instance of builder.
The builder is used to build the request information such as request method, query parameters, service, subdomain,
endpoints, headers etc. that are required to call Azure DevOps Api. The base url can be
set by
Instance
which is (dev.azure.com), however this behaviour can be overwritten by
calling baseInstance() on Instance
or by directly setting the request url by calling URI()
on the ClientRequest.Builder
instance.
If the organization name is part of AccessTokenCredential then it is appended with base instance. To override
this default behaviour call noOrganization() and to nullify the project call noProject().-
Method Summary
Modifier and TypeMethodDescriptionReturn the authentication access token credential object.apiVersion
(String apiVersion) Sets the Api version.Represents the service area.baseInstance
(String baseInstance) Sets the base instance.build()
Build and returns a new ClientRequest object.DELETE()
Represents DELETE request method.GET()
Represents the "GET" request method and constructs url for GET calls.HEAD()
Represents HEAD request method.header
(CustomHeader customHeader) Request headers to add.headers
(RequestHeaders requestHeaders) Request headers to add.Represents the service area location and all it's associated components.OPTIONS()
Represents OPTIONS request method.Represents PATCH request method.Represents the POST request method.Represents PUT request method.Appends url with query parameter.Appends the url with query parameter.request()
Returns the request information.request
(RequestInformation requestInfo) Sets the request information to execute.serviceEndpoint
(String key, Object value) Constructs the service endpoint.Sets the complete request url with query parameters.Sets the complete request url with query parameters.
-
Method Details
-
baseInstance
Sets the base instance. Default is set to (dev.azure.com).- Parameters:
baseInstance
- Base instance to set to construct the request url.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
area
Represents the service area.- Parameters:
area
- Pass the value for area. E.g. core or build or git etc.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
location
Represents the service area location and all it's associated components.- Parameters:
locationId
- Pass the location id for service specific area.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
apiVersion
Sets the Api version. ConstantApiVersion
can be used to set the api version. If the version that certain Api demands is not found inApiVersion
then the value can be set manually.- Parameters:
apiVersion
- Api version to set.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
GET
ClientRequest.Builder GET()Represents the "GET" request method and constructs url for GET calls.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
POST
Represents the POST request method.- Parameters:
requestBody
- Request body to set.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
PUT
Represents PUT request method.- Parameters:
requestBody
- Request body to set.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
PATCH
Represents PATCH request method.- Parameters:
requestBody
- Request body to set.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
DELETE
ClientRequest.Builder DELETE()Represents DELETE request method.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
OPTIONS
ClientRequest.Builder OPTIONS()Represents OPTIONS request method.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
HEAD
ClientRequest.Builder HEAD()Represents HEAD request method.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
URI
Sets the complete request url with query parameters.- Parameters:
url
- Request url to set.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
URI
Sets the complete request url with query parameters.- Parameters:
uri
- Request url to set.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
serviceEndpoint
Constructs the service endpoint. This method can be chained to construct a long service endpoint.- Parameters:
key
- Represents the path parameter of the url.value
- Value for the path parameter.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
query
Appends url with query parameter.- Parameters:
name
- Name of the query parameter.value
- Value of the query parameter.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
query
<T> ClientRequest.Builder query(Supplier<T> config, Consumer<T> requestConfig, Function<T, Object> func) Appends the url with query parameter.- Parameters:
config
- Supplier of request configuration instance.requestConfig
- Consumer of request configuration that contains the query parameters.func
- Function of request configuration query parameters that returns any object.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
header
Request headers to add.- Parameters:
customHeader
- Custom header to add.CustomHeader
- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
headers
Request headers to add.- Parameters:
requestHeaders
- Request headers value.RequestHeaders
- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
request
Sets the request information to execute.- Parameters:
requestInfo
- Request information object.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
request
RequestInformation request()Returns the request information.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
accessTokenCredential
AccessTokenCredential accessTokenCredential()Return the authentication access token credential object.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-
build
ClientRequest build()Build and returns a new ClientRequest object.- Returns:
- ClientRequest.Builder.
ClientRequest.Builder
-