code: public function sync(string $token = null, Query $query = null): \Generator
      {
          do {
              $result = $token ? $this->continueSync($token) : $this->startSync($query);
  
              yield $result;
  
              $token = $result->getToken();
          } while (!$result->isDone());
      }
docs: @param string|null $token
  @param Query|null  $query
  
  @return \Generator An instance of Result wrapped in a Generator object