patch method

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

Updates an existing subscription.

request - The metadata request object.

Request parameters:

packageName - Immutable. Package name of the parent app.

productId - Immutable. Unique product ID of the product. Unique within the parent app. Product IDs must be composed of lower-case letters (a-z), numbers (0-9), underscores (_) and dots (.). It must start with a lower-case letter or number, and be between 1 and 40 (inclusive) characters in length.

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

latencyTolerance - Optional. The latency tolerance for the propagation of this product update. 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 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. The latest version is 2022/02.

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

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

Completes with a Subscription.

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<Subscription> patch(
  Subscription 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') +
      '/subscriptions/' +
      commons.escapeVariable('$productId');

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