update method

Future<DataSource> update(
  1. DataSource request,
  2. String userId,
  3. String dataSourceId, {
  4. String? $fields,
})

Updates the specified data source.

The dataStreamId, dataType, type, dataStreamName, and device properties with the exception of version, cannot be modified. Data sources are identified by their dataStreamId.

request - The metadata request object.

Request parameters:

userId - Update the data source for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.

dataSourceId - The data stream ID of the data source to update.

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

Completes with a DataSource.

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<DataSource> update(
  DataSource request,
  core.String userId,
  core.String dataSourceId, {
  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_ = commons.escapeVariable('$userId') +
      '/dataSources/' +
      commons.escapeVariable('$dataSourceId');

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