The Bureau Works CLI is a NodeJS library that can be used to access the Bureau Works API calls directly from the command-line.
It's possible to create projects, approve, cancel and many other utilities.
Requirements
For you to be able to use the BWX CLI, you first need a Bureau Works account and API KEY. Please visit https://www.bureauworks.com to get your account!
After registering, go to My Account:
Click on "Show My Bureau Works API Token" to generate and get your credentials to access our API:
You will also need NodeJS and git installed in your environment.
For API reference, please visit https://dev.bureau.works that you'll be able to see the main calls.
Installation
Clone our GitHub repository at https://github.com/bureauworks/bwx
$ git clone https://github.com/bureauworks/cli.git
Install dependencies
$ npm i
Make the CLI friends with your shell environment:
$ chmod +x cli.js
Run the Configuration once - this will create a config.json file in your ~/.bwx/ directory.
$ ./cli.js config
You should see a message confirming the file creation now test the API with the CLI!
$ ./cli.js services
$ ./cli.js languages
You can use npm link to allow us to locally ‘symlink a package folder’. If you do so, you can call the CLI anywhere in your system with the bwx shorthand:
$ bwx timezones
$ bwx languages
For the help, use:
$ bwx --help
Or for specific commands, for example, the project creation command:
$ bwx create --help
Updating:
If you already have our API Command Line installed, you can always update it to the latest version.
Once you're inside the repository, run the following commands:
$ git pull https://github.com/bureauworks/cli.git
$ npm link
By doing that, the CLI will pull the latest version from our remote repository.
Commands:
- config - Reads configuration parameters from the command line and saves in ~/.bw/config.json
- languages - Lists the ISO codes of the available languages
- timezones - Lists timezones available in Bureau Works
- services - All the Services and IDs available to request projects in Bureau Works
create [options] - Creates a new Project in Bureau Works, returns a JSON string with IDs and relevant information.
OPTIONS:
- -r, --reference <reference>
↳ Project reference, a string value that you can use to identify this project
- -o, --original <original>
↳ Project source language
- -l, --languages <languages>
↳ Project target languages, ISO codes separated by commas
- -s, --services <services>
↳Long[] with the Service IDs, .e.g, 1 for translation, 3 for transcription; separate with commas
- -n, --note <note>
↳ A descriptive note
- -d, --delivery <longValue>
↳Desired delivery date
Example: $ bwx create -r 'A reference code' -o en_us -l pt_br,es,ru_ru,de_de,fr_fr,it_it -s 1 -n 'Project notes, special instructions, etc.' -d 1535661374000
upload [options] - Uploads a file to a project being prepared for production and quoting in Bureau Works, returns a JSON with the Project and Job ID information.
OPTIONS:
- -p, --project <projectId>
↳ The Project ID
- -s, --service_item <sid>
↳Service Item ID
- -f, --file <file>
↳ The file in the current filesystem
Example: $ bwx upload -p 17530 -s 23207 -f ./files/filename.docx
continuous [options] - Uploads a file to a continuous integration project. This method assumes that you have default target languages setup in your profile. Continuous are approved after a pre-established schedule.
OPTIONS:
- -t, --tag <tag>
↳ A tag to identify this project, e.g., ios, android, etc.
- -r, --reference <reference>
↳A mnemonic or coded reference for your record
- -f, --file <file>
↳The file in the current filesystem
- -l, --languages [languages]
↳Optional, Project target languages, ISO codes separated by commas - if set, will override client-defined preset languages
Example: $ bwx continuous -r 'Some reference' -t android -f ./files/strings.xml
Forcing target languages: $ bwx continuous -r 'Some reference' -t android -f ./files/strings.xml -l pt_br,es_es,fr_fr,de_de
ready [options] - Flags a project as READY, which means you have finished upload files and the system will now quote the project. Returns a JSON with the costs breakdown.
OPTIONS:
- -p, --project <projectId>
↳The Project ID
Example: $ bwx ready -p 17532
approve [options] - Approves a Project in Bureau Works.
OPTIONS:
- -p, --project <projectId>
↳The Project ID
Example: $ bwx approve -p 17532
cancel [options] - Cancels a Project in Bureau Works
OPTIONS:
- -p, --project <projectId>
↳The Project ID
Example: $ bwx cancel -p 17532
project [options] - Loads Project metadata from Bureau Works
OPTIONS:
- -p, --project <projectId>
↳The Project ID
Example: $ bwx project -p 17532
list [options] - Loads a list of Projects from Bureau Works using status as a parameter
OPTIONS:
- -s, --status <status>
↳The Project Status - PREPARING, PENDING, APPROVED, CANCELLED or INVOICED
Example: $ bwx list -s PENDING
costs [options] - Loads the cost structure associated to a given Project
OPTIONS:
- -p, --project <projectId>
↳The Project ID
Example: $ bwx costs -p 17532
items [options] - Loads the items associated to a given Project
OPTIONS:
- -p, --project <projectId>
↳The Project ID
Example: $ bwx items -p 17532
approve-job [options] - Approves a given Job
OPTIONS:
- -p, --project <projectId>
↳The Project ID
- -j, --job <jobId>
↳ The Job ID
Example: $ bwx approve-job -p 17532 -j 87432
reject-job [options] - Rejects a given Job
OPTIONS:
- -p, --project <projectId>
↳The Project ID
- -j, --job <jobId>
↳ The Job ID
Example: $ bwx reject-job -p 17532 -j 87432
download [options] - Downloads a file given a Job ID
OPTIONS:
- -p, --project <projectId>
↳The Project ID
- -j, --job <jobId>
↳The Job ID
- -d, --destination [directory]
↳Optional, if passed to the function will save the file in the given directory
Example: $ bwx download -p 17532 -j 87432 -d /files/repo/
download-continuous [options] - Downloads a file given a tag identification for Continuous Integration projects
OPTIONS:
- -t, --tag <tag>
↳A tag that will identify the project in the pool of CI projects
- -f, --filename <filename>
↳The file name
- -s, --status <status>
↳The job status, use DELIVERED for final files, or APPROVED for partially completed files with both Translation Memory and Machine Translation strings
- -d, --destination [directory]
↳Optional, if passed to the function will save the file in the given directory
Example: $ bwx download-continuous -t android -f strings.xml -s APPROVED
download-by-filename [options] - Alternate download method, uses Project ID, Service Item ID and a filename. This method is useful for odd deliveries, for example, if a delivery file is split into multiple files or if the delivered file has a different format than that of the input
OPTIONS:
- -p, --project <projectId>
↳The Project ID
- -s, --service_item <sid>
↳The Service Item ID
- -f, --filename <filename>
↳The filename, including any preceding path components, e.g., /pt_br/filename.docx
- -d, --destination [directory]
↳Optional, if passed to the function will save the file in the given directory
Example: $ bwx download-by-filename -p 17532 -s 87432 -f pt_br/file.json -d /files/repo/
Comments
0 comments
Please sign in to leave a comment.