findSyncs method

  1. @override
Future<FindSyncsResponse> findSyncs({
  1. SyncType? type,
  2. String? target,
  3. Set<SyncStatus>? status,
  4. DateTime? createdBefore,
  5. DateTime? updatedBefore,
})

Returns a filtered FindSyncsResponse with a list of syncs

  • type: The target type
  • target: The target
  • status: A list of status
  • createdBefore: Syncs created before this date
  • updatedBefore: Syncs updated before this date

Upon success a list of Sync objects is provided as well as the overall number of records in total (not the number of syncs in the list, the number of total results). The error is set to null

In case of error a ResponseError is set and no Sync list is provided

Implementation

@override
Future<FindSyncsResponse> findSyncs(
    {SyncType? type,
    String? target,
    Set<SyncStatus>? status,
    DateTime? createdBefore,
    DateTime? updatedBefore}) {
  return catchSqlError<FindSyncsResponse>(
      store.syncDao
          .find(
              type: type,
              target: target,
              status: status,
              createdBefore: createdBefore,
              updatedBefore: updatedBefore)
          .then((results) => FindSyncsResponse(
              syncs: results
                  .map((sync) => FindSyncResponse(sync: sync))
                  .toList())),
      (sqle) => FindSyncsResponse(
          error: toResponseError(sqle, context: contextSync)),
      options);
}