/// <summary> /// Updates a preference. /// Just send in <paramref name="request"/> the properties you want to update. /// </summary> /// <param name="id">The preference ID.</param> /// <param name="request">The data to update a preference.</param> /// <param name="requestOptions"><see cref="RequestOptions"/>.</param> /// <returns>The updated preference.</returns> /// <exception cref="MercadoPagoException">If a unexpected exception occurs.</exception> /// <exception cref="MercadoPagoApiException">If the API returns a error.</exception> /// <remarks> /// Check the API documentation /// <a href="https://www.mercadopago.com/developers/en/reference/preferences/_checkout_preferences/put/">here</a>. /// </remarks> public Preference Update( string id, PreferenceRequest request, RequestOptions requestOptions = null) { return(Send($"/checkout/preferences/{id}", HttpMethod.PUT, request, requestOptions)); }
/// <summary> /// Creates a preference as an asynchronous operation. /// </summary> /// <param name="request">The data to create a preference.</param> /// <param name="requestOptions"><see cref="RequestOptions"/>.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A task whose the result is the created preference.</returns> /// <exception cref="MercadoPagoException">If a unexpected exception occurs.</exception> /// <exception cref="MercadoPagoApiException">If the API returns a error.</exception> /// <remarks> /// Check the API documentation /// <a href="https://www.mercadopago.com/developers/en/reference/preferences/_checkout_preferences/post/">here</a>. /// </remarks> public Task <Preference> CreateAsync( PreferenceRequest request, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { return(SendAsync("/checkout/preferences", HttpMethod.POST, request, requestOptions, cancellationToken)); }
/// <summary> /// Updates a preference as an asynchronous operation. /// Just send in <paramref name="request"/> the properties you want to update. /// </summary> /// <param name="id">The preference ID.</param> /// <param name="request">The data to update a preference.</param> /// <param name="requestOptions"><see cref="RequestOptions"/>.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A task whose the result is the updated preference.</returns> /// <exception cref="MercadoPagoException">If a unexpected exception occurs.</exception> /// <exception cref="MercadoPagoApiException">If the API returns a error.</exception> /// <remarks> /// Check the API documentation /// <a href="https://www.mercadopago.com/developers/en/reference/preferences/_checkout_preferences/put/">here</a>. /// </remarks> public Task <Preference> UpdateAsync( string id, PreferenceRequest request, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { return(SendAsync($"/checkout/preferences/{id}", HttpMethod.PUT, request, requestOptions, cancellationToken)); }
/// <summary> /// Creates a preference. /// </summary> /// <param name="request">The data to create a preference.</param> /// <param name="requestOptions"><see cref="RequestOptions"/>.</param> /// <returns>The created preference.</returns> /// <exception cref="MercadoPagoException">If a unexpected exception occurs.</exception> /// <exception cref="MercadoPagoApiException">If the API returns a error.</exception> /// <remarks> /// Check the API documentation /// <a href="https://www.mercadopago.com/developers/en/reference/preferences/_checkout_preferences/post/">here</a>. /// </remarks> public Preference Create( PreferenceRequest request, RequestOptions requestOptions = null) { return(Send("/checkout/preferences", HttpMethod.POST, request, requestOptions)); }