<commit_before># Copyright (c) 2015 <NAME> <<EMAIL>>

{ URL } = require "./constants/API"
request = require "superagent/lib/client"
prefix  = (require "superagent-prefix") URL

module.exports =

  search: (txt='', cats=[], cb) ->
    unless txt.length > 0
      cb (new Error "invalid search text")
    else
      request
        .get '/entries'
        .use prefix
        .query search: txt.trim().split ' '
        .query 'categories=' + cats.join ','
        .set 'Accept', 'application/json'
        .end cb
    undefined

  getEntries: (ids=[], cb) ->
    ids = [ids] unless Array.isArray ids
    unless ids.length > 0
      cb (new Error "no IDs were passed")
    else
      request
        .get '/entries/' + ids.join ','
        .use prefix
        .set 'Accept', 'application/json'
        .end cb
    undefined

  saveNewEntry: (e, cb) ->
    request<commit_msg>adjusted web api<commit_after># Copyright (c) 2015 <NAME> <<EMAIL>>

{ URL } = require "./constants/API"
request = require "superagent/lib/client"
prefix  = (require "superagent-prefix") URL

module.exports =

  search: (txt='', cats=[], cb) ->
    unless txt.length > 0
      cb (new Error "invalid search text")
    else
      request
        .get '/search'
        .use prefix
        .query entries: txt.trim().split ' '
        .query 'categories=' + cats.join ','
        .set 'Accept', 'application/json'
        .end cb
    undefined

  getEntries: (ids=[], cb) ->
    ids = [ids] unless Array.isArray ids
    unless ids.length > 0
      cb (new Error "no IDs were passed")
    else
      request
        .get '/entries/' + ids.join ','
        .use prefix
        .set 'Accept', 'application/json'
        .end cb
    undefined

  saveNewEntry: (e, cb) ->
    request
{'fraction_non_alphanumeric': 0.14408233276157806, 'fraction_numerical': 0.00686106346483705, 'mean_word_length': 2.108348134991119, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, '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': '761208', 'n_tokens_mistral': 552, 'n_tokens_neox': 534, 'n_words': 167}