grammarbot-io

Crates.iogrammarbot-io
lib.rsgrammarbot-io
version1.0.1
sourcesrc
created_at2021-02-20 13:05:23.286439
updated_at2021-02-20 13:20:54.115757
descriptionThis crate allows you to check your texts for grammar using the grammarbot service.
homepage
repositoryhttps://github.com/vityafx/grammarbot-io
max_upload_size
id357997
size40,897
Shockingly Good (iddm)

documentation

https://docs.rs/grammarbot-io/

README

Build status Crates Docs MIT licensed

Grammarbot.io

Easy to use API for performing requests to the GrammarBot.io API for checking your grammar in your sentences.

Usage

  1. Obtain the API key
  2. Use the library:
fn main() {
    let string = "Hello this grammarbot-io world!";
    let mut r = grammarbot-io::Request::from(string);
    // With an API key:
    println!("Response: {:#?}", r.api_key("99999999").send());
}

Examples

You may run an example which uses an environment variable API_KEY:

fn main() {
    use std::env;

    let string = "Hello this grammarbot-io world!";
    let mut r = grammarbot-io::Request::from(string);
    // With an API key:
    println!(
        "Response: {:#?}",
        r.api_key(env::var("API_KEY").expect("The API_KEY variable should be set."))
            .send()
    );
}

by running

API_KEY=<YOUR API KEY> cargo run --example run_with_env

Features

The crate contains the only one feature: client which currently uses reqwest crate to perform requests. If you don't want to use this feature, or you don't want the crate to fetch the network-related dependencies and link against them, you may perform the requests yourself, using the HttpRequest structure, which contains all necessary information to perform the request, and can be easily created from the grammarbot-io::Request object.

License

This project is licensed under the MIT license.

Commit count: 23

cargo fmt