getMetadata method

Future<UrlNotificationMetadata> getMetadata({
  1. String? url,
  2. String? $fields,
})

Gets metadata about a Web Document.

This method can only be used to query URLs that were previously seen in successful Indexing API notifications. Includes the latest UrlNotification received via this API.

Request parameters:

url - URL that is being queried.

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

Completes with a UrlNotificationMetadata.

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<UrlNotificationMetadata> getMetadata({
  core.String? url,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (url != null) 'url': [url],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'v3/urlNotifications/metadata';

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