Skip to content

Bin for getting api data on your machine for local data mocking

License

Notifications You must be signed in to change notification settings

fvhockney/here-boy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Here-Boy!

Download data from API endpoints to individual files to use later. I use this for testing my api liberary integrations against actual data from the api in my test mocks.

Written with tokio and hyper for blazing fast concurrency.

Features

  • Configure with a toml file or via cli options.
    • Cli options will override configuration in the toml.
  • Convert toml enpoints entries into json for easy consumption with javaScript mocks
  • Concurrency provided by hyper and tokio
  • Receive feedback when an enpoint is unreachable/unusable

Installation

  1. Clone the repo
  2. cargo build --release
  3. Make sure the binary is in your path
  4. Create your config (must be done manually)
  5. Run and enjoy!

Config Reference

# ./api.toml

base_uri = "https://your.base.uri"

file_path_prefix = "./path/to/save/data/"

[[endpoints]]
uri = "/endpoint/1"
file = "endpoint_1.json"

[[endpoints]]
uri = "/endpoint/2/specific/entry"
file = "endpoint_2_entry.json"

Defaults

Default config location: './api.toml' Default json converstion of config enpoints: './api.json'

Cli Reference

here-boy 0.1.0

USAGE:
    here-boy [FLAGS] [OPTIONS]

FLAGS:
        --convert-config
    -h, --help              Prints help information
    -V, --version           Prints version information
    -v

OPTIONS:
        --base-url <base-uri>
    -c, --config <config>                                   [default: api.toml]
        --converted-config-path <converted-config-path>     [default: api.json]
        --dir <file-path-prefix>

NB

Paths are dumb. The program makes no attempt to merge your base-uri or file-path-prefix intelligently. If you leave off or add a /, that's on you. (for now)

This program is under development, expect changes.

No tests yet, so probably more than a few rough edges.

About

Bin for getting api data on your machine for local data mocking

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages