setPosition method

Future<Empty> setPosition(
  1. String volumeId,
  2. String position,
  3. String timestamp, {
  4. String? action,
  5. String? contentVersion,
  6. String? deviceCookie,
  7. String? source,
  8. String? $fields,
})

Sets my reading position information for a volume.

Request parameters:

volumeId - ID of volume for which to update the reading position.

position - Position string for the new volume reading position.

timestamp - RFC 3339 UTC format timestamp associated with this reading position.

action - Action that caused this reading position to be set. Possible string values are:

  • "ACTION_UNDEFINED"
  • "bookmark" : User chose bookmark within volume.
  • "chapter" : User selected chapter from list.
  • "next-page" : Next page event.
  • "prev-page" : Previous page event.
  • "scroll" : User navigated to page.
  • "search" : User chose search results within volume.

contentVersion - Volume content version for which this reading position applies.

deviceCookie - Random persistent device cookie optional on set position.

source - String to identify the originator of this request.

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

Completes with a Empty.

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<Empty> setPosition(
  core.String volumeId,
  core.String position,
  core.String timestamp, {
  core.String? action,
  core.String? contentVersion,
  core.String? deviceCookie,
  core.String? source,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'position': [position],
    'timestamp': [timestamp],
    if (action != null) 'action': [action],
    if (contentVersion != null) 'contentVersion': [contentVersion],
    if (deviceCookie != null) 'deviceCookie': [deviceCookie],
    if (source != null) 'source': [source],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'books/v1/mylibrary/readingpositions/' +
      commons.escapeVariable('$volumeId') +
      '/setPosition';

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