summaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api-spec/examples
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-09-11 16:10:47 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-09-11 16:10:47 -0700
commit91c080a2e82ec4e8908cb8e3916a543519151847 (patch)
tree1d6f450546bcd0d0888bd0f4ec52d66a8a3cfd0f /rust/fatcat-api-spec/examples
parent6315c314969d4e66db4da09a8c2ff245aafe0fc1 (diff)
downloadfatcat-91c080a2e82ec4e8908cb8e3916a543519151847.tar.gz
fatcat-91c080a2e82ec4e8908cb8e3916a543519151847.zip
implement new editgroup_id behavior
Diffstat (limited to 'rust/fatcat-api-spec/examples')
-rw-r--r--rust/fatcat-api-spec/examples/client.rs20
-rw-r--r--rust/fatcat-api-spec/examples/server_lib/server.rs80
2 files changed, 70 insertions, 30 deletions
diff --git a/rust/fatcat-api-spec/examples/client.rs b/rust/fatcat-api-spec/examples/client.rs
index cc94af11..5d600965 100644
--- a/rust/fatcat-api-spec/examples/client.rs
+++ b/rust/fatcat-api-spec/examples/client.rs
@@ -97,7 +97,7 @@ fn main() {
// Disabled because there's no example.
// Some("CreateContainer") => {
- // let result = client.create_container(???).wait();
+ // let result = client.create_container(???, Some("editgroup_example".to_string())).wait();
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
Some("CreateContainerBatch") => {
@@ -107,7 +107,7 @@ fn main() {
// Disabled because there's no example.
// Some("CreateCreator") => {
- // let result = client.create_creator(???).wait();
+ // let result = client.create_creator(???, Some("editgroup_example".to_string())).wait();
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
Some("CreateCreatorBatch") => {
@@ -123,7 +123,7 @@ fn main() {
// Disabled because there's no example.
// Some("CreateFile") => {
- // let result = client.create_file(???).wait();
+ // let result = client.create_file(???, Some("editgroup_example".to_string())).wait();
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
Some("CreateFileBatch") => {
@@ -133,7 +133,7 @@ fn main() {
// Disabled because there's no example.
// Some("CreateRelease") => {
- // let result = client.create_release(???).wait();
+ // let result = client.create_release(???, Some("editgroup_example".to_string())).wait();
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
Some("CreateReleaseBatch") => {
@@ -143,7 +143,7 @@ fn main() {
// Disabled because there's no example.
// Some("CreateWork") => {
- // let result = client.create_work(???).wait();
+ // let result = client.create_work(???, Some("editgroup_example".to_string())).wait();
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
Some("CreateWorkBatch") => {
@@ -293,31 +293,31 @@ fn main() {
// Disabled because there's no example.
// Some("UpdateContainer") => {
- // let result = client.update_container("id_example".to_string(), ???).wait();
+ // let result = client.update_container("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait();
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
// Disabled because there's no example.
// Some("UpdateCreator") => {
- // let result = client.update_creator("id_example".to_string(), ???).wait();
+ // let result = client.update_creator("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait();
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
// Disabled because there's no example.
// Some("UpdateFile") => {
- // let result = client.update_file("id_example".to_string(), ???).wait();
+ // let result = client.update_file("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait();
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
// Disabled because there's no example.
// Some("UpdateRelease") => {
- // let result = client.update_release("id_example".to_string(), ???).wait();
+ // let result = client.update_release("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait();
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
// Disabled because there's no example.
// Some("UpdateWork") => {
- // let result = client.update_work("id_example".to_string(), ???).wait();
+ // let result = client.update_work("id_example".to_string(), ???, Some("editgroup_example".to_string())).wait();
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
_ => panic!("Invalid operation provided"),
diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-api-spec/examples/server_lib/server.rs
index ab08f594..2ca8eb3b 100644
--- a/rust/fatcat-api-spec/examples/server_lib/server.rs
+++ b/rust/fatcat-api-spec/examples/server_lib/server.rs
@@ -29,9 +29,14 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn create_container(&self, entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> {
+ fn create_container(&self, entity: models::ContainerEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("create_container({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "create_container({:?}, {:?}) - X-Span-ID: {:?}",
+ entity,
+ editgroup,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
@@ -53,9 +58,14 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn create_creator(&self, entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
+ fn create_creator(&self, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("create_creator({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "create_creator({:?}, {:?}) - X-Span-ID: {:?}",
+ entity,
+ editgroup,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
@@ -83,9 +93,14 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn create_file(&self, entity: models::FileEntity, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
+ fn create_file(&self, entity: models::FileEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("create_file({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "create_file({:?}, {:?}) - X-Span-ID: {:?}",
+ entity,
+ editgroup,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
@@ -107,9 +122,14 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn create_release(&self, entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
+ fn create_release(&self, entity: models::ReleaseEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("create_release({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "create_release({:?}, {:?}) - X-Span-ID: {:?}",
+ entity,
+ editgroup,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
@@ -131,9 +151,14 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn create_work(&self, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
+ fn create_work(&self, entity: models::WorkEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("create_work({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "create_work({:?}, {:?}) - X-Span-ID: {:?}",
+ entity,
+ editgroup,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
@@ -373,48 +398,63 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn update_container(&self, id: String, entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> {
+ fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "update_container(\"{}\", {:?}) - X-Span-ID: {:?}",
+ "update_container(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
id,
entity,
+ editgroup,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
Box::new(futures::failed("Generic failure".into()))
}
- fn update_creator(&self, id: String, entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> {
+ fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "update_creator(\"{}\", {:?}) - X-Span-ID: {:?}",
+ "update_creator(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
id,
entity,
+ editgroup,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
Box::new(futures::failed("Generic failure".into()))
}
- fn update_file(&self, id: String, entity: models::FileEntity, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> {
+ fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("update_file(\"{}\", {:?}) - X-Span-ID: {:?}", id, entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "update_file(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ id,
+ entity,
+ editgroup,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
- fn update_release(&self, id: String, entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> {
+ fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "update_release(\"{}\", {:?}) - X-Span-ID: {:?}",
+ "update_release(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
id,
entity,
+ editgroup,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
Box::new(futures::failed("Generic failure".into()))
}
- fn update_work(&self, id: String, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> {
+ fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("update_work(\"{}\", {:?}) - X-Span-ID: {:?}", id, entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "update_work(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ id,
+ entity,
+ editgroup,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
}