update method

Future<InAppProduct> update(
  1. InAppProduct request,
  2. String packageName,
  3. String sku, {
  4. bool? allowMissing,
  5. bool? autoConvertMissingPrices,
  6. String? $fields,
})

Updates an in-app product (a managed product or a subscription).

This method should no longer be used to update subscriptions. See this article for more information.

request - The metadata request object.

Request parameters:

packageName - Package name of the app.

sku - Unique identifier for the in-app product.

allowMissing - If set to true, and the in-app product with the given package_name and sku doesn't exist, the in-app product will be created.

autoConvertMissingPrices - If true the prices for all regions targeted by the parent app that don't have a price specified for this in-app product will be auto converted to the target currency based on the default price. Defaults to false.

$fields - Selector specifying which fields to include in a partial response.

Completes with a InAppProduct.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<InAppProduct> update(
  InAppProduct request,
  core.String packageName,
  core.String sku, {
  core.bool? allowMissing,
  core.bool? autoConvertMissingPrices,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (allowMissing != null) 'allowMissing': ['${allowMissing}'],
    if (autoConvertMissingPrices != null)
      'autoConvertMissingPrices': ['${autoConvertMissingPrices}'],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'androidpublisher/v3/applications/' +
      commons.escapeVariable('$packageName') +
      '/inappproducts/' +
      commons.escapeVariable('$sku');

  final response_ = await _requester.request(
    url_,
    'PUT',
    body: body_,
    queryParams: queryParams_,
  );
  return InAppProduct.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}