From 28a70a8584f530345d6e7cf8076192a07de4be06 Mon Sep 17 00:00:00 2001 From: Catarina Lopes Date: Wed, 19 Dec 2018 18:05:10 +0000 Subject: [PATCH] Add branch param to request --- index.js | 8 ++++++-- package.json | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index cef582c..785e54f 100755 --- a/index.js +++ b/index.js @@ -43,7 +43,7 @@ function loadConfig () { return phrase; } -function getPhraseAppQueryParams (tag, fallbackLocale) { +function getPhraseAppQueryParams (tag, fallbackLocale, branch) { const queryParams = { file_format: 'react_simple_json', tag, @@ -54,6 +54,10 @@ function getPhraseAppQueryParams (tag, fallbackLocale) { queryParams.fallback_locale_id = fallbackLocale; } + if (branch) { + queryParams.branch = branch; + } + return Object.keys(queryParams) .map(key => `${key}=${queryParams[key]}`) .join('&'); @@ -76,7 +80,7 @@ async function loadLocale (phrase) { phrase.access_token }@api.phraseapp.com/api/v2/projects/${phrase.project_id}/locales/${ locale.locale_id - }/download?${getPhraseAppQueryParams(tag, locale.fallback_locale_id)}`; + }/download?${getPhraseAppQueryParams(tag, locale.fallback_locale_id, phrase.branch)}`; request.get(url, (error, response, body) => { if (!error && response.statusCode === 200) { fs.writeFileSync( diff --git a/package.json b/package.json index d68226f..45f99ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "phraseapp-cli", - "version": "2.3.0", + "version": "2.4.0", "description": "", "main": "index.js", "bin": {