add method Null safety

Future<void> add(
  1. String siteUrl,
  2. {String? $fields}
)

Adds a site to the set of the user's sites in Search Console.

Request parameters:

siteUrl - The URL of the site to add.

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

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<void> add(
  core.String siteUrl, {
  core.String? $fields,
}) async {
  final _queryParams = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  final _url = 'webmasters/v3/sites/' + commons.escapeVariable('$siteUrl');

  await _requester.request(
    _url,
    'PUT',
    queryParams: _queryParams,
    downloadOptions: null,
  );
}