Class PreferenceClient
- java.lang.Object
-
- com.mercadopago.client.MercadoPagoClient
-
- com.mercadopago.client.preference.PreferenceClient
-
public class PreferenceClient extends MercadoPagoClient
Client that use the Preferences APIs.
-
-
Field Summary
-
Fields inherited from class com.mercadopago.client.MercadoPagoClient
defaultHeaders, httpClient
-
-
Constructor Summary
Constructors Constructor Description PreferenceClient()
Default constructor.PreferenceClient(MPHttpClient httpClient)
Constructor used for providing a custom http client.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Preference
create(PreferenceRequest request)
Method responsible for creating preference.Preference
create(PreferenceRequest request, MPRequestOptions requestOptions)
Method responsible for creating preference with request options.Preference
get(String id)
Method responsible for getting preference.Preference
get(String id, MPRequestOptions requestOptions)
Method responsible for getting preference.MPElementsResourcesPage<PreferenceSearch>
search(MPSearchRequest request)
Method responsible for search preference.MPElementsResourcesPage<PreferenceSearch>
search(MPSearchRequest request, MPRequestOptions requestOptions)
Method responsible for search preference.Preference
update(String id, PreferenceRequest request)
Method responsible for updating preference.Preference
update(String id, PreferenceRequest request, MPRequestOptions requestOptions)
Method responsible for updating preference with request options.
-
-
-
Constructor Detail
-
PreferenceClient
public PreferenceClient()
Default constructor. Uses the default http client used by the SDK.
-
PreferenceClient
public PreferenceClient(MPHttpClient httpClient)
Constructor used for providing a custom http client.- Parameters:
httpClient
- httpClient
-
-
Method Detail
-
get
public Preference get(String id) throws MPException, MPApiException
Method responsible for getting preference.- Parameters:
id
- preference id- Returns:
- preference information
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
get
public Preference get(String id, MPRequestOptions requestOptions) throws MPException, MPApiException
Method responsible for getting preference.- Parameters:
id
- preference idrequestOptions
- metadata to customize the request- Returns:
- preference information
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
create
public Preference create(PreferenceRequest request) throws MPException, MPApiException
Method responsible for creating preference.- Parameters:
request
- attributes used to create a preference- Returns:
- preference information
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
create
public Preference create(PreferenceRequest request, MPRequestOptions requestOptions) throws MPException, MPApiException
Method responsible for creating preference with request options.- Parameters:
request
- attributes used to create a preferencerequestOptions
- metadata to customize the request- Returns:
- preference information
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
update
public Preference update(String id, PreferenceRequest request) throws MPException, MPApiException
Method responsible for updating preference.- Parameters:
id
- preference idrequest
- attributes used to create a preference- Returns:
- preference information
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
update
public Preference update(String id, PreferenceRequest request, MPRequestOptions requestOptions) throws MPException, MPApiException
Method responsible for updating preference with request options.- Parameters:
id
- preference idrequest
- attributes used to create a preferencerequestOptions
- metadata to customize the request- Returns:
- preference information
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
search
public MPElementsResourcesPage<PreferenceSearch> search(MPSearchRequest request) throws MPException, MPApiException
Method responsible for search preference.- Parameters:
request
- attributes used to create a preference- Returns:
- list of results
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
search
public MPElementsResourcesPage<PreferenceSearch> search(MPSearchRequest request, MPRequestOptions requestOptions) throws MPException, MPApiException
Method responsible for search preference.- Parameters:
request
- attributes used to create a preferencerequestOptions
- metadata to customize the request- Returns:
- list of results
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
-