UNPKG

i18nexus-cli

Version:

Command line interface (CLI) for accessing the i18nexus API

30 lines (23 loc) 696 B
const colors = require('colors'); const handleError = require('../handleError'); const handleFetch = require('../handleFetch'); const baseUrl = require('../baseUrl'); const addString = async opt => { let url = `${baseUrl}/project_resources/base_strings.json`; url += `?api_key=${opt.apiKey}`; const response = await handleFetch(url, { method: 'DELETE', body: JSON.stringify({ id: opt.id }), headers: { Authorization: `Bearer ${opt.pat}`, 'Content-Type': 'application/json' } }); if (response.status !== 204) { return handleError(response); } console.log(colors.green(`Deleted string "${opt.id.key}"`)); }; module.exports = addString;