updateSpaceReadState method

Future<SpaceReadState> updateSpaceReadState(
  1. SpaceReadState request,
  2. String name, {
  3. String? updateMask,
  4. String? $fields,
})

Updates a user's read state within a space, used to identify read and unread messages.

For an example, see Update a user's space read state. Requires user authentication.

request - The metadata request object.

Request parameters:

name - Resource name of the space read state. Format: users/{user}/spaces/{space}/spaceReadState Value must have pattern ^users/\[^/\]+/spaces/\[^/\]+/spaceReadState$.

updateMask - Required. The field paths to update. Currently supported field paths: - last_read_time When the last_read_time is before the latest message create time, the space appears as unread in the UI. To mark the space as read, set last_read_time to any value later (larger) than the latest message create time. The last_read_time is coerced to match the latest message create time. Note that the space read state only affects the read state of messages that are visible in the space's top-level conversation. Replies in threads are unaffected by this timestamp, and instead rely on the thread read state.

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

Completes with a SpaceReadState.

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

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

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