#pastebin #com #content #api #expiration #format #access

pastebin_rust_api

Library for posting content to pastebin.com

2 releases

Uses old Rust 2015

0.5.14 Aug 26, 2021
0.5.13 Aug 29, 2017
0.5.12 May 31, 2017
0.4.12 May 22, 2017
0.1.11 May 16, 2017

#10 in #expiration

25 downloads per month

Apache-2.0

30KB
819 lines

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.

Dependencies

~7–15MB
~215K SLoC