Skip to content

Commit

Permalink
Merge pull request #5 from kununu/add-branch-param
Browse files Browse the repository at this point in the history
Add branch param to request
  • Loading branch information
catarina-lopes-pt authored Dec 21, 2018
2 parents 428f0da + 28a70a8 commit 68fea83
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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('&');
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phraseapp-cli",
"version": "2.3.0",
"version": "2.4.0",
"description": "",
"main": "index.js",
"bin": {
Expand Down

0 comments on commit 68fea83

Please sign in to comment.