pub struct ClientConfig {
pub host: String,
pub token: String,
pub key: String,
}Fields§
§host: String§token: String§key: StringImplementations§
Source§impl ClientConfig
impl ClientConfig
pub fn new(host: &str, token: &str, key: &str) -> Self
pub fn save_config(&self) -> Result<(), Box<dyn Error>>
pub fn load_config() -> Result<Self, Box<dyn Error>>
pub fn default_host() -> String
Sourcepub fn get_trello_url(
&self,
path: &str,
params: &[(&str, &str)],
) -> Result<Url, ParseError>
pub fn get_trello_url( &self, path: &str, params: &[(&str, &str)], ) -> Result<Url, ParseError>
Gets the resultant URL of the Trello Config given some path and additional
parameters. Authentication is handled via the Authorization header on the
HTTP client, not as query parameters.
let config = trello::ClientConfig {
host: String::from("https://api.trello.com"),
token: String::from("some-token"),
key: String::from("some-key"),
};
let url = config.get_trello_url("/1/me/boards/", &[])?;
assert_eq!(
url.to_string(),
"https://api.trello.com/1/me/boards/"
);
let url = config.get_trello_url("/1/boards/some-id/", &[("lists", "open")])?;
assert_eq!(
url.to_string(),
"https://api.trello.com/1/boards/some-id/?lists=open",
);Trait Implementations§
Source§impl Debug for ClientConfig
impl Debug for ClientConfig
Source§impl<'de> Deserialize<'de> for ClientConfig
impl<'de> Deserialize<'de> for ClientConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ClientConfig
impl RefUnwindSafe for ClientConfig
impl Send for ClientConfig
impl Sync for ClientConfig
impl Unpin for ClientConfig
impl UnsafeUnpin for ClientConfig
impl UnwindSafe for ClientConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more