insert method

Future<InAppProduct> insert(
  1. InAppProduct request,
  2. String packageName, {
  3. bool? autoConvertMissingPrices,
  4. String? $fields,
})

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

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

request - The metadata request object.

Request parameters:

packageName - Package name of the app.

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> insert(
  InAppProduct request,
  core.String packageName, {
  core.bool? autoConvertMissingPrices,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (autoConvertMissingPrices != null)
      'autoConvertMissingPrices': ['${autoConvertMissingPrices}'],
    if ($fields != null) 'fields': [$fields],
  };

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

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