<commit_before>import * as _ from 'lodash';

import * as Http from './AtlassianHttp';
import * as StorageService from './../StorageService';
import * as WorklogService from './../WorklogService';

const URL = Http.API_TYPE + '/api/2';
const PROJECT_ENDPOINT = '/project';
const ISSUE_ENDPOINT = "/issue";
const USER_ENDPOINT = '/myself';

export function loginWithCredentials(instanceURL, username, password) {
    let apiKey = Http.createApiKeyFromCredentials(username, password);
    let options = Http.buildHeadersWithApiKey(apiKey);

    return Http.get(instanceURL + URL + USER_ENDPOINT, options)
        .then(response => {
            StorageService.setApiKey(apiKey);
            StorageService.setInstanceURL(instanceURL);
            return response.json();
        })
        .catch(() => {
            return Promise.reject({
                message: 'Login failed'
            });
        });
}

export function isAuth() {
    return !_.isEmpty(StorageService.getApiKey() && StorageService.getUser());
}

export function getProjects() {
    return Http.get(StorageService.getInstanceURL() + URL + PROJECT_ENDPOINT, Http.buildOptions()).then(response => response.json());
}

export function getLatestProjects() {
    let latestProjects = [];
    let latestProjectsIds = [];
    return WorklogService.getLatestWorklogs().then(worklogs => {
        worklogs.map(worklog => {
            if(!latestProjectsIds.includes(worklog.issue.projectId)) {
                let project = this.getProject(worklog.issue.projectId).then(project => project);
                latestProjectsIds.push(worklog.issue.projectId);
                latestProjects.push(project);
            }
        });
        return Promise.all(latestProjects);
    });
}

export function getProject(projectId) {
    let projectEndpoint = "/" + projectId;
    return Http.get(StorageService.getInstanceURL() + URL + PROJECT_ENDPOINT + projectEndpoint, Http.buildOptions()).then(response => response.json());
}

export function getIssues(projectId) {
    let searchQuery = "/search?jql=project=" + projectId;
    return Http.get(StorageService.getInstanceURL() + URL + searchQuery, Http.buildOptions()).then(response => response.json());
}

export function getIssue(issueId) {
    let issueEndpoint = "/" + issueId;
    return Http.get(StorageService.getInstanceURL() + URL + ISSUE_ENDPOINT + issueEndpoint, Http.buildOptions()).then(response => response.json());
}<commit_msg>:bug: Fetch more issues<commit_after>import * as _ from 'lodash';

import * as Http from './AtlassianHttp';
import * as StorageService from './../StorageService';
import * as WorklogService from './../WorklogService';

const URL = Http.API_TYPE + '/api/2';
const PROJECT_ENDPOINT = '/project';
const ISSUE_ENDPOINT = "/issue";
const USER_ENDPOINT = '/myself';

export function loginWithCredentials(instanceURL, username, password) {
    let apiKey = Http.createApiKeyFromCredentials(username, password);
    let options = Http.buildHeadersWithApiKey(apiKey);

    return Http.get(instanceURL + URL + USER_ENDPOINT, options)
        .then(response => {
            StorageService.setApiKey(apiKey);
            StorageService.setInstanceURL(instanceURL);
            return response.json();
        })
        .catch(() => {
            return Promise.reject({
                message: 'Login failed'
            });
        });
}

export function isAuth() {
    return !_.isEmpty(StorageService.getApiKey() && StorageService.getUser());
}

export function getProjects() {
    return Http.get(StorageService.getInstanceURL() + URL + PROJECT_ENDPOINT, Http.buildOptions()).then(response => response.json());
}

export function getLatestProjects() {
    let latestProjects = [];
    let latestProjectsIds = [];
    return WorklogService.getLatestWorklogs().then(worklogs => {
        worklogs.map(worklog => {
            if(!latestProjectsIds.includes(worklog.issue.projectId)) {
                let project = this.getProject(worklog.issue.projectId).then(project => project);
                latestProjectsIds.push(worklog.issue.projectId);
                latestProjects.push(project);
            }
        });
        return Promise.all(latestProjects);
    });
}

export function getProject(projectId) {
    let projectEndpoint = "/" + projectId;
    return Http.get(StorageService.getInstanceURL() + URL + PROJECT_ENDPOINT + projectEndpoint, Http.buildOptions()).then(response => response.json());
}

export function getIssues(projectId) {
    let searchQuery = "/search?jql=project=" + projectId + "&maxResults=1000";
    return Http.get(StorageService.getInstanceURL() + URL + searchQuery, Http.buildOptions()).then(response => response.json());
}

export function getIssue(issueId) {
    let issueEndpoint = "/" + issueId;
    return Http.get(StorageService.getInstanceURL() + URL + ISSUE_ENDPOINT + issueEndpoint, Http.buildOptions()).then(response => response.json());
}
{'fraction_non_alphanumeric': 0.13212908463568093, 'fraction_numerical': 0.0012177795818956768, 'mean_word_length': 3.4881602914389798, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '6617730', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1347, 'n_words': 270}