patch method

Future<OneTimeProduct> patch(
  1. OneTimeProduct request,
  2. String packageName,
  3. String productId, {
  4. bool? allowMissing,
  5. String? latencyTolerance,
  6. String? regionsVersion_version,
  7. String? updateMask,
  8. String? $fields,
})

Creates or updates a one-time product.

request - The metadata request object.

Request parameters:

packageName - Required. Immutable. Package name of the parent app.

productId - Required. Immutable. Unique product ID of the product. Unique within the parent app. Product IDs must start with a number or lowercase letter, and can contain numbers (0-9), lowercase letters (a-z), underscores (_), and periods (.).

allowMissing - Optional. If set to true, and the one-time product with the given package_name and product_id doesn't exist, the one-time product will be created. If a new one-time product is created, update_mask is ignored.

latencyTolerance - Optional. The latency tolerance for the propagation of this product upsert. Defaults to latency-sensitive. Possible string values are:

  • "PRODUCT_UPDATE_LATENCY_TOLERANCE_UNSPECIFIED" : Defaults to PRODUCT_UPDATE_LATENCY_TOLERANCE_LATENCY_SENSITIVE.
  • "PRODUCT_UPDATE_LATENCY_TOLERANCE_LATENCY_SENSITIVE" : The update will propagate to clients within several minutes on average and up to a few hours in rare cases. Throughput is limited to 7,200 updates per app per hour.
  • "PRODUCT_UPDATE_LATENCY_TOLERANCE_LATENCY_TOLERANT" : The update will propagate to clients within 24 hours. Supports high throughput of up to 720,000 updates per app per hour using batch modification methods.

regionsVersion_version - Required. A string representing the version of available regions being used for the specified resource. Regional prices and latest supported version for the resource have to be specified according to the information published in this article. Each time the supported locations substantially change, the version will be incremented. Using this field will ensure that creating and updating the resource with an older region's version and set of regional prices and currencies will succeed even though a new version is available.

updateMask - Required. The list of fields to be updated.

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

Completes with a OneTimeProduct.

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<OneTimeProduct> patch(
  OneTimeProduct request,
  core.String packageName,
  core.String productId, {
  core.bool? allowMissing,
  core.String? latencyTolerance,
  core.String? regionsVersion_version,
  core.String? updateMask,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (allowMissing != null) 'allowMissing': ['${allowMissing}'],
    if (latencyTolerance != null) 'latencyTolerance': [latencyTolerance],
    if (regionsVersion_version != null)
      'regionsVersion.version': [regionsVersion_version],
    if (updateMask != null) 'updateMask': [updateMask],
    if ($fields != null) 'fields': [$fields],
  };

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

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