updateEmailPreferences method
- EmailPreferences request,
- String name, {
- String? updateMask,
- String? $fields,
Updates the email preferences for a Merchant Center account user.
Advanced account users should specify the advanced account rather than a sub-account of the advanced account. Preferences which are not explicitly selected in the update mask will not be updated. It is invalid for updates to specify an UNCONFIRMED opt-in status value. Use the name=accounts / * /users/me/emailPreferences alias to update preferences for the authenticated user.
request - The metadata request object.
Request parameters:
name - Identifier. The name of the EmailPreferences. The endpoint is
only supported for the authenticated user.
Value must have pattern
^accounts/\[^/\]+/users/\[^/\]+/emailPreferences$.
updateMask - Required. List of fields being updated. The following
fields are supported (in both snake_case and lowerCamelCase): -
news_and_tips
$fields - Selector specifying which fields to include in a partial
response.
Completes with a EmailPreferences.
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<EmailPreferences> updateEmailPreferences(
  EmailPreferences request,
  core.String name, {
  core.String? updateMask,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (updateMask != null) 'updateMask': [updateMask],
    if ($fields != null) 'fields': [$fields],
  };
  final url_ = 'accounts/v1/' + core.Uri.encodeFull('$name');
  final response_ = await _requester.request(
    url_,
    'PATCH',
    body: body_,
    queryParams: queryParams_,
  );
  return EmailPreferences.fromJson(
    response_ as core.Map<core.String, core.dynamic>,
  );
}