<commit_before>package drive.api;

import com.google.api.services.drive.Drive;
import com.google.api.services.drive.model.Change;
import com.google.api.services.drive.model.ChangeList;
import com.google.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.List;
import java.util.ArrayList;

/**
 * ChangeService - Retrieve the list of changes
 *
 * <NAME> <<EMAIL>>
 */
public class ChangeService {

    private static Logger logger = LoggerFactory.getLogger(ChangeService.class);

    private DriveService driveService;

    public ChangeService(){}

    @Inject
    public ChangeService(DriveService driveService){
        this.driveService = driveService;
    }

    /**
     * Retrieve a list of Change resources.
     *
     * @param startChangeId ID of the change to start retrieving subsequent changes from or {@code null}.
     *
     * @return List of Change resources.
     */
    public List<Change> getAll(Long startChangeId) throws IOException {
        List<Change> result = new ArrayList<Change>();
        Drive.Changes.List request = driveService.getDrive().changes().list();

        if (startChangeId != null) {
            request.setStartChangeId(startChangeId);
        }
        do {
            try {
                ChangeList changes = request.execute();

                result.addAll(changes.getItems());
                request.setPageToken(changes.getNextPageToken());
            } catch (IOException e) {
                System.out.println("An error occurred: " + e);
                request.setPageToken(null);
            }
        } while (request.getPageToken() != null &&
                request.getPageToken().length() > 0);

        return result;
    }

    public Change get(String changeId) {
        Change result = null;

        try {
            Change change = driveService.getDrive().changes().get(changeId).execute();

            result = change;
        } catch (IOException e) {
            logger.error(e.getMessage());
        }

        return result;
    }
}<commit_msg>Update to V3<commit_after>package drive.api;

import com.google.api.services.drive.Drive;
import com.google.api.services.drive.model.Change;
import com.google.api.services.drive.model.ChangeList;
import com.google.api.services.drive.model.StartPageToken;
import com.google.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.List;
import java.util.ArrayList;

/**
 * ChangeService - Retrieve the list of changes
 *
 * <NAME> <<EMAIL>>
 */
public class ChangeService {
    private static Logger logger = LoggerFactory.getLogger(ChangeService.class);
    private DriveService driveService;
    private String fields;
    public ChangeService(){}

    @Inject
    public ChangeService(DriveService driveService){
        this.driveService = driveService;
        fields = "changes,kind,newStartPageToken,nextPageToken";
    }

    /**
     * Retrieve a list of Change resources.
     *
     * @param startPageToken ID of the change to start retrieving subsequent changes from or {@code null}.
     *
     * @return List of Change resources.
     */
    public List<Change> getAll(String startPageToken) throws IOException {
        List<Change> result = new ArrayList<>();

        Drive.Changes.List request = driveService.getDrive().changes().list(startPageToken).setFields(fields);

        do {
            try {
                ChangeList changes = request.execute();
                result.addAll(changes.getChanges());
                request.setPageToken(changes.getNextPageToken());
            } catch (IOException e) {
                System.out.println("An error occurred: " + e);
                request.setPageToken(null);
            }
        } while (request.getPageToken() != null &&
                request.getPageToken().length() > 0);

        return result;
    }

    public StartPageToken getStartPageToken(){
        try {
            return driveService.getDrive().changes().getStartPageToken().execute();
        } catch (IOException exception){
            logger.error("Cannot retrieve getStartPageToken");
        }

        return null;
    }
}
{'fraction_non_alphanumeric': 0.10877275951761646, 'fraction_numerical': 0.001655237644833294, 'mean_word_length': 2.542713567839196, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3619758', 'n_tokens_mistral': 1144, 'n_tokens_neox': 1104, 'n_words': 262}