MapsSearchClientBuilder Class

  • java.lang.Object
    • com.azure.maps.search.MapsSearchClientBuilder

Implements

public final class MapsSearchClientBuilder
implements AzureKeyCredentialTrait<MapsSearchClientBuilder>, AzureSasCredentialTrait<MapsSearchClientBuilder>, TokenCredentialTrait<MapsSearchClientBuilder>, HttpTrait<MapsSearchClientBuilder>, ConfigurationTrait<MapsSearchClientBuilder>, EndpointTrait<MapsSearchClientBuilder>

Builder class used to instantiate both synchronous and asynchronous MapsSearchClient clients.

Example usage

Creating a sync client using a AzureKeyCredential:

// Authenticates using subscription key
 AzureKeyCredential keyCredential = new AzureKeyCredential(System.getenv("SUBSCRIPTION_KEY"));

 // Creates a builder
 MapsSearchClientBuilder builder = new MapsSearchClientBuilder();
 builder.credential(keyCredential);
 builder.httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS));

 // Builds the client
 MapsSearchClient client = builder.buildClient();

Constructor Summary

Constructor Description
MapsSearchClientBuilder()

Default constructor for the builder class.

Method Summary

Modifier and Type Method and Description
MapsSearchClientBuilder addPolicy(HttpPipelinePolicy customPolicy)

Adds a custom Http pipeline policy.

MapsSearchAsyncClient buildAsyncClient()

Builds an instance of SearchAsyncClient async client.

MapsSearchClient buildClient()

Builds an instance of SearchClient sync client.

MapsSearchClientBuilder clientOptions(ClientOptions clientOptions)

Sets The client options such as application ID and custom headers to set on a request.

MapsSearchClientBuilder configuration(Configuration configuration)

Sets The configuration store that is used during construction of the service client.

MapsSearchClientBuilder credential(AzureKeyCredential keyCredential)

Sets the AzureKeyCredential used to authenticate HTTP requests.

MapsSearchClientBuilder credential(AzureSasCredential sasCredential)

Sets the AzureSasCredential used to authenticate HTTP requests.

MapsSearchClientBuilder credential(TokenCredential tokenCredential)

Sets the TokenCredential used to authenticate HTTP requests.

MapsSearchClientBuilder endpoint(String endpoint)

Set endpoint of the service.

MapsSearchClientBuilder httpClient(HttpClient httpClient)

Sets The HTTP client used to send the request.

MapsSearchClientBuilder httpLogOptions(HttpLogOptions httpLogOptions)

Sets The logging configuration for HTTP requests and responses.

MapsSearchClientBuilder mapsClientId(String mapsClientId)

Sets the Azure Maps client id for use with Azure AD Authentication.

MapsSearchClientBuilder pipeline(HttpPipeline pipeline)

Sets The HTTP pipeline to send requests through.

MapsSearchClientBuilder retryOptions(RetryOptions retryOptions)

Sets retry options

MapsSearchClientBuilder retryPolicy(RetryPolicy retryPolicy)

Sets The retry policy that will attempt to retry failed requests, if applicable.

MapsSearchClientBuilder serviceVersion(MapsSearchServiceVersion version)

Sets the MapsSearchServiceVersion that is used when making API requests.

Methods inherited from java.lang.Object

Constructor Details

MapsSearchClientBuilder

public MapsSearchClientBuilder()

Default constructor for the builder class.

Method Details

addPolicy

public MapsSearchClientBuilder addPolicy(HttpPipelinePolicy customPolicy)

Adds a custom Http pipeline policy.

Parameters:

customPolicy - The custom Http pipeline policy to add.

Returns:

the SearchClientBuilder.

buildAsyncClient

public MapsSearchAsyncClient buildAsyncClient()

Builds an instance of SearchAsyncClient async client.

Returns:

an instance of SearchAsyncClient.

buildClient

public MapsSearchClient buildClient()

Builds an instance of SearchClient sync client.

Returns:

an instance of SearchClient.

clientOptions

public MapsSearchClientBuilder clientOptions(ClientOptions clientOptions)

Sets The client options such as application ID and custom headers to set on a request.

Parameters:

clientOptions - the clientOptions value.

Returns:

the SearchClientBuilder.

configuration

public MapsSearchClientBuilder configuration(Configuration configuration)

Sets The configuration store that is used during construction of the service client.

Parameters:

configuration - the configuration value.

Returns:

the SearchClientBuilder.

credential

public MapsSearchClientBuilder credential(AzureKeyCredential keyCredential)

Sets the AzureKeyCredential used to authenticate HTTP requests.

Parameters:

keyCredential - The AzureKeyCredential used to authenticate HTTP requests.

Returns:

The updated MapsSearchClientBuilder object.

credential

public MapsSearchClientBuilder credential(AzureSasCredential sasCredential)

Sets the AzureSasCredential used to authenticate HTTP requests.

Parameters:

sasCredential - The AzureSasCredential used to authenticate HTTP requests.

Returns:

The updated MapsSearchClientBuilder object.

credential

public MapsSearchClientBuilder credential(TokenCredential tokenCredential)

Sets the TokenCredential used to authenticate HTTP requests.

Parameters:

tokenCredential - TokenCredential used to authenticate HTTP requests.

Returns:

The updated MapsSearchClientBuilder object.

endpoint

public MapsSearchClientBuilder endpoint(String endpoint)

Set endpoint of the service.

Parameters:

endpoint - url of the service

Returns:

SearchClientBuilder

httpClient

public MapsSearchClientBuilder httpClient(HttpClient httpClient)

Sets The HTTP client used to send the request.

Parameters:

httpClient - the httpClient value.

Returns:

the SearchClientBuilder.

httpLogOptions

public MapsSearchClientBuilder httpLogOptions(HttpLogOptions httpLogOptions)

Sets The logging configuration for HTTP requests and responses.

Parameters:

httpLogOptions - the httpLogOptions value.

Returns:

the SearchClientBuilder.

mapsClientId

public MapsSearchClientBuilder mapsClientId(String mapsClientId)

Sets the Azure Maps client id for use with Azure AD Authentication. This client id is the account-based GUID that appears on the Azure Maps Authentication page.

More details: Azure Maps AD Authentication

Parameters:

mapsClientId - the clientId value.

Returns:

the SearchClientBuilder.

pipeline

public MapsSearchClientBuilder pipeline(HttpPipeline pipeline)

Sets The HTTP pipeline to send requests through.

Parameters:

pipeline - the pipeline value.

Returns:

the SearchClientBuilder.

retryOptions

public MapsSearchClientBuilder retryOptions(RetryOptions retryOptions)

Sets retry options

Parameters:

retryOptions - the retry options for the client

Returns:

a reference to this MapsSearchClientBuilder

retryPolicy

public MapsSearchClientBuilder retryPolicy(RetryPolicy retryPolicy)

Sets The retry policy that will attempt to retry failed requests, if applicable.

Parameters:

retryPolicy - the retryPolicy value.

Returns:

the SearchClientBuilder.

serviceVersion

public MapsSearchClientBuilder serviceVersion(MapsSearchServiceVersion version)

Sets the MapsSearchServiceVersion that is used when making API requests.

If a service version is not provided, the service version that will be used will be the latest known service version based on the version of the client library being used. If no service version is specified, updating to a newer version of the client library will have the result of potentially moving to a newer service version.

Targeting a specific service version may also mean that the service will return an error for newer APIs.

Parameters:

version - MapsSearchServiceVersion of the service to be used when making requests.

Returns:

the updated MapsSearchClientBuilder object

Applies to