patch method

Future<Operation> patch(
  1. DataSource request,
  2. String name, {
  3. bool? debugOptions_enableDebugging,
  4. String? updateMask,
  5. String? $fields,
})

Updates a datasource.

Note: This API requires an admin account to execute.

request - The metadata request object.

Request parameters:

name - The name of the datasource resource. Format: datasources/{source_id}. The name is ignored when creating a datasource. Value must have pattern ^datasources/\[^/\]+$.

debugOptions_enableDebugging - If you are asked by Google to help with debugging, set this field. Otherwise, ignore this field.

updateMask - Only applies to [settings.datasources.patch](https://developers.google.com/cloud-search/docs/reference/rest/v1/settings.datasources/patch). Update mask to control which fields to update. Example field paths: name, displayName. * If update_mask is non-empty, then only the fields specified in the update_mask are updated. * If you specify a field in the update_mask, but don't specify its value in the source, that field is cleared. * If the update_mask is not present or empty or has the value *, then all fields are updated.

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

Completes with a Operation.

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<Operation> patch(
  DataSource request,
  core.String name, {
  core.bool? debugOptions_enableDebugging,
  core.String? updateMask,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (debugOptions_enableDebugging != null)
      'debugOptions.enableDebugging': ['${debugOptions_enableDebugging}'],
    if (updateMask != null) 'updateMask': [updateMask],
    if ($fields != null) 'fields': [$fields],
  };

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

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