claim method

Future<Homepage> claim(
  1. ClaimHomepageRequest request,
  2. String name, {
  3. String? $fields,
})

Claims a store's homepage.

Executing this method requires admin access. If the homepage is already claimed, this will recheck the verification (unless the business is exempted from claiming, which also exempts from verification) and return a successful response. If ownership can no longer be verified, it will return an error, but it won't clear the claim. In case of failure, a canonical error message is returned: * PERMISSION_DENIED: User doesn't have the necessary permissions on this Merchant Center account. * FAILED_PRECONDITION: - The account is not a Merchant Center account. - Merchant Center account doesn't have a homepage. - Claiming failed (in this case the error message contains more details).

request - The metadata request object.

Request parameters:

name - Required. The name of the homepage to claim. Format: accounts/{account}/homepage Value must have pattern ^accounts/\[^/\]+/homepage$.

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

Completes with a Homepage.

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

  final url_ = 'accounts/v1/' + core.Uri.encodeFull('$name') + ':claim';

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