<commit_before>import http from '@/service/http'

class DocumentService {

    async retrieve(id, full = false) {
        return (await http.get(`/documents/${id}`, { full })).data
    }

    async create(parentId, name) {
        return (await http.post("/documents", { parentId, name })).data
    }

    async upload(id, binary) {
        await http.put("/documents", data)
    }
}

export default new DocumentService()<commit_msg>Fix and enhance document service<commit_after>import http from '@/service/http'

class DocumentService {

    async retrieve(id, full = false) {
        return (await http.get(`/documents/${id}`, { full })).data
    }

    async create(parentId, name, mimeType) {
        return (await http.post("/documents", { parentId, name, mimeType })).data
    }

    async upload(id, binary) {
        await http.put(`/documents/${id}/upload`, binary, {}, 'blob')
    }

    async download(id) {
        return (await http.get(`/documents/${id}/download`, {}, 'blob')).data
    }
}

export default new DocumentService()
{'fraction_non_alphanumeric': 0.15834932821497122, 'fraction_numerical': 0.0, 'mean_word_length': 3.0426356589147288, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7653842', 'n_tokens_mistral': 318, 'n_tokens_neox': 315, 'n_words': 80}