Class PreapprovalClient
Client that use the Preapproval APIs.
Inherited Members
Namespace: MercadoPago.Client.Preapproval
Assembly: MercadoPago.dll
Syntax
public class PreapprovalClient : MercadoPagoClient<Preapproval>
Constructors
| Edit this page View SourcePreapprovalClient()
Initializes a new instance of the PreapprovalClient class.
Declaration
public PreapprovalClient()
PreapprovalClient(IHttpClient)
Initializes a new instance of the PreapprovalClient class.
Declaration
public PreapprovalClient(IHttpClient httpClient)
Parameters
Type | Name | Description |
---|---|---|
IHttpClient | httpClient | The http client that will be used in HTTP requests. |
PreapprovalClient(IHttpClient, ISerializer)
Initializes a new instance of the PreapprovalClient class.
Declaration
public PreapprovalClient(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. |
PreapprovalClient(ISerializer)
Initializes a new instance of the PreapprovalClient class.
Declaration
public PreapprovalClient(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(PreapprovalCreateRequest, RequestOptions)
Creates a Preapproval.
Declaration
public Preapproval Create(PreapprovalCreateRequest request, RequestOptions requestOptions = null)
Parameters
Type | Name | Description |
---|---|---|
PreapprovalCreateRequest | request | The data to create a Preapproval. |
RequestOptions | requestOptions |
Returns
Type | Description |
---|---|
Preapproval | The created Preapproval. |
Remarks
Check the API documentation here.
Exceptions
Type | Condition |
---|---|
MercadoPagoException | If a unexpected exception occurs. |
MercadoPagoApiException | If the API returns a error. |
CreateAsync(PreapprovalCreateRequest, RequestOptions, CancellationToken)
Creates a Preapproval as an asynchronous operation.
Declaration
public Task<Preapproval> CreateAsync(PreapprovalCreateRequest request, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
PreapprovalCreateRequest | request | The data to create a Preapproval. |
RequestOptions | requestOptions | |
CancellationToken | cancellationToken | Cancellation token. |
Returns
Type | Description |
---|---|
Task<Preapproval> | A task whose the result is the created Preapproval. |
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 a Preapproval by your ID.
Declaration
public Preapproval Get(string id, RequestOptions requestOptions = null)
Parameters
Type | Name | Description |
---|---|---|
string | id | The Preapproval ID. |
RequestOptions | requestOptions |
Returns
Type | Description |
---|---|
Preapproval | The Preapproval. |
Exceptions
Type | Condition |
---|---|
MercadoPagoException | If a unexpected exception occurs. |
MercadoPagoApiException | If the API returns a error. |
GetAsync(string, RequestOptions, CancellationToken)
Get async a Preapproval by your ID.
Declaration
public Task<Preapproval> GetAsync(string id, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | id | The Preapproval ID. |
RequestOptions | requestOptions | |
CancellationToken | cancellationToken | Cancellation token. |
Returns
Type | Description |
---|---|
Task<Preapproval> | A task whose the result is the Preapproval. |
Exceptions
Type | Condition |
---|---|
MercadoPagoException | If a unexpected exception occurs. |
MercadoPagoApiException | If the API returns a error. |
Search(SearchRequest, RequestOptions)
Searches for Preapprovals that match the criteria of AdvancedSearchRequest.
Declaration
public ResultsResourcesPage<Preapproval> Search(SearchRequest request, RequestOptions requestOptions = null)
Parameters
Type | Name | Description |
---|---|---|
SearchRequest | request | The search request parameters. |
RequestOptions | requestOptions |
Returns
Type | Description |
---|---|
ResultsResourcesPage<Preapproval> | A page of Preapprovals. |
Exceptions
Type | Condition |
---|---|
MercadoPagoException | If a unexpected exception occurs. |
MercadoPagoApiException | If the API returns a error. |
SearchAsync(SearchRequest, RequestOptions, CancellationToken)
Searches async for Preapprovals that match the criteria of AdvancedSearchRequest.
Declaration
public Task<ResultsResourcesPage<Preapproval>> SearchAsync(SearchRequest request, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
SearchRequest | request | The search request parameters. |
RequestOptions | requestOptions | |
CancellationToken | cancellationToken | Cancellation token. |
Returns
Type | Description |
---|---|
Task<ResultsResourcesPage<Preapproval>> | A task whose the result is a page of Preapprovals. |
Exceptions
Type | Condition |
---|---|
MercadoPagoException | If a unexpected exception occurs. |
MercadoPagoApiException | If the API returns a error. |
Update(string, PreapprovalUpdateRequest, RequestOptions)
Updates a Preapproval.
Just send in request
the properties you want to update.
Declaration
public Preapproval Update(string id, PreapprovalUpdateRequest request, RequestOptions requestOptions = null)
Parameters
Type | Name | Description |
---|---|---|
string | id | The Preapproval ID. |
PreapprovalUpdateRequest | request | The data to update the Preapproval. |
RequestOptions | requestOptions |
Returns
Type | Description |
---|---|
Preapproval | The updated Preapproval. |
Exceptions
Type | Condition |
---|---|
MercadoPagoException | If a unexpected exception occurs. |
MercadoPagoApiException | If the API returns a error. |
UpdateAsync(string, PreapprovalUpdateRequest, RequestOptions, CancellationToken)
Updates a Preapproval as an asynchronous operation.
Just send in request
the properties you want to update.
Declaration
public Task<Preapproval> UpdateAsync(string id, PreapprovalUpdateRequest request, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | id | The Preapproval ID. |
PreapprovalUpdateRequest | request | The data to update the Preapproval. |
RequestOptions | requestOptions | |
CancellationToken | cancellationToken | Cancellation token. |
Returns
Type | Description |
---|---|
Task<Preapproval> | A task whose the result is the updated Preapproval. |
Exceptions
Type | Condition |
---|---|
MercadoPagoException | If a unexpected exception occurs. |
MercadoPagoApiException | If the API returns a error. |