Class PreferenceClient
Client that use the Preferences APIs.
Inherited Members
Namespace: MercadoPago.Client.Preference
Assembly: MercadoPago.dll
Syntax
public class PreferenceClient : MercadoPagoClient<Preference>
Constructors
| Edit this page View SourcePreferenceClient()
Initializes a new instance of the PreferenceClient class.
Declaration
public PreferenceClient()
PreferenceClient(IHttpClient)
Initializes a new instance of the PreferenceClient class.
Declaration
public PreferenceClient(IHttpClient httpClient)
Parameters
Type | Name | Description |
---|---|---|
IHttpClient | httpClient | The http client that will be used in HTTP requests. |
PreferenceClient(IHttpClient, ISerializer)
Initializes a new instance of the PreferenceClient class.
Declaration
public PreferenceClient(IHttpClient httpClient, ISerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
IHttpClient | httpClient | The http client that will be used in HTTP requests. |
ISerializer | serializer | The serializer that will be used to serialize the HTTP requests content and to deserialize the HTTP response content. |
PreferenceClient(ISerializer)
Initializes a new instance of the PreferenceClient class.
Declaration
public PreferenceClient(ISerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
ISerializer | serializer | The serializer that will be used to serialize the HTTP requests content and to deserialize the HTTP response content. |
Methods
| Edit this page View SourceCreate(PreferenceRequest, RequestOptions)
Creates a preference.
Declaration
public Preference Create(PreferenceRequest request, RequestOptions requestOptions = null)
Parameters
Type | Name | Description |
---|---|---|
PreferenceRequest | request | The data to create a preference. |
RequestOptions | requestOptions |
Returns
Type | Description |
---|---|
Preference | The created preference. |
Remarks
Check the API documentation here.
Exceptions
Type | Condition |
---|---|
MercadoPagoException | If a unexpected exception occurs. |
MercadoPagoApiException | If the API returns a error. |
CreateAsync(PreferenceRequest, RequestOptions, CancellationToken)
Creates a preference as an asynchronous operation.
Declaration
public Task<Preference> CreateAsync(PreferenceRequest request, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
PreferenceRequest | request | The data to create a preference. |
RequestOptions | requestOptions | |
CancellationToken | cancellationToken | Cancellation token. |
Returns
Type | Description |
---|---|
Task<Preference> | A task whose the result is the created preference. |
Remarks
Check the API documentation here.
Exceptions
Type | Condition |
---|---|
MercadoPagoException | If a unexpected exception occurs. |
MercadoPagoApiException | If the API returns a error. |
Get(string, RequestOptions)
Get async a preference by your ID.
Declaration
public Preference Get(string id, RequestOptions requestOptions = null)
Parameters
Type | Name | Description |
---|---|---|
string | id | The preference id. |
RequestOptions | requestOptions |
Returns
Type | Description |
---|---|
Preference | A task whose the result is the preference. |
Remarks
Check the API documentation here.
Exceptions
Type | Condition |
---|---|
MercadoPagoException | If a unexpected exception occurs. |
MercadoPagoApiException | If the API returns a error. |
GetAsync(string, RequestOptions, CancellationToken)
Get async a preference by your ID.
Declaration
public Task<Preference> GetAsync(string id, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | id | The preference id. |
RequestOptions | requestOptions | |
CancellationToken | cancellationToken | Cancellation token. |
Returns
Type | Description |
---|---|
Task<Preference> | A task whose the result is the preference. |
Remarks
Check the API documentation here.
Exceptions
Type | Condition |
---|---|
MercadoPagoException | If a unexpected exception occurs. |
MercadoPagoApiException | If the API returns a error. |
Update(string, PreferenceRequest, RequestOptions)
Updates a preference.
Just send in request
the properties you want to update.
Declaration
public Preference Update(string id, PreferenceRequest request, RequestOptions requestOptions = null)
Parameters
Type | Name | Description |
---|---|---|
string | id | The preference ID. |
PreferenceRequest | request | The data to update a preference. |
RequestOptions | requestOptions |
Returns
Type | Description |
---|---|
Preference | The updated preference. |
Remarks
Check the API documentation here.
Exceptions
Type | Condition |
---|---|
MercadoPagoException | If a unexpected exception occurs. |
MercadoPagoApiException | If the API returns a error. |
UpdateAsync(string, PreferenceRequest, RequestOptions, CancellationToken)
Updates a preference as an asynchronous operation.
Just send in request
the properties you want to update.
Declaration
public Task<Preference> UpdateAsync(string id, PreferenceRequest request, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | id | The preference ID. |
PreferenceRequest | request | The data to update a preference. |
RequestOptions | requestOptions | |
CancellationToken | cancellationToken | Cancellation token. |
Returns
Type | Description |
---|---|
Task<Preference> | A task whose the result is the updated preference. |
Remarks
Check the API documentation here.
Exceptions
Type | Condition |
---|---|
MercadoPagoException | If a unexpected exception occurs. |
MercadoPagoApiException | If the API returns a error. |