Skip to content

pascal-chenevas/carbone_cli_rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License: MIT unstable

carbone_cli_rs

this is a CLI-App to communicate with the API of Carbone

Usage

Run from the sources

➜ cargo run -- -h
Simple CLI-App to generate a report and to manage templates using the API of Carbone (http://carbone.io)

Usage: carbone_cli_rs [OPTIONS]

Options:
  -c, --config <FILE>
          a configuration file which contains the api url, timeout and api version
  -j, --json <FILE>
          json data to be rendered
  -t, --template <FILE>
          template file
  -g, --generate-template-id
          template id
  -o, --output <FILE>
          output file for the generated report
  -r, --remove-template <TEMPLATE_ID | FILE>
          remove a template with the given template_id or from a file
  -u, --update
          update a template
  -d, --download-template <TEMPLATE_ID>
          download a template
  -h, --help
          Print help
  -V, --version
          Print version

Examples

Before to start the environment variable CARBONE_TOKEN must be set.

export CARBONE_TOKEN=My_token

(run from the sources)

Create a report

cargo run --  -j test_data/report_data.json -t test_data/template.test.odt -o /tmp/report.pdf

{
  "bytes": 92989,
  "file": "/tmp/report.pdf",
  "state": {
    "Created": true
  }
}

Generate a TemplateId

cargo run -- -g -t test_data/template.test.odt
{
  "file": "test_data/template.test.odt",
  "templateId": "844318fe97904fb0897d4b0a47fbe9bbd1ce5c9624ae694545cbc1877f581d86"
}

Upload a Template

cargo run -- -u -t test_data/template.test.odt

{
  "file": "test_data/template.test.odt",
  "state": {
    "Uploaded": true
  },
  "templateId": "844318fe97904fb0897d4b0a47fbe9bbd1ce5c9624ae694545cbc1877f581d86"
}

Delete a Template

Given a TemplateId

cargo run -- -r 844318fe97904fb0897d4b0a47fbe9bbd1ce5c9624ae694545cbc1877f581d86

Given an existing file

cargo run -- -r test_data/template.test.odt

{
  "state": {
    "Deleted": true
  },
  "templateId": "844318fe97904fb0897d4b0a47fbe9bbd1ce5c9624ae694545cbc1877f581d86"
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages