cleanup
This commit is contained in:
parent
751e88fdc4
commit
1d7d5c8a59
2 changed files with 4 additions and 21 deletions
|
@ -18,32 +18,15 @@ pub struct Client {
|
|||
token: String,
|
||||
}
|
||||
|
||||
// Implement the Default trait so that `derive_builder` will allow fields
|
||||
// containing the Client type to be defined with `#[builder(setter(skip))]`.
|
||||
//
|
||||
// In order to avoid repeating ourselves, this may also be used in
|
||||
// `new_from_access_token()`.
|
||||
impl Default for Client {
|
||||
/// WARNING: Default is implemented only to satisfy trait bound checks
|
||||
/// internally. You may use it externally as a placeholder value, but be
|
||||
/// aware that it will not be able to make any authenticated API requests.
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
impl Client {
|
||||
pub fn new_from_access_token(token: &str) -> Result<Self, reqwest::Error> {
|
||||
Ok(Self {
|
||||
api_root: DEFAULT_API_ROOT.to_owned(),
|
||||
client: reqwest::ClientBuilder::default()
|
||||
.https_only(true)
|
||||
.build()
|
||||
.expect("reqwest client is always built with the same configuration here"),
|
||||
token: "".to_owned(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Client {
|
||||
pub fn new_from_access_token(token: &str) -> Result<Self, reqwest::Error> {
|
||||
Ok(Self {
|
||||
token: token.to_owned(),
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ pub struct CreateRecordsDetails {
|
|||
pub reasons: Vec<String>,
|
||||
}
|
||||
|
||||
impl<'a, T> CreateRecordsQuery<T>
|
||||
impl<T> CreateRecordsQuery<T>
|
||||
where
|
||||
T: Clone + DeserializeOwned + Serialize,
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue