pastebin_rust_api

Crates.iopastebin_rust_api
lib.rspastebin_rust_api
version0.5.14
sourcesrc
created_at2017-05-16 12:58:47.451472
updated_at2021-08-26 21:45:59.898624
descriptionLibrary for posting content to pastebin.com
homepage
repositoryhttps://github.com/TheUberCatman/pastebin_rust_api
max_upload_size
id14808
size44,256
(Catman155)

documentation

README

Pastebin Rust Api

A Rust wrapper for the Pastebin Api

Installation

Add this to your Cargo.toml pastebin_rust_api = "0.2.11" under [dependencies]

Getting started

Simple usage of Paster:

extern crate pastebin_rust_api;
use pastebin_rust_api::{Paster, Access, Format, Expiration};

fn main() {
    // I recommend to put your dev key into an environment variable called `PASTEBIN_DEVELOPER_TOKEN`.
    let parser = Paster::new(Some("<YOUR DEV KEY>".to_owned()));
    let response = parser.paste("<html></html>",
                                Some(&Access::Private),
                                Some("TestHtml"),
                                Some(&Expiration::TenMinutes),
                                Some(&Format::HTML5),
                                None);
    if response.is_ok() {
        if let Some(paste) = response.ok() {
            // If everything is OK, you can get the url to your code here.
            println!("{}", paste.content);
        }
    }
}

If you want to see examples for all methods, check the test folder.

Commit count: 62

cargo fmt