Struct orca::app::App[][src]

pub struct App { /* fields omitted */ }

A reddit object

Usage:

To create a new instance, use Reddit::new()

Methods

impl App
[src]

Loads a thing and casts it to the type of anything as long as it implements the Thing trait. Experimental

Arguments

  • fullame - fullname of the thing

Get the posts in a subreddit sorted in a specific way

Arguments

  • sub - Name of subreddit to query
  • sort - Sort method of query

Returns

A result containing a json listing of posts

Important traits for Comments<'a>

Get a iterator of all comments in order of being posted

Arguments

  • sub - Name of the subreddit to pull comments from. Can be 'all' to pull from all of reddit

Gets the most recent comments in a subreddit. This function is also usually called internally but can be called if a one time retrieval of recent comments from a subreddit is necessary

Arguments

  • sub - Subreddit to load recent comments from
  • limit - Optional limit to amount of comments loaded
  • before - Optional comment to be the starting point for the next comments loaded

Returns

A listing of comments that should be flat (no replies)

Loads the comment tree of a post, returning a listing of the Comment enum, which can be either Loaded or NotLoaded

Arguments

  • post - The name of the post to retrieve the tree from

Returns

A fully populated listing of commments (no more values)

impl App
[src]

Comment on a thing. The thing can be a post, a comment, or a private message

Arguments

  • text - The body of the comment
  • thing - Fullname of the thing to comment on

Load more comments from a comment tree that is not completely loaded. This function at the moment can only be called internally due to requiring morechildren_id that is not available in the Thread type.

Arguments

  • link_id - The id of the post that has the comments that are being loaded
  • morechildren_id - The id of the morechildren object that is being loaded
  • comments - Slice of &strs that are the ids of the comments to be loaded

Sticky a post in a subreddit. Does nothing if the post is already stickied

Arguments

  • sticky - boolean value. True to set post as sticky, false to unset post as sticky
  • slot - Optional slot number to fill (can only be 1 or 2, and will error otherwise)
  • id - fullname of the post to sticky

Submit a self post

Arguments

  • sub - Name of the subreddit to submit a post to
  • title - Title of the post
  • text - Body of the post
  • sendreplies - Whether replies should be forwarded to the inbox of the submitter

Returns

A result with reddit's json response to the submission

impl App
[src]

Send a private message to a user

Arguments

  • to - Name of the user to send a message to
  • subject - Subject of the message
  • body - Body of the message

impl App
[src]

Authorize this app as a script

Arguments

  • id - The app id registered on Reddit
  • secret - The app secret registered on Reddit
  • username - The username of the user to authorize as
  • password - The password of the user to authorize as

Authorize this app as an installed app

Arguments

  • conn - A reference to the connection to authorize
  • id - The app id registered on Reddit
  • redirect - The app redirect URI registered on Reddit
  • response_gen - An optional function that generates a hyper Response to give to the user based on the result of the authorization attempt. The signature is (Result<String, InstalledAppError) -> Result<Response, Response>. The result passed in is either Ok with the code recieved, or Err with the error that occurred. The value returned should usually be an Ok(Response), but you can return Err(Response) to indicate that an error occurred within the function.
  • scopes - A reference to a Scopes instance representing the capabilites you are requesting as an installed app.

impl App
[src]

Gets information about a user that is not currently authorized

Arguments

  • name - username of the user to query

Returns

A json value containing the user info

impl App
[src]

Get info of the user currently authorized

Note: requires connection to be authorized

Returns

A result with the json value of the user data

impl App
[src]

Create a new reddit instance

Arguments

  • appname - Unique app name
  • appversion - App version
  • appauthor - Auther of the app

Returns

A new reddit object

Sets the method to use for ratelimiting.

Arguments

  • limit - The method to use for ratelimiting

Auto Trait Implementations

impl !Send for App

impl !Sync for App