renew method

Future<Watch> renew(
  1. RenewWatchRequest request,
  2. String formId,
  3. String watchId, {
  4. String? $fields,
})

Renew an existing watch for seven days.

The state of the watch after renewal is ACTIVE, and the expire_time is seven days from the renewal. Renewing a watch in an error state (e.g. SUSPENDED) succeeds if the error is no longer present, but fail otherwise. After a watch has expired, RenewWatch returns NOT_FOUND.

request - The metadata request object.

Request parameters:

formId - Required. The ID of the Form.

watchId - Required. The ID of the Watch to renew.

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

Completes with a Watch.

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<Watch> renew(
  RenewWatchRequest request,
  core.String formId,
  core.String watchId, {
  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_ = 'v1/forms/' +
      commons.escapeVariable('$formId') +
      '/watches/' +
      commons.escapeVariable('$watchId') +
      ':renew';

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