syncCalendar method

Future<CalendarSyncResponse?> syncCalendar({
  1. bool? wait,
})

Trigger a sync across connected calendar accounts.

Enqueues sync jobs (one per connected calendar account) and returns immediately with the job ids. Pass ?wait=true to block until all jobs complete (10-second polling budget); the response is then 200 with waited: true and a timed_out flag if any job didn't finish in time.

Parameters:

  • bool wait: Block until all sync jobs finish (10s timeout).

Implementation

Future<CalendarSyncResponse?> syncCalendar({ bool? wait, }) async {
  final response = await syncCalendarWithHttpInfo( wait: wait, );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'CalendarSyncResponse',) as CalendarSyncResponse;

  }
  return null;
}