8 releases (breaking)

Uses old Rust 2015

0.7.0 Dec 16, 2018
0.6.0 Jul 25, 2018
0.5.0 Feb 10, 2018
0.4.1 Dec 29, 2017
0.0.2 Aug 21, 2017

#1263 in Web programming

Download history 1/week @ 2023-12-18 10/week @ 2024-02-12 61/week @ 2024-02-26 24/week @ 2024-03-04 28/week @ 2024-03-11 15/week @ 2024-03-18

128 downloads per month
Used in reddit-fs

MPL-2.0 license

75KB
1.5K SLoC

orca

A simple reddit API interface for Rust

Features Implemented:

  • Comment streams from entire subreddits
  • Comment tree traversing
  • Oauth script authorization
  • Oauth installed app authorization
  • Self post submissions
  • User info
  • Comment data structure
  • Listing data structure
  • Comment submissions
  • Automatic ratelimiting (steady and burst)
  • Failure for error handling

Features Todo (nonexhaustive):

  • All data structures, or maybe pure json. Consistency is the goal.
  • More reddit api implementation
  • More complete error handling

Contributing

If you've ever made a pull request on github before, you probably know more about it than me. I would really appreciate any help on this project, so if you have an idea on how to improve it, please feel free to submit an issue or pull request.

Example: Recursively traversing a comment tree

fn print_tree(listing: Listing<Comment>, level: i32) {
	for comment in listing {
	    for _ in 0..level {
		    print!("\t");
		}
		println!("Comment by {}", comment.author);
		print_tree(comment.replies, level + 1);
	}
}

print_tree(tree, 0);

Example: Authorizing as OAuth Script type

let mut app = App::new("appnamehere", "v0.1.0", "/u/usernamehere/").unwrap();
app.authorize_script(id, secret, username, password).unwrap();

In order to send HTTPS requests, this library depends on openssl-sys, which requires openssl development libraries to be installed on your system to build the project. Instructions detailing this process can be found here

Generic Notice: This is an unstable project yadda yadda yadda use it if you dare thanks

Dependencies

~14–26MB
~397K SLoC