Struct elefren::registration::Registration [−][src]
pub struct Registration<'a, H: HttpSend = HttpSender> { /* fields omitted */ }
Handles registering your mastodon app to your instance. It is recommended you cache your data struct to avoid registering on every run.
Methods
impl<'a> Registration<'a, HttpSender>
[src]
impl<'a> Registration<'a, HttpSender>
pub fn new<I: Into<String>>(base: I) -> Self
[src]
pub fn new<I: Into<String>>(base: I) -> Self
Construct a new registration process to the instance of the base
url.
use elefren::prelude::*; let registration = Registration::new("https://mastodon.social");
impl<'a, H: HttpSend> Registration<'a, H>
[src]
impl<'a, H: HttpSend> Registration<'a, H>
ⓘImportant traits for &'a mut Rpub fn client_name<I: Into<Cow<'a, str>>>(&mut self, name: I) -> &mut Self
[src]
ⓘImportant traits for &'a mut R
pub fn client_name<I: Into<Cow<'a, str>>>(&mut self, name: I) -> &mut Self
Sets the name of this app
This is required, and if this isn't set then the AppBuilder::build method will fail
ⓘImportant traits for &'a mut Rpub fn redirect_uris<I: Into<Cow<'a, str>>>(&mut self, uris: I) -> &mut Self
[src]
ⓘImportant traits for &'a mut R
pub fn redirect_uris<I: Into<Cow<'a, str>>>(&mut self, uris: I) -> &mut Self
Sets the redirect uris that this app uses
ⓘImportant traits for &'a mut Rpub fn scopes(&mut self, scopes: Scopes) -> &mut Self
[src]
ⓘImportant traits for &'a mut R
pub fn scopes(&mut self, scopes: Scopes) -> &mut Self
Sets the scopes that this app requires
The default for an app is Scopes::Read
ⓘImportant traits for &'a mut Rpub fn website<I: Into<Cow<'a, str>>>(&mut self, website: I) -> &mut Self
[src]
ⓘImportant traits for &'a mut R
pub fn website<I: Into<Cow<'a, str>>>(&mut self, website: I) -> &mut Self
Sets the optional "website" to register the app with
pub fn register<I: TryInto<App>>(&mut self, app: I) -> Result<Registered<H>> where
Error: From<<I as TryInto<App>>::Err>,
[src]
pub fn register<I: TryInto<App>>(&mut self, app: I) -> Result<Registered<H>> where
Error: From<<I as TryInto<App>>::Err>,
Register the given application
use elefren::{apps::App, prelude::*}; let mut app = App::builder(); app.client_name("elefren_test"); let registration = Registration::new("https://mastodon.social").register(app)?; let url = registration.authorize_url()?; // Here you now need to open the url in the browser // And handle a the redirect url coming back with the code. let code = String::from("RETURNED_FROM_BROWSER"); let mastodon = registration.complete(&code)?; println!("{:?}", mastodon.get_home_timeline()?.initial_items);
pub fn build(&mut self) -> Result<Registered<H>>
[src]
pub fn build(&mut self) -> Result<Registered<H>>
Register the application with the server from the base
url.
use elefren::prelude::*; let registration = Registration::new("https://mastodon.social") .client_name("elefren_test") .build()?; let url = registration.authorize_url()?; // Here you now need to open the url in the browser // And handle a the redirect url coming back with the code. let code = String::from("RETURNED_FROM_BROWSER"); let mastodon = registration.complete(&code)?; println!("{:?}", mastodon.get_home_timeline()?.initial_items);
Trait Implementations
impl<'a, H: Debug + HttpSend> Debug for Registration<'a, H>
[src]
impl<'a, H: Debug + HttpSend> Debug for Registration<'a, H>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'a, H: Clone + HttpSend> Clone for Registration<'a, H>
[src]
impl<'a, H: Clone + HttpSend> Clone for Registration<'a, H>
fn clone(&self) -> Registration<'a, H>
[src]
fn clone(&self) -> Registration<'a, H>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl<'a, H> Send for Registration<'a, H> where
H: Send,
impl<'a, H> Send for Registration<'a, H> where
H: Send,
impl<'a, H> Sync for Registration<'a, H> where
H: Sync,
impl<'a, H> Sync for Registration<'a, H> where
H: Sync,