@ -5,7 +5,7 @@ use std::fmt;
/// let app = AppBuilder {
/// let app = AppBuilder {
/// client_name: "mammut_test",
/// client_name: "mammut_test",
/// redirect_uris: "urn:ietf:wg:oauth:2.0:oob",
/// redirect_uris: "urn:ietf:wg:oauth:2.0:oob",
/// scopes: Scope::Read,
/// scopes: Scopes ::Read,
/// website: None,
/// website: None,
/// };
/// };
/// ```
/// ```
@ -18,7 +18,7 @@ pub struct AppBuilder<'a> {
/// (for no redirect, use `urn:ietf:wg:oauth:2.0:oob`)
/// (for no redirect, use `urn:ietf:wg:oauth:2.0:oob`)
pub redirect_uris : & ' a str ,
pub redirect_uris : & ' a str ,
/// Permission scope of the application.
/// Permission scope of the application.
pub scopes : Scope ,
pub scopes : Scopes ,
/// URL to the homepage of your application.
/// URL to the homepage of your application.
#[ serde(skip_serializing_if= " Option::is_none " ) ]
#[ serde(skip_serializing_if= " Option::is_none " ) ]
pub website : Option < & ' a str > ,
pub website : Option < & ' a str > ,
@ -27,7 +27,7 @@ pub struct AppBuilder<'a> {
/// Permission scope of the application.
/// Permission scope of the application.
/// [Details on what each permission provides](//github.com/tootsuite/documentation/blob/master/Using-the-API/OAuth-details.md)
/// [Details on what each permission provides](//github.com/tootsuite/documentation/blob/master/Using-the-API/OAuth-details.md)
#[ derive(Debug, Clone, Copy, Serialize) ]
#[ derive(Debug, Clone, Copy, Serialize) ]
pub enum Scope {
pub enum Scopes {
/// All Permissions, equivalent to `read write follow`
/// All Permissions, equivalent to `read write follow`
#[ serde(rename = " read write follow " ) ]
#[ serde(rename = " read write follow " ) ]
All ,
All ,
@ -51,23 +51,23 @@ pub enum Scope {
WriteFollow ,
WriteFollow ,
}
}
impl fmt ::Display for Scope {
impl fmt ::Display for Scopes {
fn fmt ( & self , f : & mut fmt ::Formatter ) -> fmt ::Result {
fn fmt ( & self , f : & mut fmt ::Formatter ) -> fmt ::Result {
use self ::Scope ::* ;
use self ::Scopes ::* ;
write! ( f , "{}" , match * self {
write! ( f , "{}" , match * self {
All = > "read write follow" ,
All = > "read%20write%20 follow" ,
Follow = > "follow" ,
Follow = > "follow" ,
Read = > "read" ,
Read = > "read" ,
ReadFollow = > "read follow" ,
ReadFollow = > "read%20 follow" ,
ReadWrite = > "read write" ,
ReadWrite = > "read%20 write" ,
Write = > "write" ,
Write = > "write" ,
WriteFollow = > "write follow"
WriteFollow = > "write%20 follow"
} )
} )
}
}
}
}
impl Default for Scope {
impl Default for Scopes {
fn default ( ) -> Self {
fn default ( ) -> Self {
Scope ::Read
Scopes ::Read
}
}
}
}