summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-06-13 16:49:48 -0700
committerBryan Newbold <bnewbold@archive.org>2020-06-13 16:49:48 -0700
commitf3ecf5e6d85e7909ef44f44e8f18b79cf5bed0a2 (patch)
tree7258de55cf03f42ebd21868e5a838e1e55ff6ee1
parent386cda57197f13f7ff49ce44889221cfcc9b3bf2 (diff)
downloadfatcat-cli-f3ecf5e6d85e7909ef44f44e8f18b79cf5bed0a2.tar.gz
fatcat-cli-f3ecf5e6d85e7909ef44f44e8f18b79cf5bed0a2.zip
start implementing some more mutations
-rw-r--r--rust/fatcat-cli/src/entities.rs48
1 files changed, 39 insertions, 9 deletions
diff --git a/rust/fatcat-cli/src/entities.rs b/rust/fatcat-cli/src/entities.rs
index 907061c..bc5c6f3 100644
--- a/rust/fatcat-cli/src/entities.rs
+++ b/rust/fatcat-cli/src/entities.rs
@@ -138,54 +138,84 @@ impl ApiModelMutate for models::ReleaseEntity {
impl ApiModelMutate for models::ContainerEntity {
fn mutate(&mut self, mutations: Vec<Mutation>) -> Result<()> {
- unimplemented!("mutations")
+ for m in mutations {
+ match (m.field.as_str(), m.value) {
+ ("name", val) => { self.name = val; },
+ (field, _) => unimplemented!("setting field {} on a container", field),
+ }
+ }
+ Ok(())
}
}
impl ApiModelMutate for models::CreatorEntity {
fn mutate(&mut self, mutations: Vec<Mutation>) -> Result<()> {
- unimplemented!("mutations")
+ for m in mutations {
+ match (m.field.as_str(), m.value) {
+ ("display_name", val) => { self.display_name = val; },
+ (field, _) => unimplemented!("setting field {} on a creator", field),
+ }
+ }
+ Ok(())
}
}
impl ApiModelMutate for models::WorkEntity {
- fn mutate(&mut self, mutations: Vec<Mutation>) -> Result<()> {
+ fn mutate(&mut self, _mutations: Vec<Mutation>) -> Result<()> {
unimplemented!("mutations")
}
}
impl ApiModelMutate for models::FileEntity {
fn mutate(&mut self, mutations: Vec<Mutation>) -> Result<()> {
- unimplemented!("mutations")
+ for m in mutations {
+ match (m.field.as_str(), m.value) {
+ ("mimetype", val) => { self.mimetype = val; },
+ (field, _) => unimplemented!("setting field {} on a file", field),
+ }
+ }
+ Ok(())
}
}
impl ApiModelMutate for models::FilesetEntity {
- fn mutate(&mut self, mutations: Vec<Mutation>) -> Result<()> {
+ fn mutate(&mut self, _mutations: Vec<Mutation>) -> Result<()> {
unimplemented!("mutations")
}
}
impl ApiModelMutate for models::WebcaptureEntity {
- fn mutate(&mut self, mutations: Vec<Mutation>) -> Result<()> {
+ fn mutate(&mut self, _mutations: Vec<Mutation>) -> Result<()> {
unimplemented!("mutations")
}
}
impl ApiModelMutate for models::Editor {
fn mutate(&mut self, mutations: Vec<Mutation>) -> Result<()> {
- unimplemented!("mutations")
+ for m in mutations {
+ match (m.field.as_str(), m.value) {
+ ("username", Some(val)) => { self.username = val; },
+ (field, _) => unimplemented!("setting field {} on an editor", field),
+ }
+ }
+ Ok(())
}
}
impl ApiModelMutate for models::Editgroup {
fn mutate(&mut self, mutations: Vec<Mutation>) -> Result<()> {
- unimplemented!("mutations")
+ for m in mutations {
+ match (m.field.as_str(), m.value) {
+ ("description", val) => { self.description = val; },
+ (field, _) => unimplemented!("setting field {} on an editgroup", field),
+ }
+ }
+ Ok(())
}
}
impl ApiModelMutate for models::ChangelogEntry {
- fn mutate(&mut self, mutations: Vec<Mutation>) -> Result<()> {
+ fn mutate(&mut self, _mutations: Vec<Mutation>) -> Result<()> {
unimplemented!("mutations")
}
}