aboutsummaryrefslogtreecommitdiffstats
path: root/src/item.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/item.rs')
-rw-r--r--src/item.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/item.rs b/src/item.rs
index 5507577..3d9ad1e 100644
--- a/src/item.rs
+++ b/src/item.rs
@@ -21,7 +21,6 @@ use crate::{
use serde::Serialize;
use std::collections::BTreeMap;
-
/// Data type for values that an Item can hold.
#[derive(Debug, Serialize)]
#[serde(untagged)]
@@ -85,8 +84,8 @@ fn convert_itemdata_list_with_one_member_to_a_string() {
/// ```
#[derive(Debug)]
pub struct ItemBuilder<'a> {
- client : &'a Client,
- data : BTreeMap<&'a str, ItemData<'a>>,
+ client: &'a Client,
+ data: BTreeMap<&'a str, ItemData<'a>>,
files: Vec<&'a str>,
}
@@ -119,7 +118,9 @@ impl<'a> ItemBuilder<'a> {
/// Set groups allowed to access item
pub fn group_allow(&mut self, group: &'a str) -> &mut ItemBuilder<'a> {
- let groups_allow = self.data.entry("groups_allow")
+ let groups_allow = self
+ .data
+ .entry("groups_allow")
.or_insert(ItemData::List(Vec::<&str>::new()));
groups_allow.push(group);
@@ -130,10 +131,11 @@ impl<'a> ItemBuilder<'a> {
pub fn create(&self) -> Result<String, Error> {
dbg!(self);
if self.files.is_empty() {
- self.client.post_data(client::ZOTAPI_ITEM_UPDATE_PATH, &self.data)
- }
- else {
- self.client.post_multipart(client::ZOTAPI_ITEM_UPDATE_PATH, &self.data, &self.files)
+ self.client
+ .post_data(client::ZOTAPI_ITEM_UPDATE_PATH, &self.data)
+ } else {
+ self.client
+ .post_multipart(client::ZOTAPI_ITEM_UPDATE_PATH, &self.data, &self.files)
}
}
}