<commit_before>class GitLab {
  constructor(args = {}) {
    // remove end of "/"
    const api_path = args.api_path || "";
    this.api_path = api_path.replace(/\/+$/, "");

    this.gitlab_path = args.gitlab_path;
    this.private_token = args.private_token;
    this.polling_second = args.polling_second;
    this.per_page = args.per_page || 100;
    this.projects = null;
    this.avatar_cache = args.avatar_cache;
  }

  static createFromConfig(config, storage) {
    return new GitLab({
      api_path: config.apiPath,
      gitlab_path: config.gitlabPath,
      private_token: config.<PASSWORD>,
      polling_second: config.pollingSecond,
      avatar_cache: new AvatarCache(storage),
    });
  }

  loadProjects() {
    if (this.api_path.length > 0){
      this.projects = null;
      return this.loadProjectsBase(1, []);
    } else {
      this.projects = [];
      return Promise.resolve(this.projects);
    }
  }

  loadProjectsBase(page, all_projects) {
    // List projects
    // GET /projects
    // https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/projects.md#list-projects
    // NOTE: order_by and sort are supported by v7.7.0+. If no options, order_by created_at DESC
    return m.request({
      url: `${this.api_path}/projects`,
      method: "GET",
      data: {
        page: page,
        per_page: this.per_page,
        order_by: "name",
        sort: "asc"
      },
      headers: {
        "PRIVATE-TOKEN": this.private_token
      }
    }).then((projects) => {<commit_msg>Add membership to GET /projects<commit_after>class GitLab {
  constructor(args = {}) {
    // remove end of "/"
    const api_path = args.api_path || "";
    this.api_path = api_path.replace(/\/+$/, "");

    this.gitlab_path = args.gitlab_path;
    this.private_token = args.private_token;
    this.polling_second = args.polling_second;
    this.per_page = args.per_page || 100;
    this.projects = null;
    this.avatar_cache = args.avatar_cache;
  }

  static createFromConfig(config, storage) {
    return new GitLab({
      api_path: config.apiPath,
      gitlab_path: config.gitlabPath,
      private_token: config.privateToken,
      polling_second: config.pollingSecond,
      avatar_cache: new AvatarCache(storage),
    });
  }

  loadProjects() {
    if (this.api_path.length > 0){
      this.projects = null;
      return this.loadProjectsBase(1, []);
    } else {
      this.projects = [];
      return Promise.resolve(this.projects);
    }
  }

  loadProjectsBase(page, all_projects) {
    const data = {
      page: page,
      per_page: this.per_page,
      order_by: "name",
      sort: "asc"
    };

    if (this.apiVersion >= 4) {
      // Until v3, GET /projects returns that user is member.
      // But since v4, GET /projects returns all projects visible to current user, even if the user is not a member.
      // To get projects the user is a member of, use GET /projects?membership=true
      data.membership = true;
    }

    // List projects
    // GET /projects
    // https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/projects.md#list-projects
    // NOTE: order_by and sort are supported by v7.7.0+. If no options, order_by created_at DESC
    return m.request({
      url: `${this.api_path}/projects`,
      method: "GET",
      data: data,
      headers: {
        "PRIVATE-TOKEN": this.private_token
      }
    }).then((projects) => {
{'fraction_non_alphanumeric': 0.1299468399291199, 'fraction_numerical': 0.005611340815121087, 'mean_word_length': 2.542887029288703, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '3545813', 'n_tokens_mistral': 1128, 'n_tokens_neox': 1108, 'n_words': 239}